-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.prisma
62 lines (49 loc) · 1.37 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
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DB_URL")
}
model Achievement {
@@map("achievements")
id String @id @default(cuid())
name String
description String
image String
isObtainable Boolean @default(true)
createdAt DateTime @default(now())
category Category @relation(fields: [categoryId], references: [id])
categoryId String
userAchievements UserAchievement[]
}
model User {
@@map("users")
id String @id @default(cuid())
cid String @unique
createdAt DateTime @default(now())
achievements UserAchievement[]
}
model UserAchievement {
@@map("userAchievements")
createdAt DateTime @default(now())
user User @relation(fields: [cid], references: [cid])
cid String
achievement Achievement @relation(fields: [achievementId], references: [id])
achievementId String
@@id([cid, achievementId])
}
model Category {
@@map("categories")
id String @id @default(cuid())
name String @unique
// Maybe add an image for the category?
achievements Achievement[]
}
model AuthorizeToken {
@@map("authorizeTokens")
token String @id @default(cuid())
tokenName String @unique
createdAt DateTime @default(now())
expiresAt DateTime?
}