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>
19 lines
636 B
SQL
19 lines
636 B
SQL
-- 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;
|