mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-24 03:37:23 +02:00
♻️ Switch to turborepo (#532)
This commit is contained in:
parent
41ef81aa75
commit
0a836aeec7
419 changed files with 2300 additions and 2504 deletions
128
packages/database/prisma/schema.prisma
Normal file
128
packages/database/prisma/schema.prisma
Normal file
|
@ -0,0 +1,128 @@
|
|||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
relationMode = "prisma"
|
||||
}
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
binaryTargets = ["native"]
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
email String @unique() @db.Citext
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt @map("updated_at")
|
||||
comments Comment[]
|
||||
polls Poll[]
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
|
||||
enum PollType {
|
||||
date
|
||||
|
||||
@@map("poll_type")
|
||||
}
|
||||
|
||||
model Poll {
|
||||
id String @id @unique @map("id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
deadline DateTime?
|
||||
title String
|
||||
type PollType
|
||||
description String?
|
||||
location String?
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId String @map("user_id")
|
||||
votes Vote[]
|
||||
timeZone String? @map("time_zone")
|
||||
verified Boolean @default(false)
|
||||
options Option[]
|
||||
participants Participant[]
|
||||
authorName String @default("") @map("author_name")
|
||||
demo Boolean @default(false)
|
||||
comments Comment[]
|
||||
legacy Boolean @default(false)
|
||||
closed Boolean @default(false)
|
||||
notifications Boolean @default(false)
|
||||
deleted Boolean @default(false)
|
||||
deletedAt DateTime? @map("deleted_at")
|
||||
touchedAt DateTime @default(now()) @map("touched_at")
|
||||
participantUrlId String @unique @map("participant_url_id")
|
||||
adminUrlId String @unique @map("admin_url_id")
|
||||
|
||||
@@index([userId], type: Hash)
|
||||
@@map("polls")
|
||||
}
|
||||
|
||||
model Participant {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
userId String? @map("user_id")
|
||||
poll Poll @relation(fields: [pollId], references: [id])
|
||||
pollId String @map("poll_id")
|
||||
votes Vote[]
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt @map("updated_at")
|
||||
|
||||
@@index([pollId], type: Hash)
|
||||
@@unique([id, pollId])
|
||||
@@map("participants")
|
||||
}
|
||||
|
||||
model Option {
|
||||
id String @id @default(cuid())
|
||||
value String
|
||||
pollId String @map("poll_id")
|
||||
poll Poll @relation(fields: [pollId], references: [id])
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt @map("updated_at")
|
||||
|
||||
@@index([pollId], type: Hash)
|
||||
@@map("options")
|
||||
}
|
||||
|
||||
enum VoteType {
|
||||
yes
|
||||
no
|
||||
ifNeedBe
|
||||
|
||||
@@map("vote_type")
|
||||
}
|
||||
|
||||
model Vote {
|
||||
id String @id @default(cuid())
|
||||
participant Participant @relation(fields: [participantId], references: [id], onDelete: Cascade)
|
||||
participantId String @map("participant_id")
|
||||
optionId String @map("option_id")
|
||||
poll Poll @relation(fields: [pollId], references: [id])
|
||||
pollId String @map("poll_id")
|
||||
type VoteType @default(yes)
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt @map("updated_at")
|
||||
|
||||
@@index([participantId], type: Hash)
|
||||
@@index([pollId], type: Hash)
|
||||
@@map("votes")
|
||||
}
|
||||
|
||||
model Comment {
|
||||
id String @id @default(cuid())
|
||||
content String
|
||||
poll Poll @relation(fields: [pollId], references: [id])
|
||||
pollId String @map("poll_id")
|
||||
authorName String @map("author_name")
|
||||
user User? @relation(fields:[userId], references: [id])
|
||||
userId String? @map("user_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt @map("updated_at")
|
||||
|
||||
@@unique([id, pollId])
|
||||
@@index([userId], type: Hash)
|
||||
@@index([pollId], type: Hash)
|
||||
@@map("comments")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue