Cannot add foreign key constraint
for MySQL migration that tries to create foreign key pointing to non-PK and unindexed field
#13339
Labels
bug/1-unconfirmed
Bug should have enough information for reproduction, but confirmation has not happened yet.
kind/bug
A reported bug.
team/schema
Issue for team Schema.
topic: mysql
topic: prisma migrate dev
CLI: prisma migrate dev
This schema:
(Note how
custom_id
is not indexed at all [and also not unique, which might be invalid, see issue https://github.com//issues/13340)leads to this migration SQL:
Which on execution fails with:
Adding an index
@@index([custom_id])
toA
makes the migration pass.The text was updated successfully, but these errors were encountered: