From 87f9e0e030dcdfa2e9fb5448c5c89130ec99b2fc Mon Sep 17 00:00:00 2001 From: Christopher Kolstad Date: Mon, 25 Nov 2024 09:20:51 +0100 Subject: [PATCH] task: added unique index for release plan templates --- ...dd-unique-idx-to-release-plan-discriminator.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/migrations/20241125080935-add-unique-idx-to-release-plan-discriminator.js diff --git a/src/migrations/20241125080935-add-unique-idx-to-release-plan-discriminator.js b/src/migrations/20241125080935-add-unique-idx-to-release-plan-discriminator.js new file mode 100644 index 000000000000..e67e7137d8ff --- /dev/null +++ b/src/migrations/20241125080935-add-unique-idx-to-release-plan-discriminator.js @@ -0,0 +1,15 @@ +exports.up = function (db, cb) { + db.runSql( + `CREATE UNIQUE INDEX idx_uniq_release_plan_definitions_discriminator_template + ON release_plan_definitions(name) + WHERE discriminator = 'template'`, + cb, + ); +}; + +exports.down = function (db, cb) { + db.runSql( + `DROP INDEX IF EXISTS idx_uniq_release_plan_definitions_discriminator_template`, + cb, + ); +};