Skip to content
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

Handle blob and literal type #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ const reverseSequelizeColType = function(col, prefix = 'Sequelize.')
return prefix + 'TEXT';
return prefix + 'TEXT('+options.length.toLowerCase()+')';

case DataTypes["DOUBLE PRECISION"].key:
return 'Sequelize["DOUBLE PRECISION"]';

// NUMBER(length, decimals).UNSIGNED.ZEROFILL
case DataTypes.NUMBER.key:
case DataTypes.TINYINT.key:
Expand Down Expand Up @@ -78,7 +81,7 @@ const reverseSequelizeColType = function(col, prefix = 'Sequelize.')
case DataTypes.BLOB.key:
if (!options.length)
return prefix + 'BLOB';
return prefix + 'BLOB('+options.length.toLowerCase()+')';
return prefix + 'BLOB("'+options.length.toLowerCase()+'")';

case DataTypes.ENUM.key:
return prefix + "ENUM('" +options.values.join("', '")+"')";
Expand Down Expand Up @@ -130,7 +133,7 @@ const reverseSequelizeDefValueType = function(defaultValue, prefix = 'Sequelize.
{
if (typeof defaultValue === 'object') {
if (defaultValue.constructor && defaultValue.constructor.name) {
return { internal: true, value: prefix + defaultValue.constructor.name };
return { internal: true, value: prefix + defaultValue.constructor.name.toLowerCase() + '("' + defaultValue.val + '")' };
}
}

Expand Down