Database migration workflow helper. Use when creating database migrations, modifying SQLAlchemy models, or managing Alembic migrations. Automatically handles model changes, migration creation, and database upgrades.
This skill helps with the complete database migration workflow in this project.
backend/app/models/Before modifying models: Check current migration status
make db-upgrade # Ensure all migrations are applied
After modifying models: Create migration
make db-migrate # Auto-generate migration from model changes
Review migration: Always read the generated migration file in backend/alembic/versions/
Apply migration:
make db-upgrade # Apply to local database
Test migration: Run tests to verify schema changes
make test
pgdata - local database must persistmake db-migratemake db-upgrademake testbackend/app/models/__init__.pymake db-migratemake db-upgrademake testcd backend
uv run alembic current # Show current revision
uv run alembic heads # Show latest revision
uv run alembic history # Show all migrations
alembic mergeDATABASE_URL="postgresql://postgres:postgres@localhost:5433/manageros_test" make db-upgrade