report id 3380
I can reproduce the problem.
Steps to reproduce:
model Post {
id Int @default(autoincrement()) @id
title String
content String?
published Boolean @default(false)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
}
model User {
id Int @default(autoincrement()) @id
email String @unique
password String
name String?
posts Post[]
}
Migrate the database using prisma migrate
Change the datamodel to the following:
model Post {
id Int @default(autoincrement()) @id
title String
content String?
published Boolean @default(false)
author User? @relation(fields: [authorId], references: [uid])
authorId Int?
}
model User {
uid Int @id
posts Post[]
}
Try migrating the database
See the following error:

Version used:
@prisma/cli : 2.0.0-beta.3
Current platform : darwin
Query Engine : query-engine 2fb8f444d9cdf7c0beee7b041194b42d7a9ce1e6 (at /Users/harshit/.nvm/versions/node/v12.16.2/lib/node_modules/@prisma/cli/query-engine-darwin)
Migration Engine : migration-engine-cli 2fb8f444d9cdf7c0beee7b041194b42d7a9ce1e6 (at /Users/harshit/.nvm/versions/node/v12.16.2/lib/node_modules/@prisma/cli/migration-engine-darwin)
Introspection Engine : introspection-core 2fb8f444d9cdf7c0beee7b041194b42d7a9ce1e6 (at /Users/harshit/.nvm/versions/node/v12.16.2/lib/node_modules/@prisma/cli/introspection-engine-darwin)
@do4gr to reproduce to see if it's still an issue.
Still an issue: The migration changes the primary key, but a foreign key still depends on it. We'll need to adjust the order of operations.
Most helpful comment
I can reproduce the problem.
Steps to reproduce:
Migrate the database using prisma migrate
Change the datamodel to the following:
Try migrating the database
See the following error:

Version used: