-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschema.prisma
More file actions
89 lines (78 loc) · 2.37 KB
/
Copy pathschema.prisma
File metadata and controls
89 lines (78 loc) · 2.37 KB
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
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
binaryTargets = "native"
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String @default("Website owner")
hashedPassword String
salt String
resetToken String?
resetTokenExpiresAt DateTime?
webAuthnChallenge String? @unique
credentials UserCredential[]
Website Website[]
}
model UserCredential {
id String @id
userId Int
user User @relation(fields: [userId], references: [id])
publicKey Bytes
transports String?
counter BigInt
}
model Website {
id Int @id @default(autoincrement())
domain String
owner User @relation(fields: [ownerId], references: [id])
ownerId Int
isArchived Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime?
Comment Comment[]
Author Author[]
@@index([domain])
}
model Comment {
id Int @id @default(autoincrement())
website Website @relation(fields: [websiteId], references: [id])
websiteId Int
link String
message String
parentId Int?
isSpam Boolean @default(false)
isPublished Boolean @default(false)
isDeleted Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime?
// If createdBy and updatedBy is not null then it's a comment created by the admin
createdBy Int?
updatedBy Int?
authors AuthorsOnComments[]
@@index([websiteId, link, parentId])
}
model Author {
id Int @id @default(autoincrement())
name String
email String?
website Website @relation(fields: [websiteId], references: [id])
websiteId Int
createdAt DateTime @default(now())
updatedAt DateTime?
comments AuthorsOnComments[]
@@index([name])
}
model AuthorsOnComments {
comment Comment @relation(fields: [commentId], references: [id])
commentId Int
author Author @relation(fields: [authorId], references: [id])
authorId Int
createdAt DateTime @default(now())
createdBy String
@@id([commentId, authorId])
}