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

Commit cdcab4a8 by heartsentwined Committed by Loïc Mahieu

renameColumn: non-null column can't default null

1 parent 85a4166d
Showing with 5 additions and 0 deletions
...@@ -400,6 +400,11 @@ module.exports = (function() { ...@@ -400,6 +400,11 @@ module.exports = (function() {
defaultValue: data.defaultValue defaultValue: data.defaultValue
} }
// fix: a not-null column cannot have null as default value
if (data.defaultValue === null && !data.allowNull) {
delete options[attrNameAfter].defaultValue;
}
if (this.sequelize.options.dialect === 'sqlite') { if (this.sequelize.options.dialect === 'sqlite') {
// sqlite needs some special treatment as it cannot rename a column // sqlite needs some special treatment as it cannot rename a column
SQLiteQueryInterface.renameColumn.call(this, tableName, attrNameBefore, attrNameAfter, emitter, queryAndEmit) SQLiteQueryInterface.renameColumn.call(this, tableName, attrNameBefore, attrNameAfter, emitter, queryAndEmit)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!