Sane schema migrations with Alembic and Postgres
summary
Uses Alembic + SQLAlchemy against Postgres to turn chaotic SQL-and-bash migrations into an automated, reviewable pipeline with CI and a full 1.5 terabyte staging copy; runs schema changes weekly, treats migrations as separate commits so downgrades work, and embeds raw SQL for tricky work like index creation with concurrent and partition changes. Handles user-defined functions via file-per-object loading, performs multi-commit sequences for a thousand check constraints, and removes 100,000 lines of ad hoc schema code.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 3:59Schema migrations challenges
- 11:02Failed migration lessons
- 21:51Choosing migration tools
- 28:56Alembic in practice
- 33:46Alembic insights
- 41:07What Alembic could do better
- 43:52Alembic demo
- 54:26Q&A
related talks
31mBeyond Alembic and Django Migrations
34mLet's talk Databases in Python: SQLAlchemy and Alembic
52mManaging PostgreSQL changes for the Agile DBA
29mYour database migrations are bad and you should feel bad
33mDatabase Schema Migrations with Zero Downtime
24mMigrating from Oracle to Azure Database for PostgreSQL, Seamlessly
43mPostgres schema migrations using the expand/contract pattern
31mHelp! My Database Is The Bottleneck
