From 95245c4413bccd6ecfef31e1af4518a07a6f018e Mon Sep 17 00:00:00 2001 From: andreas-unleash Date: Fri, 3 Nov 2023 09:28:19 +0200 Subject: [PATCH] chore: remove enum type from db (#5254) Changes the change_request_schedule `status` column to text. Drops the custom type --------- Signed-off-by: andreas-unleash --- ...746-change-request-schedule-change-type.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/migrations/20231103064746-change-request-schedule-change-type.js diff --git a/src/migrations/20231103064746-change-request-schedule-change-type.js b/src/migrations/20231103064746-change-request-schedule-change-type.js new file mode 100644 index 0000000000..4f2b794651 --- /dev/null +++ b/src/migrations/20231103064746-change-request-schedule-change-type.js @@ -0,0 +1,22 @@ +'use strict'; + +exports.up = function (db, cb) { + db.runSql(` + ALTER TABLE change_request_schedule + ALTER COLUMN status TYPE text USING status::text; + + COMMIT; + + DROP TYPE IF EXISTS change_request_schedule_status CASCADE + `, cb); +}; + +exports.down = function (db, cb) { + db.runSql(` + CREATE TYPE change_request_schedule_status AS ENUM ('pending', 'failed'); + + ALTER TABLE change_request_schedule + ALTER COLUMN status TYPE change_request_schedule_status USING status::change_request_schedule_status; + + `, cb); +};