queryInterface.addColumn with references not work in mysql
queryInterface.addColumn('Contents', 'ToolId', {
type: Sequelize.INTEGER,
references: {
model: 'Tools',
key: 'id'
}
})
will result sql
ALTER TABLE `Contents` ADD `ToolId` INTEGER REFERENCES `Tools` (`id`);
this sql statement is not work.
mysql alter column
add column sql with reference should be:
ALTER TABLE `Contents` ADD `ToolId` INTEGER, ADD FOREIGN KEY (`ToolId`) REFERENCES `Tools` (`id`);