DROP TRIGGER IF EXISTS `nw_sn_info_update`;
DELIMITER ;;
CREATE TRIGGER `nw_sn_info_update` AFTER UPDATE ON `nw_sn_info` FOR EACH ROW begin
replace into nw_sn_info_trigger set auto_id=new.auto_id;
end
;;
DELIMITER ;
DROP TRIGGER IF EXISTS `nw_sn_info_delete`;
DELIMITER ;;
CREATE TRIGGER `nw_sn_info_delete` BEFORE DELETE ON `nw_sn_info` FOR EACH ROW begin
delete FROM nw_sn_info_trigger where auto_id=old.auto_id;
end
;
DELIMITER ;
DROP TRIGGER IF EXISTS `nw_sn_status_update`;
DELIMITER ;;
CREATE TRIGGER `nw_sn_status_update` AFTER UPDATE ON `nw_sn_status` FOR EACH ROW begin
replace into nw_sn_status_trigger set product_sn=new.product_sn;
end
;;
DELIMITER ;
DROP TRIGGER IF EXISTS `nw_sn_status_delete`;
DELIMITER ;;
CREATE TRIGGER `nw_sn_status_delete` BEFORE DELETE ON `nw_sn_status` FOR EACH ROW begin
delete FROM nw_sn_status_trigger where product_sn=old.product_sn;
end
;;
DELIMITER ;