diff --git a/lib/adapters/mysql.js b/lib/adapters/mysql.js index 6769f69e..b27963e3 100644 --- a/lib/adapters/mysql.js +++ b/lib/adapters/mysql.js @@ -445,24 +445,23 @@ MySQL.prototype.propertySettingsSQL = function (model, prop) { }; function datatype(p) { - var dt = ''; + var dt = ''; switch (p.type.name) { case 'String': dt = 'VARCHAR(' + (p.limit || 255) + ')'; - break; + break; case 'Text': dt = 'TEXT'; - break; + break; case 'Number': dt = 'INT(' + (p.limit || 11) + ')'; - break; + break; case 'Date': dt = 'DATETIME'; - break; + break; case 'Boolean': dt = 'TINYINT(1)'; - break; - } - dt += (typeof p.default !== 'undefined') ? ' DEFAULT ' + p.default.toString() : ''; - return dt; + break; + } + return dt; } diff --git a/test/common_test.js b/test/common_test.js index fb5305c4..a5cb562c 100644 --- a/test/common_test.js +++ b/test/common_test.js @@ -590,7 +590,7 @@ function testOrm(schema) { test.ok(post.published === false); post.updateAttributes({title: 'hey', published: true}, function () { Post.find(id, function (err, post) { - test.ok(post.published === true); + test.ok(!!post.published, 'Update boolean field'); test.ok(post.id); test.done(); });