prisma migrate status: Check Migration State in CI
prisma migrate status compares prisma/migrations against _prisma_migrations and reports whether the database is up to date, behind, or has failed migrations.
status is the read-only check for Prisma. It exits non-zero when the database is not in sync, which makes it directly usable as a pipeline gate.
What it does
prisma migrate status connects to the database, compares the migrations folder to the _prisma_migrations table, and prints whether every migration is applied, some are pending, or any failed. It exits with a non-zero code when the database is not up to date.
Common usage
# fail a pre-deploy check if migrations are pending or failed
npx prisma migrate status
# typical CI: status as a gate, then deploy
npx prisma migrate status && npx prisma migrate deployOptions
| Command / flag | What it does |
|---|---|
| migrate status | Report applied/pending/failed migration state |
| --schema <path> | Path to schema.prisma if not the default |
| migrate resolve | Companion command to mark a migration applied or rolled back |
In CI
Run migrate status in a check job; a non-zero exit means the database is behind or has a failed migration, so the pipeline can react before deploying. It is read-only. Use it alongside migrate deploy, which does the actual applying.
Common errors in CI
status reports "Following migration have not yet been applied" when the database is behind (run prisma migrate deploy), and surfaces the P3009 failed-migration state when a previous migration is recorded as failed (resolve it with prisma migrate resolve). "P1001: Can't reach database server" means the connection URL or network is wrong for the runner.