1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-21 13:47:39 +02:00
unleash.unleash/src/migrations/20250618090103-create-cr-requested-approvals.js
Christopher Kolstad ce8d49be10
task: added table for requested approvers for CRs (#10159)
As part of the task to make it possible to send notifications to
approvers for a CR, this PR adds a table that can link users to CRs
they've been requested to make an approval for.
2025-06-18 11:52:29 +02:00

20 lines
781 B
JavaScript

exports.up = function(db, cb) {
db.runSql(`CREATE TABLE change_request_requested_approvers(
change_request_id INTEGER REFERENCES change_requests(id) ON DELETE CASCADE,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
requested_at TIMESTAMP WITH TIME ZONE DEFAULT (now() at time zone 'utc'),
PRIMARY KEY (change_request_id, user_id)
);
CREATE INDEX IF NOT EXISTS change_request_requested_approvers_cr_id_idx ON change_request_requested_approvers(change_request_id);
CREATE INDEX IF NOT EXISTS change_request_requested_approvers_user_id_idx ON change_request_requested_approvers(user_id);
`, cb)
};
exports.down = function(db, cb) {
db.runSql(`DROP TABLE IF EXISTS change_request_requested_approvers`, cb);
};
exports._meta = {
"version": 1
};