mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-06-22 04:11:32 +10:00
Merge remote-tracking branch 'origin/develop' into db-store
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
-- AlterEnum
|
||||
ALTER TYPE "ClientCapabilities" ADD VALUE 'save';
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "SaveSlot" (
|
||||
"gameId" TEXT NOT NULL,
|
||||
"userId" TEXT NOT NULL,
|
||||
"index" INTEGER NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"playtime" DOUBLE PRECISION NOT NULL,
|
||||
"lastUsedClientId" TEXT NOT NULL,
|
||||
"data" TEXT[],
|
||||
|
||||
CONSTRAINT "SaveSlot_pkey" PRIMARY KEY ("gameId","userId","index")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "SaveSlot" ADD CONSTRAINT "SaveSlot_gameId_fkey" FOREIGN KEY ("gameId") REFERENCES "Game"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "SaveSlot" ADD CONSTRAINT "SaveSlot_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "SaveSlot" ADD CONSTRAINT "SaveSlot_lastUsedClientId_fkey" FOREIGN KEY ("lastUsedClientId") REFERENCES "Client"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "ApplicationSettings" ADD COLUMN "saveSlotCountLimit" INTEGER NOT NULL DEFAULT 5,
|
||||
ADD COLUMN "saveSlotSizeLimit" DOUBLE PRECISION NOT NULL DEFAULT 10;
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- The values [save] on the enum `ClientCapabilities` will be removed. If these variants are still used in the database, this will fail.
|
||||
|
||||
*/
|
||||
-- AlterEnum
|
||||
BEGIN;
|
||||
CREATE TYPE "ClientCapabilities_new" AS ENUM ('peerAPI', 'userStatus', 'cloudSaves');
|
||||
ALTER TABLE "Client" ALTER COLUMN "capabilities" TYPE "ClientCapabilities_new"[] USING ("capabilities"::text::"ClientCapabilities_new"[]);
|
||||
ALTER TYPE "ClientCapabilities" RENAME TO "ClientCapabilities_old";
|
||||
ALTER TYPE "ClientCapabilities_new" RENAME TO "ClientCapabilities";
|
||||
DROP TYPE "ClientCapabilities_old";
|
||||
COMMIT;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "ApplicationSettings" ADD COLUMN "saveSlotHistoryLimit" INTEGER NOT NULL DEFAULT 3;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "SaveSlot" ALTER COLUMN "playtime" SET DEFAULT 0;
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `data` on the `SaveSlot` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "SaveSlot" DROP COLUMN "data",
|
||||
ADD COLUMN "history" TEXT[],
|
||||
ADD COLUMN "historyChecksums" TEXT[];
|
||||
@@ -3,6 +3,10 @@ model ApplicationSettings {
|
||||
|
||||
enabledAuthencationMechanisms AuthMec[]
|
||||
metadataProviders String[]
|
||||
|
||||
saveSlotCountLimit Int @default(5)
|
||||
saveSlotSizeLimit Float @default(10) // MB
|
||||
saveSlotHistoryLimit Int @default(3)
|
||||
}
|
||||
|
||||
enum Platform {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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
|
||||
@@ -16,6 +17,8 @@ model Client {
|
||||
lastConnected DateTime
|
||||
|
||||
peerAPI ClientPeerAPIConfiguration?
|
||||
|
||||
lastAccessedSaves SaveSlot[]
|
||||
}
|
||||
|
||||
model ClientPeerAPIConfiguration {
|
||||
|
||||
@@ -31,9 +31,10 @@ model Game {
|
||||
mImageLibrary String[] // linked to objects in s3
|
||||
|
||||
versions GameVersion[]
|
||||
libraryBasePath String @unique // Base dir for all the game versions
|
||||
|
||||
libraryBasePath String @unique // Base dir for all the game versions
|
||||
|
||||
collections CollectionEntry[]
|
||||
saves SaveSlot[]
|
||||
|
||||
@@unique([metadataSource, metadataId], name: "metadataKey")
|
||||
}
|
||||
@@ -48,9 +49,9 @@ model GameVersion {
|
||||
|
||||
platform Platform
|
||||
|
||||
launchCommand String @default("") // Command to run to start. Platform-specific. Windows games on Linux will wrap this command in Proton/Wine
|
||||
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)
|
||||
setupCommand String @default("") // Command to setup game (dependencies and such)
|
||||
setupArgs String[]
|
||||
onlySetup Boolean @default(false)
|
||||
|
||||
@@ -64,6 +65,26 @@ model GameVersion {
|
||||
@@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())
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ model User {
|
||||
|
||||
tokens APIToken[]
|
||||
sessions Session[]
|
||||
|
||||
saves SaveSlot[]
|
||||
}
|
||||
|
||||
model Notification {
|
||||
|
||||
Reference in New Issue
Block a user