discordBots/schema.sql

15 lines
444 B
MySQL
Raw Normal View History

2024-07-12 13:50:20 +00:00
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;