Fix branched Alembic migration chain#100
Fix branched Alembic migration chain#100garland3 merged 1 commit intofeature/user-annotations-collectionsfrom
Conversation
Agent-Logs-Url: https://github.com/sandialabs/VISTA/sessions/7b1183d4-b03d-4e6b-ba3b-73166bd02fd4 Co-authored-by: garland3 <1162675+garland3@users.noreply.github.com>
2eff3a5
into
feature/user-annotations-collections
There was a problem hiding this comment.
Pull request overview
This PR fixes a branched Alembic migration graph by re-pointing down_revision values so the backend schema migrations apply in a single linear order (avoiding multiple-head/fork issues during alembic upgrade head).
Changes:
- Update
20260315_0004to depend on20260306_0004(instead of20260220_0003). - Update
20260331_0005to depend on20260315_0004(instead of20260306_0004).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| backend/alembic/versions/20260315_0004_add_annotations_collections_audit.py | Re-parents the audit/annotations migration so it no longer creates a fork off 0003. |
| backend/alembic/versions/20260331_0005_add_project_archive.py | Re-parents the project-archive migration so it no longer skips the audit/annotations migration. |
| revision = '20260331_0005' | ||
| down_revision = '20260306_0004' | ||
| down_revision = '20260315_0004' | ||
| branch_labels = None |
There was a problem hiding this comment.
The module docstring still says Revises: 20260306_0004, but down_revision is now 20260315_0004. Please update the docstring header so it matches the actual Alembic dependency chain (helps when reading alembic history --verbose).
| revision = '20260315_0004' | ||
| down_revision = '20260220_0003' | ||
| down_revision = '20260306_0004' | ||
| branch_labels = None |
There was a problem hiding this comment.
The module docstring header still says Revises: 20260220_0003, but down_revision is now 20260306_0004. Please update the docstring so it reflects the true parent revision (otherwise migration history output and manual audits are confusing).
| # revision identifiers, used by Alembic. | ||
| revision = '20260315_0004' | ||
| down_revision = '20260220_0003' | ||
| down_revision = '20260306_0004' |
There was a problem hiding this comment.
This PR modifies down_revision of existing migrations. The repo docs explicitly call out “Never modify applied migrations” and suggest resolving conflicts via a merge revision (alembic merge heads). If these revisions may already be applied in any shared/staging/prod database, consider using a merge migration (or a new follow-up revision) instead of rewriting history, or at least document the required recovery steps (e.g., stamping/merging) for environments already upgraded.
| down_revision = '20260306_0004' | |
| down_revision = '20260220_0003' |
Two migrations both declared
down_revision = '20260220_0003', creating a fork that Alembic cannot apply linearly.20260331_0005also skipped20260315_0004entirely.Before (broken):
After (linear):
Changes:
20260315_0004_add_annotations_collections_audit.py:down_revision'20260220_0003'→'20260306_0004'20260331_0005_add_project_archive.py:down_revision'20260306_0004'→'20260315_0004'