fix: prisma migrations in docker

i hate prisma so so so so so much
This commit is contained in:
DecDuck
2025-04-20 18:12:29 +10:00
parent ec6d38d7af
commit 0a270b267c
12 changed files with 49 additions and 50 deletions

View File

@ -1,16 +0,0 @@
model ApplicationSettings {
timestamp DateTime @id @default(now())
enabledAuthencationMechanisms AuthMec[]
metadataProviders String[]
saveSlotCountLimit Int @default(5)
saveSlotSizeLimit Float @default(10) // MB
saveSlotHistoryLimit Int @default(3)
}
enum Platform {
Windows @map("windows")
Linux @map("linux")
macOS @map("macos")
}

View File

@ -1,67 +0,0 @@
enum AuthMec {
Simple
}
model LinkedAuthMec {
userId String
mec AuthMec
enabled Boolean @default(true)
version Int @default(1)
credentials Json
user User @relation(fields: [userId], references: [id])
@@id([userId, mec])
}
model Invitation {
id String @id @default(uuid())
isAdmin Boolean @default(false)
username String?
email String?
expires DateTime
}
enum APITokenMode {
User
System
Client
}
model APIToken {
id String @id @default(uuid())
token String @unique @default(uuid())
mode APITokenMode
name String
userId String?
user User? @relation(fields: [userId], references: [id])
clientId String?
client Client? @relation(fields: [clientId], references: [id], onDelete: Cascade)
acls String[]
@@index([token])
}
model Certificate {
id String @id @default(uuid())
privateKey String
certificate String
blacklisted Boolean @default(false)
}
model Session {
token String @id
expiresAt DateTime
userId String
user User? @relation(fields: [userId], references: [id])
data Json // misc extra data
}

View File

@ -1,32 +0,0 @@
enum ClientCapabilities {
PeerAPI @map("peerAPI") // other clients can use the HTTP API to P2P with this client
UserStatus @map("userStatus") // this client can report this user's status (playing, online, etc etc)
CloudSaves @map("cloudSaves") // ability to save to save slots
}
// References a device
model Client {
id String @id @default(uuid())
userId String
user User @relation(fields: [userId], references: [id])
capabilities ClientCapabilities[]
name String
platform Platform
lastConnected DateTime
peerAPI ClientPeerAPIConfiguration?
lastAccessedSaves SaveSlot[]
tokens APIToken[]
}
model ClientPeerAPIConfiguration {
id String @id @default(uuid())
clientId String @unique
client Client @relation(fields: [clientId], references: [id])
endpoints String[]
}

View File

@ -1,20 +0,0 @@
model Collection {
id String @id @default(uuid())
name String
isDefault Boolean @default(false)
userId String
user User @relation(fields: [userId], references: [id])
entries CollectionEntry[]
}
model CollectionEntry {
collectionId String
collection Collection @relation(fields: [collectionId], references: [id], onDelete: Cascade)
gameId String
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
@@id([collectionId, gameId])
}

View File

@ -1,129 +0,0 @@
enum MetadataSource {
Manual
GiantBomb
PCGamingWiki
IGDB
}
model Game {
id String @id @default(uuid())
metadataSource MetadataSource
metadataId String
created DateTime @default(now())
// Any field prefixed with m is filled in from metadata
// Acts as a cache so we can search and filter it
mName String // Name of game
mShortDescription String // Short description
mDescription String // Supports markdown
mDevelopers Developer[]
mPublishers Publisher[]
mReleased DateTime // When the game was released
mReviewCount Int
mReviewRating Float // 0 to 1
mIconId String // linked to objects in s3
mBannerId String // linked to objects in s3
mCoverId String
mImageCarousel String[] // linked to below array
mImageLibrary String[] // linked to objects in s3
versions GameVersion[]
libraryBasePath String @unique // Base dir for all the game versions
collections CollectionEntry[]
saves SaveSlot[]
@@unique([metadataSource, metadataId], name: "metadataKey")
}
// A particular set of files that relate to the version
model GameVersion {
gameId String
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
versionName String // Sub directory for the game files
created DateTime @default(now())
platform Platform
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)
umuIdOverride String?
dropletManifest Json // Results from droplet
versionIndex Int
delta Boolean @default(false)
@@id([gameId, versionName])
}
// 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])
history String[] // list of objects
historyChecksums String[] // list of hashes
@@id([gameId, userId, index], name: "id")
}
model Developer {
id String @id @default(uuid())
metadataSource MetadataSource
metadataId String
metadataOriginalQuery String
mName String
mShortDescription String
mDescription String
mLogo String
mBanner String
mWebsite String
games Game[]
@@unique([metadataSource, metadataId, metadataOriginalQuery], name: "metadataKey")
}
model Publisher {
id String @id @default(uuid())
metadataSource MetadataSource
metadataId String
metadataOriginalQuery String
mName String
mShortDescription String
mDescription String
mLogo String
mBanner String
mWebsite String
games Game[]
@@unique([metadataSource, metadataId, metadataOriginalQuery], name: "metadataKey")
}
model ObjectHash {
id String @id
hash String
}

View File

@ -1,21 +0,0 @@
model Tag {
id String @id @default(uuid())
name String @unique
articles Article[]
}
model Article {
id String @id @default(uuid())
title String
description String
content String @db.Text
tags Tag[]
image String? // Object ID
publishedAt DateTime @default(now())
author User? @relation(fields: [authorId], references: [id]) // Optional, if no user, it's a system post
authorId String?
}

View File

@ -1,15 +0,0 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
generator client {
provider = "prisma-client-js"
previewFeatures = ["prismaSchemaFolder", "omitApi", "fullTextSearchPostgres"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

View File

@ -1,37 +0,0 @@
model User {
id String @id @default(uuid())
username String @unique
admin Boolean @default(false)
enabled Boolean @default(true)
email String
displayName String
profilePicture String // Object
authMecs LinkedAuthMec[]
clients Client[]
notifications Notification[]
collections Collection[]
articles Article[]
tokens APIToken[]
sessions Session[]
saves SaveSlot[]
}
model Notification {
id String @id @default(uuid())
nonce String? @unique
userId String
user User @relation(fields: [userId], references: [id])
created DateTime @default(now())
title String
description String
actions String[]
read Boolean @default(false)
}