We have a requirement to fulfill - we need an auditing table for all of our entities. We wonder if creating the following triggers will be a good practice:
CREATE DEFINER=`root`@`localhost` TRIGGER `admin`.`company_AFTER_UPDATE` AFTER UPDATE ON `company` FOR EACH ROW BEGIN INSERT INTO AuditCompany select *, now() from Company where id = NEW.id; END
1) Is this a good practice?
2) Is there a better way of doing this?
3) We wanted to avoid the 'insert into XXX values (NEW.id, NEW.col1, NEW.col2) thats why this trigger is doing a subselect on its own - this will remove the need to update the trigger on every new column in the entity. But is it ok?