summaryrefslogtreecommitdiff
path: root/util/updates
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-12-30 16:02:16 +0100
committerYorhel <git@yorhel.nl>2019-12-30 16:19:12 +0100
commit214646f73973a84ae4a91e8b7a3be440546edccf (patch)
tree7726bf2f8b9ee292d98455be50fba71168bd75e5 /util/updates
parent8143e41a59efb8d7220da458e0a94b5b839179b2 (diff)
Minor refactor: Move all trigger functions and declarations to separate file
This keeps the function body and the trigger declaration closer to each other, so it's easier to tell when the function will be called and which cases it needs to handle. If you ignore errors from existing trigger declarations, the triggers.sql script is idempotent and can be used in from scripts.
Diffstat (limited to 'util/updates')
-rw-r--r--util/updates/update_wip_lists.sql10
1 files changed, 4 insertions, 6 deletions
diff --git a/util/updates/update_wip_lists.sql b/util/updates/update_wip_lists.sql
index 0ff7a452..7d8c4b82 100644
--- a/util/updates/update_wip_lists.sql
+++ b/util/updates/update_wip_lists.sql
@@ -118,14 +118,12 @@ DROP FUNCTION update_vnpopularity();
ALTER TABLE users ADD COLUMN c_vns integer NOT NULL DEFAULT 0;
ALTER TABLE users ADD COLUMN c_wish integer NOT NULL DEFAULT 0;
-\i util/sql/func.sql
-\i util/sql/perms.sql
-
DROP TRIGGER users_votes_update ON votes;
+DROP TRIGGER update_vnlist_rlist ON rlists;
-CREATE TRIGGER ulist_labels_create AFTER INSERT ON users FOR EACH ROW EXECUTE PROCEDURE ulist_labels_create();
-CREATE TRIGGER ulist_voted_label AFTER INSERT OR UPDATE ON ulist_vns FOR EACH ROW EXECUTE PROCEDURE ulist_voted_label();
-CREATE CONSTRAINT TRIGGER update_vnlist_rlist AFTER DELETE ON ulist_vns DEFERRABLE FOR EACH ROW EXECUTE PROCEDURE update_vnlist_rlist();
+\i util/sql/func.sql
+\i util/sql/triggers.sql
+\i util/sql/perms.sql
\timing
SELECT update_users_ulist_stats(NULL);