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,
76 calendarize BOOLEAN NOT NULL DEFAULT FALSE
78 CREATE TABLE todo_children (
79 parent INTEGER NOT NULL,
80 child INTEGER NOT NULL,
81 PRIMARY KEY (parent, child),
82 FOREIGN KEY (parent) REFERENCES todos(id),
83 FOREIGN KEY (child) REFERENCES todos(id)
85 CREATE TABLE todo_conditions (
86 todo INTEGER NOT NULL,
87 condition INTEGER NOT NULL,
88 PRIMARY KEY(todo, condition),
89 FOREIGN KEY (todo) REFERENCES todos(id),
90 FOREIGN KEY (condition) REFERENCES conditions(id)
92 CREATE TABLE todo_disables (
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_enables (
100 todo INTEGER NOT NULL,
101 condition INTEGER NOT NULL,
102 PRIMARY KEY(todo, condition),
103 FOREIGN KEY (todo) REFERENCES todos(id),
104 FOREIGN KEY (condition) REFERENCES conditions(id)
107 id INTEGER PRIMARY KEY,
108 process INTEGER NOT NULL,
109 is_done BOOLEAN NOT NULL,
111 comment TEXT NOT NULL DEFAULT "",
113 calendarize BOOLEAN NOT NULL DEFAULT FALSE,
114 FOREIGN KEY (process) REFERENCES processes(id),
115 FOREIGN KEY (day) REFERENCES days(id)