Prisma formatting
This commit is contained in:
parent
c140f0b8c2
commit
0d38f87215
1 changed files with 69 additions and 68 deletions
|
@ -1,110 +1,111 @@
|
||||||
enum RoleValue {
|
enum RoleValue {
|
||||||
USER
|
USER
|
||||||
ADMIN
|
ADMIN
|
||||||
}
|
}
|
||||||
|
|
||||||
generator client {
|
generator client {
|
||||||
provider = "prisma-client-js"
|
provider = "prisma-client-js"
|
||||||
}
|
}
|
||||||
|
|
||||||
datasource db {
|
datasource db {
|
||||||
provider = "postgresql"
|
provider = "postgresql"
|
||||||
url = env("DATABASE_URL")
|
url = env("DATABASE_URL")
|
||||||
}
|
}
|
||||||
|
|
||||||
model Account {
|
model Account {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
userId String
|
userId String
|
||||||
type String
|
type String
|
||||||
provider String
|
provider String
|
||||||
providerAccountId String
|
providerAccountId String
|
||||||
refresh_token String? @db.Text
|
refresh_token String? @db.Text
|
||||||
access_token String? @db.Text
|
access_token String? @db.Text
|
||||||
expires_at Int?
|
expires_at Int?
|
||||||
token_type String?
|
token_type String?
|
||||||
scope String?
|
scope String?
|
||||||
id_token String? @db.Text
|
id_token String? @db.Text
|
||||||
session_state String?
|
session_state String?
|
||||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
@@unique([provider, providerAccountId])
|
@@unique([provider, providerAccountId])
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Session {
|
model Session {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
sessionToken String @unique
|
sessionToken String @unique
|
||||||
userId String
|
userId String
|
||||||
expires DateTime
|
expires DateTime
|
||||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
}
|
}
|
||||||
|
|
||||||
model User {
|
model User {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
role RoleValue @default(USER)
|
role RoleValue @default(USER)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
name String?
|
name String?
|
||||||
email String? @unique
|
email String? @unique
|
||||||
emailVerified DateTime?
|
emailVerified DateTime?
|
||||||
image String?
|
image String?
|
||||||
accounts Account[]
|
accounts Account[]
|
||||||
sessions Session[]
|
sessions Session[]
|
||||||
rooms Room[]
|
rooms Room[]
|
||||||
votes Vote[]
|
votes Vote[]
|
||||||
logs Log[]
|
logs Log[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model VerificationToken {
|
model VerificationToken {
|
||||||
identifier String
|
identifier String
|
||||||
token String @unique
|
token String @unique
|
||||||
expires DateTime
|
expires DateTime
|
||||||
|
|
||||||
@@unique([identifier, token])
|
@@unique([identifier, token])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Room {
|
model Room {
|
||||||
id String @id @default(cuid()) @unique
|
id String @id @unique @default(cuid())
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
userId String
|
userId String
|
||||||
roomName String
|
roomName String
|
||||||
storyName String
|
storyName String
|
||||||
visible Boolean
|
visible Boolean
|
||||||
votes Vote[]
|
votes Vote[]
|
||||||
scale String
|
scale String
|
||||||
logs Log[]
|
logs Log[]
|
||||||
owner User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
owner User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Vote {
|
model Vote {
|
||||||
id String @id @default(cuid()) @unique
|
id String @id @unique @default(cuid())
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
userId String
|
userId String
|
||||||
roomId String
|
roomId String
|
||||||
value String
|
value String
|
||||||
owner User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
owner User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
|
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
|
||||||
@@unique([userId, roomId])
|
|
||||||
@@index([roomId])
|
@@unique([userId, roomId])
|
||||||
|
@@index([roomId])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Log {
|
model Log {
|
||||||
id String @id @default(cuid()) @unique
|
id String @id @unique @default(cuid())
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
userId String
|
userId String
|
||||||
roomId String
|
roomId String
|
||||||
scale String
|
scale String
|
||||||
votes Json
|
votes Json
|
||||||
roomName String
|
roomName String
|
||||||
storyName String
|
storyName String
|
||||||
owner User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
owner User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
|
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
@@index([roomId])
|
@@index([roomId])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue