alembic-migration
/alembic-migration
Create, review, and apply database schema changes with Alembic. Use whenever a SQLAlchemy model is added or changed, a column/index/constraint needs to change, or a data backfill is required — anything that alters the PostgreSQL schema.
- Author
- AnkonKumarSingh ↗
- Repository
- InnovateIT-Agent-OS-AI-Agent-Platform ↗
- Licence
- MIT
- Last repository change
- 06.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 06.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Create, review, and apply database schema changes with Alembic. Use whenever a SQLAlchemy model is added or changed, a column/index/constraint needs to change, or a data backfill is required — anything that alters the PostgreSQL schema.
Original author description
Create, review, and apply database schema changes with Alembic. Use whenever a SQLAlchemy model is added or changed, a column/index/constraint needs to change, or a data backfill is required — anything that alters the PostgreSQL schema.
How it works
- Workflow
- Data migrations / backfills
- Rules
SKILL.md preview
--- name: alembic-migration description: Create, review, and apply database schema changes with Alembic. Use whenever a SQLAlchemy model is added or changed, a column/index/constraint needs to change, or a data backfill is required — anything that alters the PostgreSQL schema. --- # Alembic Migrations This project uses **async SQLAlchemy 2.0 + Alembic** on PostgreSQL. Migrations live in `backend/alembic/versions/` and are numbered (`0001_…`, `0002_…`). ## Workflow 1. **Change the model first** in `backend/app/db/models/` (`Mapped[...]` + `mapped_column()`, `__repr__`, relationships with `ondelete="CASCADE"`). Make sure the model is imported in `backend/app/db/models/__init__.py` so autogenerate sees it. 2. **Autogenerate** the migration: ```bash cd backend && uv run alembic revision --autogenerate -m "add <thing>" # or: make db-migrate ``` 3. **ALWAYS review the generated file.** Autogenerate is a draft, not the truth: - Confirm `upgrade()` matches your intent and `downgrade()` actually reverses it. - Check the `down_revision` chains onto the current head (`uv run alembic heads`). - Watch for dropped columns/tables you didn't intend, server defaults, enum changes, and JSON/array types. - Name the revision file with the next sequential prefix to match the existing convention. 4. **Apply and verify:** ```bash cd backend && uv run alembic upgrade head # or: make db-upgrade uv run alembic current # confirm at head ``` Then round-trip once to prove `downgrade()` works: `alembic downgrade -1 && alembic upgrade head`. ## Data migrations / backfills For backfills, add explicit `op.execute(...)` or a small data-loop in `upgrade()` (see the existing `*_backfill_*.py` migrations for the pattern). Keep schema and data changes in separate, well-named revisions when practical. ## Rules - Never edit a migration that has already been applied in shared environments — add a new one. - `make dev` / `make bootstrap` run `alembic upgrade head` automatically; you don't need a separate step in dev. - Keep models and migrations in sync — a model change without a migration will pass tests (sessions are mocked) but break on real Postgres.
Versions
The database has no other skills named alembic-migration.
Database snapshot: 13.11.2026 · package version 1b816e32141f (SHA-256 digest of the entire package)
Downloads in the last 30 days: 1 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100alembic
Manage database migrations for SQLAlchemy with Alembic. Use when a user asks to version database schemas, autogenerate migration scripts from models, run or roll back migrations, set up async SQLAlchemy migrations, or handle schema changes safely in production. - 100db-migration
Use when the user needs a PostgreSQL schema or data change through Liquibase or Flyway: new table, add, rename, or drop a column, add an index, change a constraint, backfill or one-time data fix, zero-downtime migration, or a new entity that needs persistence. - 90sqlalchemy-code-review
Reviews SQLAlchemy code for session management, relationships, N+1 queries, and migration patterns. Use when reviewing SQLAlchemy 2.0 code, checking session lifecycle, relationship() usage, or Alembic migrations. - 85sqlalchemy-code-review
Reviews SQLAlchemy code for session management, relationships, N+1 queries, and migration patterns. Use when reviewing SQLAlchemy 2.0 code, checking session lifecycle, relationship() usage, or Alembic migrations. - 100python-database-ops
SQLAlchemy and database patterns for Python. Triggers on: sqlalchemy, database, orm, migration, alembic, async database, connection pool, repository pattern, unit of work. - 100database-migration-patterns
Manage database schema changes safely with migration tools, zero-downtime strategies, and rollback procedures. Covers Alembic, SQL migrations, data migrations, and testing strategies. Triggers on database migration, schema changes, or Alembic configuration requests.