Is possible to log sqlite changes in a trigger without list all the fields, defining a custom function?

Viewed 17

I need to log all the changes made to most tables in my sqlite db.

Using triggers I need to list all the fields for it, and duplicate it for all crud events (insert, update, delete).

I understand is not possible to use NEW/OLD as values so I wonder if registering a custom function that I could do in Rust, I can add this functionality so my triggers get simplified to:

CREATE TRIGGER visit_log
  AFTER INSERT ON visit
BEGIN
    INSERT INTO log (table, pk, data, date) VALUES(.., data = to_my_json(???));
END;
0 Answers
Related