-
Notifications
You must be signed in to change notification settings - Fork 12
/
schema.prisma
100 lines (88 loc) · 3.08 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
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
output = "./generated/prisma-client-js"
binaryTargets = ["native"]
}
datasource db {
provider = "sqlite"
url = "file:./dev.db"
}
model GuildOptions {
guildId String @id @unique
gambleChance Decimal @default(33.33)
globalDuelCD Int @default(60000) // 1 minute in millis
lastDuel DateTime @default(dbgenerated("0"))
lastRPG DateTime @default(dbgenerated("0"))
}
model User {
id String @id @unique
favColor String?
duelStats Duels[]
lastRandom DateTime @default(dbgenerated("0"))
lastLoss DateTime @default(dbgenerated("0"))
}
model Duels {
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId String
losses Int @default(0)
wins Int @default(0)
draws Int @default(0)
winStreak Int @default(0)
lossStreak Int @default(0)
winStreakMax Int @default(0)
lossStreakMax Int @default(0)
}
model BestMixu {
id String @unique @default("1")
owner String @default("")
tiles String @default("")
score Int @default(0)
}
model RPGCharacter {
id String @id @unique
wins Int @default(0)
losses Int @default(0)
draws Int @default(0)
lastLoss DateTime @default(dbgenerated("0"))
eloRank Int @default(1000) // 1000 is center of "skill" distribution
peakElo Int @default(1000)
floorElo Int @default(1000)
}
model NFDItem {
id Int @id @default(autoincrement())
name String @unique
code String @unique
filename String @unique
owner String
discordUrl String @default("")
mintDate DateTime @default(dbgenerated("0"))
previousOwners String @default("")
coveters String @default("")
shunners String @default("")
enthusiasts NFDEnthusiasts[]
hotness Int @default(0)
}
model NFDEnjoyer {
id String @id @unique
mintCount Int @default(0)
lastMint DateTime @default(dbgenerated("0"))
lastGiftGiven DateTime @default(dbgenerated("0"))
lastSlurp DateTime @default(dbgenerated("0"))
consecutiveFails Int @default(4)
successfulMints Int @default(0)
failedMints Int @default(0)
favorites NFDEnthusiasts[]
}
// Opting to not use prisma's implicit many-to-many
// I'm doing this so it's clear *what* is happening and also for future proofing should we wanat to add fields
// to this relation
model NFDEnthusiasts {
dino NFDItem @relation(fields: [dinoId], references: [id], onUpdate: Cascade, onDelete: Cascade)
dinoId Int
enjoyer NFDEnjoyer @relation(fields: [enjoyerId], references: [id], onUpdate: Cascade, onDelete: Cascade)
enjoyerId String
@@id([dinoId, enjoyerId])
}