diff options
author | terminaldweller <devi@terminaldweller.com> | 2024-06-11 14:13:13 +0000 |
---|---|---|
committer | terminaldweller <devi@terminaldweller.com> | 2024-06-11 14:13:13 +0000 |
commit | 556c839dc1b5881c1594dbdfede0bd610790967d (patch) | |
tree | f27987d2387fa86d3644df778c96491bd2bf7d1c /scripts | |
parent | added a new lua function, query_db (diff) | |
download | milla-556c839dc1b5881c1594dbdfede0bd610790967d.tar.gz milla-556c839dc1b5881c1594dbdfede0bd610790967d.zip |
added a shell.nix for pgformatter, and a wip trigger for db size maintenance
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/entry_limit_trigger.pgsql | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/entry_limit_trigger.pgsql b/scripts/entry_limit_trigger.pgsql new file mode 100644 index 0000000..d7d99c2 --- /dev/null +++ b/scripts/entry_limit_trigger.pgsql @@ -0,0 +1,19 @@ +CREATE OR REPLACE FUNCTION milla.janitor () + RETURNS TRIGGER + AS $$ +BEGIN + UPDATE + posts + SET + updated_at = now() + WHERE + id = NEW.id; + RETURN new; +END; +$$ +LANGUAGE plpgsql; + +CREATE TRIGGER janitor_trigger + AFTER INSERT ON milla.tables + EXECUTE PROCEDURE milla.janitor (); + |