Migrate creates unnecessary migration with SQL syntax error #9204
Labels
bug/1-unconfirmed
Bug should have enough information for reproduction, but confirmation has not happened yet.
domain/schema
Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc.
kind/bug
A reported bug.
topic: migrate
topic: sqlite
Milestone
Reproduction repository: https://github.com/janpio/prisma-sqlite-bug
See README for how this was created.
npm install
npx prisma db pull
to introspect the schema so it definitely matches the databasenpx prisma migrate dev --create-only
migration.sql
:INSERT INTO "new_USER" ("email", "id") SELECT "email", coalesce("id", ) AS "id" FROM "USER";
Complete file:
npx prisma migrate deploy
:If you want you can replace steps 4 to 6 with running
npx prisma db push
instead and get this error message directly:Seems the initial migrated SQL from the repository https://github.com/janpio/prisma-sqlite-bug/blob/main/prisma/migrations/init/migration.sql creates a SQLite database, that when introspected, creates a schema that Migrate will try to migrate again (although it should of course not) and then create invalid SQL to do that.
The text was updated successfully, but these errors were encountered: