1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-11-10 01:19:53 +01:00
unleash.unleash/src/migrations/20250623100820-cr-requested-approvals-add-notified-at-column.js
Christopher Kolstad 6aecc3f93e
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>
2025-06-23 10:51:47 +00:00

11 lines
462 B
JavaScript

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);
};