Automatically filled dates
Automatically filled dates
marwi
Posts: 33Questions: 9Answers: 0
Hi
I have many tables with the common two datetime columns "created_at" and "modified_at". Is there any way to let Editor automatically set and update their values?
Maybe it's even possible to use the PHP lib on serverside for this.
regards
Marwi
This discussion has been closed.
Replies
the DBMS can handle it for you. For MySQL you would need to define as "Default/Expression"
a) created_at: CURRENT_TIMESTAMP
b) modified_at: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
In that case you don't need to specify the columns in your SQL at all unless you want to display them of course. But then you can do "->set (false)" to avoid Editor doing anything with them and leave the job to the DBMS.
If you want to do this with Editor PHP: