diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 336ce3f..8bdcda0 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -1,110 +1,111 @@ enum RoleValue { - USER - ADMIN + USER + ADMIN } generator client { - provider = "prisma-client-js" + provider = "prisma-client-js" } datasource db { provider = "postgresql" - url = env("DATABASE_URL") + url = env("DATABASE_URL") } model Account { - id String @id @default(cuid()) - createdAt DateTime @default(now()) - userId String - type String - provider String + id String @id @default(cuid()) + createdAt DateTime @default(now()) + userId String + type String + provider String providerAccountId String - 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) + 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) @@unique([provider, providerAccountId]) @@index([userId]) } model Session { - 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) + 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) @@index([userId]) } model User { - id String @id @default(cuid()) - role RoleValue @default(USER) - createdAt DateTime @default(now()) - name String? - email String? @unique + id String @id @default(cuid()) + role RoleValue @default(USER) + createdAt DateTime @default(now()) + name String? + email String? @unique emailVerified DateTime? - image String? - accounts Account[] - sessions Session[] - rooms Room[] - votes Vote[] - logs Log[] + image String? + accounts Account[] + sessions Session[] + rooms Room[] + votes Vote[] + logs Log[] } model VerificationToken { identifier String - token String @unique - expires DateTime + token String @unique + expires DateTime @@unique([identifier, token]) } model Room { - id String @id @default(cuid()) @unique - 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) + 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) - @@index([userId]) + @@index([userId]) } model Vote { - id String @id @default(cuid()) @unique - 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]) + 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]) } model Log { - id String @id @default(cuid()) @unique - 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) + 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) - @@index([userId]) - @@index([roomId]) + @@index([userId]) + @@index([roomId]) }