blob: 9dde5b57496b38f0e95f94b091a74a7b721c2cce (
plain) (
blame)
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
|
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
generator client {
provider = "prisma-client-js"
output = "../src/generated/prisma"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id @default(uuid())
email String @unique
name String?
password String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
locations Location[]
locationShares LocationShare[] @relation("Sender")
locationReceived LocationShare[] @relation("Receiver")
}
model Location {
id String @id @default(uuid())
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
latitude Float
longitude Float
accuracy Float?
timestamp DateTime @default(now())
shares LocationShare[]
}
model LocationShare {
id String @id @default(uuid())
senderId String
sender User @relation("Sender", fields: [senderId], references: [id], onDelete: Cascade)
receiverId String?
receiver User? @relation("Receiver", fields: [receiverId], references: [id], onDelete: SetNull)
locationId String
location Location @relation(fields: [locationId], references: [id], onDelete: Cascade)
token String @unique
expiryAt DateTime?
createdAt DateTime @default(now())
emailSent Boolean @default(false)
accessCount Int @default(0)
}
|