From d27871e0f792a8e31f9dcbe966c4f181a74cb36b Mon Sep 17 00:00:00 2001 From: Anthony Date: Sat, 11 Nov 2023 15:49:58 +0100 Subject: [PATCH] feat(db): add counting table --- .../migrations/20231111144714_counting/migration.sql | 11 +++++++++++ prisma/schema.prisma | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 prisma/migrations/20231111144714_counting/migration.sql diff --git a/prisma/migrations/20231111144714_counting/migration.sql b/prisma/migrations/20231111144714_counting/migration.sql new file mode 100644 index 0000000..43d0670 --- /dev/null +++ b/prisma/migrations/20231111144714_counting/migration.sql @@ -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; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index ce654a5..4048b9a 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -47,6 +47,7 @@ model User { ModRoleLog RoleLog[] @relation("modRoleLog") FunLogSender FunLog[] @relation("sendFunLog") FunLogReciever FunLog[] @relation("receiveFunLog") + Counting Counting[] @relation("counting") EventLeader Event[] @relation("eventLeader") StatLeader Stat[] @relation("statLeader") OutreachParticipation ParticipantStat[] @relation("participantUser") @@ -179,6 +180,13 @@ model FunType { 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 model Event {