-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathschema.prisma
225 lines (190 loc) · 6.58 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model User {
id String @id
sessions Session[]
github_id Int @unique
name String
username String
email String
admin Boolean @default(false)
avatar String
access_token String? @db.Text
RepositoryStatus RepositoryStatus[]
Repository Repository[]
PullRequestStatus PullRequestStatus[]
DigitalRewardClaim DigitalRewardClaim[]
PhysicalRewardClaim PhysicalRewardClaim[]
@@unique([id])
}
model Session {
id String @id
userId String
expiresAt DateTime
user User @relation(references: [id], fields: [userId], onDelete: Cascade)
@@unique([id])
}
model Sponsor {
id String @id @default(cuid())
name String
summary String @db.Text
image_url String
SponsoredRepository SponsoredRepository[]
links SponsorLinks[]
Reward Reward[]
@@unique([id])
}
model SponsorLinks {
id String @id @default(cuid())
sponsor_id String
name String
value String
sponsor Sponsor @relation(references: [id], fields: [sponsor_id], onDelete: Cascade)
@@unique([id])
}
model Repository {
id String @id @default(cuid())
repository_id String @unique
submitter String?
SponsoredRepository SponsoredRepository?
cache RepositoryCache?
RepositoryStatus RepositoryStatus?
user User? @relation(fields: [submitter], references: [id], onDelete: Cascade)
PullRequest PullRequest[]
tags TaggedRepository[]
@@unique([id, repository_id])
}
model SponsoredRepository {
id String @id @default(cuid())
repository_id String @unique
sponsor_id String
repository Repository @relation(fields: [repository_id], references: [repository_id], onDelete: Cascade)
sponsor Sponsor @relation(fields: [sponsor_id], references: [id], onDelete: Cascade)
@@unique([id])
}
model RepositoryStatus {
id String @id @default(cuid())
repository_id String @unique
invalid Boolean
reason String? @db.Text
reviewed Boolean @default(false)
reviewed_by String?
Repository Repository @relation(fields: [repository_id], references: [repository_id], onDelete: Cascade)
user User? @relation(fields: [reviewed_by], references: [id], onDelete: Cascade)
@@unique([id, repository_id])
}
model RepositoryCache {
id String @id @default(cuid())
repository_id String @unique
name String
owner String
ownerHtmlUrl String
ownerAvatarUrl String
url String
description String? @db.Text
stars Int
openIssues Int
updatedAt DateTime @default(now())
languageName String?
language Language? @relation(fields: [languageName], references: [name])
license String? @db.Text
Repository Repository @relation(fields: [repository_id], references: [repository_id], onDelete: Cascade)
@@unique([id, repository_id])
}
model PullRequest {
id String @id @default(cuid())
pr_id BigInt @unique
html_url String
number Int
state String
title String @db.Text
author String
author_id String
created_at DateTime
owner String
owner_id String
owner_avatar_url String @db.Text
repository_id String
merged Boolean
PullRequestStatus PullRequestStatus?
Repository Repository @relation(fields: [repository_id], references: [repository_id], onDelete: Cascade)
@@unique([id, pr_id])
}
model PullRequestStatus {
id String @id @default(cuid())
pr_id BigInt @unique
invalid Boolean
reason String? @db.Text
reviewed Boolean @default(false)
reviewed_by String?
PullRequest PullRequest @relation(fields: [pr_id], references: [pr_id], onDelete: Cascade)
user User? @relation(fields: [reviewed_by], references: [id], onDelete: Cascade)
@@unique([id, pr_id])
}
model Language {
name String @id
color String? @db.Text
RepositoryCache RepositoryCache[]
}
model Tag {
name String @id
TaggedRepository TaggedRepository[]
}
model TaggedRepository {
tag_name String
repository_id String
Tag Tag @relation(fields: [tag_name], references: [name], onDelete: Cascade)
Repository Repository @relation(fields: [repository_id], references: [id], onDelete: Cascade)
@@id([tag_name, repository_id])
}
model Reward {
id String @id @default(cuid())
title String @db.Text
summary String @db.LongText
description String @db.LongText
redeem_info String? @db.LongText
logo_url String @db.Text
banner_url String @db.Text
digital Boolean
sponsor_id String
required_prs Int @default(4)
sponsor Sponsor @relation(fields: [sponsor_id], references: [id], onDelete: Cascade)
DigitalRewardCodes DigitalRewardCodes[]
PhysicalRewardClaim PhysicalRewardClaim[]
}
model DigitalRewardCodes {
id String @id @default(cuid())
reward_id String
code String @db.LongText
reward Reward @relation(fields: [reward_id], references: [id], onDelete: Cascade)
ClaimedCode DigitalRewardClaim?
}
model DigitalRewardClaim {
code_id String @unique
claimer_id String
code DigitalRewardCodes @relation(fields: [code_id], references: [id], onDelete: Cascade)
claimer User @relation(fields: [claimer_id], references: [id], onDelete: Cascade)
@@id([code_id, claimer_id])
}
model PhysicalRewardClaim {
id String @id @default(cuid())
reward_id String
claimer_id String
firstName String
lastName String
address1 String
address2 String?
city String
zip String
state String
country String
email String
phoneNumber String?
reward Reward @relation(fields: [reward_id], references: [id], onDelete: Cascade)
claimer User @relation(fields: [claimer_id], references: [id], onDelete: Cascade)
}