Files
geniusrun/backend/internal/store/migrations/0007_race_kind.sql
Christophe Vila 8ff3d62b2f Add Race workout kind with Garmin eventType auto-detection, sync-time running filter, and pill-based review queue filter
Race is the 8th fixed workout kind, seeded with a real (not placeholder)
rule since Garmin Connect's eventType.typeKey reports "race" for
manually-tagged race activities. Non-running activity types (padel,
cycling, strength training, ...) are now dropped at sync time instead of
being stored. The Review Queue's type filter is now clickable exclusive
pill buttons instead of a dropdown.
2026-07-19 10:52:09 +02:00

13 lines
755 B
SQL

-- "Race" is an 8th fixed workout kind. Unlike the other 7 (seeded with a
-- never-matching placeholder rule pending manual tuning), it gets a real
-- rule from day one: Garmin Connect lets a user manually tag an activity's
-- event type as "Race", and that value round-trips through get_activities()
-- as eventType.typeKey -- a genuine, deterministic signal, not a guess.
ALTER TABLE activities ADD COLUMN event_type_key TEXT NOT NULL DEFAULT '';
INSERT INTO workout_kinds (name, description, color, rule_json, priority, is_active) VALUES
('Race', '', '#dc2626', '{"match":"all","conditions":[{"metric":"is_race","op":"==","value":true}]}', 0, 1);
INSERT INTO workout_type_paces (workout_kind_id)
SELECT id FROM workout_kinds WHERE name = 'Race';