-
Notifications
You must be signed in to change notification settings - Fork 10
/
schema.prisma
71 lines (60 loc) · 2.22 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
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.
datasource postgresql {
url = env("DATABASE_URL")
provider = "postgresql"
}
generator client {
provider = "prisma-client-js"
output = "node_modules/.prisma/client"
}
model Post {
id String @id @default(cuid())
title String @default("")
slug String @unique @default("")
status String? @default("draft")
publishedDate DateTime?
author User? @relation("Post_author", fields: [authorId], references: [id])
authorId String? @map("author")
labels Label[] @relation("Label_posts")
intro Json @default("[{\"type\":\"paragraph\",\"children\":[{\"text\":\"\"}]}]")
content Json @default("[{\"type\":\"paragraph\",\"children\":[{\"text\":\"\"}]}]")
@@index([authorId])
}
model Label {
id String @id @default(cuid())
name String @default("")
posts Post[] @relation("Label_posts")
}
model Poll {
id String @id @default(cuid())
label String @default("")
answers PollAnswer[] @relation("PollAnswer_poll")
}
model PollAnswer {
id String @id @default(cuid())
label String @default("")
poll Poll? @relation("PollAnswer_poll", fields: [pollId], references: [id])
pollId String? @map("poll")
answeredByUsers User[] @relation("PollAnswer_answeredByUsers")
@@index([pollId])
}
model User {
id String @id @default(cuid())
name String @default("")
email String @unique @default("")
password String
role Role? @relation("User_role", fields: [roleId], references: [id])
roleId String? @map("role")
githubUsername String @default("")
authoredPosts Post[] @relation("Post_author")
pollAnswers PollAnswer[] @relation("PollAnswer_answeredByUsers")
@@index([roleId])
}
model Role {
id String @id @default(cuid())
name String @default("")
canManageContent Boolean @default(false)
canManageUsers Boolean @default(false)
users User[] @relation("User_role")
}