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_blockers (
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_conditions (
31 process INTEGER NOT NULL,
32 condition INTEGER NOT NULL,
33 PRIMARY KEY (process, condition),
34 FOREIGN KEY (process) REFERENCES processes(id),
35 FOREIGN KEY (condition) REFERENCES conditions(id)
37 CREATE TABLE process_descriptions (
38 parent INTEGER NOT NULL,
39 timestamp TEXT NOT NULL,
40 description TEXT NOT NULL,
41 PRIMARY KEY (parent, timestamp),
42 FOREIGN KEY (parent) REFERENCES processes(id)
44 CREATE TABLE process_disables (
45 process INTEGER NOT NULL,
46 condition INTEGER NOT NULL,
47 PRIMARY KEY(process, condition),
48 FOREIGN KEY (process) REFERENCES processes(id),
49 FOREIGN KEY (condition) REFERENCES conditions(id)
51 CREATE TABLE process_efforts (
52 parent INTEGER NOT NULL,
53 timestamp TEXT NOT NULL,
55 PRIMARY KEY (parent, timestamp),
56 FOREIGN KEY (parent) REFERENCES processes(id)
58 CREATE TABLE process_enables (
59 process INTEGER NOT NULL,
60 condition INTEGER NOT NULL,
61 PRIMARY KEY(process, condition),
62 FOREIGN KEY (process) REFERENCES processes(id),
63 FOREIGN KEY (condition) REFERENCES conditions(id)
65 CREATE TABLE process_step_suppressions (
66 process INTEGER NOT NULL,
67 process_step INTEGER NOT NULL,
68 PRIMARY KEY (process, process_step),
69 FOREIGN KEY (process) REFERENCES processes(id),
70 FOREIGN KEY (process_step) REFERENCES process_steps(id)
72 CREATE TABLE process_steps (
73 id INTEGER PRIMARY KEY,
74 owner INTEGER NOT NULL,
75 step_process INTEGER NOT NULL,
77 FOREIGN KEY (owner) REFERENCES processes(id),
78 FOREIGN KEY (step_process) REFERENCES processes(id),
79 FOREIGN KEY (parent_step) REFERENCES process_steps(step_id)
81 CREATE TABLE process_titles (
82 parent INTEGER NOT NULL,
83 timestamp TEXT NOT NULL,
85 PRIMARY KEY (parent, timestamp),
86 FOREIGN KEY (parent) REFERENCES processes(id)
88 CREATE TABLE processes (
89 id INTEGER PRIMARY KEY,
90 calendarize BOOLEAN NOT NULL DEFAULT FALSE
92 CREATE TABLE todo_blockers (
93 todo INTEGER NOT NULL,
94 condition INTEGER NOT NULL,
95 PRIMARY KEY (todo, condition),
96 FOREIGN KEY (todo) REFERENCES todos(id),
97 FOREIGN KEY (condition) REFERENCES conditions(id)
99 CREATE TABLE todo_children (
100 parent INTEGER NOT NULL,
101 child INTEGER NOT NULL,
102 PRIMARY KEY (parent, child),
103 FOREIGN KEY (parent) REFERENCES todos(id),
104 FOREIGN KEY (child) REFERENCES todos(id)
106 CREATE TABLE todo_conditions (
107 todo INTEGER NOT NULL,
108 condition INTEGER NOT NULL,
109 PRIMARY KEY(todo, condition),
110 FOREIGN KEY (todo) REFERENCES todos(id),
111 FOREIGN KEY (condition) REFERENCES conditions(id)
113 CREATE TABLE todo_disables (
114 todo INTEGER NOT NULL,
115 condition INTEGER NOT NULL,
116 PRIMARY KEY(todo, condition),
117 FOREIGN KEY (todo) REFERENCES todos(id),
118 FOREIGN KEY (condition) REFERENCES conditions(id)
120 CREATE TABLE todo_enables (
121 todo INTEGER NOT NULL,
122 condition INTEGER NOT NULL,
123 PRIMARY KEY(todo, condition),
124 FOREIGN KEY (todo) REFERENCES todos(id),
125 FOREIGN KEY (condition) REFERENCES conditions(id)
128 id INTEGER PRIMARY KEY,
129 process INTEGER NOT NULL,
130 is_done BOOLEAN NOT NULL,
132 comment TEXT NOT NULL DEFAULT "",
134 calendarize BOOLEAN NOT NULL DEFAULT FALSE,
135 FOREIGN KEY (process) REFERENCES processes(id),
136 FOREIGN KEY (day) REFERENCES days(id)