Add extra unique constraints to DB jobs.

1. Can only have one high-priority job now. This actually got messed up for at least 10 people in the production DB and I fixed them manually.
2. Can't have duplicate jobs with the same name on the same profile.
This commit is contained in:
Pieter-Jan Briers
2021-09-15 11:37:05 +02:00
parent 15c5d5cf65
commit 9dae24ad89
7 changed files with 1259 additions and 0 deletions

View File

@@ -196,6 +196,13 @@ namespace Content.Server.Database.Migrations.Postgres
b.HasIndex("ProfileId");
b.HasIndex("ProfileId", "JobName")
.IsUnique();
b.HasIndex(new[] { "ProfileId" }, "IX_job_one_high_priority")
.IsUnique()
.HasFilter("priority = 3");
b.ToTable("job");
});