Skip to content

Commit 2dd8e30

Browse files
committed
Undo schema
1 parent fd9c61a commit 2dd8e30

File tree

1 file changed

+81
-104
lines changed

1 file changed

+81
-104
lines changed

prisma/schema.prisma

Lines changed: 81 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,158 +1,120 @@
1+
generator client {
2+
provider = "prisma-client-js"
3+
}
4+
15
datasource db {
26
provider = "postgresql"
37
url = env("DATABASE_URL")
48
}
59

6-
generator client {
7-
provider = "prisma-client-js"
8-
}
9-
1010
model User {
11-
id String @id @default(cuid())
12-
name String?
13-
email String? @unique
14-
password String? // <-- Add this for email/password auth
15-
emailVerified DateTime?
16-
verificationToken String? @unique
11+
id String @id @default(cuid())
12+
name String?
13+
email String? @unique
14+
password String?
15+
emailVerified DateTime?
16+
verificationToken String? @unique
1717
verificationTokenExpires DateTime?
18-
image String?
19-
accounts Account[]
20-
sessions Session[]
21-
22-
// Profile Information
23-
profile Profile?
24-
25-
// Optional for WebAuthn support
26-
Authenticator Authenticator[]
27-
28-
createdAt DateTime @default(now())
29-
updatedAt DateTime @updatedAt
18+
image String?
19+
createdAt DateTime @default(now())
20+
updatedAt DateTime @updatedAt
21+
accounts Account[]
22+
Authenticator Authenticator[]
23+
profile Profile?
24+
sessions Session[]
3025
}
3126

3227
model Profile {
33-
id String @id @default(cuid())
34-
userId String @unique
35-
location String? // Need to normalize later for geospatial
36-
description String?
37-
contactInfo String?
38-
birthYear Int?
39-
occupation String?
40-
gender Gender?
41-
personalityType PersonalityType?
42-
introversion Int?
43-
conflictStyle ConflictStyle?
44-
images String[]
45-
// communicationPreferences CommunicationPreferences[]
46-
47-
// Many-to-many
48-
promptAnswers PromptAnswer[]
28+
id String @id @default(cuid())
29+
userId String @unique
30+
location String?
31+
description String?
32+
contactInfo String?
33+
birthYear Int?
34+
occupation String?
35+
gender Gender?
36+
personalityType PersonalityType?
37+
introversion Int?
38+
conflictStyle ConflictStyle?
39+
images String[]
40+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
41+
causeAreas ProfileCauseArea[]
4942
desiredConnections ProfileConnection[]
5043
intellectualInterests ProfileInterest[]
5144
coreValues ProfileValue[]
52-
causeAreas ProfileCauseArea[]
53-
54-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
55-
}
56-
57-
enum Gender {
58-
Man
59-
Woman
60-
Other
61-
}
62-
63-
enum PersonalityType {
64-
Introvert
65-
Extrovert
66-
Ambivert
67-
}
68-
69-
enum ConflictStyle {
70-
Competing
71-
Avoidant
72-
Compromising
73-
Accommodating
74-
Collaborating
45+
promptAnswers PromptAnswer[]
7546
}
7647

7748
model Connection {
78-
id String @id @default(cuid())
79-
name String @unique
49+
id String @id @default(cuid())
50+
name String @unique
8051
users ProfileConnection[]
8152
}
8253

8354
model Interest {
84-
id String @id @default(cuid())
85-
name String @unique
55+
id String @id @default(cuid())
56+
name String @unique
8657
users ProfileInterest[]
8758
}
8859

8960
model Value {
90-
id String @id @default(cuid())
91-
name String @unique
61+
id String @id @default(cuid())
62+
name String @unique
9263
users ProfileValue[]
9364
}
9465

9566
model CauseArea {
96-
id String @id @default(cuid())
97-
name String @unique
67+
id String @id @default(cuid())
68+
name String @unique
9869
users ProfileCauseArea[]
9970
}
10071

101-
// Join tables
10272
model ProfileConnection {
103-
profileId String
73+
profileId String
10474
connectionId String
105-
106-
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
107-
connection Connection @relation(fields: [connectionId], references: [id], onDelete: Cascade)
75+
connection Connection @relation(fields: [connectionId], references: [id], onDelete: Cascade)
76+
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
10877
10978
@@id([profileId, connectionId])
11079
}
11180

112-
// Join tables
11381
model ProfileInterest {
114-
profileId String
82+
profileId String
11583
interestId String
116-
117-
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
118-
interest Interest @relation(fields: [interestId], references: [id], onDelete: Cascade)
84+
interest Interest @relation(fields: [interestId], references: [id], onDelete: Cascade)
85+
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
11986
12087
@@id([profileId, interestId])
12188
}
12289

12390
model ProfileValue {
12491
profileId String
125-
valueId String
126-
127-
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
128-
value Value @relation(fields: [valueId], references: [id], onDelete: Cascade)
92+
valueId String
93+
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
94+
value Value @relation(fields: [valueId], references: [id], onDelete: Cascade)
12995
13096
@@id([profileId, valueId])
13197
}
13298

13399
model ProfileCauseArea {
134-
profileId String
100+
profileId String
135101
causeAreaId String
136-
137-
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
138-
causeArea CauseArea @relation(fields: [causeAreaId], references: [id], onDelete: Cascade)
102+
causeArea CauseArea @relation(fields: [causeAreaId], references: [id], onDelete: Cascade)
103+
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
139104
140105
@@id([profileId, causeAreaId])
141106
}
142107

143108
model PromptAnswer {
144-
id String @id @default(cuid())
109+
id String @id @default(cuid())
145110
profileId String
146111
prompt String
147112
answer String
148-
149-
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
113+
profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)
150114
}
151115

152-
153-
154116
model Account {
155-
id String @id @default(cuid())
117+
id String @id @default(cuid())
156118
userId String
157119
type String
158120
provider String
@@ -164,11 +126,9 @@ model Account {
164126
scope String?
165127
id_token String?
166128
session_state String?
167-
168-
createdAt DateTime @default(now())
169-
updatedAt DateTime @updatedAt
170-
171-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
129+
createdAt DateTime @default(now())
130+
updatedAt DateTime @updatedAt
131+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
172132
173133
@@unique([provider, providerAccountId])
174134
}
@@ -178,10 +138,9 @@ model Session {
178138
sessionToken String @unique
179139
userId String
180140
expires DateTime
141+
createdAt DateTime @default(now())
142+
updatedAt DateTime @updatedAt
181143
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
182-
183-
createdAt DateTime @default(now())
184-
updatedAt DateTime @updatedAt
185144
}
186145

187146
model VerificationToken {
@@ -192,7 +151,6 @@ model VerificationToken {
192151
@@unique([identifier, token])
193152
}
194153

195-
// Optional for WebAuthn support
196154
model Authenticator {
197155
credentialID String @unique
198156
userId String
@@ -202,8 +160,27 @@ model Authenticator {
202160
credentialDeviceType String
203161
credentialBackedUp Boolean
204162
transports String?
205-
206-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
163+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
207164
208165
@@id([userId, credentialID])
209166
}
167+
168+
enum Gender {
169+
Male
170+
Female
171+
Other
172+
}
173+
174+
enum PersonalityType {
175+
Introvert
176+
Extrovert
177+
Ambivert
178+
}
179+
180+
enum ConflictStyle {
181+
Competing
182+
Avoidant
183+
Compromising
184+
Accommodating
185+
Collaborating
186+
}

0 commit comments

Comments
 (0)