From 973aec43ea54bbf95b64fbcb636403401d1ca60e Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Fri, 28 Aug 2026 18:03:05 +0200 Subject: Import from e4b104792206ee7ea64bf39c6b7d2c0c230f9d14 --- server/migrations/2_kaas_up.sql | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 server/migrations/2_kaas_up.sql (limited to 'server/migrations/2_kaas_up.sql') 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 @@ +BEGIN; + +-- TODO enable strict mode so that primary key is automatically enforced to not be NULL +CREATE TABLE received_route ( + id INTEGER PRIMARY KEY, + + received_route_source route_source NOT NULL, + recieved_route_strava_id TEXT, + + -- ON DELETE what? + FOREIGN KEY (received_route_source_id) REFERENCES received_route_source (id), + CHECK (received_route_source IN ('gpx_upload', 'strava', 'rwgps')), + CHECK ((received_route_source = 'strava') = (received_route_strava_id IS NULL)) +); + +CREATE TABLE received_route_linestring ( + received_route_id INT NOT NULL, + linestring BLOB NOT NULL, + + FOREIGN KEY (received_route_id) REFERENCES received_route (id) +); + +COMMIT; -- cgit v1.3