summaryrefslogtreecommitdiffstats
path: root/server/migrations/2_kaas_up.sql
diff options
context:
space:
mode:
Diffstat (limited to 'server/migrations/2_kaas_up.sql')
-rw-r--r--server/migrations/2_kaas_up.sql23
1 files changed, 23 insertions, 0 deletions
diff --git a/server/migrations/2_kaas_up.sql b/server/migrations/2_kaas_up.sql
new file mode 100644
index 0000000..0c7837a
--- /dev/null
+++ b/server/migrations/2_kaas_up.sql
@@ -0,0 +1,23 @@
1BEGIN;
2
3-- TODO enable strict mode so that primary key is automatically enforced to not be NULL
4CREATE TABLE received_route (
5 id INTEGER PRIMARY KEY,
6
7 received_route_source route_source NOT NULL,
8 recieved_route_strava_id TEXT,
9
10 -- ON DELETE what?
11 FOREIGN KEY (received_route_source_id) REFERENCES received_route_source (id),
12 CHECK (received_route_source IN ('gpx_upload', 'strava', 'rwgps')),
13 CHECK ((received_route_source = 'strava') = (received_route_strava_id IS NULL))
14);
15
16CREATE TABLE received_route_linestring (
17 received_route_id INT NOT NULL,
18 linestring BLOB NOT NULL,
19
20 FOREIGN KEY (received_route_id) REFERENCES received_route (id)
21);
22
23COMMIT;