Whether to use or not to use: DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
0
votes
1
answer
2076
views
In one Database table, created_at & updated_at are defined as:
created_at
timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
updated_at
timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Updated At',
And in another database table, it's defined as:
created_at
timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Created At',
updated_at
timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Updated At',
created_at -> stores datetime when the data is created.
updated_at -> stores the datetime when data is updated.
Which definition among above two would you prefer & why?
Asked by MagePsycho
(201 rep)
Jun 11, 2014, 02:11 PM
Last activity: Jan 19, 2018, 05:23 AM
Last activity: Jan 19, 2018, 05:23 AM