From 8fd5e21b4a2c642c63f8432c2d6720d7525815ec Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Mon, 14 Aug 2023 13:00:21 +0200 Subject: [PATCH] feat: Change request rejections db table (#4486) --- ...0230814095253-change-request-rejections.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/migrations/20230814095253-change-request-rejections.js diff --git a/src/migrations/20230814095253-change-request-rejections.js b/src/migrations/20230814095253-change-request-rejections.js new file mode 100644 index 0000000000..45f40fc60a --- /dev/null +++ b/src/migrations/20230814095253-change-request-rejections.js @@ -0,0 +1,25 @@ +'use strict'; + +exports.up = function (db, callback) { + db.runSql( + ` + CREATE TABLE IF NOT EXISTS change_request_rejections ( + id SERIAL PRIMARY KEY, + change_request_id INTEGER NOT NULL REFERENCES change_requests(id) ON DELETE CASCADE, + created_by INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE, + created_at TIMESTAMP DEFAULT now(), + UNIQUE (change_request_id, created_by) + ); + `, + callback, + ); +}; + +exports.down = function (db, callback) { + db.runSql( + ` + DROP TABLE IF EXISTS change_request_rejections; + `, + callback, + ); +};