Skip to content

Instantly share code, notes, and snippets.

@alegomes
Created July 18, 2011 23:33
Show Gist options
  • Save alegomes/1090952 to your computer and use it in GitHub Desktop.
Save alegomes/1090952 to your computer and use it in GitHub Desktop.
Auditing dotProject (2.1-rc2) task_log records
-- 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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment