PostgreSQL for Developers
LESSON 4.2

Schema migrations without downtime

Learn key techniques and workflows in PostgreSQL for Developers.

31m
intermediate
5,747 students

Overview

A migration runs against a live application. Expand, migrate, contract lets you change a schema while both old and new code are running.

In this lesson you will:

  • Apply the expand, migrate, contract pattern
  • Avoid locks that block writes on large tables
  • Make every migration reversible or forward-only on purpose

Pro Tip

Use caching and revalidation wisely to ensure your app stays fast and data remains fresh without unnecessary requests.

Resources