Adds auto increment ID (#9848)

Co-authored-by: alannnc <alannnc@gmail.com>
This commit is contained in:
sean-brydonandalannnc authored and GitHub committed 2023-06-30 11:32:35 -04:00
1 parent 44191e79a1
commit e5ca77eb93
2 files changed
+16 -1

No files matched your search

@@ -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");
+2 -1
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])
}