I'm trying to create an automatic event in MySQL so that every 24 hours it runs the following command to delete promotions without the administrator interaction, where if the end date is less than the current date it will delete, I'm not sure if it works.
CREATE EVENT excluirPromocao
ON SCHEDULE EVERY 24 HOUR
ON COMPLETION PRESERVE
DO
DELETE FROM promocao where data_termino < NOW();
// New event
CREATE EVENT
EXCLUIR_PROMOCAO
ON SCHEDULE EVERY
24 HOUR
ON COMPLETION PRESERVE
DO
DELETE FROM
promocao
WHERE
data_termino < CURDATE();