65 lines
1.4 KiB
Text
65 lines
1.4 KiB
Text
|
// 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"
|
||
|
}
|
||
|
|
||
|
datasource db {
|
||
|
provider = "sqlite"
|
||
|
url = env("DATABASE_URL")
|
||
|
}
|
||
|
|
||
|
model Beatmap {
|
||
|
id Int @id
|
||
|
difficulty String
|
||
|
|
||
|
beatmapset BeatmapSet @relation(fields: [beatmapset_id], references: [id])
|
||
|
beatmapset_id Int
|
||
|
|
||
|
scores Score[]
|
||
|
}
|
||
|
|
||
|
model BeatmapSet {
|
||
|
id Int @id
|
||
|
artist String
|
||
|
artistUnicode String
|
||
|
title String
|
||
|
titleUnicode String
|
||
|
ranked Boolean
|
||
|
|
||
|
scores Score[]
|
||
|
beatmaps Beatmap[]
|
||
|
}
|
||
|
|
||
|
model Score {
|
||
|
id Int @id @default(autoincrement())
|
||
|
accuracy Float
|
||
|
best_id BigInt?
|
||
|
created_at DateTime
|
||
|
score_id BigInt?
|
||
|
score Int
|
||
|
beatmap Beatmap @relation(fields: [beatmap_id], references: [id])
|
||
|
beatmap_id Int
|
||
|
beatmapset BeatmapSet @relation(fields: [beatmapset_id], references: [id])
|
||
|
beatmapset_id Int
|
||
|
user_id Int
|
||
|
|
||
|
transition_from Transition[] @relation("before")
|
||
|
transition_to Transition[] @relation("after")
|
||
|
|
||
|
@@unique([user_id, beatmap_id, created_at, score])
|
||
|
}
|
||
|
|
||
|
model Transition {
|
||
|
before Score @relation("before", fields: [before_id], references: [id])
|
||
|
before_id Int
|
||
|
after Score @relation("after", fields: [after_id], references: [id])
|
||
|
after_id Int
|
||
|
|
||
|
user_id Int
|
||
|
ms_between BigInt
|
||
|
|
||
|
@@id([before_id, after_id])
|
||
|
}
|