Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: add alembic troubleshooting #181

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/check_revision_id.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Check for duplicate revision IDs
on:
pull_request:
paths:
- 'src/backend/alembic/versions/'
- 'src/backend/alembic/versions/**'
push:
paths:
- 'src/backend/alembic/versions/'
- 'src/backend/alembic/versions/**'

jobs:
check-alembic-revision-ids:
Expand Down
15 changes: 15 additions & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,18 @@ import pdb; pdb.set_trace()

it will allow you to debug.


## Alembic migrations out of sync error:

When developing on the backend if database model changes are made in different git branches your Alembic migrations may diverge.

If you have changes on your branch_a that contains a migration <my_migration_id>.py that is out of sync with the main branch, first downgrade your local branch using:

docker compose run --build backend alembic -c src/backend/alembic.ini downgrade -1
Then delete <my_migration_id>.py for your existing changes, and run:

make migrate
To sync with main, then:

make migration
to regenerate your migrations.
Loading