-
Notifications
You must be signed in to change notification settings - Fork 113
/
schema.prisma
156 lines (137 loc) · 3.9 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
datasource postgres {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
// binaryTargets = ["windows", "debian-openssl-1.1.x"]
output = "../prisma/generated/client"
previewFeatures = ["fullTextSearch"]
}
generator typegraphql {
provider = "node ../../src/cli/dev.ts"
output = "../prisma/generated/type-graphql"
emitDMMF = true
// emitTranspiledCode = true
simpleResolvers = false
// useOriginalMapping = true
useUncheckedScalarInputs = false
emitIdAsIDType = true
// emitOnly = ["enums", "models"]
customPrismaImportPath = "../client"
contextPrismaKey = "prismaClient"
useSimpleInputs = true
emitRedundantTypesInfo = true
formatGeneratedCode = "tsc"
}
// Role enum comment
/// Role enum doc
enum Role {
USER
ADMIN
}
// User model comment
/// User model doc
/// @@TypeGraphQL.type(name: "MainUser")
model User {
// User model field comment
/// User model field doc
id Int @id @default(autoincrement())
email String @unique
/// renamed field doc
/// @TypeGraphQL.field(name: "firstName")
name String?
age Int
/// @TypeGraphQL.field(name: "accountBalance")
balance Float
amount Float
/// @TypeGraphQL.field(name: "clientPosts")
posts post[] @relation("posts")
role Role
/// @TypeGraphQL.omit(output: true)
editorPosts post[] @relation("editorPosts")
grades Int[]
aliases String[]
}
enum PostKind {
BLOG
ADVERT
}
model post {
/// first line of comment
/// second line of comment
/// third line of comment
uuid String @id @default(uuid())
createdAt DateTime @default(now())
/// @TypeGraphQL.omit(input: ["create", "update"])
updatedAt DateTime @updatedAt
/// @TypeGraphQL.omit(input: true)
/// @TypeGraphQL.field(name: "isPublished")
published Boolean @default(false)
title String
/// @TypeGraphQL.omit(output: true)
subtitle String
content String?
author User @relation(fields: [authorId], references: [id], name: "posts", onDelete: Cascade)
authorId Int
/// @TypeGraphQL.omit(output: true)
editor User? @relation(fields: [editorId], references: [id], name: "editorPosts", onDelete: Cascade)
/// @TypeGraphQL.omit(output: true)
editorId Int?
kind PostKind?
metadata Json
}
model Category {
name String
slug String
number Int
@@unique([slug, number], name: "categoryCompoundUnique")
}
model Patient {
firstName String
lastName String
email String
@@id([firstName, lastName])
}
model Movie {
directorFirstName String
directorLastName String
director Director @relation(fields: [directorFirstName, directorLastName], references: [firstName, lastName], onDelete: Cascade)
title String
@@id([directorFirstName, directorLastName, title], name: "movieCompoundId")
}
model Director {
firstName String
lastName String
movies Movie[]
@@id([firstName, lastName])
}
model Problem {
id Int @id @default(autoincrement())
problemText String
likedBy Creator[]
creator Creator? @relation(name: "creator", fields: [creatorId], references: [id], onDelete: Cascade)
creatorId Int?
}
model Creator {
id Int @id @default(autoincrement())
name String
likes Problem[]
problems Problem[] @relation("creator")
}
model NativeTypeModel {
id Int @id @default(autoincrement()) @postgres.Integer
bigInt BigInt? @postgres.BigInt
byteA Bytes? @postgres.ByteA
decimal Decimal? @postgres.Decimal
}
/// @@TypeGraphQL.type(plural: "equipments")
model Equipment {
id String @id @default(cuid())
name String?
}
/// @@TypeGraphQL.omit(output: true)
model Hidden {
id String @id @default(cuid())
name String?
}