Files
reflector/.github/workflows/db_migrations.yml
Mathieu Virbel 3d370336cc fix: alembic migrations (#470)
* fix: alembic migrations

This commit fixes all the migrations that was half-backed, due to auto
creation in the db init before. The process was to checkout at the
commit where the migration was created, and use --autogenerate to
regenerate at the state of the migration. 4 migrations was fixed.

It also includes a workflow to ensure migration can applies correctly.

* fix: db migration check

* fix: nullable on meeting_consent

* fix: try fixing tests
2025-06-27 12:03:10 -06:00

56 lines
1.4 KiB
YAML

name: Test Database Migrations
on:
push:
paths:
- "server/migrations/**"
- "server/reflector/db/**"
- "server/alembic.ini"
- ".github/workflows/db_migrations.yml"
pull_request:
paths:
- "server/migrations/**"
- "server/reflector/db/**"
- "server/alembic.ini"
- ".github/workflows/db_migrations.yml"
jobs:
test-migrations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "poetry"
cache-dependency-path: "server/poetry.lock"
- name: Install requirements
working-directory: ./server
run: |
poetry install --no-root
- name: Test migrations from scratch
working-directory: ./server
run: |
echo "Testing migrations from clean database..."
poetry run alembic upgrade head
echo "✅ Fresh migration successful"
- name: Test migration rollback and re-apply
working-directory: ./server
run: |
echo "Testing rollback to base..."
poetry run alembic downgrade base
echo "✅ Rollback successful"
echo "Testing re-apply of all migrations..."
poetry run alembic upgrade head
echo "✅ Re-apply successful"