Files
drop/prisma/models/content.prisma
DecDuck 251ddb8ff8 Rearchitecture for v0.4.0 (#197)
* feat: database redist support

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

* feat: import redists

* fix: giantbomb logging bug

* feat: partial user platform support + statusMessage -> message

* feat: add user platform filters to store view

* fix: sanitize svg uploads

... copilot suggested this

I feel dirty.

* feat: beginnings of platform & redist management

* feat: add server side redist patching

* fix: update drop-base commit

* feat: import of custom platforms & file extensions

* fix: redelete platform

* fix: remove platform

* feat: uninstall commands, new R UI

* checkpoint: before migrating to nuxt v4

* update to nuxt 4

* fix: fixes for Nuxt v4 update

* fix: remaining type issues

* feat: initial feedback to import other kinds of versions

* working commit

* fix: lint

* feat: redist import
2025-11-10 10:36:13 +11:00

218 lines
6.5 KiB
Plaintext

enum HardwarePlatform {
Windows @map("windows")
Linux @map("linux")
macOS @map("macos")
// Switch @map("switch")
// etc
// @@map("Platform")
}
model UserPlatform {
id String @id @default(uuid())
platformName String
iconSvg String
fileExtensions String[] @default([])
redistId String @unique
redist Redist @relation(fields: [redistId], references: [id], onDelete: Cascade, onUpdate: Cascade)
//platform PlatformLink[]
}
model PlatformLink {
id String @id // This is either the ID of the user platform, or a repeat of the HardwarePlatform enum. It's cursed.
hardwarePlatform HardwarePlatform?
// Waiting on weak reference
// userPlatform UserPlatform? @relation(fields: [id], references: [id])
gameVersions GameVersion[]
dlcVersions DLCVersion[]
redistVerisons RedistVersion[]
modVersions ModVersion[]
}
/**
*/
model LaunchOption {
launchId String @id @default(uuid())
redistVersionId String?
redistVersion RedistVersion? @relation(fields: [redistVersionId], references: [versionId], onDelete: Cascade, onUpdate: Cascade, map: "redistVersion_fkey")
launchGId String?
launchGVersion GameVersion? @relation(name: "launches", fields: [launchGId], references: [versionId])
installGId String? @unique
installGVersion GameVersion? @relation(name: "install")
uninstallGId String? @unique
uninstallGVersion GameVersion? @relation(name: "uninstall")
installRId String? @unique
installRVersion RedistVersion? @relation(name: "install_redist")
uninstallRId String? @unique
uninstallRVersion RedistVersion? @relation(name: "uninstall_redist")
name String
description String
command String
args String @default("")
}
// Platform agnostic object
model Version {
versionId String @id @unique @default(uuid())
versionPath String
versionName String
versionIndex Int
created DateTime @default(now())
hidden Boolean @default(false)
gameId String?
game Game? @relation(fields: [gameId], references: [id], map: "game_link", onDelete: Cascade, onUpdate: Cascade)
gameVersions GameVersion[]
redistId String?
redist Redist? @relation(fields: [redistId], references: [id], map: "redist_link", onDelete: Cascade, onUpdate: Cascade)
redistVersions RedistVersion[]
dlcId String?
dlc DLC? @relation(fields: [dlcId], references: [id], map: "dlc_link", onDelete: Cascade, onUpdate: Cascade)
dlcVersions DLCVersion[]
modId String?
mod Mod? @relation(fields: [modId], references: [id], map: "mod_link", onDelete: Cascade, onUpdate: Cascade)
modVersions ModVersion[]
dropletManifest Json // Results from droplet
}
// Platform specific object
model GameVersion {
versionId String @id
version Version @relation(fields: [versionId], references: [versionId], onDelete: Cascade, onUpdate: Cascade)
redistDeps RedistVersion[]
launches LaunchOption[] @relation(name: "launches")
installId String? @unique
install LaunchOption? @relation(name: "install", fields: [installId], references: [launchId])
uninstallId String? @unique
uninstall LaunchOption? @relation(name: "uninstall", fields: [uninstallId], references: [launchId])
onlySetup Boolean @default(false)
umuIdOverride String?
delta Boolean @default(false)
platformId String
platform PlatformLink @relation(fields: [platformId], references: [id])
}
// Platform specific object
model DLCVersion {
versionId String @id
version Version @relation(fields: [versionId], references: [versionId], onDelete: Cascade, onUpdate: Cascade)
redistDeps RedistVersion[]
platformId String
platform PlatformLink @relation(fields: [platformId], references: [id])
}
// Platform specific object
model RedistVersion {
versionId String @id
version Version @relation(fields: [versionId], references: [versionId], onDelete: Cascade, onUpdate: Cascade)
installId String? @unique
install LaunchOption? @relation(name: "install_redist", fields: [installId], references: [launchId])
uninstallId String? @unique
uninstall LaunchOption? @relation(name: "uninstall_redist", fields: [uninstallId], references: [launchId])
onlySetup Boolean @default(false)
launches LaunchOption[]
versionIndex Int
delta Boolean @default(false)
gameDependees GameVersion[]
dlcDependees DLCVersion[]
platformId String
platform PlatformLink @relation(fields: [platformId], references: [id])
}
// Platform specific object
model ModVersion {
versionId String @id
version Version @relation(fields: [versionId], references: [versionId], onDelete: Cascade, onUpdate: Cascade)
dependencies String[]
platformId String
platform PlatformLink @relation(fields: [platformId], references: [id])
}
// A save slot for a game
model SaveSlot {
gameId String
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
index Int
createdAt DateTime @default(now())
playtime Float @default(0) // hours
lastUsedClientId String?
lastUsedClient Client? @relation(fields: [lastUsedClientId], references: [id])
historyObjectIds String[] // list of objects
historyChecksums String[] // list of hashes
@@id([gameId, userId, index], name: "id")
}
model Screenshot {
id String @id @default(uuid())
gameId String
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
objectId String
private Boolean // if other users can see
createdAt DateTime @default(now()) @db.Timestamptz(0)
@@index([gameId, userId])
@@index([userId])
}
model Playtime {
gameId String
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
seconds Int // seconds user has spent playing the game
updatedAt DateTime @updatedAt @db.Timestamptz(6)
createdAt DateTime @default(now()) @db.Timestamptz(6)
@@id([gameId, userId])
@@index([userId])
}
model ObjectHash {
id String @id
hash String
}