From 7f5d27302e6f0541560347bd7ba66db60b8e6392 Mon Sep 17 00:00:00 2001 From: David Leek Date: Thu, 31 Oct 2024 13:49:55 +0100 Subject: [PATCH] chore: add migration for release-plans-definitions that removes fk on users(id) (#8614) --- ...lan-definition-remove-fk-constraint-on-userid.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/migrations/20241031123526-release-plan-definition-remove-fk-constraint-on-userid.js diff --git a/src/migrations/20241031123526-release-plan-definition-remove-fk-constraint-on-userid.js b/src/migrations/20241031123526-release-plan-definition-remove-fk-constraint-on-userid.js new file mode 100644 index 0000000000..07ecd6244a --- /dev/null +++ b/src/migrations/20241031123526-release-plan-definition-remove-fk-constraint-on-userid.js @@ -0,0 +1,13 @@ +exports.up = function(db, cb) { + db.runSql(` + ALTER TABLE release_plan_definitions DROP CONSTRAINT release_plan_definitions_created_by_user_id_fkey; + CREATE INDEX idx_release_plan_definitions_created_by_user_id ON release_plan_definitions (created_by_user_id); + `, cb) +}; + +exports.down = function(db, cb) { + db.runSql(` + ALTER TABLE release_plan_definitions ADD CONSTRAINT release_plan_definitions_created_by_user_id_fkey FOREIGN KEY (created_by_user_id) REFERENCES users(id); + DROP INDEX idx_release_plan_definitions_created_by_user_id; + `, cb); +};