Skip to content
Browse files

Default should not be handled by database engine

  • Loading branch information...
1 parent 11b4436 commit 35e872368ab821b2d780d7ef54ddb778688951bb @1602 committed Feb 20, 2012
Showing with 9 additions and 10 deletions.
  1. +8 −9 lib/adapters/mysql.js
  2. +1 −1 test/common_test.js
View
17 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;
}
View
2 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();
});

0 comments on commit 35e8723

Please sign in to comment.
Something went wrong with that request. Please try again.