mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-16 09:41:13 +10:00
* feat: start of library backends * feat: update backend routes and create initializer * feat: add legacy library creation * fix: resolve frontend type errors * fix: runtime errors * fix: lint
This commit is contained in:
@ -0,0 +1,53 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `ClientPeerAPIConfiguration` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- CreateEnum
|
||||
CREATE TYPE "LibraryBackend" AS ENUM ('Filesystem');
|
||||
|
||||
-- AlterEnum
|
||||
ALTER TYPE "ClientCapabilities" ADD VALUE 'trackPlaytime';
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "ClientPeerAPIConfiguration" DROP CONSTRAINT "ClientPeerAPIConfiguration_clientId_fkey";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Screenshot" ALTER COLUMN "private" DROP DEFAULT;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "ClientPeerAPIConfiguration";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Library" (
|
||||
"id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"backend" "LibraryBackend" NOT NULL,
|
||||
"options" JSONB NOT NULL,
|
||||
|
||||
CONSTRAINT "Library_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Playtime" (
|
||||
"gameId" TEXT NOT NULL,
|
||||
"userId" TEXT NOT NULL,
|
||||
"seconds" INTEGER NOT NULL,
|
||||
"updatedAt" TIMESTAMPTZ(6) NOT NULL,
|
||||
"createdAt" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "Playtime_pkey" PRIMARY KEY ("gameId","userId")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "Playtime_userId_idx" ON "Playtime"("userId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "Screenshot_userId_idx" ON "Screenshot"("userId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Playtime" ADD CONSTRAINT "Playtime_gameId_fkey" FOREIGN KEY ("gameId") REFERENCES "Game"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Playtime" ADD CONSTRAINT "Playtime_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@ -0,0 +1,17 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `libraryBasePath` on the `Game` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- DropIndex
|
||||
DROP INDEX "Game_libraryBasePath_key";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Game" RENAME COLUMN "libraryBasePath" TO "libraryPath";
|
||||
|
||||
ALTER TABLE "Game" ADD COLUMN "libraryId" TEXT;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Game"
|
||||
ADD CONSTRAINT "Game_libraryId_fkey" FOREIGN KEY ("libraryId") REFERENCES "Library" ("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@ -0,0 +1,8 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[libraryId,libraryPath]` on the table `Game` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Game_libraryId_libraryPath_key" ON "Game"("libraryId", "libraryPath");
|
||||
@ -1,7 +1,7 @@
|
||||
model ApplicationSettings {
|
||||
timestamp DateTime @id @default(now())
|
||||
|
||||
metadataProviders String[]
|
||||
metadataProviders String[]
|
||||
|
||||
saveSlotCountLimit Int @default(5)
|
||||
saveSlotSizeLimit Float @default(10) // MB
|
||||
@ -13,3 +13,17 @@ enum Platform {
|
||||
Linux @map("linux")
|
||||
macOS @map("macos")
|
||||
}
|
||||
|
||||
enum LibraryBackend {
|
||||
Filesystem
|
||||
}
|
||||
|
||||
model Library {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
|
||||
backend LibraryBackend
|
||||
options Json
|
||||
|
||||
games Game[]
|
||||
}
|
||||
|
||||
@ -29,8 +29,13 @@ model Game {
|
||||
mImageCarouselObjectIds String[] // linked to below array
|
||||
mImageLibraryObjectIds String[] // linked to objects in s3
|
||||
|
||||
versions GameVersion[]
|
||||
libraryBasePath String @unique // Base dir for all the game versions
|
||||
versions GameVersion[]
|
||||
|
||||
// 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
|
||||
libraryId String?
|
||||
library Library? @relation(fields: [libraryId], references: [id])
|
||||
libraryPath String
|
||||
|
||||
collections CollectionEntry[]
|
||||
saves SaveSlot[]
|
||||
@ -42,6 +47,7 @@ model Game {
|
||||
publishers Company[] @relation(name: "publishers")
|
||||
|
||||
@@unique([metadataSource, metadataId], name: "metadataKey")
|
||||
@@unique([libraryId, libraryPath], name: "libraryKey")
|
||||
}
|
||||
|
||||
model GameRating {
|
||||
|
||||
Reference in New Issue
Block a user