node-orm-timestamps
node-orm-timestamps copied to clipboard
created_at and updated_at not working
I added this code in my project:
var orm = require("orm");
var modts = require('orm-timestamps');
orm.settings.set("instance.returnAllErrors", true);
orm.settings.set("connection.reconnect", true);
orm.settings.set("connection.pool", true);
orm.settings.set("connection.debug", true);
orm.connect("mysql://root:@localhost/laser_control", function (err, db) {
if (err) throw err;
db.use(modts);
var user = db.define("users", {
id : {type: 'serial'},
name : { type: 'text', required : true},
mail : { type: 'text', unique: true, required : true},
password : { type: 'text', required : true},
crm : { type: 'integer', key: true },
city : { type: 'text', key: true, size: 2},
id_socket : { type: 'text', size: 100},
status : { type: "enum", values: [ "1", "0"], defaultValue: "1" },
}, {
timestamp: true
});
db.sync(function(err) {
if (err) throw err;
});
});
--
it create all my model including created_at and updated_at, but everytime that i insert a new user, my fields created_at and updated_at keep the value "NULL" in database, i'm doing something wrong ?
obs: my code isn't give any error, it just not fill with the values that i want.