home · contact · privacy
Refactor models' .by_id().
[plomtask] / scripts / init.sql
index 807e1e7a0fc06b3da97204e99a23b2342306272a..870e845c31827bd7400faea3e7ea877458493715 100644 (file)
@@ -17,7 +17,7 @@ CREATE TABLE conditions (
     is_active BOOLEAN NOT NULL
 );
 CREATE TABLE days (
-    date TEXT PRIMARY KEY,
+    id TEXT PRIMARY KEY,
     comment TEXT NOT NULL
 );
 CREATE TABLE process_conditions (
@@ -49,7 +49,7 @@ CREATE TABLE process_fulfills (
     FOREIGN KEY (condition) REFERENCES conditions(id)
 );
 CREATE TABLE process_steps (
-    step_id INTEGER PRIMARY KEY,
+    id INTEGER PRIMARY KEY,
     owner_id INTEGER NOT NULL,
     step_process_id INTEGER NOT NULL,
     parent_step_id INTEGER,
@@ -108,5 +108,5 @@ CREATE TABLE todos (
     is_done BOOLEAN NOT NULL,
     day TEXT NOT NULL,
     FOREIGN KEY (process_id) REFERENCES processes(id),
-    FOREIGN KEY (day) REFERENCES days(date)
+    FOREIGN KEY (day) REFERENCES days(id)
 );