pollo/prisma/schema.prisma

110 lines
2.8 KiB
Text
Raw Normal View History

2023-04-20 04:20:00 -06:00
generator client {
2023-07-11 17:30:40 -06:00
provider = "prisma-client-js"
2023-04-20 04:20:00 -06:00
}
datasource db {
2023-07-26 23:55:48 -06:00
provider = "mysql"
2023-07-11 17:30:40 -06:00
url = env("DATABASE_URL")
2023-07-26 23:55:48 -06:00
relationMode = "prisma"
2023-04-20 04:20:00 -06:00
}
model Account {
2023-07-11 17:30:40 -06:00
id String @id @default(cuid())
createdAt DateTime @default(now())
userId String
type String
provider String
2023-04-20 04:20:00 -06:00
providerAccountId String
2023-07-11 17:30:40 -06:00
refresh_token String? @db.Text
access_token String? @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? @db.Text
session_state String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
2023-04-20 04:20:00 -06:00
@@unique([provider, providerAccountId])
@@index([userId])
}
model Session {
2023-07-11 17:30:40 -06:00
id String @id @default(cuid())
createdAt DateTime @default(now())
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
2023-04-20 04:20:00 -06:00
@@index([userId])
}
model User {
2023-07-11 17:30:40 -06:00
id String @id @default(cuid())
createdAt DateTime @default(now())
name String?
email String? @unique
2023-04-20 04:20:00 -06:00
emailVerified DateTime?
2023-07-11 17:30:40 -06:00
image String?
accounts Account[]
sessions Session[]
rooms Room[]
votes Vote[]
logs Log[]
2023-07-29 21:38:59 -06:00
isAdmin Boolean @default(false)
isVIP Boolean @default(false)
2023-04-20 04:20:00 -06:00
}
model VerificationToken {
identifier String
2023-07-11 17:30:40 -06:00
token String @unique
expires DateTime
2023-04-20 04:20:00 -06:00
@@unique([identifier, token])
}
model Room {
2023-07-11 17:30:40 -06:00
id String @id @unique @default(cuid())
createdAt DateTime @default(now())
userId String
roomName String
storyName String
visible Boolean
votes Vote[]
scale String
logs Log[]
owner User @relation(fields: [userId], references: [id], onDelete: Cascade)
2023-04-20 04:20:00 -06:00
2023-07-11 17:30:40 -06:00
@@index([userId])
2023-04-20 04:20:00 -06:00
}
model Vote {
2023-07-11 17:30:40 -06:00
id String @id @unique @default(cuid())
createdAt DateTime @default(now())
userId String
roomId String
value String
owner User @relation(fields: [userId], references: [id], onDelete: Cascade)
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
@@unique([userId, roomId])
@@index([roomId])
2023-04-20 04:20:00 -06:00
}
model Log {
2023-07-11 17:30:40 -06:00
id String @id @unique @default(cuid())
createdAt DateTime @default(now())
userId String
roomId String
scale String
votes Json
roomName String
storyName String
owner User @relation(fields: [userId], references: [id], onDelete: Cascade)
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
2023-04-20 04:20:00 -06:00
2023-07-11 17:30:40 -06:00
@@index([userId])
@@index([roomId])
2023-04-20 04:20:00 -06:00
}