-- Fas 3d: spara måltidsdatum på cooking session (UTC) för framtida
-- statistik, gruppering och analys; undo använder lagrade mealBoxMutations.
ALTER TABLE cooking_sessions ADD COLUMN IF NOT EXISTS meal_date DATE;
-- Bakåtfyll: använd UTC-datumet för befintliga sessioner.
UPDATE cooking_sessions SET meal_date = (completed_at AT TIME ZONE 'UTC')::DATE WHERE meal_date IS NULL AND completed_at IS NOT NULL;
UPDATE cooking_sessions SET meal_date = (started_at AT TIME ZONE 'UTC')::DATE WHERE meal_date IS NULL AND started_at IS NOT NULL;
UPDATE cooking_sessions SET meal_date = (created_at AT TIME ZONE 'UTC')::DATE WHERE meal_date IS NULL;
