-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.prisma
272 lines (230 loc) · 11.2 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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Account {
id Int @id @default(autoincrement())
compoundId String @unique @map("compound_id") @db.VarChar(255)
userId Int @map("user_id")
providerType String @map("provider_type") @db.VarChar(255)
providerId String @map("provider_id") @db.VarChar(255)
providerAccountId String @map("provider_account_id") @db.VarChar(255)
refreshToken String? @map("refresh_token")
accessToken String? @map("access_token")
accessTokenExpire DateTime? @map("access_token_expires") @db.Timestamptz(6)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
@@index([providerAccountId], name: "provider_account_id")
@@index([providerId], name: "provider_id")
@@index([userId], name: "user_id")
@@map("accounts")
}
model Organization {
id Int @id @default(autoincrement())
name String? @db.VarChar(255)
long Float?
lat Float?
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
applicationStatus ApplicationStatus @default(draft) @map("application_status")
active Boolean @default(false)
contactName String? @map("contact_name") @db.VarChar(255)
contactEmail String? @map("contact_email") @db.VarChar(255)
organizationType OrganizationType? @map("organization_type")
workType WorkType? @map("work_type")
address String? @db.VarChar(255)
missionStatement String? @map("mission_statement")
shortHistory String? @map("short_history")
lgbtqDemographic LgbtqDemographic[] @map("lgbtq_demographic")
raceDemographic RaceDemographic[] @map("race_demographic")
ageDemographic AgeDemographic[] @map("age_demographic")
capacity Int?
ein String? @db.VarChar(255)
foundingDate DateTime? @map("founding_date") @db.Date
is501c3 Boolean @default(false) @map("is_501c3")
userId Int? @unique @map("user_id")
contactPhone String? @map("contact_phone") @db.VarChar(255)
website String? @db.VarChar(255)
user User? @relation("OrganizationsToUsers", fields: [userId], references: [id])
applicationNote ApplicationNote? @relation("ApplicationNotesToOrganizations")
applicationResponses ApplicationResponse[] @relation("ApplicationResponsesToOrganizations")
organizationApplicationReviews OrganizationApplicationReview[] @relation("OrganizationApplicationReviewsToOrganizations")
organizationEvents OrganizationEvent[] @relation("OrganizationEventsToOrganizations")
organizationProjects OrganizationProject[] @relation("OrganizationProjectsToOrganizations")
@@map("organizations")
}
model Session {
id Int @id @default(autoincrement())
userId Int @map("user_id")
expire DateTime @map("expires") @db.Timestamptz(6)
sessionToken String @unique @map("session_token") @db.VarChar(255)
accessToken String @unique @map("access_token") @db.VarChar(255)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
@@map("sessions")
}
model User {
id Int @id @default(autoincrement())
role UserRole?
email String @unique @db.VarChar(255)
emailVerified DateTime? @map("email_verified") @db.Timestamptz(6)
image String? @db.VarChar(255)
hashedPassword String @map("hashed_password") @db.VarChar(255)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
organization Organization? @relation("OrganizationsToUsers")
passwordResets PasswordResets[] @relation("PasswordResetsToUsers")
@@map("users")
}
model VerificationRequest {
id Int @id @default(autoincrement())
identifier String @db.VarChar(255)
token String @unique @db.VarChar(255)
expire DateTime @map("expires") @db.Timestamptz(6)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
@@map("verification_requests")
}
model ApplicationQuestion {
id Int @id @default(autoincrement())
question String @db.VarChar(255)
hint String?
placeholder String?
required Boolean @default(false)
wordLimit Int? @map("word_limit")
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
applicationResponses ApplicationResponse[] @relation("ApplicationQuestionsToApplicationResponses")
@@map("application_questions")
}
model ApplicationResponse {
id Int @id @default(autoincrement())
answer String
questionId Int @map("question_id")
organizationId Int @map("organization_id")
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
organization Organization @relation("ApplicationResponsesToOrganizations", fields: [organizationId], references: [id])
applicationQuestion ApplicationQuestion @relation("ApplicationQuestionsToApplicationResponses", fields: [questionId], references: [id])
@@map("application_responses")
}
model migrations {
id Int @id @default(autoincrement())
name String @db.VarChar(255)
run_on DateTime @db.Timestamp(6)
}
model ApplicationNote {
id Int @id @default(autoincrement())
note String?
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
organizationId Int @unique @map("organization_id")
organization Organization @relation("ApplicationNotesToOrganizations", fields: [organizationId], references: [id])
@@map("application_notes")
}
model OrganizationProject {
id Int @id @default(autoincrement())
title String
description String?
organizationId Int @map("organization_id")
organization Organization @relation("OrganizationProjectsToOrganizations", fields: [organizationId], references: [id])
@@map("organization_projects")
}
model PasswordResets {
id String @id @default(dbgenerated("uuid_generate_v4()")) @db.Uuid
userId Int @map("user_id")
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
valid Boolean @default(true)
users User @relation("PasswordResetsToUsers", fields: [userId], references: [id])
@@map("password_resets")
}
model ModeratorInvite {
id String @id @default(dbgenerated("uuid_generate_v4()")) @db.Uuid
email String @db.VarChar(255)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
valid Boolean @default(true)
@@map("moderator_invites")
}
model OrganizationApplicationReview {
id Int @id @default(autoincrement())
reason String?
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
organizationId Int @map("organization_id")
organization Organization @relation("OrganizationApplicationReviewsToOrganizations", fields: [organizationId], references: [id])
@@map("organization_application_reviews")
}
model OrganizationEvent {
id Int @id @default(autoincrement())
title String
description String
address String? @db.VarChar(255)
long Float?
lat Float?
link String? @db.VarChar(255)
lgbtqDemographic LgbtqDemographic[] @map("lgbtq_demographic")
raceDemographic RaceDemographic[] @map("race_demographic")
ageDemographic AgeDemographic[] @map("age_demographic")
organizationId Int @map("organization_id")
startDatetime DateTime @map("start_datetime") @db.Timestamptz(6)
endDatetime DateTime? @map("end_datetime") @db.Timestamptz(6)
organization Organization @relation("OrganizationEventsToOrganizations", fields: [organizationId], references: [id])
@@map("organization_events")
}
enum AgeDemographic {
child @map("Children")
teen @map("Teens")
adult @map("Adults")
senior @map("Seniors")
@@map("age_demographic")
}
enum ApplicationStatus {
draft
submitted
approved
rejected
@@map("application_status")
}
enum LgbtqDemographic {
queer @map("Queer")
asexualAromantic @map("Asexual/Aromantic")
bisexual @map("Bisexual")
pansexual @map("Pansexual")
lesbianSgl @map("Lesbian/SGL")
gaySgl @map("Gay/SGL")
straightHeterosexual @map("Straight/Heterosexual")
lgbtqPlus @map("LGBTQ+")
other @map("Other")
@@map("lgbtq_demographic")
}
enum OrganizationType {
grassrootsLocal @map("Grassroots/Local")
statewide @map("Statewide")
national @map("National")
other @map("Other")
@@map("organization_type")
}
enum RaceDemographic {
black @map("Black")
native @map("Native")
hispanic @map("Hispanic")
asian @map("Asian")
arab @map("Arab")
white @map("White")
other @map("Other")
@@map("race_demographic")
}
enum UserRole {
organization
moderator
admin
@@map("user_role")
}
enum WorkType {
advocacy @map("Advocacy")
directService @map("Direct Service")
networkingSocial @map("Networking/Social")
@@map("work_type")
}