Skip to content

Commit

Permalink
task: added unique index for release plan templates (#8846)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chriswk authored Nov 25, 2024
1 parent 4f87f1e commit 0f76a8a
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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,
);
};

0 comments on commit 0f76a8a

Please sign in to comment.