-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
172 lines (135 loc) · 3.71 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
generator client {
provider = "prisma-client-js"
engineType = "library"
}
generator pothos {
provider = "prisma-pothos-types"
}
datasource db {
provider = "postgresql"
url = env("ACCELERATE_URL")
directUrl = env("DATABASE_URL")
}
model User {
id String @id @default(uuid())
name String?
tagline String?
email String @unique
emailVerified DateTime?
image String?
password String?
accounts Account[]
sessions Session[]
trips TripsOnUsers[]
role Role @default(GUIDE)
profile Profile?
Authenticator Authenticator[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Profile {
id String @id @default(uuid())
description String?
email String?
birth DateTime?
locationId String
location Location @relation(fields: [locationId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String @unique
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model Account {
userId String
type String
provider String
providerAccountId String
refresh_token String?
refresh_token_expires_in Int?
access_token String?
expires_at Int?
token_type String?
scope String?
id_token String?
session_state String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@id([provider, providerAccountId])
}
model Session {
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model VerificationToken {
identifier String
token String
expires DateTime
@@id([identifier, token])
}
// Optional for WebAuthn support
model Authenticator {
credentialID String @unique
userId String
providerAccountId String
credentialPublicKey String
counter Int
credentialDeviceType String
credentialBackedUp Boolean
transports String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@id([userId, credentialID])
}
enum Role {
GUIDE
ADMIN
TOURIST
}
model Address {
id String @id @default(uuid())
name String
address String?
postalCode String?
lat Float?
long Float?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
locationId String
location Location @relation(fields: [locationId], references: [id], onDelete: Cascade)
}
model Location {
id String @id @default(uuid())
city String
state String
country String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
addresses Address[]
profiles Profile[]
trips Trip[]
@@unique(fields: [country, state, city], name: "identifier")
}
model Trip {
id String @id @default(uuid())
title String
description String?
location Location @relation(fields: [locationId], references: [id])
locationId String
details Json?
users TripsOnUsers[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model TripsOnUsers {
id String @default(uuid())
user User @relation(fields: [userId], references: [id])
userId String
trip Trip @relation(fields: [tripId], references: [id])
tripId String
assignedAt DateTime @default(now())
@@id([userId, tripId])
}