PRAGMA foreign_keys=1; CREATE TABLE snippets ( id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, content TEXT, created_at DATETIME DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP, expires_at DATETIME NOT NULL ); -- Add an index on the created column. CREATE INDEX idx_snippets_created ON snippets(created_at); -- Add a trigger to keep timestamp updated. CREATE TRIGGER snippet_update_timestamp AFTER UPDATE ON snippets FOR EACH ROW BEGIN UPDATE snippets SET updated_at = CURRENT_TIMESTAMP WHERE id = OLD.id; END;