1 CREATE TABLE condition_descriptions (
2 parent INTEGER NOT NULL,
3 timestamp TEXT NOT NULL,
4 description TEXT NOT NULL,
5 PRIMARY KEY (parent, timestamp),
6 FOREIGN KEY (parent) REFERENCES conditions(id)
8 CREATE TABLE condition_titles (
9 parent INTEGER NOT NULL,
10 timestamp TEXT NOT NULL,
12 PRIMARY KEY (parent, timestamp),
13 FOREIGN KEY (parent) REFERENCES conditions(id)
15 CREATE TABLE conditions (
16 id INTEGER PRIMARY KEY,
17 is_active BOOLEAN NOT NULL
23 CREATE TABLE process_conditions (
24 process INTEGER NOT NULL,
25 condition INTEGER NOT NULL,
26 PRIMARY KEY (process, condition),
27 FOREIGN KEY (process) REFERENCES processes(id),
28 FOREIGN KEY (condition) REFERENCES conditions(id)
30 CREATE TABLE process_descriptions (
31 parent INTEGER NOT NULL,
32 timestamp TEXT NOT NULL,
33 description TEXT NOT NULL,
34 PRIMARY KEY (parent, timestamp),
35 FOREIGN KEY (parent) REFERENCES processes(id)
37 CREATE TABLE process_disables (
38 process INTEGER NOT NULL,
39 condition INTEGER NOT NULL,
40 PRIMARY KEY(process, condition),
41 FOREIGN KEY (process) REFERENCES processes(id),
42 FOREIGN KEY (condition) REFERENCES conditions(id)
44 CREATE TABLE process_efforts (
45 parent INTEGER NOT NULL,
46 timestamp TEXT NOT NULL,
48 PRIMARY KEY (parent, timestamp),
49 FOREIGN KEY (parent) REFERENCES processes(id)
51 CREATE TABLE process_enables (
52 process INTEGER NOT NULL,
53 condition INTEGER NOT NULL,
54 PRIMARY KEY(process, condition),
55 FOREIGN KEY (process) REFERENCES processes(id),
56 FOREIGN KEY (condition) REFERENCES conditions(id)
58 CREATE TABLE process_steps (
59 id INTEGER PRIMARY KEY,
60 owner INTEGER NOT NULL,
61 step_process INTEGER NOT NULL,
63 FOREIGN KEY (owner) REFERENCES processes(id),
64 FOREIGN KEY (step_process) REFERENCES processes(id),
65 FOREIGN KEY (parent_step) REFERENCES process_steps(step_id)
67 CREATE TABLE process_titles (
68 parent INTEGER NOT NULL,
69 timestamp TEXT NOT NULL,
71 PRIMARY KEY (parent, timestamp),
72 FOREIGN KEY (parent) REFERENCES processes(id)
74 CREATE TABLE processes (
75 id INTEGER PRIMARY KEY
77 CREATE TABLE todo_children (
78 parent INTEGER NOT NULL,
79 child INTEGER NOT NULL,
80 PRIMARY KEY (parent, child),
81 FOREIGN KEY (parent) REFERENCES todos(id),
82 FOREIGN KEY (child) REFERENCES todos(id)
84 CREATE TABLE todo_conditions (
85 todo INTEGER NOT NULL,
86 condition INTEGER NOT NULL,
87 PRIMARY KEY(todo, condition),
88 FOREIGN KEY (todo) REFERENCES todos(id),
89 FOREIGN KEY (condition) REFERENCES conditions(id)
91 CREATE TABLE todo_disables (
92 todo INTEGER NOT NULL,
93 condition INTEGER NOT NULL,
94 PRIMARY KEY(todo, condition),
95 FOREIGN KEY (todo) REFERENCES todos(id),
96 FOREIGN KEY (condition) REFERENCES conditions(id)
98 CREATE TABLE todo_enables (
99 todo INTEGER NOT NULL,
100 condition INTEGER NOT NULL,
101 PRIMARY KEY(todo, condition),
102 FOREIGN KEY (todo) REFERENCES todos(id),
103 FOREIGN KEY (condition) REFERENCES conditions(id)
106 id INTEGER PRIMARY KEY,
107 process INTEGER NOT NULL,
108 is_done BOOLEAN NOT NULL,
110 FOREIGN KEY (process) REFERENCES processes(id),
111 FOREIGN KEY (day) REFERENCES days(id)