Migration a390332fa722 crashes: drops non-existent team.data_source column #480
Labels
No labels
Kestra
bug
enhancement
someday
subtask
☁️ api
🎛️ infrastructure
🐞 sentry
📆 2025 Season
📝 pages
allpicks
📝 pages
picks
📝 pages
standings
🚀 performance
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
johnsturgeon/tgfp-web#480
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Production crashes running Alembic migrations because migration
a390332fa722drops a column that doesn't exist in the schema.Error
Root cause
The migration
a390332fa722_drop_team_data_sourceruns an unconditionalop.drop_column('team', 'data_source'), but no migration in the chain ever creates that column:team.data_source0c2ed4448b99(baseline)20469f2897b6(email_queue)a390332fa722UndefinedColumndata_sourcewas an ESPN-era field (added in #368) removed from theTeammodel during the Tank01 refactor (302663c, 2026-08-28). The Alembic baseline was auto-generated on 2026-08-31 — after that removal — so it codifies ateamtable without the column. Any database built from the chain createsteamwithoutdata_sourceand then fails trying to drop it.Fix
Make the drop idempotent:
ALTER TABLE team DROP COLUMN IF EXISTS data_source. It drops the column on any pre-baseline snapshot that still carries it and is a no-op on databases built from the current baseline.