omdb/prisma/schema.prisma

232 lines
6.2 KiB
Text
Raw Normal View History

2023-09-05 21:42:50 +00:00
generator client {
provider = "prisma-client-js"
previewFeatures = ["fullTextIndex"]
2023-09-05 21:42:50 +00:00
}
datasource db {
2023-09-06 01:45:38 +00:00
provider = "mysql"
url = env("DATABASE_URL")
}
model ApiKey {
ApiKey String @id
Name String
UserID Int
2023-09-06 01:45:38 +00:00
User OmdbUser @relation(fields: [UserID], references: [UserID])
2023-09-06 01:45:38 +00:00
}
model BeatmapCreator {
BeatmapID Int
CreatorID Int
@@id([BeatmapID, CreatorID])
@@index([BeatmapID], map: "idx_BeatmapID")
}
model BeatmapEditRequest {
EditID Int @id @default(autoincrement())
BeatmapID Int
2023-09-06 01:45:38 +00:00
UserID Int
EditData Json
Timestamp DateTime @default(now())
Status BeatmapEditRequestStatus @default(Pending)
2023-09-06 01:45:38 +00:00
EditorID Int?
User OmdbUser @relation(fields: [UserID], references: [UserID])
2023-09-06 01:45:38 +00:00
}
model Beatmap {
BeatmapID Int @id
SetID Int
DifficultyName String
Mode Int
Status Int
SR Float
2023-09-06 01:45:38 +00:00
Rating String? @db.VarChar(45)
ChartRank Int?
ChartYearRank Int?
Timestamp DateTime? @default(now()) @db.Timestamp(0)
RatingCount Int?
WeightedAvg Float? @db.Float
Blacklisted Boolean @default(false)
BlacklistReason String? @db.Text
controversy Decimal? @db.Decimal(10, 8)
BeatmapSet BeatmapSet @relation(fields: [SetID], references: [SetID])
RatingTags RatingTag[]
DescriptorVotes DescriptorVote[]
Ratings Rating[]
}
model BeatmapSet {
SetID Int @id
HostID Int
Genre Int
Lang Int
Artist String
ArtistUnicode String
Title String
TitleUnicode String
DateRanked DateTime @db.Timestamp(0)
Host OsuUser @relation(fields: [HostID], references: [UserID])
Beatmaps Beatmap[]
Comments Comment[]
@@fulltext([Title, Artist])
2023-09-05 21:42:50 +00:00
}
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
2023-09-06 01:45:38 +00:00
model BeatmapSetNominator {
SetID Int?
NominatorID Int?
Mode Int?
2023-09-05 21:42:50 +00:00
2023-09-06 01:45:38 +00:00
@@unique([SetID, NominatorID, Mode], map: "beatmapset_nominators_pk")
@@index([SetID], map: "beatmapset_nominators_SetID_index")
@@ignore
2023-09-05 21:42:50 +00:00
}
2023-09-06 01:45:38 +00:00
model Comment {
CommentID Int @id @default(autoincrement())
UserID Int
SetID Int
Content String
DatePosted DateTime @default(now())
2023-09-06 01:45:38 +00:00
User OmdbUser @relation(fields: [UserID], references: [UserID])
BeatmapSet BeatmapSet @relation(fields: [SetID], references: [SetID])
2023-09-05 21:42:50 +00:00
}
2023-09-06 01:45:38 +00:00
model DescriptorVote {
VoteID Int @id @default(autoincrement())
BeatmapID Int
UserID Int
Vote Boolean
DescriptorID Int
2023-09-05 21:42:50 +00:00
Beatmap Beatmap @relation(fields: [BeatmapID], references: [BeatmapID])
User OmdbUser @relation(fields: [UserID], references: [UserID])
Descriptor Descriptor @relation(fields: [DescriptorID], references: [DescriptorID])
2023-09-06 01:45:38 +00:00
@@unique([BeatmapID, UserID, DescriptorID], map: "descriptor_votes_pk2")
2023-09-05 21:42:50 +00:00
}
2023-09-06 01:45:38 +00:00
model Descriptor {
DescriptorID Int @id @default(autoincrement())
Name String @unique(map: "descriptors_pk2") @db.VarChar(40)
ShortDescription String? @db.Text
ParentID Int?
Usable Boolean @default(true)
DescriptorVote DescriptorVote[]
2023-09-05 21:42:50 +00:00
}
2023-09-06 01:45:38 +00:00
model Log {
LogID Int @id @default(autoincrement())
2023-09-06 01:45:38 +00:00
UserID Int
LogData Json
2023-09-06 01:45:38 +00:00
User OmdbUser @relation(fields: [UserID], references: [UserID])
2023-09-05 21:42:50 +00:00
}
2023-09-06 01:45:38 +00:00
model RatingTag {
TagID Int @id @default(autoincrement())
UserID Int
BeatmapID Int
Tag String
2023-09-05 21:42:50 +00:00
User OmdbUser @relation(fields: [UserID], references: [UserID])
Beatmap Beatmap @relation(fields: [BeatmapID], references: [BeatmapID])
@@unique([BeatmapID, UserID, Tag])
2023-09-05 21:42:50 +00:00
}
2023-09-06 01:45:38 +00:00
model Rating {
RatingID Int @id @default(autoincrement())
BeatmapID Int
UserID Int
Score Decimal @db.Decimal(2, 1)
DateRated DateTime
2023-09-05 21:42:50 +00:00
Beatmap Beatmap @relation(fields: [BeatmapID], references: [BeatmapID])
User OmdbUser @relation(fields: [UserID], references: [UserID])
2023-09-05 21:42:50 +00:00
}
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
2023-09-06 01:45:38 +00:00
model SetRetrieveInfo {
Id Int @id
LastRetrieval DateTime
LastDate DateTime
2023-09-05 21:42:50 +00:00
}
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
2023-09-06 01:45:38 +00:00
model UserCorrelation {
User1ID Int
User2ID Int
2023-09-05 21:42:50 +00:00
Correlation Float
Data Json
User1 OmdbUser @relation(name: "user1", fields: [User1ID], references: [UserID])
User2 OmdbUser @relation(name: "user2", fields: [User2ID], references: [UserID])
@@unique([User1ID, User2ID], map: "user_correlations_pk")
2023-09-05 21:42:50 +00:00
}
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
2023-09-06 01:45:38 +00:00
model UserRelation {
UserIDFrom Int?
UserIDTo Int?
type Int?
@@unique([UserIDTo, UserIDFrom], map: "user_relations_pk")
@@map("user_relations")
@@ignore
}
model OmdbUser {
UserID Int @id
AccessToken String
RefreshToken String
Weight Decimal @db.Decimal(6, 4)
2023-09-06 01:45:38 +00:00
DoTrueRandom Boolean @default(false)
CustomRatings Json @default("{}")
LastAccessedSite DateTime @default(now())
HideRatings Boolean @default(false)
IsBlacklisted Boolean @default(false)
ApiKeys ApiKey[]
OsuUser OsuUser @relation(fields: [UserID], references: [UserID])
RatingTags RatingTag[]
BeatmapEditRequests BeatmapEditRequest[]
Comments Comment[]
DescriptorVotes DescriptorVote[]
Ratings Rating[]
Log Log[]
User1Correlation UserCorrelation[] @relation("user1")
User2Correlation UserCorrelation[] @relation("user2")
}
model OsuUser {
UserID Int @id
Username String @db.VarChar(255)
Banned Boolean @default(false)
OmdbUser OmdbUser?
HostedBeatmapSets BeatmapSet[]
2023-09-06 01:45:38 +00:00
}
enum BeatmapEditRequestStatus {
Pending
Denied
Approved
2023-09-05 21:42:50 +00:00
}