sequelize/sequelize — pull request #1321 by heartsentwined (2014-01-30 12:31:34+00:00)
Title: renameColumn: non-null column can't default null

This fixes a bug in `renameColumn()` of migration. If one tries to rename a column which was originally `NOT NULL` and doesn't have a default value set, it will incorrectly try to set the default value as `NULL` after renaming.

Code explanation:

```javascript
// query-interface.js L391
this.describeTable(tableName).success(function(data) {
/*
* describeTable() returns null for defaultValue,
* even when no defaultValue is set
*/

data = data[attrNameBefore] || {}

var options = {}

options[attrNameAfter] = {
attribute: attrNameAfter,
type: data.type,
allowNull: data.allowNull,
defaultValue: data.defaultValue
}

// fix: a not-null column cannot have null as default value
if (data.defaultValue === null && !data.allowNull) {
delete options[attrNameAfter].defaultValue;
}
```