summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrations/20260804000000_rides.sql19
-rw-r--r--db/schema.sql18
2 files changed, 36 insertions, 1 deletions
diff --git a/db/migrations/20260804000000_rides.sql b/db/migrations/20260804000000_rides.sql
new file mode 100644
index 0000000..4f25c64
--- /dev/null
+++ b/db/migrations/20260804000000_rides.sql
@@ -0,0 +1,19 @@
+-- migrate:up
+create table rides (
+ id integer primary key,
+ external_id text unique not null,
+ gpx_path text not null,
+ name text not null,
+ type text not null,
+ start_date text not null,
+ distance_m real not null,
+ moving_time_s integer not null,
+ elapsed_time_s integer not null,
+ total_elevation_gain_m real not null,
+ average_speed_mps real not null,
+ created_at text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
+ updated_at text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))
+);
+
+-- migrate:down
+drop table rides;
diff --git a/db/schema.sql b/db/schema.sql
index 398bfea..6a22bc5 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -15,7 +15,23 @@ CREATE TABLE osm_passes (
latitude real not null,
longitude real not null
);
+CREATE TABLE rides (
+ id integer primary key,
+ external_id text unique not null,
+ gpx_path text not null,
+ name text not null,
+ type text not null,
+ start_date text not null,
+ distance_m real not null,
+ moving_time_s integer not null,
+ elapsed_time_s integer not null,
+ total_elevation_gain_m real not null,
+ average_speed_mps real not null,
+ created_at text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
+ updated_at text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))
+);
-- Dbmate schema migrations
INSERT INTO "schema_migrations" (version) VALUES
('20250802140659'),
- ('20260802090000');
+ ('20260802090000'),
+ ('20260804000000');