completed game importing; partial work on version importing

This commit is contained in:
DecDuck
2024-10-11 00:37:08 +11:00
parent 718f5ba514
commit a7c33e7d43
42 changed files with 1499 additions and 281 deletions

View File

@ -0,0 +1,25 @@
/*
Warnings:
- A unique constraint covering the columns `[libraryBasePath]` on the table `Game` will be added. If there are existing duplicate values, this will fail.
- Added the required column `libraryBasePath` to the `Game` table without a default value. This is not possible if the table is not empty.
- Added the required column `versionOrder` to the `Game` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Game" ADD COLUMN "libraryBasePath" TEXT NOT NULL,
ADD COLUMN "versionOrder" TEXT NOT NULL;
-- CreateTable
CREATE TABLE "GameVersion" (
"gameId" TEXT NOT NULL,
"versionName" TEXT NOT NULL,
CONSTRAINT "GameVersion_pkey" PRIMARY KEY ("gameId","versionName")
);
-- CreateIndex
CREATE UNIQUE INDEX "Game_libraryBasePath_key" ON "Game"("libraryBasePath");
-- AddForeignKey
ALTER TABLE "GameVersion" ADD CONSTRAINT "GameVersion_gameId_fkey" FOREIGN KEY ("gameId") REFERENCES "Game"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -0,0 +1,25 @@
/*
Warnings:
- The `versionOrder` column on the `Game` table would be dropped and recreated. This will lead to data loss if there is data in the column.
- Changed the type of `platform` on the `Client` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
- Added the required column `launchCommand` to the `GameVersion` table without a default value. This is not possible if the table is not empty.
- Added the required column `platform` to the `GameVersion` table without a default value. This is not possible if the table is not empty.
- Added the required column `setupCommand` to the `GameVersion` table without a default value. This is not possible if the table is not empty.
*/
-- CreateEnum
CREATE TYPE "Platform" AS ENUM ('windows', 'linux');
-- AlterTable
ALTER TABLE "Client" DROP COLUMN "platform",
ADD COLUMN "platform" "Platform" NOT NULL;
-- AlterTable
ALTER TABLE "Game" DROP COLUMN "versionOrder",
ADD COLUMN "versionOrder" TEXT[];
-- AlterTable
ALTER TABLE "GameVersion" ADD COLUMN "launchCommand" TEXT NOT NULL,
ADD COLUMN "platform" "Platform" NOT NULL,
ADD COLUMN "setupCommand" TEXT NOT NULL;

View File

@ -0,0 +1,12 @@
/*
Warnings:
- Added the required column `metadataOriginalQuery` to the `Developer` table without a default value. This is not possible if the table is not empty.
- Added the required column `metadataOriginalQuery` to the `Publisher` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Developer" ADD COLUMN "metadataOriginalQuery" TEXT NOT NULL;
-- AlterTable
ALTER TABLE "Publisher" ADD COLUMN "metadataOriginalQuery" TEXT NOT NULL;

View File

@ -0,0 +1,18 @@
/*
Warnings:
- A unique constraint covering the columns `[metadataSource,metadataId,metadataOriginalQuery]` on the table `Developer` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[metadataSource,metadataId,metadataOriginalQuery]` on the table `Publisher` will be added. If there are existing duplicate values, this will fail.
*/
-- DropIndex
DROP INDEX "Developer_metadataSource_metadataId_key";
-- DropIndex
DROP INDEX "Publisher_metadataSource_metadataId_key";
-- CreateIndex
CREATE UNIQUE INDEX "Developer_metadataSource_metadataId_metadataOriginalQuery_key" ON "Developer"("metadataSource", "metadataId", "metadataOriginalQuery");
-- CreateIndex
CREATE UNIQUE INDEX "Publisher_metadataSource_metadataId_metadataOriginalQuery_key" ON "Publisher"("metadataSource", "metadataId", "metadataOriginalQuery");

View File

@ -45,6 +45,11 @@ enum ClientCapabilities {
DownloadAggregation
}
enum Platform {
Windows @map("windows")
Linux @map("linux")
}
// References a device
model Client {
id String @id @default(uuid())
@ -55,7 +60,7 @@ model Client {
capabilities ClientCapabilities[]
name String
platform String
platform Platform
lastConnected DateTime
}
@ -86,9 +91,9 @@ model Game {
mArt String[] // linked to objects in s3
mScreenshots String[] // linked to objects in s3
versionOrder String
versionOrder String[]
versions GameVersion[]
libraryBasePath String // Base dir for all the game versions
libraryBasePath String @unique // Base dir for all the game versions
@@unique([metadataSource, metadataId], name: "metadataKey")
}
@ -99,7 +104,9 @@ model GameVersion {
game Game @relation(fields: [gameId], references: [id])
versionName String // Sub directory for the game files
platform Platform
launchCommand String // Command to run to start. Platform-specific. Windows games on Linux will wrap this command in Proton/Wine
setupCommand String // Command to setup game (dependencies and such)
@@id([gameId, versionName])
}
@ -107,8 +114,9 @@ model GameVersion {
model Developer {
id String @id @default(uuid())
metadataSource MetadataSource
metadataId String
metadataSource MetadataSource
metadataId String
metadataOriginalQuery String
mName String
mShortDescription String
@ -119,14 +127,15 @@ model Developer {
games Game[]
@@unique([metadataSource, metadataId], name: "metadataKey")
@@unique([metadataSource, metadataId, metadataOriginalQuery], name: "metadataKey")
}
model Publisher {
id String @id @default(uuid())
metadataSource MetadataSource
metadataId String
metadataSource MetadataSource
metadataId String
metadataOriginalQuery String
mName String
mShortDescription String
@ -137,5 +146,5 @@ model Publisher {
games Game[]
@@unique([metadataSource, metadataId], name: "metadataKey")
@@unique([metadataSource, metadataId, metadataOriginalQuery], name: "metadataKey")
}