不要怂,就是干,撸起袖子干!

Commit b98af0bd by Sushant

fix(#966) : Added test which fails to change column to foreignKey

1 parent ece76317
Showing with 36 additions and 0 deletions
...@@ -410,6 +410,42 @@ describe(Support.getTestDialectTeaser('QueryInterface'), function() { ...@@ -410,6 +410,42 @@ describe(Support.getTestDialectTeaser('QueryInterface'), function() {
}); });
}); });
}); });
it('should be able to change to foreign key reference', function() {
return this.queryInterface.createTable('level', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
}
}).bind(this).then(function() {
this.queryInterface.createTable('users', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
level_id: {
type: DataTypes.INTEGER
}
});
})
.bind(this).then(function() {
return this.queryInterface.changeColumn('users', 'level_id', {
type: DataTypes.INTEGER,
references: {
model: 'level',
key: 'id'
},
onUpdate: 'cascade',
onDelete: 'set null'
}, {logging: log});
}).then(function() {
expect(count).to.be.equal(1);
count = 0;
});
});
}); });
describe('addColumn', function() { describe('addColumn', function() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!