Alembic Cheatsheet 01 — Setup and env.py
Cheatsheet: alembic init, env.py wiring for SQLAlchemy 2.0, async env.py, naming conventions.
Cheatsheet: alembic init, env.py wiring for SQLAlchemy 2.0, async env.py, naming conventions.
Alembic basics: setup with SQLAlchemy 2.0, env.py for sync/async, naming conventions, the migration directory.
Cheatsheet: complete list of alembic CLI commands with flags and common scenarios.
What Alembic autogenerate detects (tables, columns, indexes, constraints) and what it doesn’t (data migrations, complex changes, defaults), plus a review checklist.
Cheatsheet: autogenerate detection rules, common misses (renames, data, defaults), drift detection.
Manual migrations: op API, ALTER patterns, batch ops for SQLite, data migrations, idempotent migrations.
Cheatsheet: model change → autogenerate → review → upgrade → ship.
Cheatsheet: op.create_table / drop / add_column / alter_column / indexes / constraints / FKs / raw SQL.
Alembic branching: how multiple revisions create branches, merging strategies, and team workflows.
Cheatsheet: expand-contract pattern, CONCURRENTLY index, FK validation in two phases, batched backfill.