MySQL: Trigger example

04-11-2018
```sql show create table clienttype; drop table `clienttypeaudit`; CREATE TABLE `clienttypeaudit` ( `id` int(11) NOT NULL, `name` varchar(40) NOT NULL, `createDate` datetime NOT NULL, `idRowUser` int(11) NOT NULL DEFAULT '0', `rowDate` datetime NOT NULL, `rowType` varchar(6) not null ); DELIMITER $$ CREATE TRIGGER `clienttype_after_update` AFTER UPDATE ON `clienttype` FOR EACH ROW BEGIN INSERT INTO clienttypeaudit (id,name,createDate,irRowUser,rowDate,rowType) VALUES (OLD.id,OLD.name,OLD.createDate,OLD.irRowUser,UTC_TIMESTAMP(),'UPDATE'); END$$ CREATE TRIGGER `clienttype_after_delete` AFTER DELETE ON `clienttype` FOR EACH ROW BEGIN INSERT INTO clienttypeaudit (id,name,createDate,irRowUser,rowDate,rowType) VALUES (OLD.id,OLD.name,OLD.createDate,OLD.irRowUser,UTC_TIMESTAMP(),'DELETE'); END$$ DELIMITER ; ```
MySQL

Amura