use clinic;
INSERT INTO change_notification(`table_name`) VALUES('sys_config');
drop trigger if exists au_sys_config;
drop trigger if exists ai_sys_config;
drop trigger if exists ad_sys_config;
delimiter |
CREATE TRIGGER au_sys_config after UPDATE ON `sys_config`
FOR EACH ROW
BEGIN
DECLARE v_row_count int DEFAULT row_count();
IF v_row_count!=1 THEN
update change_notification set change_count = change_count + 1, update_date = now() where table_name = 'sys_config';
END IF;
END;
|
CREATE TRIGGER ai_sys_config after INSERT ON `sys_config`
FOR EACH ROW
BEGIN
DECLARE v_row_count int DEFAULT row_count();
IF v_row_count!=1 THEN
update change_notification set change_count = change_count + 1, update_date = now() where table_name = 'sys_config';
END IF;
END;
|
CREATE TRIGGER ad_sys_config after Delete ON `sys_config`
FOR EACH ROW
BEGIN
DECLARE v_row_count int DEFAULT row_count();
IF v_row_count!=1 THEN
update change_notification set change_count = change_count + 1, update_date = now() where table_name = 'sys_config';
END IF;
END;
|
delimiter ;