I have a table called districts in mysql database with the columns as DistrictId and District. I need to add 2 more columns in the same table called create_at and lastupdate_at. create_at column should contain the date and time for when the query is inserted in the table whereas lastupdate_at column will contain the date and time of the record last updated. create_at column will have the date and time only once(when the record is inserted) where as lastupdate_at will have date and time all the time when it was updated lastly.
So what would be the data type for these columns TIMESTAMP or DATETIME.
Suppose a new record is inserted as below
DistrictId District create_at lastupdate_at
1 ABC 2023-07-18 05:25:15 PM NULL
Similarly when an existing record is updated
DistrictId District create_at lastupdate_at
1 ABC1 2023-07-18 05:25:15 PM 2023-07-20 10:00:05 AM
Is the below query better to add the columns to the table
ALTER TABLE district
ADD COLUMN created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;