Alembic

Use when running Alembic database migrations on top of a SQLAlchemy 2.x data layer that targets more than one dialect — SQLite, PostgreSQL, and MySQL — from a single migration history. Covers wiring env.py / alembic.ini to your models' Base.metadata (sourcing the DB URL from the environment, sync-first with a short async run_async_migrations note), the full revision -> autogenerate -> review -> upgrade/downgrade workflow, branching (history / current / heads / merge for multiple heads), and the load-bearing multi-dialect gotcha: SQLite cannot ALTER most schema, so write migrations in BATCH (move-and-copy) style — the same batch_alter_table code emits plain ALTER on PG/MySQL. Also owns the create_all-vs-Alembic decision and the baseline-stamp path off a create_all'd DB. Multi-dialect, portable, sync-first. Not SQLAlchemy model/engine authoring (see sqlalchemy), not job-queue/lease patterns (see sql-job-queue).

bm629 50d2e7e 3 files · 33.4 KB Updated

File contents

bm629/agent-skills/tree/main/skills/alembic commit 50d2e7ed22

Frequently asked questions

npx skillmds@latest add bm629/alembic