Permalink
Browse files

Added text datatype

  • Loading branch information...
1 parent 8d8f376 commit c185031ecbb4471eef235b38c708f6ba22de3ba9 mde committed Aug 18, 2012
Showing with 15 additions and 2 deletions.
  1. +12 −0 lib/datatypes.js
  2. +1 −0 lib/generators/sql.js
  3. +2 −2 lib/index.js
View
12 lib/datatypes.js
@@ -82,6 +82,18 @@ datatypes = {
}
}
+, 'text': {
+ validate: function (name, val, locale) {
+ return {
+ err: null
+ , val: String(val)
+ };
+ }
+ , serialize: function (input, options) {
+ return _serialize(input, options);
+ }
+ }
+
, 'number': {
validate: function (name, val, locale) {
if (isNaN(val)) {
View
1 lib/generators/sql.js
@@ -6,6 +6,7 @@ var model = require('../index')
datatypeMap = {
'string': 'varchar(256)'
+, 'text': 'text'
, 'number': 'real'
, 'int': 'integer'
, 'boolean': 'boolean'
View
4 lib/index.js
@@ -648,8 +648,8 @@ model.ModelDefinitionBase = function (name) {
// Add the base model properties -- these should not be handled by user input
if (model.useTimestamps) {
- //this.property('createdAt', 'datetime');
- //this.property('updatedAt', 'datetime');
+ this.property('createdAt', 'datetime');
+ this.property('updatedAt', 'datetime');
}
['hasMany', 'hasOne', 'belongsTo'].forEach(function (assnKey) {

0 comments on commit c185031

Please sign in to comment.