Permalink
Browse files

differentiate between normal defaultValues and NOW

  • Loading branch information...
1 parent 8921b13 commit 473bce052acc07a6b884c0e1593ced06eab362af @sdepold committed May 1, 2012
Showing with 6 additions and 4 deletions.
  1. +1 −1 lib/dao-factory.js
  2. +3 −2 lib/dao.js
  3. +2 −1 lib/data-types.js
View
@@ -165,7 +165,7 @@ module.exports = (function() {
var value = null
if(self.rawAttributes.hasOwnProperty(name) && self.rawAttributes[name].hasOwnProperty('defaultValue')) {
- value = self.rawAttributes[name].defaultValue
+ value = Utils.toDefaultValue(self.rawAttributes[name].defaultValue)
}
instance[name] = value
View
@@ -249,8 +249,9 @@ module.exports = (function() {
}
Utils._.map(defaults, function(value, attr) {
- if(!self.hasOwnProperty(attr))
- self.addAttribute(attr, value)
+ if(!self.hasOwnProperty(attr)) {
+ self.addAttribute(attr, Utils.toDefaultValue(value))
+ }
})
}
View
@@ -4,5 +4,6 @@ module.exports = {
INTEGER: 'INTEGER',
DATE: 'DATETIME',
BOOLEAN: 'TINYINT(1)',
- FLOAT: 'FLOAT'
+ FLOAT: 'FLOAT',
+ NOW: 'NOW'
}

0 comments on commit 473bce0

Please sign in to comment.