Skip to content
StackDecode
System Design
4. Database FundamentalsAnimated

Database Migrations

Controlled, versioned changes to the schema.

The idea

Migrations are scripts applied in order so every environment has the same schema, and they can be rolled forward safely.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

DeveloperGit repoCI pipelineTerraformCloud provider
  • client
  • gateway / proxy
  • service
  • cache
  • data store
  • queue / stream

Describe infrastructure as code in Git.

step:
1/4
at:
Developer
1/8

The green dot is a request moving through the system.

Step by step

  1. 1Write a versioned migration
  2. 2Apply it in staging
  3. 3Deploy compatible code
  4. 4Apply in production

Where it is used

Evolving databases.

Watch out for

Locking large tables. Use expand and contract steps.

Related