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

This commit is contained in:
DecDuck
2025-08-20 20:35:50 +10:00
parent 6853383e86
commit 322af0b4ca
125 changed files with 1384 additions and 1837 deletions

View File

@ -51,7 +51,11 @@
@update="() => updateVersionOrder()" @update="() => updateVersionOrder()"
> >
<template <template
#item="{ element: item }: { element: GameVersionModel }" #item="{
element: item,
}: {
element: VersionModel & { gameVersion: GameVersionModel };
}"
> >
<div <div
class="w-full inline-flex items-center px-4 py-2 bg-zinc-800 rounded justify-between" class="w-full inline-flex items-center px-4 py-2 bg-zinc-800 rounded justify-between"
@ -60,7 +64,11 @@
{{ item.versionName }} {{ item.versionName }}
</div> </div>
<div class="text-zinc-400"> <div class="text-zinc-400">
{{ item.delta ? $t("library.admin.version.delta") : "" }} {{
item.gameVersion.delta
? $t("library.admin.version.delta")
: ""
}}
</div> </div>
<div class="inline-flex items-center gap-x-2"> <div class="inline-flex items-center gap-x-2">
<component <component
@ -70,7 +78,7 @@
<Bars3Icon <Bars3Icon
class="cursor-move w-6 h-6 text-zinc-400 handle" class="cursor-move w-6 h-6 text-zinc-400 handle"
/> />
<button @click="() => deleteVersion(item.versionName)"> <button @click="() => deleteVersion(item.versionId)">
<TrashIcon class="w-5 h-5 text-red-600" /> <TrashIcon class="w-5 h-5 text-red-600" />
</button> </button>
</div> </div>
@ -112,7 +120,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type { GameModel, GameVersionModel } from "~/prisma/client/models"; import type {
GameModel,
GameVersionModel,
VersionModel,
} from "~/prisma/client/models";
import { Bars3Icon, TrashIcon } from "@heroicons/vue/24/solid"; import { Bars3Icon, TrashIcon } from "@heroicons/vue/24/solid";
import type { SerializeObject } from "nitropack"; import type { SerializeObject } from "nitropack";
import type { H3Error } from "h3"; import type { H3Error } from "h3";
@ -130,7 +142,9 @@ const canImport = computed(
() => hasDeleted.value || props.unimportedVersions.length > 0, () => hasDeleted.value || props.unimportedVersions.length > 0,
); );
type GameAndVersions = GameModel & { versions: GameVersionModel[] }; type GameAndVersions = GameModel & {
versions: (VersionModel & { gameVersion: GameVersionModel })[];
};
const game = defineModel<SerializeObject<GameAndVersions>>() as Ref< const game = defineModel<SerializeObject<GameAndVersions>>() as Ref<
SerializeObject<GameAndVersions> SerializeObject<GameAndVersions>
>; >;
@ -146,7 +160,7 @@ async function updateVersionOrder() {
method: "PATCH", method: "PATCH",
body: { body: {
id: game.value.id, id: game.value.id,
versions: game.value.versions.map((e) => e.versionName), versions: game.value.versions.map((e) => e.versionId),
}, },
}); });
game.value.versions = newVersions; game.value.versions = newVersions;
@ -165,32 +179,18 @@ async function updateVersionOrder() {
} }
} }
async function deleteVersion(versionName: string) { async function deleteVersion(versionId: string) {
try {
await $dropFetch("/api/v1/admin/game/version", { await $dropFetch("/api/v1/admin/game/version", {
method: "DELETE", method: "DELETE",
body: { body: {
id: game.value.id, id: versionId,
versionName: versionName,
}, },
failTitle: "Failed to delete version.",
}); });
game.value.versions.splice( game.value.versions.splice(
game.value.versions.findIndex((e) => e.versionName === versionName), game.value.versions.findIndex((e) => e.versionId === versionId),
1, 1,
); );
hasDeleted.value = true; hasDeleted.value = true;
} catch (e) {
createModal(
ModalType.Notification,
{
title: t("errors.version.delete.title"),
description: t("errors.version.delete.desc", {
error: (e as H3Error)?.statusMessage ?? t("errors.unknown"),
}),
buttonText: t("common.close"),
},
(e, c) => c(),
);
}
} }
</script> </script>

View File

@ -32,7 +32,7 @@
class="absolute z-10 mt-1 max-h-56 w-full overflow-auto rounded-md bg-zinc-900 py-1 text-base shadow-lg ring-1 ring-zinc-950 ring-opacity-5 focus:outline-none sm:text-sm" class="absolute z-10 mt-1 max-h-56 w-full overflow-auto rounded-md bg-zinc-900 py-1 text-base shadow-lg ring-1 ring-zinc-950 ring-opacity-5 focus:outline-none sm:text-sm"
> >
<ListboxOption <ListboxOption
v-for="[name, value] in Object.entries(values)" v-for="[name, value] in values"
:key="value" :key="value"
v-slot="{ active, selected }" v-slot="{ active, selected }"
as="template" as="template"
@ -82,10 +82,11 @@ import {
ListboxOptions, ListboxOptions,
} from "@headlessui/vue"; } from "@headlessui/vue";
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid"; import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
import { Platform } from "~/prisma/client/enums";
const model = defineModel<PlatformClient | undefined>(); const model = defineModel<Platform | undefined>();
const typedModel = computed<PlatformClient | null>({ const typedModel = computed<Platform | null>({
get() { get() {
return model.value || null; return model.value || null;
}, },
@ -95,5 +96,5 @@ const typedModel = computed<PlatformClient | null>({
}, },
}); });
const values = Object.fromEntries(Object.entries(PlatformClient)); const values = Object.entries(Platform);
</script> </script>

View File

@ -361,6 +361,7 @@ import {
import type { SerializeObject } from "nitropack"; import type { SerializeObject } from "nitropack";
import type { GameModel, GameTagModel } from "~/prisma/client/models"; import type { GameModel, GameTagModel } from "~/prisma/client/models";
import MultiItemSelector from "./MultiItemSelector.vue"; import MultiItemSelector from "./MultiItemSelector.vue";
import { Platform } from "~/prisma/client/enums";
const { showGamePanelTextDecoration } = await $dropFetch(`/api/v1/settings`); const { showGamePanelTextDecoration } = await $dropFetch(`/api/v1/settings`);
const mobileFiltersOpen = ref(false); const mobileFiltersOpen = ref(false);
@ -407,7 +408,7 @@ const options: Array<StoreFilterOption> = [
name: "Platform", name: "Platform",
param: "platform", param: "platform",
multiple: true, multiple: true,
options: Object.values(PlatformClient).map((e) => ({ name: e, param: e })), options: Object.values(Platform).map((e) => ({ name: e, param: e })),
}, },
...(props.extraOptions ?? []), ...(props.extraOptions ?? []),
]; ];

View File

@ -1,8 +1,8 @@
import { IconsLinuxLogo, IconsWindowsLogo, IconsMacLogo } from "#components"; import { IconsLinuxLogo, IconsWindowsLogo, IconsMacLogo } from "#components";
import { PlatformClient } from "./types"; import { Platform } from "~/prisma/client/enums";
export const PLATFORM_ICONS = { export const PLATFORM_ICONS = {
[PlatformClient.Linux]: IconsLinuxLogo, [Platform.Linux]: IconsLinuxLogo,
[PlatformClient.Windows]: IconsWindowsLogo, [Platform.Windows]: IconsWindowsLogo,
[PlatformClient.macOS]: IconsMacLogo, [Platform.macOS]: IconsMacLogo,
}; };

View File

@ -11,9 +11,3 @@ export type QuickActionNav = {
notifications?: Ref<number>; notifications?: Ref<number>;
action: () => Promise<void>; action: () => Promise<void>;
}; };
export enum PlatformClient {
Windows = "Windows",
Linux = "Linux",
macOS = "macOS",
}

View File

@ -293,8 +293,8 @@
"advancedOptions": "Advanced options", "advancedOptions": "Advanced options",
"import": "Import version", "import": "Import version",
"installDir": "(install_dir)/", "installDir": "(install_dir)/",
"launchCmd": "Launch executable/command", "launchCmd": "Launch executables/commands",
"launchDesc": "Executable to launch the game", "launchDesc": "Executables to launch the game",
"launchPlaceholder": "game.exe", "launchPlaceholder": "game.exe",
"loadingVersion": "Loading version metadata…", "loadingVersion": "Loading version metadata…",
"noAdv": "No advanced options for this configuration.", "noAdv": "No advanced options for this configuration.",

View File

@ -47,7 +47,7 @@
"nuxt-security": "2.2.0", "nuxt-security": "2.2.0",
"pino": "^9.7.0", "pino": "^9.7.0",
"pino-pretty": "^13.0.0", "pino-pretty": "^13.0.0",
"prisma": "^6.11.1", "prisma": "^6.14.0",
"sanitize-filename": "^1.6.3", "sanitize-filename": "^1.6.3",
"semver": "^7.7.1", "semver": "^7.7.1",
"stream-mime-type": "^2.0.0", "stream-mime-type": "^2.0.0",

View File

@ -1,8 +1,9 @@
<template> <template>
<div class="flex flex-col gap-y-4 max-w-lg"> <div class="flex flex-col gap-y-4">
<Listbox <Listbox
as="div" as="div"
:model-value="currentlySelectedVersion" :model-value="currentlySelectedVersion"
class="max-w-lg"
@update:model-value="(value) => updateCurrentlySelectedVersion(value)" @update:model-value="(value) => updateCurrentlySelectedVersion(value)"
> >
<ListboxLabel class="block text-sm font-medium leading-6 text-zinc-100">{{ <ListboxLabel class="block text-sm font-medium leading-6 text-zinc-100">{{
@ -73,9 +74,32 @@
</div> </div>
</Listbox> </Listbox>
<div v-if="versionGuesses" class="flex flex-col gap-8"> <div v-if="versionGuesses" class="flex flex-col gap-4">
<!-- setup executable --> <!-- version name -->
<div> <div class="max-w-lg">
<label
for="startup"
class="block text-sm font-medium leading-6 text-zinc-100"
>Version name</label
>
<p class="text-zinc-400 text-xs">
Shown to users when selecting what version to install.
</p>
<div class="mt-2">
<input
id="name"
v-model="versionSettings.name"
name="name"
type="text"
required
placeholder="my version name"
class="block w-full rounded-md border-0 py-1.5 px-3 bg-zinc-950 disabled:bg-zinc-900/80 text-zinc-100 disabled:text-zinc-400 shadow-sm ring-1 ring-inset ring-zinc-800 disabled:ring-zinc-800 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm sm:leading-6"
/>
</div>
</div>
<!-- setup command -->
<div class="max-w-lg">
<label <label
for="startup" for="startup"
class="block text-sm font-medium leading-6 text-zinc-100" class="block text-sm font-medium leading-6 text-zinc-100"
@ -144,7 +168,7 @@
> >
{{ guess.filename }} {{ guess.filename }}
<component <component
:is="PLATFORM_ICONS[guess.platform as PlatformClient]" :is="PLATFORM_ICONS[guess.platform as Platform]"
class="size-5" class="size-5"
/> />
</span> </span>
@ -205,7 +229,7 @@
</div> </div>
</div> </div>
<!-- setup mode --> <!-- setup mode -->
<SwitchGroup as="div" class="flex items-center justify-between"> <SwitchGroup as="div" class="max-w-lg flex items-center justify-between">
<span class="flex flex-grow flex-col"> <span class="flex flex-grow flex-col">
<SwitchLabel <SwitchLabel
as="span" as="span"
@ -233,7 +257,8 @@
/> />
</Switch> </Switch>
</SwitchGroup> </SwitchGroup>
<div class="relative"> <!-- launch commands -->
<div class="relative max-w-3xl">
<label <label
for="startup" for="startup"
class="block text-sm font-medium leading-6 text-zinc-100" class="block text-sm font-medium leading-6 text-zinc-100"
@ -242,9 +267,23 @@
<p class="text-zinc-400 text-xs"> <p class="text-zinc-400 text-xs">
{{ $t("library.admin.import.version.launchDesc") }} {{ $t("library.admin.import.version.launchDesc") }}
</p> </p>
<div class="mt-2"> <div class="mt-2 ml-4 flex flex-col gap-y-2 items-start">
<div <div
class="flex w-fit rounded-md shadow-sm bg-zinc-950 ring-1 ring-inset ring-zinc-800 focus-within:ring-2 focus-within:ring-inset focus-within:ring-blue-600" v-for="(launch, launchIdx) in versionSettings.launches"
:key="launchIdx"
class="inline-flex items-center gap-x-2"
>
<input
id="launch-name"
v-model="launch.name"
type="text"
name="launch-name"
class="block w-full rounded-md border-0 py-1.5 px-3 bg-zinc-950 disabled:bg-zinc-900/80 text-zinc-100 disabled:text-zinc-400 shadow-sm ring-1 ring-inset ring-zinc-800 disabled:ring-zinc-800 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm sm:leading-6"
placeholder="My Launch Command"
/>
<div
class="flex w-full rounded-md shadow-sm bg-zinc-950 ring-1 ring-inset ring-zinc-800 focus-within:ring-2 focus-within:ring-inset focus-within:ring-blue-600"
> >
<span <span
class="flex select-none items-center pl-3 text-zinc-500 sm:text-sm" class="flex select-none items-center pl-3 text-zinc-500 sm:text-sm"
@ -252,9 +291,9 @@
> >
<Combobox <Combobox
as="div" as="div"
:value="versionSettings.launch" :value="launch.launchCommand"
nullable nullable
@update:model-value="(v) => updateLaunchCommand(v)" @update:model-value="(v) => updateLaunchCommand(launchIdx, v)"
> >
<div class="relative"> <div class="relative">
<ComboboxInput <ComboboxInput
@ -301,7 +340,7 @@
> >
{{ guess.filename }} {{ guess.filename }}
<component <component
:is="PLATFORM_ICONS[guess.platform as PlatformClient]" :is="PLATFORM_ICONS[guess.platform as Platform]"
class="size-5" class="size-5"
/> />
</span> </span>
@ -331,7 +370,10 @@
]" ]"
> >
<span <span
:class="['block truncate', selected && 'font-semibold']" :class="[
'block truncate',
selected && 'font-semibold',
]"
> >
{{ $t("chars.quoted", { text: launchProcessQuery }) }} {{ $t("chars.quoted", { text: launchProcessQuery }) }}
</span> </span>
@ -352,13 +394,43 @@
</Combobox> </Combobox>
<input <input
id="startup" id="startup"
v-model="versionSettings.launchArgs" v-model="launch.launchArgs"
type="text" type="text"
name="startup" name="startup"
class="border-l border-zinc-700 block flex-1 border-0 py-1.5 pl-2 bg-transparent text-zinc-100 placeholder:text-zinc-400 focus:ring-0 sm:text-sm sm:leading-6" class="border-l border-zinc-700 block flex-1 border-0 py-1.5 pl-2 bg-transparent text-zinc-100 placeholder:text-zinc-400 focus:ring-0 sm:text-sm sm:leading-6"
placeholder="--launch" placeholder="--launch"
/> />
</div> </div>
<button
class="transition bg-zinc-800 rounded-sm aspect-square p-1 text-zinc-600 hover:text-red-600 hover:bg-red-600/20"
@click="() => versionSettings.launches!.splice(launchIdx, 1)"
>
<TrashIcon class="size-5" />
</button>
</div>
<p
v-if="versionSettings.launches!.length == 0"
class="uppercase font-display font-bold text-zinc-500 text-xs"
>
No launch commands
</p>
<LoadingButton
:loading="false"
class="inline-flex items-center gap-x-4"
@click="
() =>
versionSettings.launches!.push({
name: '',
description: '',
launchCommand: '',
launchArgs: '',
})
"
>
Add new <PlusIcon class="size-5" />
</LoadingButton>
</div> </div>
<div <div
v-if="versionSettings.onlySetup" v-if="versionSettings.onlySetup"
@ -366,10 +438,10 @@
/> />
</div> </div>
<PlatformSelector v-model="versionSettings.platform"> <PlatformSelector v-model="versionSettings.platform" class="max-w-lg">
{{ $t("library.admin.import.version.platform") }} {{ $t("library.admin.import.version.platform") }}
</PlatformSelector> </PlatformSelector>
<SwitchGroup as="div" class="flex items-center justify-between"> <SwitchGroup as="div" class="flex items-center justify-between max-w-lg">
<span class="flex flex-grow flex-col"> <span class="flex flex-grow flex-col">
<SwitchLabel <SwitchLabel
as="span" as="span"
@ -398,7 +470,7 @@
/> />
</Switch> </Switch>
</SwitchGroup> </SwitchGroup>
<Disclosure v-slot="{ open }" as="div" class="py-2"> <Disclosure v-slot="{ open }" as="div" class="py-2 max-w-lg">
<dt> <dt>
<DisclosureButton <DisclosureButton
class="border-b border-zinc-600 pb-2 flex w-full items-start justify-between text-left text-zinc-100" class="border-b border-zinc-600 pb-2 flex w-full items-start justify-between text-left text-zinc-100"
@ -418,7 +490,7 @@
> >
<!-- UMU launcher configuration --> <!-- UMU launcher configuration -->
<div <div
v-if="versionSettings.platform == PlatformClient.Windows" v-if="versionSettings.platform == 'Linux'"
class="flex flex-col gap-y-4" class="flex flex-col gap-y-4"
> >
<SwitchGroup as="div" class="flex items-center justify-between"> <SwitchGroup as="div" class="flex items-center justify-between">
@ -467,7 +539,7 @@
required required
:disabled="!umuIdEnabled" :disabled="!umuIdEnabled"
placeholder="umu-starcitizen" placeholder="umu-starcitizen"
class="block w-full rounded-md border-0 py-1.5 px-3 bg-zinc-950 disabled:bg-zinc-900/80 text-zinc-100 disabled:text-zinc-400 shadow-sm ring-1 ring-inset ring-zinc-700 disabled:ring-zinc-800 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm sm:leading-6" class="block w-full rounded-md border-0 py-1.5 px-3 bg-zinc-950 disabled:bg-zinc-900/80 text-zinc-100 disabled:text-zinc-400 shadow-sm ring-1 ring-inset ring-zinc-800 disabled:ring-zinc-800 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm sm:leading-6"
/> />
</div> </div>
</div> </div>
@ -547,7 +619,11 @@ import {
} from "@headlessui/vue"; } from "@headlessui/vue";
import { XCircleIcon } from "@heroicons/vue/16/solid"; import { XCircleIcon } from "@heroicons/vue/16/solid";
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid"; import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
import { PlusIcon, TrashIcon } from "@heroicons/vue/24/outline";
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/vue/24/solid"; import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/vue/24/solid";
import type { SerializeObject } from "nitropack";
import type { Platform } from "~/prisma/client/enums";
import type { ImportVersion } from "~/server/api/v1/admin/import/version/index.post";
definePageMeta({ definePageMeta({
layout: "admin", layout: "admin",
@ -561,30 +637,13 @@ const versions = await $dropFetch(
`/api/v1/admin/import/version?id=${encodeURIComponent(gameId)}`, `/api/v1/admin/import/version?id=${encodeURIComponent(gameId)}`,
); );
const currentlySelectedVersion = ref(-1); const currentlySelectedVersion = ref(-1);
const versionSettings = ref<{ const versionSettings = ref<Partial<typeof ImportVersion.infer>>({
platform: PlatformClient | undefined; id: gameId,
launches: [],
onlySetup: boolean;
launch: string;
launchArgs: string;
setup: string;
setupArgs: string;
delta: boolean;
umuId: string;
}>({
platform: undefined,
launch: "",
launchArgs: "",
setup: "",
setupArgs: "",
delta: false,
onlySetup: false,
umuId: "",
}); });
const versionGuesses = const versionGuesses =
ref<Array<{ platform: PlatformClient; filename: string }>>(); ref<Array<SerializeObject<{ platform: Platform; filename: string }>>>();
const launchProcessQuery = ref(""); const launchProcessQuery = ref("");
const setupProcessQuery = ref(""); const setupProcessQuery = ref("");
@ -599,8 +658,8 @@ const setupFilteredVersionGuesses = computed(() =>
), ),
); );
function updateLaunchCommand(value: string) { function updateLaunchCommand(idx: number, value: string) {
versionSettings.value.launch = value; versionSettings.value.launches![idx].launchCommand = value;
autosetPlatform(value); autosetPlatform(value);
} }
@ -646,8 +705,9 @@ async function updateCurrentlySelectedVersion(value: number) {
); );
versionGuesses.value = results.map((e) => ({ versionGuesses.value = results.map((e) => ({
...e, ...e,
platform: e.platform as PlatformClient, platform: e.platform as Platform,
})); }));
versionSettings.value.name = version;
} }
async function startImport() { async function startImport() {

View File

@ -245,7 +245,6 @@
import { ArrowTopRightOnSquareIcon } from "@heroicons/vue/24/outline"; import { ArrowTopRightOnSquareIcon } from "@heroicons/vue/24/outline";
import { StarIcon } from "@heroicons/vue/24/solid"; import { StarIcon } from "@heroicons/vue/24/solid";
import { micromark } from "micromark"; import { micromark } from "micromark";
import type { PlatformClient } from "~/composables/types";
const route = useRoute(); const route = useRoute();
const gameId = route.params.id.toString(); const gameId = route.params.id.toString();
@ -279,7 +278,7 @@ const descriptionHTML = micromark(game.mDescription);
const showReadMore = previewHTML != descriptionHTML; const showReadMore = previewHTML != descriptionHTML;
const platforms = game.versions const platforms = game.versions
.map((e) => e.platform as PlatformClient) .map((e) => e.platform)
.flat() .flat()
.filter((e, i, u) => u.indexOf(e) === i); .filter((e, i, u) => u.indexOf(e) === i);

View File

@ -1,25 +0,0 @@
-- CreateEnum
CREATE TYPE "AuthMec" AS ENUM ('Simple');
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"username" TEXT NOT NULL,
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "LinkedAuthMec" (
"userId" TEXT NOT NULL,
"mec" "AuthMec" NOT NULL,
"credentials" TEXT[],
CONSTRAINT "LinkedAuthMec_pkey" PRIMARY KEY ("userId","mec")
);
-- CreateIndex
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");
-- AddForeignKey
ALTER TABLE "LinkedAuthMec" ADD CONSTRAINT "LinkedAuthMec_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -1,9 +0,0 @@
/*
Warnings:
- Changed the type of `credentials` on the `LinkedAuthMec` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
*/
-- AlterTable
ALTER TABLE "LinkedAuthMec" DROP COLUMN "credentials",
ADD COLUMN "credentials" JSONB NOT NULL;

View File

@ -1,76 +0,0 @@
-- CreateEnum
CREATE TYPE "MetadataSource" AS ENUM ('Custom', 'GiantBomb');
-- CreateTable
CREATE TABLE "Game" (
"id" TEXT NOT NULL,
"metadataSource" "MetadataSource" NOT NULL,
"metadataId" TEXT NOT NULL,
"mName" TEXT NOT NULL,
"mShortDescription" TEXT NOT NULL,
"mDescription" TEXT NOT NULL,
"mReviewCount" INTEGER NOT NULL,
"mReviewRating" DOUBLE PRECISION NOT NULL,
"mIconId" TEXT NOT NULL,
"mBannerId" TEXT NOT NULL,
"mArt" TEXT[],
"mScreenshots" TEXT[],
CONSTRAINT "Game_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Developer" (
"id" TEXT NOT NULL,
"metadataSource" "MetadataSource" NOT NULL,
"metadataId" TEXT NOT NULL,
"mName" TEXT NOT NULL,
CONSTRAINT "Developer_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Publisher" (
"id" TEXT NOT NULL,
"metadataSource" "MetadataSource" NOT NULL,
"metadataId" TEXT NOT NULL,
"mName" TEXT NOT NULL,
CONSTRAINT "Publisher_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "_GameToPublisher" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL
);
-- CreateTable
CREATE TABLE "_DeveloperToGame" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL
);
-- CreateIndex
CREATE UNIQUE INDEX "_GameToPublisher_AB_unique" ON "_GameToPublisher"("A", "B");
-- CreateIndex
CREATE INDEX "_GameToPublisher_B_index" ON "_GameToPublisher"("B");
-- CreateIndex
CREATE UNIQUE INDEX "_DeveloperToGame_AB_unique" ON "_DeveloperToGame"("A", "B");
-- CreateIndex
CREATE INDEX "_DeveloperToGame_B_index" ON "_DeveloperToGame"("B");
-- AddForeignKey
ALTER TABLE "_GameToPublisher" ADD CONSTRAINT "_GameToPublisher_A_fkey" FOREIGN KEY ("A") REFERENCES "Game"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_GameToPublisher" ADD CONSTRAINT "_GameToPublisher_B_fkey" FOREIGN KEY ("B") REFERENCES "Publisher"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_DeveloperToGame" ADD CONSTRAINT "_DeveloperToGame_A_fkey" FOREIGN KEY ("A") REFERENCES "Developer"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_DeveloperToGame" ADD CONSTRAINT "_DeveloperToGame_B_fkey" FOREIGN KEY ("B") REFERENCES "Game"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

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

View File

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

View File

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

View File

@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "admin" BOOLEAN NOT NULL DEFAULT false;

View File

@ -1,15 +0,0 @@
-- CreateEnum
CREATE TYPE "ClientCapabilities" AS ENUM ('DownloadAggregation');
-- CreateTable
CREATE TABLE "Client" (
"sharedToken" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"endpoint" TEXT NOT NULL,
"capabilities" "ClientCapabilities"[],
CONSTRAINT "Client_pkey" PRIMARY KEY ("sharedToken")
);
-- AddForeignKey
ALTER TABLE "Client" ADD CONSTRAINT "Client_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -1,19 +0,0 @@
/*
Warnings:
- The primary key for the `Client` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `sharedToken` on the `Client` table. All the data in the column will be lost.
- The required column `id` was added to the `Client` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required.
- Added the required column `lastConnected` to the `Client` table without a default value. This is not possible if the table is not empty.
- Added the required column `name` to the `Client` table without a default value. This is not possible if the table is not empty.
- Added the required column `platform` to the `Client` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Client" DROP CONSTRAINT "Client_pkey",
DROP COLUMN "sharedToken",
ADD COLUMN "id" TEXT NOT NULL,
ADD COLUMN "lastConnected" TIMESTAMP(3) NOT NULL,
ADD COLUMN "name" TEXT NOT NULL,
ADD COLUMN "platform" TEXT NOT NULL,
ADD CONSTRAINT "Client_pkey" PRIMARY KEY ("id");

View File

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

View File

@ -1,25 +0,0 @@
/*
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

@ -1,25 +0,0 @@
/*
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

@ -1,12 +0,0 @@
/*
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

@ -1,18 +0,0 @@
/*
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

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

View File

@ -1,14 +0,0 @@
/*
Warnings:
- You are about to drop the column `mArt` on the `Game` table. All the data in the column will be lost.
- You are about to drop the column `mBannerId` on the `Game` table. All the data in the column will be lost.
- You are about to drop the column `mScreenshots` on the `Game` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Game" DROP COLUMN "mArt",
DROP COLUMN "mBannerId",
DROP COLUMN "mScreenshots",
ADD COLUMN "mBannerIndex" INTEGER NOT NULL DEFAULT 0,
ADD COLUMN "mImageLibrary" TEXT[];

View File

@ -1,10 +0,0 @@
/*
Warnings:
- You are about to drop the column `mBannerIndex` on the `Game` table. All the data in the column will be lost.
- Added the required column `mBannerId` to the `Game` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Game" DROP COLUMN "mBannerIndex",
ADD COLUMN "mBannerId" TEXT NOT NULL;

View File

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

View File

@ -1,9 +0,0 @@
/*
Warnings:
- Added the required column `versionIndex` to the `GameVersion` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "GameVersion" ADD COLUMN "delta" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "versionIndex" INTEGER NOT NULL;

View File

@ -1,8 +0,0 @@
/*
Warnings:
- You are about to drop the column `versionOrder` on the `Game` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Game" DROP COLUMN "versionOrder";

View File

@ -1,9 +0,0 @@
-- CreateTable
CREATE TABLE "Invitation" (
"id" TEXT NOT NULL,
"isAdmin" BOOLEAN NOT NULL DEFAULT false,
"username" TEXT,
"email" TEXT,
CONSTRAINT "Invitation_pkey" PRIMARY KEY ("id")
);

View File

@ -1,7 +0,0 @@
-- CreateTable
CREATE TABLE "ApplicationSettings" (
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"enabledAuthencationMechanisms" "AuthMec"[],
CONSTRAINT "ApplicationSettings_pkey" PRIMARY KEY ("timestamp")
);

View File

@ -1,14 +0,0 @@
/*
Warnings:
- The values [DownloadAggregation] 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');
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;

View File

@ -1,14 +0,0 @@
/*
Warnings:
- The values [PeerAPI,UserStatus] 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');
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;

View File

@ -1,23 +0,0 @@
/*
Warnings:
- You are about to drop the column `endpoint` on the `Client` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Client" DROP COLUMN "endpoint";
-- CreateTable
CREATE TABLE "ClientPeerAPIConfiguration" (
"id" TEXT NOT NULL,
"clientId" TEXT NOT NULL,
"ipConfigurations" TEXT[],
CONSTRAINT "ClientPeerAPIConfiguration_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "ClientPeerAPIConfiguration_clientId_key" ON "ClientPeerAPIConfiguration"("clientId");
-- AddForeignKey
ALTER TABLE "ClientPeerAPIConfiguration" ADD CONSTRAINT "ClientPeerAPIConfiguration_clientId_fkey" FOREIGN KEY ("clientId") REFERENCES "Client"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -1,9 +0,0 @@
/*
Warnings:
- You are about to drop the column `ipConfigurations` on the `ClientPeerAPIConfiguration` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "ClientPeerAPIConfiguration" DROP COLUMN "ipConfigurations",
ADD COLUMN "endpoints" TEXT[];

View File

@ -1,8 +0,0 @@
/*
Warnings:
- Added the required column `expires` to the `Invitation` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Invitation" ADD COLUMN "expires" TIMESTAMP(3) NOT NULL;

View File

@ -1,18 +0,0 @@
-- CreateTable
CREATE TABLE "Notification" (
"id" TEXT NOT NULL,
"nonce" TEXT,
"userId" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT NOT NULL,
"actions" TEXT[],
"read" BOOLEAN NOT NULL DEFAULT false,
CONSTRAINT "Notification_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Notification_nonce_key" ON "Notification"("nonce");
-- AddForeignKey
ALTER TABLE "Notification" ADD CONSTRAINT "Notification_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "Notification" ADD COLUMN "created" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;

View File

@ -1,5 +0,0 @@
-- AlterTable
ALTER TABLE "Game" ADD COLUMN "created" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
-- AlterTable
ALTER TABLE "GameVersion" ADD COLUMN "created" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;

View File

@ -1,8 +0,0 @@
/*
Warnings:
- Added the required column `mReleased` to the `Game` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Game" ADD COLUMN "mReleased" TIMESTAMP(3) NOT NULL;

View File

@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "GameVersion" ADD COLUMN "umuIdOverride" TEXT;

View File

@ -1,5 +0,0 @@
-- DropForeignKey
ALTER TABLE "GameVersion" DROP CONSTRAINT "GameVersion_gameId_fkey";
-- AddForeignKey
ALTER TABLE "GameVersion" ADD CONSTRAINT "GameVersion_gameId_fkey" FOREIGN KEY ("gameId") REFERENCES "Game"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,11 +0,0 @@
-- AlterTable
ALTER TABLE "_DeveloperToGame" ADD CONSTRAINT "_DeveloperToGame_AB_pkey" PRIMARY KEY ("A", "B");
-- DropIndex
DROP INDEX "_DeveloperToGame_AB_unique";
-- AlterTable
ALTER TABLE "_GameToPublisher" ADD CONSTRAINT "_GameToPublisher_AB_pkey" PRIMARY KEY ("A", "B");
-- DropIndex
DROP INDEX "_GameToPublisher_AB_unique";

View File

@ -1,16 +0,0 @@
/*
Warnings:
- The values [Custom] on the enum `MetadataSource` will be removed. If these variants are still used in the database, this will fail.
*/
-- AlterEnum
BEGIN;
CREATE TYPE "MetadataSource_new" AS ENUM ('Manual', 'GiantBomb');
ALTER TABLE "Game" ALTER COLUMN "metadataSource" TYPE "MetadataSource_new" USING ("metadataSource"::text::"MetadataSource_new");
ALTER TABLE "Developer" ALTER COLUMN "metadataSource" TYPE "MetadataSource_new" USING ("metadataSource"::text::"MetadataSource_new");
ALTER TABLE "Publisher" ALTER COLUMN "metadataSource" TYPE "MetadataSource_new" USING ("metadataSource"::text::"MetadataSource_new");
ALTER TYPE "MetadataSource" RENAME TO "MetadataSource_old";
ALTER TYPE "MetadataSource_new" RENAME TO "MetadataSource";
DROP TYPE "MetadataSource_old";
COMMIT;

View File

@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "Game" ADD COLUMN "mImageCarousel" INTEGER[];

View File

@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "Game" ALTER COLUMN "mImageCarousel" SET DATA TYPE TEXT[];

View File

@ -1,6 +0,0 @@
-- AlterTable
ALTER TABLE "GameVersion" ADD COLUMN "launchArgs" TEXT[],
ADD COLUMN "onlySetup" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "setupArgs" TEXT[],
ALTER COLUMN "launchCommand" DROP NOT NULL,
ALTER COLUMN "setupCommand" DROP NOT NULL;

View File

@ -1,29 +0,0 @@
-- CreateTable
CREATE TABLE "Collection" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"isDefault" BOOLEAN NOT NULL DEFAULT false,
"userId" TEXT NOT NULL,
CONSTRAINT "Collection_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "_CollectionToGame" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL,
CONSTRAINT "_CollectionToGame_AB_pkey" PRIMARY KEY ("A","B")
);
-- CreateIndex
CREATE INDEX "_CollectionToGame_B_index" ON "_CollectionToGame"("B");
-- AddForeignKey
ALTER TABLE "Collection" ADD CONSTRAINT "Collection_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_CollectionToGame" ADD CONSTRAINT "_CollectionToGame_A_fkey" FOREIGN KEY ("A") REFERENCES "Collection"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_CollectionToGame" ADD CONSTRAINT "_CollectionToGame_B_fkey" FOREIGN KEY ("B") REFERENCES "Game"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,28 +0,0 @@
/*
Warnings:
- You are about to drop the `_CollectionToGame` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "_CollectionToGame" DROP CONSTRAINT "_CollectionToGame_A_fkey";
-- DropForeignKey
ALTER TABLE "_CollectionToGame" DROP CONSTRAINT "_CollectionToGame_B_fkey";
-- DropTable
DROP TABLE "_CollectionToGame";
-- CreateTable
CREATE TABLE "CollectionEntry" (
"collectionId" TEXT NOT NULL,
"gameId" TEXT NOT NULL,
CONSTRAINT "CollectionEntry_pkey" PRIMARY KEY ("collectionId","gameId")
);
-- AddForeignKey
ALTER TABLE "CollectionEntry" ADD CONSTRAINT "CollectionEntry_collectionId_fkey" FOREIGN KEY ("collectionId") REFERENCES "Collection"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CollectionEntry" ADD CONSTRAINT "CollectionEntry_gameId_fkey" FOREIGN KEY ("gameId") REFERENCES "Game"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -1,5 +0,0 @@
-- DropForeignKey
ALTER TABLE "CollectionEntry" DROP CONSTRAINT "CollectionEntry_collectionId_fkey";
-- AddForeignKey
ALTER TABLE "CollectionEntry" ADD CONSTRAINT "CollectionEntry_collectionId_fkey" FOREIGN KEY ("collectionId") REFERENCES "Collection"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,16 +0,0 @@
-- CreateTable
CREATE TABLE "news" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT NOT NULL,
"excerpt" TEXT NOT NULL,
"tags" TEXT[],
"image" TEXT,
"publishedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"authorId" TEXT NOT NULL,
CONSTRAINT "news_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "news" ADD CONSTRAINT "news_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -1,15 +0,0 @@
-- CreateEnum
CREATE TYPE "APITokenMode" AS ENUM ('User', 'System');
-- CreateTable
CREATE TABLE "APIToken" (
"token" TEXT NOT NULL,
"mode" "APITokenMode" NOT NULL,
"userId" TEXT,
"acls" TEXT[],
CONSTRAINT "APIToken_pkey" PRIMARY KEY ("token")
);
-- AddForeignKey
ALTER TABLE "APIToken" ADD CONSTRAINT "APIToken_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View File

@ -1,5 +0,0 @@
-- DropForeignKey
ALTER TABLE "CollectionEntry" DROP CONSTRAINT "CollectionEntry_gameId_fkey";
-- AddForeignKey
ALTER TABLE "CollectionEntry" ADD CONSTRAINT "CollectionEntry_gameId_fkey" FOREIGN KEY ("gameId") REFERENCES "Game"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

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

View File

@ -1,14 +0,0 @@
/*
Warnings:
- The primary key for the `APIToken` table will be changed. If it partially fails, the table could be left without primary key constraint.
- The required column `id` was added to the `APIToken` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required.
*/
-- AlterTable
ALTER TABLE "APIToken" DROP CONSTRAINT "APIToken_pkey",
ADD COLUMN "id" TEXT NOT NULL,
ADD CONSTRAINT "APIToken_pkey" PRIMARY KEY ("id");
-- CreateIndex
CREATE INDEX "APIToken_token_idx" ON "APIToken"("token");

View File

@ -1,20 +0,0 @@
/*
Warnings:
- Made the column `launchCommand` on table `GameVersion` required. This step will fail if there are existing NULL values in that column.
- Made the column `setupCommand` on table `GameVersion` required. This step will fail if there are existing NULL values in that column.
*/
UPDATE "GameVersion"
SET "launchCommand" = ''
WHERE "launchCommand" is NULL;
UPDATE "GameVersion"
SET "setupCommand" = ''
WHERE "launchCommand" is NULL;
-- AlterTable
ALTER TABLE "GameVersion" ALTER COLUMN "launchCommand" SET NOT NULL,
ALTER COLUMN "launchCommand" SET DEFAULT '',
ALTER COLUMN "setupCommand" SET NOT NULL,
ALTER COLUMN "setupCommand" SET DEFAULT '';

View File

@ -1,52 +0,0 @@
/*
Warnings:
- You are about to drop the `news` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "news" DROP CONSTRAINT "news_authorId_fkey";
-- DropTable
DROP TABLE "news";
-- CreateTable
CREATE TABLE "Tag" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
CONSTRAINT "Tag_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Article" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT NOT NULL,
"content" TEXT NOT NULL,
"image" TEXT,
"publishedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"authorId" TEXT,
CONSTRAINT "Article_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "_ArticleToTag" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL,
CONSTRAINT "_ArticleToTag_AB_pkey" PRIMARY KEY ("A","B")
);
-- CreateIndex
CREATE INDEX "_ArticleToTag_B_index" ON "_ArticleToTag"("B");
-- AddForeignKey
ALTER TABLE "Article" ADD CONSTRAINT "Article_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_ArticleToTag" ADD CONSTRAINT "_ArticleToTag_A_fkey" FOREIGN KEY ("A") REFERENCES "Article"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_ArticleToTag" ADD CONSTRAINT "_ArticleToTag_B_fkey" FOREIGN KEY ("B") REFERENCES "Tag"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,8 +0,0 @@
/*
Warnings:
- A unique constraint covering the columns `[name]` on the table `Tag` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "Tag_name_key" ON "Tag"("name");

View File

@ -1,8 +0,0 @@
/*
Warnings:
- A unique constraint covering the columns `[token]` on the table `APIToken` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "APIToken_token_key" ON "APIToken"("token");

View File

@ -1,2 +0,0 @@
-- AlterEnum
ALTER TYPE "Platform" ADD VALUE 'macos';

View File

@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "ApplicationSettings" ADD COLUMN "metadataProviders" TEXT[];

View File

@ -1,10 +0,0 @@
-- AlterEnum
-- This migration adds more than one value to an enum.
-- With PostgreSQL versions 11 and earlier, this is not possible
-- in a single migration. This can be worked around by creating
-- multiple migrations, each migration adding only one value to
-- the enum.
ALTER TYPE "MetadataSource" ADD VALUE 'PCGamingWiki';
ALTER TYPE "MetadataSource" ADD VALUE 'IGDB';

View File

@ -1,5 +0,0 @@
-- AlterTable
ALTER TABLE "LinkedAuthMec" ADD COLUMN "enabled" BOOLEAN NOT NULL DEFAULT true;
-- AlterTable
ALTER TABLE "User" ADD COLUMN "enabled" BOOLEAN NOT NULL DEFAULT true;

View File

@ -1,17 +0,0 @@
-- CreateTable
CREATE TABLE "Certificate" (
"id" TEXT NOT NULL,
"privateKey" TEXT NOT NULL,
"certificate" TEXT NOT NULL,
"blacklisted" BOOLEAN NOT NULL DEFAULT false,
CONSTRAINT "Certificate_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Session" (
"token" TEXT NOT NULL,
"data" JSONB NOT NULL,
CONSTRAINT "Session_pkey" PRIMARY KEY ("token")
);

View File

@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "LinkedAuthMec" ADD COLUMN "version" INTEGER NOT NULL DEFAULT 1;

View File

@ -1,24 +0,0 @@
-- 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;

View File

@ -1,3 +0,0 @@
-- AlterTable
ALTER TABLE "ApplicationSettings" ADD COLUMN "saveSlotCountLimit" INTEGER NOT NULL DEFAULT 5,
ADD COLUMN "saveSlotSizeLimit" DOUBLE PRECISION NOT NULL DEFAULT 10;

View File

@ -1,14 +0,0 @@
/*
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;

View File

@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "ApplicationSettings" ADD COLUMN "saveSlotHistoryLimit" INTEGER NOT NULL DEFAULT 3;

View File

@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "SaveSlot" ALTER COLUMN "playtime" SET DEFAULT 0;

View File

@ -1,10 +0,0 @@
/*
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[];

View File

@ -1,13 +0,0 @@
/*
Warnings:
- Added the required column `expiresAt` to the `Session` table without a default value. This is not possible if the table is not empty.
- Added the required column `userId` to the `Session` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Session" ADD COLUMN "expiresAt" TIMESTAMP(3) NOT NULL,
ADD COLUMN "userId" TEXT NOT NULL;
-- AddForeignKey
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -1,8 +0,0 @@
-- DropForeignKey
ALTER TABLE "SaveSlot" DROP CONSTRAINT "SaveSlot_lastUsedClientId_fkey";
-- AlterTable
ALTER TABLE "SaveSlot" ALTER COLUMN "lastUsedClientId" DROP NOT NULL;
-- AddForeignKey
ALTER TABLE "SaveSlot" ADD CONSTRAINT "SaveSlot_lastUsedClientId_fkey" FOREIGN KEY ("lastUsedClientId") REFERENCES "Client"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View File

@ -1,2 +0,0 @@
-- AlterEnum
ALTER TYPE "APITokenMode" ADD VALUE 'Client';

View File

@ -1,5 +0,0 @@
-- AlterTable
ALTER TABLE "APIToken" ADD COLUMN "clientId" TEXT;
-- AddForeignKey
ALTER TABLE "APIToken" ADD CONSTRAINT "APIToken_clientId_fkey" FOREIGN KEY ("clientId") REFERENCES "Client"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,7 +0,0 @@
-- CreateTable
CREATE TABLE "ObjectHash" (
"id" TEXT NOT NULL,
"hash" TEXT NOT NULL,
CONSTRAINT "ObjectHash_pkey" PRIMARY KEY ("id")
);

View File

@ -1,2 +0,0 @@
-- AlterEnum
ALTER TYPE "AuthMec" ADD VALUE 'OpenID';

View File

@ -1,8 +0,0 @@
/*
Warnings:
- You are about to drop the column `enabledAuthencationMechanisms` on the `ApplicationSettings` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "ApplicationSettings" DROP COLUMN "enabledAuthencationMechanisms";

View File

@ -1,20 +0,0 @@
-- CreateTable
CREATE TABLE "Screenshot" (
"id" TEXT NOT NULL,
"gameId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"objectId" TEXT NOT NULL,
"private" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMPTZ(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Screenshot_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "Screenshot_gameId_userId_idx" ON "Screenshot"("gameId", "userId");
-- AddForeignKey
ALTER TABLE "Screenshot" ADD CONSTRAINT "Screenshot_gameId_fkey" FOREIGN KEY ("gameId") REFERENCES "Game"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Screenshot" ADD CONSTRAINT "Screenshot_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,16 +0,0 @@
-- Rename game table columns
ALTER TABLE "Game" RENAME COLUMN "mIconId" TO "mIconObjectId";
ALTER TABLE "Game" RENAME COLUMN "mBannerId" TO "mBannerObjectId";
ALTER TABLE "Game" RENAME COLUMN "mCoverId" TO "mCoverObjectId";
ALTER TABLE "Game" RENAME COLUMN "mImageCarousel" TO "mImageCarouselObjectIds";
ALTER TABLE "Game" RENAME COLUMN "mImageLibrary" TO "mImageLibraryObjectIds";
-- Rename saveslot table columns
ALTER TABLE "SaveSlot" RENAME COLUMN "history" TO "historyObjectIds";
-- Rename article table columns
ALTER TABLE "Article" RENAME COLUMN "image" TO "imageObjectId";
-- Rename user table columns
ALTER TABLE "User" RENAME COLUMN "profilePicture" TO "profilePictureObjectId";

View File

@ -1,35 +0,0 @@
-- CreateTable
CREATE TABLE "Company" (
"id" TEXT NOT NULL,
"metadataSource" "MetadataSource" NOT NULL,
"metadataId" TEXT NOT NULL,
"metadataOriginalQuery" TEXT NOT NULL,
"mName" TEXT NOT NULL,
"mShortDescription" TEXT NOT NULL,
"mDescription" TEXT NOT NULL,
"mLogoObjectId" TEXT NOT NULL,
"mBannerObjectId" TEXT NOT NULL,
"mWebsite" TEXT NOT NULL,
CONSTRAINT "Company_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "CompanyGameRelation" (
"companyId" TEXT NOT NULL,
"gameId" TEXT NOT NULL,
"developer" BOOLEAN NOT NULL DEFAULT false,
"publisher" BOOLEAN NOT NULL DEFAULT false
);
-- CreateIndex
CREATE UNIQUE INDEX "Company_metadataSource_metadataId_key" ON "Company"("metadataSource", "metadataId");
-- CreateIndex
CREATE UNIQUE INDEX "CompanyGameRelation_companyId_gameId_key" ON "CompanyGameRelation"("companyId", "gameId");
-- AddForeignKey
ALTER TABLE "CompanyGameRelation" ADD CONSTRAINT "CompanyGameRelation_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "Company"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CompanyGameRelation" ADD CONSTRAINT "CompanyGameRelation_gameId_fkey" FOREIGN KEY ("gameId") REFERENCES "Game"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,76 +0,0 @@
/*
Warnings:
- You are about to drop the `CompanyGameRelation` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `Developer` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `Publisher` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `_DeveloperToGame` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `_GameToPublisher` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "CompanyGameRelation" DROP CONSTRAINT "CompanyGameRelation_companyId_fkey";
-- DropForeignKey
ALTER TABLE "CompanyGameRelation" DROP CONSTRAINT "CompanyGameRelation_gameId_fkey";
-- DropForeignKey
ALTER TABLE "_DeveloperToGame" DROP CONSTRAINT "_DeveloperToGame_A_fkey";
-- DropForeignKey
ALTER TABLE "_DeveloperToGame" DROP CONSTRAINT "_DeveloperToGame_B_fkey";
-- DropForeignKey
ALTER TABLE "_GameToPublisher" DROP CONSTRAINT "_GameToPublisher_A_fkey";
-- DropForeignKey
ALTER TABLE "_GameToPublisher" DROP CONSTRAINT "_GameToPublisher_B_fkey";
-- DropTable
DROP TABLE "CompanyGameRelation";
-- DropTable
DROP TABLE "Developer";
-- DropTable
DROP TABLE "Publisher";
-- DropTable
DROP TABLE "_DeveloperToGame";
-- DropTable
DROP TABLE "_GameToPublisher";
-- CreateTable
CREATE TABLE "_developers" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL,
CONSTRAINT "_developers_AB_pkey" PRIMARY KEY ("A","B")
);
-- CreateTable
CREATE TABLE "_publishers" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL,
CONSTRAINT "_publishers_AB_pkey" PRIMARY KEY ("A","B")
);
-- CreateIndex
CREATE INDEX "_developers_B_index" ON "_developers"("B");
-- CreateIndex
CREATE INDEX "_publishers_B_index" ON "_publishers"("B");
-- AddForeignKey
ALTER TABLE "_developers" ADD CONSTRAINT "_developers_A_fkey" FOREIGN KEY ("A") REFERENCES "Company"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_developers" ADD CONSTRAINT "_developers_B_fkey" FOREIGN KEY ("B") REFERENCES "Game"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_publishers" ADD CONSTRAINT "_publishers_A_fkey" FOREIGN KEY ("A") REFERENCES "Company"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_publishers" ADD CONSTRAINT "_publishers_B_fkey" FOREIGN KEY ("B") REFERENCES "Game"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,16 +0,0 @@
-- CreateTable
CREATE TABLE "_GameToTag" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL,
CONSTRAINT "_GameToTag_AB_pkey" PRIMARY KEY ("A","B")
);
-- CreateIndex
CREATE INDEX "_GameToTag_B_index" ON "_GameToTag"("B");
-- AddForeignKey
ALTER TABLE "_GameToTag" ADD CONSTRAINT "_GameToTag_A_fkey" FOREIGN KEY ("A") REFERENCES "Game"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_GameToTag" ADD CONSTRAINT "_GameToTag_B_fkey" FOREIGN KEY ("B") REFERENCES "Tag"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,11 +0,0 @@
/*
Warnings:
- A unique constraint covering the columns `[userId,nonce]` on the table `Notification` will be added. If there are existing duplicate values, this will fail.
*/
-- DropIndex
DROP INDEX "Notification_nonce_key";
-- CreateIndex
CREATE UNIQUE INDEX "Notification_userId_nonce_key" ON "Notification"("userId", "nonce");

View File

@ -1,41 +0,0 @@
/*
Warnings:
- You are about to drop the column `mReviewCount` on the `Game` table. All the data in the column will be lost.
- You are about to drop the column `mReviewRating` on the `Game` table. All the data in the column will be lost.
*/
-- AlterEnum
-- This migration adds more than one value to an enum.
-- With PostgreSQL versions 11 and earlier, this is not possible
-- in a single migration. This can be worked around by creating
-- multiple migrations, each migration adding only one value to
-- the enum.
ALTER TYPE "MetadataSource" ADD VALUE 'Metacritic';
ALTER TYPE "MetadataSource" ADD VALUE 'OpenCritic';
-- AlterTable
ALTER TABLE "Game" DROP COLUMN "mReviewCount",
DROP COLUMN "mReviewRating";
-- CreateTable
CREATE TABLE "GameRating" (
"id" TEXT NOT NULL,
"metadataSource" "MetadataSource" NOT NULL,
"metadataId" TEXT NOT NULL,
"created" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"mReviewCount" INTEGER NOT NULL,
"mReviewRating" DOUBLE PRECISION NOT NULL,
"mReviewHref" TEXT,
"gameId" TEXT NOT NULL,
CONSTRAINT "GameRating_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "GameRating_metadataSource_metadataId_key" ON "GameRating"("metadataSource", "metadataId");
-- AddForeignKey
ALTER TABLE "GameRating" ADD CONSTRAINT "GameRating_gameId_fkey" FOREIGN KEY ("gameId") REFERENCES "Game"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "Notification" ADD COLUMN "acls" TEXT[];

View File

@ -1,53 +0,0 @@
/*
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;

View File

@ -1,17 +0,0 @@
/*
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;

View File

@ -1,8 +0,0 @@
/*
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");

View File

@ -1,14 +0,0 @@
-- CreateTable
CREATE TABLE "Task" (
"id" TEXT NOT NULL,
"taskGroup" TEXT NOT NULL,
"started" TIMESTAMP(3) NOT NULL,
"ended" TIMESTAMP(3) NOT NULL,
"success" BOOLEAN NOT NULL,
"error" JSONB,
"progress" DOUBLE PRECISION NOT NULL,
"log" TEXT[],
"acls" TEXT[],
CONSTRAINT "Task_pkey" PRIMARY KEY ("id")
);

View File

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

View File

@ -1,41 +0,0 @@
-- DropForeignKey
ALTER TABLE "APIToken" DROP CONSTRAINT "APIToken_userId_fkey";
-- DropForeignKey
ALTER TABLE "Article" DROP CONSTRAINT "Article_authorId_fkey";
-- DropForeignKey
ALTER TABLE "Client" DROP CONSTRAINT "Client_userId_fkey";
-- DropForeignKey
ALTER TABLE "Collection" DROP CONSTRAINT "Collection_userId_fkey";
-- DropForeignKey
ALTER TABLE "LinkedAuthMec" DROP CONSTRAINT "LinkedAuthMec_userId_fkey";
-- DropForeignKey
ALTER TABLE "Notification" DROP CONSTRAINT "Notification_userId_fkey";
-- DropForeignKey
ALTER TABLE "Session" DROP CONSTRAINT "Session_userId_fkey";
-- AddForeignKey
ALTER TABLE "LinkedAuthMec" ADD CONSTRAINT "LinkedAuthMec_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "APIToken" ADD CONSTRAINT "APIToken_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Client" ADD CONSTRAINT "Client_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Collection" ADD CONSTRAINT "Collection_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Article" ADD CONSTRAINT "Article_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Notification" ADD CONSTRAINT "Notification_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "ApplicationSettings" ADD COLUMN "showGamePanelTextDecoration" BOOLEAN NOT NULL DEFAULT true;

View File

@ -1,2 +0,0 @@
-- AlterEnum
ALTER TYPE "LibraryBackend" ADD VALUE 'FlatFilesystem';

View File

@ -1,5 +0,0 @@
-- CreateEnum
CREATE TYPE "Genre" AS ENUM ('Action', 'Strategy', 'Sports', 'Adventure', 'Roleplay', 'Racing', 'Simulation', 'Educational', 'Fighting', 'Shooter', 'RealTimeStrategy', 'CardGame', 'BoardGame', 'Compilation', 'MMORPG', 'MinigameCollection', 'Puzzle', 'MusicRhythm');
-- AlterTable
ALTER TABLE "Game" ADD COLUMN "genres" "Genre"[];

View File

@ -1,14 +0,0 @@
/*
Warnings:
- The values [RealTimeStrategy,CardGame,BoardGame,MinigameCollection,MusicRhythm] on the enum `Genre` will be removed. If these variants are still used in the database, this will fail.
*/
-- AlterEnum
BEGIN;
CREATE TYPE "Genre_new" AS ENUM ('Action', 'Strategy', 'Sports', 'Adventure', 'Roleplay', 'Racing', 'Simulation', 'Educational', 'Fighting', 'Shooter', 'RTS', 'Card', 'Board', 'Compilation', 'MMORPG', 'Minigames', 'Puzzle', 'Rhythm');
ALTER TABLE "Game" ALTER COLUMN "genres" TYPE "Genre_new"[] USING ("genres"::text::"Genre_new"[]);
ALTER TYPE "Genre" RENAME TO "Genre_old";
ALTER TYPE "Genre_new" RENAME TO "Genre";
DROP TYPE "Genre_old";
COMMIT;

View File

@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "Game" ADD COLUMN "featured" BOOLEAN NOT NULL DEFAULT false;

View File

@ -1,11 +0,0 @@
/*
Warnings:
- You are about to drop the column `genres` on the `Game` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Game" DROP COLUMN "genres";
-- DropEnum
DROP TYPE "Genre";

View File

@ -1,5 +0,0 @@
-- Add pg_trgm
CREATE EXTENSION pg_trgm;
-- Create index for tag names
-- CREATE INDEX trgm_tag_name ON "Tag" USING GIST (name gist_trgm_ops(siglen=32));

View File

@ -1,2 +0,0 @@
-- CreateIndex
CREATE INDEX "Tag_name_idx" ON "Tag" USING GIST ("name" gist_trgm_ops(siglen=32));

Some files were not shown because too many files have changed in this diff Show More