Adds auto increment ID (#9848)

Co-authored-by: alannnc <alannnc@gmail.com>
pull/9863/head^2
sean-brydon 2023-06-30 16:32:35 +01:00 committed by GitHub
parent 44191e79a1
commit e5ca77eb93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -0,0 +1,14 @@
/*
Warnings:
- The primary key for the `Membership` table will be changed. If it partially fails, the table could be left without primary key constraint.
- A unique constraint covering the columns `[userId,teamId]` on the table `Membership` will be added. If there are existing duplicate values, this will fail.
*/
-- AlterTable
ALTER TABLE "Membership" DROP CONSTRAINT "Membership_pkey",
ADD COLUMN "id" SERIAL NOT NULL,
ADD CONSTRAINT "Membership_pkey" PRIMARY KEY ("id");
-- CreateIndex
CREATE UNIQUE INDEX "Membership_userId_teamId_key" ON "Membership"("userId", "teamId");

View File

@ -284,6 +284,7 @@ enum MembershipRole {
}
model Membership {
id Int @id @default(autoincrement())
teamId Int
userId Int
accepted Boolean @default(false)
@ -292,7 +293,7 @@ model Membership {
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
disableImpersonation Boolean @default(false)
@@id([userId, teamId])
@@unique([userId, teamId])
@@index([teamId])
@@index([userId])
}