I'm investigating some rows/tables that intermittently go missing on a Magento site, and of course there's no entries in the error log. (I suspect Magento queries/rules or human error might be the culprit) I know I can enable the General log, but I don't want to log EVERYTHING as this site processes a huge amount of sales every day and the log would be massive.
I'm hoping someone might know of a way to configure either the general log or log table to record only DELETE
commands. Open to any suggestions you might have of a better way to go about this.
Best Answer
This is mostly copied from the docs:
Trigger Example - Logging deletions
Books
with your table nameDELETE
statement that affects zero rows.Books_Deleted_Log
with the name of the table you're logging the deleted rows into. Make sure this table has all the columns you need to log the information you need.OLD
is an alias for a single old row, soOLD.TITLE
is the scalar value derived from theTITLE
Column of that old row. You will have to changeTitle
to a column you want to track. You can also add more columns by following theOld.<column name>
pattern using commas as separators.