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 uv uses: astral-sh/setup-uv@v3 with: enable-cache: true working-directory: server - name: Test migrations from scratch working-directory: server run: | echo "Testing migrations from clean database..." uv run alembic upgrade head echo "✅ Fresh migration successful" - name: Test migration rollback and re-apply working-directory: server run: | echo "Testing rollback to base..." uv run alembic downgrade base echo "✅ Rollback successful" echo "Testing re-apply of all migrations..." uv run alembic upgrade head echo "✅ Re-apply successful"