PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE tasks (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, estimate INTEGER, description TEXT, status TEXT NOT NULL, last_modified_at INTEGER NOT NULL DEFAULT (CAST(strftime('%s', current_timestamp) AS integer)), created_at INTEGER NOT NULL DEFAULT (CAST(strftime('%s', current_timestamp) AS integer)));
INSERT INTO tasks VALUES(1,'a test task',4,NULL,'In Progress',1753732126,1753732126);
INSERT INTO tasks VALUES(2,'another great test task',4,NULL,'TODO',1753732059,1753732059);
INSERT INTO tasks VALUES(4,'a finished task',2,NULL,'Finished',1753732131,1753732131);
INSERT INTO tasks VALUES(5,'a long task',32,'A grand description!','Current',1753732155,1753732155);
INSERT INTO tasks VALUES(6,'identically named task',32,NULL,'TODO',1753732155,1753732155);
INSERT INTO tasks VALUES(7,'identically named task',32,NULL,'TODO',1753732155,1753732155);
CREATE TABLE history (id INTEGER PRIMARY KEY AUTOINCREMENT,taskid INTEGER NOT NULL,is_start BOOLEAN NOT NULL,time INTEGER NOT NULL DEFAULT (CAST(strftime('%s', current_timestamp) AS integer)),FOREIGN KEY (taskid) REFERENCES tasks(id));
INSERT INTO history VALUES(3,1,1,1753732103);
INSERT INTO history VALUES(4,1,0,1753732126);
INSERT INTO history VALUES(5,4,1,1753732126);
INSERT INTO history VALUES(6,4,0,1753732131);
INSERT INTO history VALUES(7,5,1,1753732093);
INSERT INTO history VALUES(8,5,0,1753732103);
INSERT INTO history VALUES(9,5,1,1753732137);
DELETE FROM sqlite_sequence;
INSERT INTO sqlite_sequence VALUES('tasks',7);
INSERT INTO sqlite_sequence VALUES('history',9);
CREATE TRIGGER last_modified_task_trigger AFTER UPDATE ON tasks BEGIN
  UPDATE tasks SET last_modified_at = (CAST(strftime('%s', current_timestamp) AS integer)) WHERE id = NEW.id;
END;
COMMIT;
