Migrations and the type-safe client

A migration turns a schema edit into versioned SQL

You just wrote a schema, but the database doesn't know about it yet. Migrations are how a schema change reaches the actual tables β€” and how that change becomes a reproducible, checked-in artifact instead of an ALTER TABLE someone typed once and forgot.

The command is npx prisma migrate dev. It compares your schema.prisma against the migration history, writes a timestamped SQL file under prisma/migrations/, applies it to your dev database, and then regenerates the client. You commit that SQL file to git, so every teammate and your CI pipeline rebuilds the exact same database by replaying the same migrations.

The one-liner: a migration is a schema change under version control. Editing the database by hand is a change nobody can reproduce and nobody reviewed.