I have date_created and date_modified columns for each table in the database.
What are the advantages / disadvantages of setting timestamp columns in a database using MySQL triggers rather than setting them at the application level using PHP?
What is easier to maintain and have better time synchronization when deploying to many servers?
EDIT: since Johan suggested setting timestamps in the database, are these the correct implementations? Also, is it good practice to have date_created and date_modified on each table? or do you recommend adding them to specific tables?
date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP date_modified TIMESTAMP NOT NULL DEFAULT 0 ON UPDATE CURRENT_TIMESTAMP
php mysql timestamp
Joon Sep 03 2018-11-11T00: 00Z
source share