15 lines
No EOL
444 B
SQL
15 lines
No EOL
444 B
SQL
CREATE TABLE IF NOT EXISTS store
|
|
(
|
|
id TEXT NOT NULL PRIMARY KEY,
|
|
data BLOB NOT NULL,
|
|
created_at DATE NOT NULL DEFAULT current_timestamp,
|
|
updated_at DATE NOT NULL DEFAULT current_timestamp
|
|
);
|
|
|
|
-- automatic updated at
|
|
CREATE TRIGGER IF NOT EXISTS update_store_updated_at
|
|
AFTER UPDATE ON store
|
|
WHEN OLD.updated_at <> current_timestamp
|
|
BEGIN
|
|
UPDATE store SET updated_at = CURRENT_TIMESTAMP WHERE id = OLD.id;
|
|
END; |