Add image upload function

This commit is contained in:
2025-06-26 21:21:52 +02:00
parent d608267a62
commit 0ccc01fb97
28 changed files with 4523 additions and 26 deletions

View File

@ -0,0 +1,38 @@
/*
Warnings:
- Added the required column `updatedAt` to the `ImageMetadata` table without a default value. This is not possible if the table is not empty.
- Added the required column `updatedAt` to the `ImageStats` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "ImageMetadata" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL;
-- AlterTable
ALTER TABLE "ImageStats" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL;
-- CreateTable
CREATE TABLE "ImageVariant" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"imageId" TEXT NOT NULL,
"s3Key" TEXT NOT NULL,
"type" TEXT NOT NULL,
"height" INTEGER NOT NULL,
"width" INTEGER NOT NULL,
"fileExtension" TEXT,
"mimeType" TEXT,
"url" TEXT,
"sizeBytes" INTEGER,
CONSTRAINT "ImageVariant_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "ImageVariant_imageId_key" ON "ImageVariant"("imageId");
-- AddForeignKey
ALTER TABLE "ImageVariant" ADD CONSTRAINT "ImageVariant_imageId_fkey" FOREIGN KEY ("imageId") REFERENCES "Image"("id") ON DELETE RESTRICT ON UPDATE CASCADE;