
Untitled
By: a guest on
May 4th, 2012 | syntax:
None | size: 0.44 KB | hits: 11 | expires: Never
-- MySQL 5.0
alter table task_log add column task_log_created datetime default '1900-01-01 00:00:00';
delimiter //
CREATE TRIGGER task_log_created_trigger BEFORE INSERT ON task_log
FOR EACH ROW
BEGIN
IF NEW.task_log_created = "1900-01-01 00:00:00" THEN
SET NEW.task_log_created = NOW();
END IF;
END;//
delimiter ;
alter table task_log add column task_log_modified timestamp default current_timestamp on update current_timestamp;