I want to add a database password_updated_at column to my user_accounts table. I’ve been playing with sql via the console and i see that using timestamp not null creates an auto updated timestamp anytime something changes in the row. This is great for monitoring database row changes but i don’t want this action. I only want a timestamp if a user changes their password. I found a possible solution at stackoverflow but i want to know if it is the correct method or not:
ALTER TABLE `customers`
ADD COLUMN `s_timestamp` TIMESTAMP NULL DEFAULT NULL;
https://stackoverflow.com/questions/20520443/mysql-timestamp-to-default-null-not-current-timestamp
so, if i set the column to NULL DEFAULT NULL, then no timestamp will be used unless i add one, correct? thus, update x password_updated_at = Now() where y = z;
is this method the best way to document such changes?
Thanlk you.