1

When creating a record in a plugin it automatically creates dataCreated and dataUpdated columns. However, it doesn't look like the dataUpdated columns is updated on update.

Is there a way to set the dataUpdated column attribute to on update CURRENT_TIMESTAMP?

Or is that column manually updated in the background when using active record's update()?

2

How are you inserting the data?

If you're inserting data through any of Craft's Active Record or DbCommand classes (craft()->db->createCommand()), then Craft will take of updating dateUpdated for you.

If you're using raw SQL, then you'll have to keep track of it yourself.

| improve this answer | |
  • Ah, that makes sense. In prototyping I updated a record through phpMyAdmin and noticed it didn't have the on update CURRENT_TIMESTAMP attribute. If it's taken care of with update() it's fine. – Brett DeWoody Mar 11 '15 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.