diff --git a/.github/workflows/check_revision_id.yml b/.github/workflows/check_revision_id.yml index ba5b197ebf..1f03211273 100644 --- a/.github/workflows/check_revision_id.yml +++ b/.github/workflows/check_revision_id.yml @@ -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: diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index d3c655c9d9..9d1b58b7ef 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -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 .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 .py for your existing changes, and run: + +make migrate +To sync with main, then: + +make migration +to regenerate your migrations. \ No newline at end of file