Skip to content

Instantly share code, notes, and snippets.

@jlstanus
Last active August 24, 2020 14:46
Show Gist options
  • Save jlstanus/f868e9e9e6ec8c2715abf4a6b2d88b2c to your computer and use it in GitHub Desktop.
Save jlstanus/f868e9e9e6ec8c2715abf4a6b2d88b2c to your computer and use it in GitHub Desktop.
-- Classic triggers for geopackages DB files
-- 1. Creation date
CREATE TRIGGER "trigger_add_creation_date" AFTER INSERT
ON "table_name"
BEGIN
UPDATE table_name SET attribute = datetime('now') WHERE fid = NEW.fid;
END
-- 2. Update date
CREATE TRIGGER "trigger_update_date" AFTER UPDATE
ON "table_name"
BEGIN
UPDATE "line_area_exceptions" SET attribute = datetime('now') WHERE fid = OLD.fid;
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment