feat(db): add counting table

This commit is contained in:
Anthony 2023-11-11 15:49:58 +01:00
parent 871696bf89
commit d27871e0f7
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,11 @@
-- CreateTable
CREATE TABLE "Counting" (
"id" SERIAL NOT NULL,
"userId" TEXT NOT NULL,
"number" INTEGER NOT NULL,
CONSTRAINT "Counting_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "Counting" ADD CONSTRAINT "Counting_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -47,6 +47,7 @@ model User {
ModRoleLog RoleLog[] @relation("modRoleLog") ModRoleLog RoleLog[] @relation("modRoleLog")
FunLogSender FunLog[] @relation("sendFunLog") FunLogSender FunLog[] @relation("sendFunLog")
FunLogReciever FunLog[] @relation("receiveFunLog") FunLogReciever FunLog[] @relation("receiveFunLog")
Counting Counting[] @relation("counting")
EventLeader Event[] @relation("eventLeader") EventLeader Event[] @relation("eventLeader")
StatLeader Stat[] @relation("statLeader") StatLeader Stat[] @relation("statLeader")
OutreachParticipation ParticipantStat[] @relation("participantUser") OutreachParticipation ParticipantStat[] @relation("participantUser")
@ -179,6 +180,13 @@ model FunType {
FunLog FunLog[] FunLog FunLog[]
} }
model Counting {
id Int @id @default(autoincrement())
user User @relation("counting", fields: [userId], references: [id])
userId String
number Int // This is the number that the user has counted, if the count failed, the number should be 0
}
// Outreach // Outreach
model Event { model Event {