From 6aecc3f93e023d62b0d2e634e064ce710da8fe83 Mon Sep 17 00:00:00 2001 From: Christopher Kolstad Date: Mon, 23 Jun 2025 12:51:47 +0200 Subject: [PATCH] task: added notified at to change request requested approvals (#10196) Adding this should allow us to only notify users that haven't been notified before. Necessary because the change_added event does not include a preData that allowed us to diff requestedApprovers based on the event alone. Also added a index on this column, since we're going to be using it to filter. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- ...20-cr-requested-approvals-add-notified-at-column.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/migrations/20250623100820-cr-requested-approvals-add-notified-at-column.js diff --git a/src/migrations/20250623100820-cr-requested-approvals-add-notified-at-column.js b/src/migrations/20250623100820-cr-requested-approvals-add-notified-at-column.js new file mode 100644 index 0000000000..46d44f701c --- /dev/null +++ b/src/migrations/20250623100820-cr-requested-approvals-add-notified-at-column.js @@ -0,0 +1,10 @@ +exports.up = function(db, cb) { + db.runSql(`ALTER TABLE change_request_requested_approvers ADD COLUMN notified_at TIMESTAMP WITH TIME ZONE; + CREATE INDEX IF NOT EXISTS cr_req_approvers_notified_at_idx ON change_request_requested_approvers(notified_at);`, cb); +}; + +exports.down = function(db, cb) { + db.runSql(` +DROP INDEX IF EXISTS cr_req_approvers_notified_at_idx; +ALTER TABLE change_request_requested_approvers DROP COLUMN notified_at;`, cb); +};