Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foreign keys should not be created twice #2118

Merged

Conversation

pimeys
Copy link
Contributor

@pimeys pimeys commented Aug 2, 2021

In a case where we need to recreate a table, if the table has a foreign key we have to change, this change could be run twice, leading to an error.

The fix checks if the created foreign key references a table that was redefined earlier, and skips the creation if needed.

Closes: prisma/prisma#8539

@pimeys pimeys added this to the 2.29.0 milestone Aug 2, 2021
@pimeys pimeys changed the title Foreign keys should not created twice Foreign keys should not be created twice Aug 2, 2021
In a case where we need to recreate a table, if the table has a foreign
key we have to change, this change could be run twice, leading to an
error.

The fix checks if the created foreign key references a table that was
redefined earlier, and skips the creation if needed.
@pimeys pimeys force-pushed the migration-engine/sql-server-rename-columns-part-of-relations branch from a2ffad0 to 99d6b24 Compare August 2, 2021 19:05
@pimeys pimeys merged commit 8b139c1 into master Aug 3, 2021
@pimeys pimeys deleted the migration-engine/sql-server-rename-columns-part-of-relations branch August 3, 2021 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQL Server: Unable to rename a column referenced by a relation
2 participants