liveBook · Manning

Migration

As explained in Unit Testing Principles, Practices, and Patterns

A database migration is an explicit, versioned change that transitions a database schema or its data to a subsequent state.

A database migration is an explicit, versioned change that transitions a database schema or its data from one state to another. Store migrations with regular code in source control so the schema has a single, traceable source of truth. section 10.1 section 10.7

A migration-based workflow establishes practical rules:

  • Apply every schema modification, including reference data, through migrations. section 10.7
  • Prefer explicit migrations over a model database or state-based delivery when data motion matters more than resolving schema merge conflicts. section 10.1 section 10.7
  • Keep database changes out of unmanaged database instances so development and production changes remain traceable. section 10.1

Creating and reversing a table

A numbered migration defines both directions of a schema change: its Up operation creates the Users table, while its Down operation deletes it.

How Unit Testing Principles, Practices, and Patterns covers it

How deep it goes
Explains source control, version transitions, reversibility, and trade-offs against state-based delivery, but not migration tooling internals.
Examples
Uses a numbered CreateUserTable migration with Up and Down operations, plus a version-transition diagram.
What it assumes
Assumes a database schema and source-control workflow, while teaching why model databases should not serve as schema authority.
What you can do after
Operate database delivery by applying schema and reference-data changes through explicit, source-controlled migrations.
How it connects
Connects database schema, source control, reference data, state-based delivery, and integration testing.

Also explained in

Compare how 19 books explain migration →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Unit Testing Principles, Practices, and Patterns. The section links point to the parts of the book it draws on.