fix: Add unique constraint to team and slug for attributes (#22357)

* Add unique constraint to team and slug

* Add migration file
This commit is contained in:
Joe Au-Yeung
2025-07-09 15:52:48 +00:00
committed by GitHub
parent 179a547bd0
commit 3fe9327724
2 changed files with 14 additions and 3 deletions
@@ -0,0 +1,11 @@
/*
Warnings:
- A unique constraint covering the columns `[teamId,slug]` on the table `Attribute` will be added. If there are existing duplicate values, this will fail.
*/
-- DropIndex
DROP INDEX "Attribute_slug_key";
-- CreateIndex
CREATE UNIQUE INDEX "Attribute_teamId_slug_key" ON "Attribute"("teamId", "slug");
+3 -3
View File
@@ -1999,9 +1999,8 @@ model Attribute {
type AttributeType
name String
slug String @unique
name String
slug String
enabled Boolean @default(true)
usersCanEditRelation Boolean @default(false)
@@ -2012,6 +2011,7 @@ model Attribute {
isWeightsEnabled Boolean @default(false)
isLocked Boolean @default(false)
@@unique([teamId, slug])
@@index([teamId])
}