Retrofit in real developer workflows.

Each demo runs schema changes against a real database and verifies the result. Retrofit records each change as a schema operation: one intent, such as RenameColumn or DecomposeTable, rendered to whatever DDL and DML it needs. Retrofit reports an operation’s risks as it is declared, before any SQL exists.

Before the app runs, one Makefile check compares the operation log in git with the local database’s schema. When the log is newer, make db-sync brings the database forward. When the database is newer, make db-capture appends the change to the log.

Exercised
identify --expect
migrate --from-dump
drift
AddColumn
CreateIndex
Stack
make + git + PostgreSQL
Chapters
4

Retrofit imports a schema dump into its operation log, writes the migrations that add and then validate a foreign key between existing tables, then backs the change out and reapplies it. Every script is generated, none is written by hand.

Exercised
import
Seal
AddForeignKey
ValidateConstraint
Stack
Flyway + PostgreSQL
Chapters
4

Retrofit imports a populated database, preserves its rows through column and table refactors, and pulls changes made directly in PostgreSQL back into the log. Retrofit starts from a database dump, a set of migration scripts, or zero; this demo starts from the dump.

Exercised
import
op add
drift
DecomposeTable
Seal
Stack
PostgreSQL
Chapters
4