aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-10-16 15:32:34 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-10-16 15:32:34 +0200
commitfaaf478c8ee4708cda80617d098ea2613a6ce7b4 (patch)
treefe33bed9c223e3f424d4267c661cda05f015cb81
parentUpdate number of tests. (diff)
downloadcalp-sqlite-alt.tar.gz
calp-sqlite-alt.tar.xz
Experiment with different approach to storing components in sqlite.sqlite-alt
-rw-r--r--module/vcomponent/data-stores/sqlite-alt.scm26
1 files changed, 26 insertions, 0 deletions
diff --git a/module/vcomponent/data-stores/sqlite-alt.scm b/module/vcomponent/data-stores/sqlite-alt.scm
new file mode 100644
index 00000000..bf4d5706
--- /dev/null
+++ b/module/vcomponent/data-stores/sqlite-alt.scm
@@ -0,0 +1,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?
+
+ )