-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
68 lines (53 loc) · 1.66 KB
/
schema.prisma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
relationMode = "prisma"
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["fullTextIndex", "fullTextSearch"]
}
model User {
id String @id @default(uuid())
username String @unique
imageUrl String @db.Text
externalId String @unique
bio String? @db.Text
//relation
following Follow[] @relation("Following")
followedBy Follow[] @relation("FollowedBy")
stream Stream?
CreatedAt DateTime @default(now())
UpdatedAt DateTime @updatedAt
}
model Follow {
id String @id @default(uuid())
followerId String
followingId String
follower User @relation(name: "Following", fields: [followerId], references: [id], onDelete: Cascade)
following User @relation(name: "FollowedBy", fields: [followingId], references: [id], onDelete: Cascade)
CreatedAt DateTime @default(now())
UpdatedAt DateTime @updatedAt
@@unique([followerId, followingId])
@@index([followerId])
@@index([followingId])
}
model Stream {
id String @id @default(uuid())
name String @db.Text
thumbnailUrl String? @db.Text
ingressId String? @unique
Streamkey String? @db.Text
serverUrl String? @db.Text
isLive Boolean @default(false)
isChatEnabled Boolean @default(true)
isChatDelayed Boolean @default(false)
isChatFollowersOnly Boolean @default(false)
userId String @unique
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([userId])
@@index([ingressId])
@@fulltext([name])
}