blob: bf4d570698c7ce74e98d8080663b2d7e6d03c0e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
(define (initialize-database db)
;; TODO on delete/update cascade
(sqlite-exec db "
CREATE TABLE IF NOT EXISTS components
( id TEXT PRIMARY KEY NOT NULL
, type TEXT NOT NULL
, parent INTEGER REFERENCES components(id)
)")
(sqlite-exec db "
CREATE TABLE IF NOT EXISTS component_properties
( id INTEGER PRIMARY KEY NOT NULL
, component TEXT NOT NULL REFERENCES components(id)
, key TEXT NOT NULL
, value TEXT NOT NULL
)
")
;; TODO index on component_properties.component
;; TODO index on component_properties.key
;; TODO manually build indexes for components start and end times?
)
|