fix: Migration 029 - activate missing goal types (flexibility, strength)
These goal types existed but were inactive or misconfigured. Uses UPSERT (INSERT ... ON CONFLICT DO UPDATE): - If exists → activate + fix labels/icons/category - If not exists → create properly Idempotent: Safe to run multiple times, works on dev + prod. Both types have no automatic data source (source_table = NULL), so current_value must be updated manually. Fixes: flexibility and strength goals not visible in admin Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
db90f397e8
commit
ce37afb2bb
74
backend/migrations/029_fix_missing_goal_types.sql
Normal file
74
backend/migrations/029_fix_missing_goal_types.sql
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
-- Migration 029: Fix Missing Goal Types (flexibility, strength)
|
||||||
|
-- Date: 2026-03-27
|
||||||
|
-- Purpose: Ensure flexibility and strength goal types are active and properly configured
|
||||||
|
|
||||||
|
-- These types were created earlier but are inactive or misconfigured
|
||||||
|
-- This migration fixes them without breaking if they don't exist
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
-- Upsert flexibility goal type
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
INSERT INTO goal_type_definitions (
|
||||||
|
type_key, label_de, label_en, unit, icon, category,
|
||||||
|
source_table, source_column, aggregation_method,
|
||||||
|
calculation_formula, filter_conditions, description, is_active
|
||||||
|
) VALUES (
|
||||||
|
'flexibility',
|
||||||
|
'Beweglichkeit',
|
||||||
|
'Flexibility',
|
||||||
|
'cm',
|
||||||
|
'🤸',
|
||||||
|
'training',
|
||||||
|
NULL, -- No automatic data source
|
||||||
|
NULL,
|
||||||
|
'latest',
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
'Beweglichkeit und Mobilität - manuelle Erfassung',
|
||||||
|
true
|
||||||
|
)
|
||||||
|
ON CONFLICT (type_key)
|
||||||
|
DO UPDATE SET
|
||||||
|
label_de = 'Beweglichkeit',
|
||||||
|
label_en = 'Flexibility',
|
||||||
|
unit = 'cm',
|
||||||
|
icon = '🤸',
|
||||||
|
category = 'training',
|
||||||
|
is_active = true,
|
||||||
|
description = 'Beweglichkeit und Mobilität - manuelle Erfassung';
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
-- Upsert strength goal type
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
INSERT INTO goal_type_definitions (
|
||||||
|
type_key, label_de, label_en, unit, icon, category,
|
||||||
|
source_table, source_column, aggregation_method,
|
||||||
|
calculation_formula, filter_conditions, description, is_active
|
||||||
|
) VALUES (
|
||||||
|
'strength',
|
||||||
|
'Kraftniveau',
|
||||||
|
'Strength',
|
||||||
|
'Punkte',
|
||||||
|
'💪',
|
||||||
|
'training',
|
||||||
|
NULL, -- No automatic data source
|
||||||
|
NULL,
|
||||||
|
'latest',
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
'Allgemeines Kraftniveau - manuelle Erfassung',
|
||||||
|
true
|
||||||
|
)
|
||||||
|
ON CONFLICT (type_key)
|
||||||
|
DO UPDATE SET
|
||||||
|
label_de = 'Kraftniveau',
|
||||||
|
label_en = 'Strength',
|
||||||
|
unit = 'Punkte',
|
||||||
|
icon = '💪',
|
||||||
|
category = 'training',
|
||||||
|
is_active = true,
|
||||||
|
description = 'Allgemeines Kraftniveau - manuelle Erfassung';
|
||||||
|
|
||||||
|
COMMENT ON TABLE goal_type_definitions IS 'Goal type registry - defines all available goal types (v1.5: DB-driven, flexible system)';
|
||||||
Loading…
Reference in New Issue
Block a user