Remember uploaded images

This commit is contained in:
2025-08-04 19:34:50 +02:00
parent 464791d9f5
commit 8aa8be7e9f
21 changed files with 573 additions and 241 deletions
@@ -0,0 +1,15 @@
/*
Warnings:
- You are about to drop the `UserLoginLinks` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "public"."UserLoginLinks" DROP CONSTRAINT "UserLoginLinks_userId_fkey";
-- AlterTable
ALTER TABLE "public"."User" ADD COLUMN "password" TEXT NOT NULL DEFAULT '',
ALTER COLUMN "role" SET DEFAULT 'USER';
-- DropTable
DROP TABLE "public"."UserLoginLinks";
@@ -0,0 +1,40 @@
/*
Warnings:
- You are about to drop the column `picture` on the `QuestAnswer` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "public"."QuestAnswer" DROP COLUMN "picture",
ADD COLUMN "pictureId" INTEGER;
-- CreateTable
CREATE TABLE "public"."File" (
"id" SERIAL NOT NULL,
"uuid" TEXT NOT NULL,
"creatorId" INTEGER NOT NULL,
"huntId" INTEGER,
"questId" INTEGER,
"answerId" INTEGER,
"createdAt" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "File_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "File_uuid_key" ON "public"."File"("uuid");
-- AddForeignKey
ALTER TABLE "public"."File" ADD CONSTRAINT "File_creatorId_fkey" FOREIGN KEY ("creatorId") REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "public"."File" ADD CONSTRAINT "File_huntId_fkey" FOREIGN KEY ("huntId") REFERENCES "public"."Hunt"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "public"."File" ADD CONSTRAINT "File_questId_fkey" FOREIGN KEY ("questId") REFERENCES "public"."HuntQuest"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "public"."File" ADD CONSTRAINT "File_answerId_fkey" FOREIGN KEY ("answerId") REFERENCES "public"."QuestAnswer"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "public"."QuestAnswer" ADD CONSTRAINT "QuestAnswer_pictureId_fkey" FOREIGN KEY ("pictureId") REFERENCES "public"."File"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,18 @@
/*
Warnings:
- You are about to drop the column `image` on the `HuntQuest` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "public"."Hunt" ADD COLUMN "pictureId" INTEGER;
-- AlterTable
ALTER TABLE "public"."HuntQuest" DROP COLUMN "image",
ADD COLUMN "pictureId" INTEGER;
-- AddForeignKey
ALTER TABLE "public"."Hunt" ADD CONSTRAINT "Hunt_pictureId_fkey" FOREIGN KEY ("pictureId") REFERENCES "public"."File"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "public"."HuntQuest" ADD CONSTRAINT "HuntQuest_pictureId_fkey" FOREIGN KEY ("pictureId") REFERENCES "public"."File"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,12 @@
/*
Warnings:
- A unique constraint covering the columns `[url]` on the table `File` will be added. If there are existing duplicate values, this will fail.
- Added the required column `url` to the `File` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "public"."File" ADD COLUMN "url" TEXT NOT NULL;
-- CreateIndex
CREATE UNIQUE INDEX "File_url_key" ON "public"."File"("url");
@@ -0,0 +1,9 @@
/*
Warnings:
- You are about to drop the column `revealPictures` on the `Hunt` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "public"."Hunt" DROP COLUMN "revealPictures",
ADD COLUMN "revealQuests" BOOLEAN NOT NULL DEFAULT false;