fix: re-normalize series statuses with UI-added mappings
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 6s
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:
18
infra/migrations/0041_renormalize_with_current_mappings.sql
Normal file
18
infra/migrations/0041_renormalize_with_current_mappings.sql
Normal 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;
|
||||
Reference in New Issue
Block a user