prisma: removing `@unique` in `schema.prisma` does not generate SQL to do so
This occurs for me using MySQL 5.7
To reproduce:
- Make a model for a new table with a field that is marked as @unique
- Generate and run migrations.
- Remove the @unique
- Generate migrations
- There is no
ALTER TABLE foo DROP KEY 'table_name_field_name_key;generated in the migrations
This is a problem for me, partly because I need that field not to be unique, but also because the generated prisma client thinks that everything is fine - so the typescript allows statements that then fail due to a unique key violation.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 7
- Comments: 15 (5 by maintainers)
This issue still exist on latest prisma versions >5.15.0
same here, reopen this issue please @aqrln
@Rodrigodd One the second
migrate devrun you could usemigrate dev --create-onlyinstead and manually add the SQL to drop the unique index. Then apply it withmigrate deployand your database should match the state of your Prisma schema going forward.