This repository has been archived by the owner on Oct 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.prisma
100 lines (70 loc) · 1.8 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("PRISMA_DATABASE_URL")
}
model Account {
id String @id
user User @relation(fields: [userId], references: [id])
userId String
}
model User {
id String @id @default(cuid())
alias String @unique @db.Citext
displayName String
avatar String
accounts Account[]
createdAt DateTime @default(now())
henkenFrom Henken[] @relation("henkenFrom")
henkenTo Henken[] @relation("henkenTo")
followFrom Follow[] @relation("followFrom")
followTo Follow[] @relation("followTo")
}
model Follow {
id String @id @default(cuid())
createdAt DateTime @default(now())
from User @relation("followFrom", fields: [fromId], references: [id])
fromId String
to User @relation("followTo", fields: [toId], references: [id])
toId String
@@unique([fromId, toId])
}
model Henken {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comment String @default("")
from User @relation("henkenFrom", fields: [fromId], references: [id])
fromId String
to User @relation("henkenTo", fields: [toId], references: [id])
toId String
answer Answer?
content Content @relation(fields: [contentId], references: [id])
contentId String
@@unique([toId, contentId])
}
model Answer {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
type AnswerType
comment String @default("")
henken Henken @relation(fields: [henkenId], references: [id])
henkenId String
}
enum AnswerType {
RIGHT
WRONG
}
model Content {
id String @id @default(uuid())
type ContentType
henkens Henken[]
}
enum ContentType {
BOOK
BOOK_SERIES
AUTHOR
}