fix: make Migration 024 idempotent + add seed data fix script
Deploy Development / deploy (push) Successful in 50s
Build Test / lint-backend (push) Successful in 1s
Build Test / build-frontend (push) Successful in 14s

This commit is contained in:
Lars committed 2026-03-27 07:40:42 +01:00
1 parent c9e4b6aa02
commit b3cc588293
2 files changed
+231 -8

No files matched your search

+16 -8
View File
@@ -63,7 +63,8 @@ INSERT INTO goal_type_definitions (
'weight', 'Gewicht', 'Weight', 'kg', '⚖️', 'body',
'weight_log', 'weight', 'latest',
'Aktuelles Körpergewicht', true
);
)
ON CONFLICT (type_key) DO NOTHING;
-- 2. Body Fat (simple - latest value)
INSERT INTO goal_type_definitions (
@@ -74,7 +75,8 @@ INSERT INTO goal_type_definitions (
'body_fat', 'Körperfett', 'Body Fat', '%', '📊', 'body',
'caliper_log', 'body_fat_pct', 'latest',
'Körperfettanteil aus Caliper-Messung', true
);
)
ON CONFLICT (type_key) DO NOTHING;
-- 3. Lean Mass (complex - calculation formula)
INSERT INTO goal_type_definitions (
@@ -85,7 +87,8 @@ INSERT INTO goal_type_definitions (
'lean_mass', 'Muskelmasse', 'Lean Mass', 'kg', '💪', 'body',
'{"type": "lean_mass", "dependencies": ["weight_log.weight", "caliper_log.body_fat_pct"], "formula": "weight - (weight * body_fat_pct / 100)"}',
'Fettfreie Körpermasse (berechnet aus Gewicht und Körperfett)', true
);
)
ON CONFLICT (type_key) DO NOTHING;
-- 4. VO2 Max (simple - latest value)
INSERT INTO goal_type_definitions (
@@ -96,7 +99,8 @@ INSERT INTO goal_type_definitions (
'vo2max', 'VO2Max', 'VO2Max', 'ml/kg/min', '🫁', 'recovery',
'vitals_baseline', 'vo2_max', 'latest',
'Maximale Sauerstoffaufnahme (geschätzt oder gemessen)', true
);
)
ON CONFLICT (type_key) DO NOTHING;
-- 5. Resting Heart Rate (simple - latest value)
INSERT INTO goal_type_definitions (
@@ -107,7 +111,8 @@ INSERT INTO goal_type_definitions (
'rhr', 'Ruhepuls', 'Resting Heart Rate', 'bpm', '💓', 'recovery',
'vitals_baseline', 'resting_hr', 'latest',
'Ruhepuls morgens vor dem Aufstehen', true
);
)
ON CONFLICT (type_key) DO NOTHING;
-- 6. Blood Pressure (placeholder - compound goal for v2.0)
-- Currently limited to single value, v2.0 will support systolic/diastolic
@@ -119,7 +124,8 @@ INSERT INTO goal_type_definitions (
'bp', 'Blutdruck', 'Blood Pressure', 'mmHg', '❤️', 'recovery',
'blood_pressure_log', 'systolic', 'latest',
'Blutdruck (aktuell nur systolisch, v2.0: beide Werte)', true
);
)
ON CONFLICT (type_key) DO NOTHING;
-- 7. Strength (placeholder - no data source yet)
INSERT INTO goal_type_definitions (
@@ -128,7 +134,8 @@ INSERT INTO goal_type_definitions (
) VALUES (
'strength', 'Kraft', 'Strength', 'kg', '🏋️', 'activity',
'Maximalkraft (Platzhalter, Datenquelle in v2.0)', true, false
);
)
ON CONFLICT (type_key) DO NOTHING;
-- 8. Flexibility (placeholder - no data source yet)
INSERT INTO goal_type_definitions (
@@ -137,7 +144,8 @@ INSERT INTO goal_type_definitions (
) VALUES (
'flexibility', 'Beweglichkeit', 'Flexibility', 'cm', '🤸', 'activity',
'Beweglichkeit (Platzhalter, Datenquelle in v2.0)', true, false
);
)
ON CONFLICT (type_key) DO NOTHING;
-- ============================================================================
-- Example: Future custom goal types (commented out, for reference)