add orgid unique constraint to repo

This commit is contained in:
msukkari 2025-02-19 18:53:49 -08:00
parent fdd71cfcfe
commit 62e64c1c25
2 changed files with 12 additions and 1 deletions

View file

@ -0,0 +1,11 @@
/*
Warnings:
- A unique constraint covering the columns `[external_id,external_codeHostUrl,orgId]` on the table `Repo` will be added. If there are existing duplicate values, this will fail.
*/
-- DropIndex
DROP INDEX "Repo_external_id_external_codeHostUrl_key";
-- CreateIndex
CREATE UNIQUE INDEX "Repo_external_id_external_codeHostUrl_orgId_key" ON "Repo"("external_id", "external_codeHostUrl", "orgId");

View file

@ -55,7 +55,7 @@ model Repo {
org Org @relation(fields: [orgId], references: [id], onDelete: Cascade) org Org @relation(fields: [orgId], references: [id], onDelete: Cascade)
orgId Int orgId Int
@@unique([external_id, external_codeHostUrl]) @@unique([external_id, external_codeHostUrl, orgId])
} }
model Connection { model Connection {