From e8ffea39209e4ac03cd1c9149ddb45baece6079f Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Wed, 10 Jan 2024 08:47:30 +0530 Subject: [PATCH] chore: add `reason` column to change request schedule table (#5802) This PR adds a new `reason` column to the change request schedules table and populates it with the data that is in the `failure_reason` column. This is the expand phase of the expand/contract pattern. The code in enterprise will be updated to try and use the new column name, but fall back to the old one if no value is present. The old column can be removed later. --- ...240109095348-add-reason-column-to-schedule.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/migrations/20240109095348-add-reason-column-to-schedule.js diff --git a/src/migrations/20240109095348-add-reason-column-to-schedule.js b/src/migrations/20240109095348-add-reason-column-to-schedule.js new file mode 100644 index 000000000000..a99eab3fd3b6 --- /dev/null +++ b/src/migrations/20240109095348-add-reason-column-to-schedule.js @@ -0,0 +1,16 @@ +'use strict'; + +exports.up = function (db, cb) { + db.runSql( + `ALTER TABLE change_request_schedule ADD COLUMN reason TEXT; + UPDATE change_request_schedule SET reason = failure_reason;`, + cb, + ); +}; + +exports.down = function (db, cb) { + db.runSql( + `ALTER TABLE change_request_schedule DROP COLUMN reason;`, + cb, + ); +};