feat: rearchitecture of database schemas, migration reset, and #180

This commit is contained in:
DecDuck
2025-08-20 20:35:50 +10:00
parent 6853383e86
commit 322af0b4ca
125 changed files with 1384 additions and 1837 deletions

View File

@ -21,6 +21,13 @@ enum LibraryBackend {
FlatFilesystem
}
enum LibraryMode {
Game
Redist
Addon
Mod
}
model Library {
id String @id @default(uuid())
name String
@ -28,6 +35,8 @@ model Library {
backend LibraryBackend
options Json
games Game[]
games Game[]
redists Redist[]
addons Addon[]
mods Mod[]
}

View File

@ -1,41 +1,83 @@
// A particular set of files that relate to the version
model Version {
versionId String @id @unique @default(uuid())
versionPath String
versionName String
created DateTime @default(now())
gameId String?
game Game? @relation(fields: [gameId], references: [id], map: "game_link", onDelete: Cascade, onUpdate: Cascade)
gameVersion GameVersion?
redistId String?
redist Redist? @relation(fields: [redistId], references: [id], map: "redist_link", onDelete: Cascade, onUpdate: Cascade)
redistVersion RedistVersion?
addonId String?
addon Addon? @relation(fields: [addonId], references: [id], map: "addon_link", onDelete: Cascade, onUpdate: Cascade)
addonVersion AddonVersion?
modId String?
mod Mod? @relation(fields: [modId], references: [id], map: "mod_link", onDelete: Cascade, onUpdate: Cascade)
modVersion ModVersion?
platform Platform
dropletManifest Json // Results from droplet
}
model GameVersion {
gameId String
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
versionName String // Sub directory for the game files
versionId String @id
version Version @relation(fields: [versionId], references: [versionId], onDelete: Cascade, onUpdate: Cascade)
created DateTime @default(now())
redistDeps RedistVersion[]
platform Platform
launches GameVersionLaunch[]
launchCommand String @default("") // Command to run to start. Platform-specific. Windows games on Linux will wrap this command in Proton/Wine
launchArgs String[]
setupCommand String @default("") // Command to setup game (dependencies and such)
setupArgs String[]
onlySetup Boolean @default(false)
setup String @default("") // Command to setup game (dependencies and such)
setupArgs String @default("")
onlySetup Boolean @default(false)
umuIdOverride String?
dropletManifest Json // Results from droplet
versionIndex Int
delta Boolean @default(false)
hidden Boolean @default(false)
}
@@id([gameId, versionName])
model GameVersionLaunch {
launchId String @id @default(uuid())
versionId String
gameVersion GameVersion @relation(fields: [versionId], references: [versionId], onDelete: Cascade, onUpdate: Cascade)
name String
description String
launchCommand String
launchArgs String @default("")
}
model AddonVersion {
versionId String @id
version Version @relation(fields: [versionId], references: [versionId], onDelete: Cascade, onUpdate: Cascade)
redistDeps RedistVersion[]
}
model RedistVersion {
redistId String
redist Redist @relation(fields: [redistId], references: [id], onDelete: Cascade)
versionName String
versionId String @id
version Version @relation(fields: [versionId], references: [versionId], onDelete: Cascade, onUpdate: Cascade)
created DateTime @default(now())
gameDependees GameVersion[]
addonDependees AddonVersion[]
}
platform Platform
model ModVersion {
versionId String @id
version Version @relation(fields: [versionId], references: [versionId], onDelete: Cascade, onUpdate: Cascade)
dropletManifest Json // Results from droplet
@@id([redistId, versionName])
dependencies String[]
}
// A save slot for a game

View File

@ -31,7 +31,8 @@ model Game {
mImageCarouselObjectIds String[] // linked to below array
mImageLibraryObjectIds String[] // linked to objects in s3
versions GameVersion[]
versions Version[]
mods Mod[]
// These fields will not be optional in the next version
// Any game without a library ID will be assigned one at startup, based on the defaults
@ -52,9 +53,8 @@ model Game {
@@unique([libraryId, libraryPath], name: "libraryKey")
}
model Redist {
id String @id @default(uuid())
created DateTime @default(now())
model Addon {
id String @id @default(uuid())
name String
description String
@ -64,16 +64,61 @@ model Redist {
library Library @relation(fields: [libraryId], references: [id], onDelete: Cascade, onUpdate: Cascade)
libraryPath String
versions RedistVersion[]
versions Version[]
}
model Redist {
id String @id @default(uuid())
created DateTime @default(now())
mName String
mShortDescription String
mIconObjectId String
libraryId String
library Library @relation(fields: [libraryId], references: [id], onDelete: Cascade, onUpdate: Cascade)
libraryPath String
versions Version[]
@@unique([libraryId, libraryPath], name: "libraryKey")
}
model Mod {
id String @id @default(uuid())
created DateTime @default(now())
gameId String
game Game @relation(fields: [gameId], references: [id])
// If this mod is user-provided
user Boolean @default(true)
mName String
mShortDescription String
mDescription String
mIconObjectId String // linked to objects in s3
mBannerObjectId String // linked to objects in s3
mCoverObjectId String
mImageCarouselObjectIds String[] // linked to below array
mImageLibraryObjectIds String[] // linked to objects in s3
libraryId String
library Library @relation(fields: [libraryId], references: [id], onDelete: Cascade, onUpdate: Cascade)
libraryPath String
tags GameTag[]
versions Version[]
}
model GameTag {
id String @id @default(uuid())
name String @unique
games Game[]
mods Mod[]
@@index([name(ops: raw("gist_trgm_ops(siglen=32)"))], type: Gist)
}