diff --git a/src/migrations/20231030091931-add-created-by-and-status-change-request-schedule.js b/src/migrations/20231030091931-add-created-by-and-status-change-request-schedule.js new file mode 100644 index 0000000000..aa53941aad --- /dev/null +++ b/src/migrations/20231030091931-add-created-by-and-status-change-request-schedule.js @@ -0,0 +1,26 @@ +'use strict'; + +exports.up = function (db, cb) { + db.runSql(` + CREATE TYPE change_request_schedule_status AS ENUM ('pending', 'failed'); + + ALTER TABLE change_request_schedule + ADD COLUMN IF NOT EXISTS created_by integer REFERENCES users(id); + + ALTER TABLE change_request_schedule + ADD COLUMN IF NOT EXISTS status change_request_schedule_status default 'pending'; + + `, cb); +}; + +exports.down = function (db, cb) { + db.runSql(` + ALTER TABLE change_request_schedule + DROP COLUMN IF EXISTS created_by; + + ALTER TABLE change_request_schedule + DROP COLUMN IF EXISTS status; + + DROP TYPE change_request_schedule_status + `, cb); +};