diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2021-12-16 09:04:08 -0800 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2021-12-16 09:09:20 -0800 |
commit | b13c9d23c792ec8c1764444a96986f0800d7084a (patch) | |
tree | 4966b426b090e9fda0172558a3e44ccb8b40cae8 /migrations |
Initial commit of the flowerpot service
At this point it can store and retrieve data from the sqlite database.
Everything could definitely use some cleanup and proper error
handling...
Diffstat (limited to 'migrations')
-rw-r--r-- | migrations/.gitkeep | 0 | ||||
-rw-r--r-- | migrations/2021-12-15-035955_initial-schema/down.sql | 2 | ||||
-rw-r--r-- | migrations/2021-12-15-035955_initial-schema/up.sql | 12 |
3 files changed, 14 insertions, 0 deletions
diff --git a/migrations/.gitkeep b/migrations/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/migrations/.gitkeep diff --git a/migrations/2021-12-15-035955_initial-schema/down.sql b/migrations/2021-12-15-035955_initial-schema/down.sql new file mode 100644 index 0000000..cf9254a --- /dev/null +++ b/migrations/2021-12-15-035955_initial-schema/down.sql @@ -0,0 +1,2 @@ +DROP TABLE data; +DROP TABLE devices; diff --git a/migrations/2021-12-15-035955_initial-schema/up.sql b/migrations/2021-12-15-035955_initial-schema/up.sql new file mode 100644 index 0000000..c9a1650 --- /dev/null +++ b/migrations/2021-12-15-035955_initial-schema/up.sql @@ -0,0 +1,12 @@ +CREATE TABLE devices ( + device_id TEXT PRIMARY KEY NOT NULL, + name TEXT NOT NULL DEFAULT "My wonderful plant" +); + +CREATE TABLE data ( + device_id TEXT NOT NULL REFERENCES devices(device_id), + timestamp DATETIME NOT NULL, + value NUMERIC NOT NULL, + PRIMARY KEY (device_id, timestamp) +); + |