Merge pull request #759 from judsonjuniorr/V2-duplicated-label-creation

Changed labels to be unique on the same instance
This commit is contained in:
Davidson Gomes
2024-08-13 15:56:24 -03:00
committed by GitHub
3 changed files with 32 additions and 10 deletions
@@ -0,0 +1,11 @@
/*
Warnings:
- A unique constraint covering the columns `[labelId,instanceId]` on the table `Label` will be added. If there are existing duplicate values, this will fail.
*/
-- DropIndex
DROP INDEX "Label_labelId_key";
-- CreateIndex
CREATE UNIQUE INDEX "Label_labelId_instanceId_key" ON "Label"("labelId", "instanceId");
+3 -1
View File
@@ -216,7 +216,7 @@ model Chatwoot {
model Label {
id String @id @default(cuid())
labelId String? @unique @db.VarChar(100)
labelId String? @db.VarChar(100)
name String @db.VarChar(100)
color String @db.VarChar(100)
predefinedId String? @db.VarChar(100)
@@ -224,6 +224,8 @@ model Label {
updatedAt DateTime @updatedAt @db.Timestamp
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
instanceId String
@@unique([labelId, instanceId])
}
model Proxy {