fix: re-normalize series statuses with UI-added mappings
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 6s

Migration 0041 re-applies status normalization using all current
status_mappings entries, including those added via the UI after the
initial migration 0039 (e.g. "one shot" → "ended").

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-19 12:57:14 +01:00
parent 9cec32ba3e
commit d304877a83

View File

@@ -0,0 +1,18 @@
-- Re-normalize series_metadata.status using current status_mappings.
-- Catches mappings added via UI after migration 0039 ran (e.g. "one shot" → "ended").
-- Exact match
UPDATE series_metadata sm
SET status = m.mapped_status, updated_at = NOW()
FROM status_mappings m
WHERE LOWER(sm.status) = m.provider_status
AND sm.status IS NOT NULL
AND LOWER(sm.status) != m.mapped_status;
-- Substring match
UPDATE series_metadata sm
SET status = m.mapped_status, updated_at = NOW()
FROM status_mappings m
WHERE LOWER(sm.status) LIKE '%' || m.provider_status || '%'
AND sm.status IS NOT NULL
AND LOWER(sm.status) != m.mapped_status;