-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathschema.prisma
More file actions
65 lines (54 loc) · 1.77 KB
/
Copy pathschema.prisma
File metadata and controls
65 lines (54 loc) · 1.77 KB
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
// 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"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id BigInt @id @default(autoincrement())
googleId String @unique
email String?
picture String?
device Device[]
Activity TurnActivity[]
@@index([googleId], type: Hash)
}
model Device {
id String @unique
lastSeen DateTime? @db.Timestamp(6)
name String?
user User @relation(fields: [userId], references: [id])
userId BigInt
tempToken String?
tempTokenExpiresAt DateTime?
secretToken String? @unique
@@index([userId], type: Hash)
@@index([tempToken], type: Hash)
@@index([secretToken], type: Hash)
}
model TurnActivity {
id BigInt @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId BigInt
createdAt DateTime? @default(now()) @db.Timestamp(6)
bytesSent Int
bytesReceived Int
@@index([userId], type: Hash)
}
model Release {
id BigInt @id @default(autoincrement())
version String
rolloutPercentage Int @default(10) // 10% of users
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
url String
type String @default("app") // "app" or "system"
hash String
@@unique([version, type])
@@index([type, rolloutPercentage])
}