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
I have an initial migration that creates a table "offer" and a table "purchase" (among others) and defines a foreign key "offerId" at "purchase" that points to "offer" with the queryInterface.addColumn method. This works well.
Then, I'm creating a new migration that creates a new table "timeRange" that also defines a foreign key "offerId" at "timeRange" that points to "offer".
What do you expect to happen?
Both migrations should work (maybe using a combination of both table names and column names) or at least it would be great to be able to manually specify the constraint name to use in the queryInterface.addColumn method.
What is actually happening?
The second migration is failing. This is because it is creating the same constraint name "offerId_foreign_idx" for "timeRange" table that created in the first migration for "purchase" table.
This is the SQL it is generating:
ALTER TABLE `timeRange` ADD `offerId` INTEGER(11), ADD CONSTRAINT `offerId_foreign_idx` FOREIGN KEY (`offerId`) REFERENCES `offer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
Hi.
What you are doing?
I have an initial migration that creates a table "offer" and a table "purchase" (among others) and defines a foreign key "offerId" at "purchase" that points to "offer" with the queryInterface.addColumn method. This works well.
Then, I'm creating a new migration that creates a new table "timeRange" that also defines a foreign key "offerId" at "timeRange" that points to "offer".
What do you expect to happen?
Both migrations should work (maybe using a combination of both table names and column names) or at least it would be great to be able to manually specify the constraint name to use in the queryInterface.addColumn method.
What is actually happening?
The second migration is failing. This is because it is creating the same constraint name "offerId_foreign_idx" for "timeRange" table that created in the first migration for "purchase" table.
This is the SQL it is generating:
And the full error:
Dialect: mysql (MariaDB)
Database version: 10.1.13
Sequelize version: 3.23.2
The text was updated successfully, but these errors were encountered: