(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? )