diff options
| author | Rutger Broekhoff | 2026-08-28 18:03:05 +0200 |
|---|---|---|
| committer | Rutger Broekhoff | 2026-08-28 18:03:05 +0200 |
| commit | 973aec43ea54bbf95b64fbcb636403401d1ca60e (patch) | |
| tree | 41b7911c420766a9b463245b9296f44c5bf35258 /server/migrations | |
| download | routemon-973aec43ea54bbf95b64fbcb636403401d1ca60e.tar.gz routemon-973aec43ea54bbf95b64fbcb636403401d1ca60e.zip | |
Import from e4b104792206ee7ea64bf39c6b7d2c0c230f9d14
Diffstat (limited to 'server/migrations')
| -rw-r--r-- | server/migrations/1_init_down.sql | 1 | ||||
| -rw-r--r-- | server/migrations/1_init_up.sql | 7 | ||||
| -rw-r--r-- | server/migrations/2_kaas_up.sql | 23 |
3 files changed, 31 insertions, 0 deletions
diff --git a/server/migrations/1_init_down.sql b/server/migrations/1_init_down.sql new file mode 100644 index 0000000..795e617 --- /dev/null +++ b/server/migrations/1_init_down.sql | |||
| @@ -0,0 +1 @@ | |||
| DROP TABLE migration; | |||
diff --git a/server/migrations/1_init_up.sql b/server/migrations/1_init_up.sql new file mode 100644 index 0000000..7edb398 --- /dev/null +++ b/server/migrations/1_init_up.sql | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | BEGIN; | ||
| 2 | |||
| 3 | CREATE TABLE migration (version); | ||
| 4 | |||
| 5 | INSERT INTO migration VALUES (1); | ||
| 6 | |||
| 7 | COMMIT; | ||
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 @@ | |||
| 1 | BEGIN; | ||
| 2 | |||
| 3 | -- TODO enable strict mode so that primary key is automatically enforced to not be NULL | ||
| 4 | CREATE 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 | |||
| 16 | CREATE 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 | |||
| 23 | COMMIT; | ||