geddy / model

Datastore-agnostic ORM in JavaScript
265 stars 55 forks source link

createdAt and updatedAt #248

Open wellermiranda opened 9 years ago

wellermiranda commented 9 years ago

How can I change this properties names? I'm trying to use the same database that I use in a cakephp application and cakephp use "created" and "modified"...

jancimertel commented 9 years ago

As far as i know, createdAt and updatedAt are system properties which are based on flag, that can be changed with 'model.config.useTimestamps = false'.

After that, you should use your own defined properties in model this.defineProperties({ created: {type: 'datetime'} });

Since you are using cakephp, the actual time could be set in one of the hooks, check https://github.com/geddy/model#lifecycle-events.

Hope this helps even though its a few months old question.