You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
generate automatic_foreign_key:migration in existing project
run it and see it fail somewhere in the middle
fix the migration, see it run successfully
Now you have created twice all the foreign keys that were before the failing one. As a result, you'll have some garbage in the database and db/schema.rb.
Although the root cause of the problem is lack of transactional DDL in MySQL, this behaviour is slightly different than usual errors in migrations. E.g when you fail in the middle of adding columns, run it again, then you cannot add the earlier columns twice and migration will fail earlier.
The proposed solution is to output warnings when creating foreign key same as one that already exists.
The text was updated successfully, but these errors were encountered:
Imagine the following scenario (using MySQL):
Now you have created twice all the foreign keys that were before the failing one. As a result, you'll have some garbage in the database and db/schema.rb.
Although the root cause of the problem is lack of transactional DDL in MySQL, this behaviour is slightly different than usual errors in migrations. E.g when you fail in the middle of adding columns, run it again, then you cannot add the earlier columns twice and migration will fail earlier.
The proposed solution is to output warnings when creating foreign key same as one that already exists.
The text was updated successfully, but these errors were encountered: