GuideAdvanced

Database Migrations And Cicd

Learn to change a production database's schema and data without breaking it: the migration as a versioned, ordered, repeatable, and reversible change. It covers `ALTER TABLE` and the table-rebuild pattern, data migrations with backfills, the expand/contract pattern for zero downtime, and database CI/CD — applying migrations, running quality checks and tests in a pipeline, with quality gates and rollback. You evolve Reservo's database through a real series of migrations and come out knowing how to build and operate a production migration system.

64
lessons
8
modules
English · Spanish
available in
Yes
certificate
Free
access
NIEVA

Outcomes

What you'll be able to do

  • Understand why migrations exist: schema drift between environments, and why a hand-run ALTER is neither versioned, reversible, nor auditable
  • Design the anatomy of a migration: up and down, the versioned file, the `schema_migrations` table, and an idempotent runner that applies only what's pending
  • Write schema migrations with ALTER TABLE: adding columns, tables, and indexes, and the table-rebuild pattern that sqlite's limitations require
  • Migrate existing data with idempotent, batched backfills, and decide when to separate a schema migration from a data migration
  • Apply the expand/contract pattern for zero-downtime migrations, test on a copy before production, and mitigate what's irreversible
  • Run migrations in CI: applying them from scratch and incrementally, and detecting schema drift before merging
  • Build the database's CI/CD pipeline: quality gates, rollback on failure, and per-environment configuration (dev, staging, prod)
  • Deliver Reservo's complete migration system: ordered migrations, a Python runner, and a CI pipeline in YAML

Before you start

What you need to bring

It's for you if...

  • Backend devs who change the schema of a live database and need to do it without breaking production
  • Teams suffering schema drift across environments from unversioned manual ALTERs
  • Anyone setting up or maintaining a CI/CD pipeline that includes the database
  • Devs who want to understand what tools like Alembic, Flyway, or Liquibase are doing under the hood

Requirements and materials

  • Basic SQL: CREATE TABLE, ALTER TABLE, INSERT
  • Python 3 installed (the `sqlite3` module ships with the standard library)
  • A general sense of what a CI/CD pipeline is; no prior experience setting one up required

Content

The syllabus, module by module

Open any of them to see its lessons.

Common questions

What people usually ask

Start whenever you like

Reviews

What students say

These reviews are from enrolled students who completed at least 50% of the course. We moderate reviews only on content grounds (spam, offensive language, personal data), never for being critical or negative.

No approved reviews yet.

Be the first to share your experience!