user14082
user14082

Reputation: 482

how to reproduce migration failure in Prisma

We are currently building a CI test pipeline that includes down-migration process after Prisma migration failure.

https://www.prisma.io/docs/guides/database/developing-with-prisma-migrate/generating-down-migrations#how-to-generate-and-run-down-migrations

But we can't quite figure out how to reproduce the situation where it fails on purpose. Is there any easy, simple way to make migration fail?

Thanks.

(To use broken SQL is not a good idea because we suppose that we are going to use migrations(*.sql) which are auto-generated by Prisma that are not broken. So it is not suitable for what we expect from the CI.)

Upvotes: 1

Views: 170

Answers (1)

Raphael Etim
Raphael Etim

Reputation: 823

A migration might fail if:

  1. You modify a migration before running it and introduce a syntax error.
  2. You add a mandatory (NOT NULL) column to a table that already has data.
  3. The migration process stopped unexpectedly.
  4. The database shut down in the middle of the migration process.

See the Prisma documentation on failed migration.

Upvotes: 1

Related Questions