I want to update a field with the current timestamp whenever the row is updated.
In MySQL I would do, when declaring the table
LastUpdate TIMESTAMP D
There is more efficient, nice and clean way to do it, for example:
-- List all required fields after 'OF' except the LastUpdate field to prevent infinite loop
CREATE TRIGGER UpdateLastTime UPDATE OF field1, field2, fieldN ON Package
BEGIN
UPDATE Package SET LastUpdate=CURRENT_TIMESTAMP WHERE ActionId=ActionId;
END;
The code like this one has been tested in my project. Deep sqlite trigger explanation can be found here https://www.sqlite.org/lang_createtrigger.html