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

queryInterface.addColumn with references not add reference in mysql #5592

Closed
ningshen opened this Issue Mar 16, 2016 · 0 comments

Comments

2 participants
@ningshen

ningshen commented Mar 16, 2016

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`);

@ningshen ningshen changed the title from queryInterface.addColumn with references not work in mysql to queryInterface.addColumn with references not add reference in mysql Mar 16, 2016

@janmeier janmeier closed this Mar 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment