Bug: Alembic forked history — migrations 019 and 020 both descend from 018 #166

Closed
opened 2026-03-25 00:38:19 +00:00 by forgejo_admin · 0 comments

Type

Bug

Lineage

Discovered during QA review of PR #163 (issue #130)

Repo

forgejo_admin/basketball-api

What Broke

Main has a forked Alembic migration chain. Both 019_player_teams_junction.py and 020_add_custom_notes_to_player.py declare down_revision = "018", creating two heads. This happened when PRs #164 and #165 merged without chain coordination.

Repro Steps

  1. cd ~/basketball-api && git checkout main
  2. alembic heads — returns two heads instead of one
  3. alembic upgrade head — fails or behaves unpredictably

Expected Behavior

Single linear Alembic chain. alembic heads returns exactly one head.

Environment

basketball-api main branch, Alembic migrations directory

Acceptance Criteria

  • Single linear Alembic chain on main
  • alembic heads returns exactly one head
  • All existing tests pass after merge migration

Constraints

  • Create a merge migration that unifies the two heads
  • Do not alter existing migration files (they're already applied in prod)
  • Verify against production schema before applying
  • PR #163 (OAuth persistence) — QA discovered this
  • PR #164, #165 — root cause (merged without chain coordination)
### Type Bug ### Lineage Discovered during QA review of PR #163 (issue #130) ### Repo `forgejo_admin/basketball-api` ### What Broke Main has a forked Alembic migration chain. Both `019_player_teams_junction.py` and `020_add_custom_notes_to_player.py` declare `down_revision = "018"`, creating two heads. This happened when PRs #164 and #165 merged without chain coordination. ### Repro Steps 1. `cd ~/basketball-api && git checkout main` 2. `alembic heads` — returns two heads instead of one 3. `alembic upgrade head` — fails or behaves unpredictably ### Expected Behavior Single linear Alembic chain. `alembic heads` returns exactly one head. ### Environment basketball-api main branch, Alembic migrations directory ### Acceptance Criteria - [ ] Single linear Alembic chain on main - [ ] `alembic heads` returns exactly one head - [ ] All existing tests pass after merge migration ### Constraints - Create a merge migration that unifies the two heads - Do not alter existing migration files (they're already applied in prod) - Verify against production schema before applying ### Related - PR #163 (OAuth persistence) — QA discovered this - PR #164, #165 — root cause (merged without chain coordination)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo_admin/basketball-api#166
No description provided.