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

Commit 0d871591 by Sushant Committed by GitHub

fix(changeColumn): normalize attribute (#9897)

1 parent 0db96d34
......@@ -516,7 +516,7 @@ class QueryInterface {
attributes[attributeName] = dataTypeOrOptions;
}
attributes[attributeName].type = this.sequelize.normalizeDataType(attributes[attributeName].type);
attributes[attributeName] = this.sequelize.normalizeAttribute(attributes[attributeName]);
if (this.sequelize.options.dialect === 'sqlite') {
// sqlite needs some special treatment as it cannot change a column
......
......@@ -82,7 +82,7 @@ describe(Support.getTestDialectTeaser('QueryInterface'), () => {
// MSSQL doesn't support using a modified column in a check constraint.
// https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql
if (dialect !== 'mssql') {
it('should work with enums', function() {
it('should work with enums (case 1)', function() {
return this.queryInterface.createTable({
tableName: 'users'
}, {
......@@ -94,6 +94,19 @@ describe(Support.getTestDialectTeaser('QueryInterface'), () => {
});
});
it('should work with enums (case 2)', function() {
return this.queryInterface.createTable({
tableName: 'users'
}, {
firstName: DataTypes.STRING
}).then(() => {
return this.queryInterface.changeColumn('users', 'firstName', {
type: DataTypes.ENUM,
values: ['value1', 'value2', 'value3']
});
});
});
it('should work with enums with schemas', function() {
return this.sequelize.createSchema('archive').then(() => {
return this.queryInterface.createTable({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!