You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 25, 2021. It is now read-only.
Trying to remove a model with a foreign key on a database without data, lands me in a permanently broken state on SQL Server.
Error: Database error: Error querying the database: ''FK__Post__userId__267ABA7A' is not a constraint.' on server 369707b4e132 executing on line 8 (code: 3728, state: 1, class: 16)
0: migration_core::api::ApplyMigrations
at migration-engine/core/src/api.rs:102
generatorjs {provider="prisma-client-js"previewFeatures=["microsoftSqlServer"]}datasourcems {provider="sqlserver"url=env("DATABASE_URL")}modelUser {idInt@id@default(autoincrement())nameString?// Post Post[]}// model Post {// id Int @id @default(autoincrement())// title String// User User @relation(fields: [userId], references: [id])// userId Int// }
npx prisma migrate dev --preview-feature
Environment variables loaded from prisma/.env
Prisma schema loaded from prisma/schema.prisma
Datasource "ms"
✔ Name of migration …
Error: Database error: Error querying the database: ''FK__Post__userId__267ABA7A' is not a constraint.' on server 417d5b86856f executing on line 8 (code: 3728, state: 1, class: 16)
0: migration_core::api::ApplyMigrations
at migration-engine/core/src/api.rs:102
Puts me in a permanently broken state. I need to manually adjust my SQL scripts to remove the migration.
Expected behavior
This should work as expected.
Environment & setup
OS:
Database:
Node.js version:
Prisma version:
Environment variables loaded from prisma/.env
@prisma/cli : 2.13.0-dev.100
@prisma/client : 2.13.0-dev.100
Current platform : darwin
Query Engine : query-engine 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/query-engine-darwin)
Migration Engine : migration-engine-cli 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary : prisma-fmt 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/prisma-fmt-darwin)
Studio : 0.329.0
Preview Features : microsoftSqlServer
Bug description
Trying to remove a model with a foreign key on a database without data, lands me in a permanently broken state on SQL Server.
How to reproduce
Previous
Current
Puts me in a permanently broken state. I need to manually adjust my SQL scripts to remove the migration.
Expected behavior
This should work as expected.
Environment & setup