1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

task: added unique index for release plan templates (#8846)

We want to prevent our users from defining multiple templates with the
same name. So this adds a unique index on the name column when
discriminator is template.
This commit is contained in:
Christopher Kolstad 2024-11-25 11:25:55 +01:00 committed by GitHub
parent 4f87f1e0b9
commit 0f76a8a5a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,
);
};