Upgrade prisma 2 to 5 and got renamed index error
Hi! I recently upgrade prisma 2 to 5. and tried to
I think theres change index name on unique. But I cant find out how to solve... Is there anybody know how to solve this please?
prisma migrate dev
and got this message.
Here is message and prisma shema.
- schema.prisma
model Tag {
id Int @id @default(autoincrement())
text String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
blogs Blog[] @relation("BlogToTag")
projects Project[] @relation("ProjectToTag")
}
model User {
id Int @id @default(autoincrement())
email String @unique
password String
}
- error code
Drift detected: Your database schema is not in sync with your migration history.
The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database.
It should be understood as the set of changes to get from the expected schema to the actual schema.
[] Changed the Tag
table
[] Renamed index Tag.text_unique
to Tag_text_key
[] Changed the User
table
[] Renamed index User.email_unique
to User_email_key
I think theres change index name on unique. But I cant find out how to solve... Is there anybody know how to solve this please?
5 Replies
Hi @grizzle 👋
Is this in a development environment? If yes, then following this troubleshooting guide can help fix this issue.
Troubleshooting | Prisma Documentation
Troubleshooting issues with Prisma Migrate in a development environment.
@RaphaelEtim Thank you for reply! sadly,,, it was produce environment.
I couldnt find solution.. so just backup all of data and reset migration. 😂
For production environment, this guide would be helpful. Also
prisma migrate dev
is not meant to be used in a production environment.Patching & hotfixing | Prisma Documentation
How to reconcile the migration history after applying a hotfix or patch to a production environment.
Thank you @RaphaelEtim !! It really helpful!! 🥹
You're welcome