If I update a person with a vacuum that does not insert anything in Audit, but if I update a person with a data, name, etc., that does a INSERT
. I have a reservation table with schedules, when someone booking updated the person field associated with the schedule, and that triggers the trigger
that leaves the record of who registered, when, etc., but in turn I have an event that every day at 00:00:00 update
all fields empty people so that the next day can be solved again, that is the problem, the update
reservation is ok, when the event is executed the trigger
I take the 24 empty updates and insert 24 empty data in the audit table
This is the trigger
code that I currently have
DELIMITER $$
CREATE TRIGGER Pc_Auditoria
AFTER UPDATE ON pcTotal
FOR EACH ROW
INSERT INTO auditoria (pc, personaAnterior, horario, persona, fecha_mod)
VALUES (NEW.pc, OLD.persona, NEW.horario, NEW.persona, NOW());
DELIMITER ;
When I make a reservation: The record inserted ok in the audit: How is the audit when the event is executed: