0

Error :

Near "(": syntax error

SQL statement :

CREATE TABLE IF NOT EXISTS tickets (
    numero INTEGER PRIMARY KEY AUTOINCREMENT,
    identifier VARCHAR(4) NOT NULL,
    subject VARCHAR(150) NOT NULL,
    concerned_staff TEXT NULL,
    author_id VARCHAR(22) NOT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT current_timestamp(),
    is_archived BOOLEAN NOT NULL DEFAULT false,
    ticket_channel_id VARCHAR(24) NOT NULL
);

I do not understand why. The only other question doesn't fit what I'm doing. My goal is to get a numeric value of the time. I don't want 21-12-2022 10:00:00 but 1671613200.

user4157124
  • 2,809
  • 13
  • 27
  • 42
V E L Δ
  • 17
  • 4

1 Answers1

1

I do not understand why.

Change current_timestamp() to CURRENT_TIMESTAMP.

I don't want 21-12-2022 10:00:00 but 1671613200.

created_at TIMESTAMP resolves to numeric affinity while CURRENT_TIMESTAMP returns string value. Use unixepoch() instead:

created_at TIMESTAMP NOT NULL DEFAULT (unixepoch()),
user4157124
  • 2,809
  • 13
  • 27
  • 42