 DELIMITER $$
DROP TRIGGER IF EXISTS `absencje_bd`$$
CREATE DEFINER = `root`@`localhost` TRIGGER `absencje_bd` BEFORE DELETE ON `absencje` FOR EACH ROW 
A: BEGIN
	IF _TriggerDisabled() THEN LEAVE A; END IF;
	SET @session.trigger.absencje = TRUE;
	DELETE FROM  absencje_deleted WHERE GUID = OLD.GUID;
	INSERT IGNORE INTO absencje_deleted 
	SELECT * FROM absencje WHERE GUID = OLD.GUID;
	UPDATE absencje_deleted SET ModifyAt=now() WHERE GUID = OLD.GUID;
	SET @session.trigger.absencje = FALSE;
END;
$$
