Migration adds creation of foreign key that already exists
On a MySql database there is a Download table that has this definition of a foreign key (removed columns for reading purposes):
This table already has a definition in the
schema.prisma file and has been migrated earlier. So the foreign key is already defined and it exists.
When I update the schema.prisma file with new models but no change in the definition of the Download model, the migration creates a line to add the foreign key to the Download table:
So what I did was running it with --create-only , manually delete this line and then deploy the database. However, this could happen again in upcoming migrations and I was wondering if this can be fixed. So any ideas where I should look?
Version used for Prisma "prisma": "6.18.0".1 Reply
You decided to hold for human wisdom. We'll chime in soon! Meanwhile,
#ask-ai is there if you need a quick second opinion.