-- "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';
