0Pricing
FastAPI Backend Development Bootcamp · Lesson

Database Migrations with Alembic

Evolve your SQLAlchemy schema safely over time using Alembic: initialize migrations, autogenerate revisions, and apply or roll back changes in a FastAPI project.

Why Migrations

Your database schema changes as your app grows: new columns, tables, and indexes. Migrations are versioned, repeatable scripts that evolve the schema without losing data. Alembic is the standard tool for SQLAlchemy.

create_all Is Not Enough

Base.metadata.create_all() creates missing tables but never alters existing ones. It cannot add a column to a populated table or track history. Production needs real migrations.

All lessons in this course

  1. SQLAlchemy ORM Fundamentals
  2. Connecting FastAPI to PostgreSQL
  3. CRUD Operations with SQLAlchemy
  4. Database Migrations with Alembic
← Back to FastAPI Backend Development Bootcamp