Skip to content

Commit

Permalink
Docs: add alembic troubleshooting (#181)
Browse files Browse the repository at this point in the history
* Docs: add alembic troubleshooting

* comments
  • Loading branch information
lusmoura authored Jun 7, 2024
1 parent 42253c9 commit 3b5f94f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
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.

0 comments on commit 3b5f94f

Please sign in to comment.