Add art types and categories

This commit is contained in:
2025-07-20 10:07:09 +02:00
parent b2c77ec9e0
commit 92081828f0
20 changed files with 989 additions and 103 deletions

View File

@ -0,0 +1,22 @@
/*
Warnings:
- A unique constraint covering the columns `[name]` on the table `PortfolioCategory` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[name]` on the table `PortfolioTag` will be added. If there are existing duplicate values, this will fail.
- Made the column `name` on table `PortfolioCategory` required. This step will fail if there are existing NULL values in that column.
- Made the column `name` on table `PortfolioTag` required. This step will fail if there are existing NULL values in that column.
*/
-- AlterTable
ALTER TABLE "PortfolioCategory" ADD COLUMN "description" TEXT,
ALTER COLUMN "name" SET NOT NULL;
-- AlterTable
ALTER TABLE "PortfolioTag" ADD COLUMN "description" TEXT,
ALTER COLUMN "name" SET NOT NULL;
-- CreateIndex
CREATE UNIQUE INDEX "PortfolioCategory_name_key" ON "PortfolioCategory"("name");
-- CreateIndex
CREATE UNIQUE INDEX "PortfolioTag_name_key" ON "PortfolioTag"("name");

View File

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

View File

@ -0,0 +1,9 @@
-- AlterTable
ALTER TABLE "PortfolioImage" ADD COLUMN "artType" TEXT,
ADD COLUMN "group" TEXT,
ADD COLUMN "kind" TEXT,
ADD COLUMN "layoutGroup" TEXT,
ADD COLUMN "layoutOrder" INTEGER,
ADD COLUMN "month" INTEGER,
ADD COLUMN "series" TEXT,
ADD COLUMN "year" INTEGER;

View File

@ -0,0 +1,28 @@
/*
Warnings:
- You are about to drop the column `artType` on the `PortfolioImage` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "PortfolioImage" DROP COLUMN "artType",
ADD COLUMN "artTypeId" TEXT;
-- CreateTable
CREATE TABLE "PortfolioArtType" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"sortIndex" INTEGER NOT NULL DEFAULT 0,
"name" TEXT NOT NULL,
"slug" TEXT,
"description" TEXT,
CONSTRAINT "PortfolioArtType_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "PortfolioArtType_name_key" ON "PortfolioArtType"("name");
-- AddForeignKey
ALTER TABLE "PortfolioImage" ADD CONSTRAINT "PortfolioImage_artTypeId_fkey" FOREIGN KEY ("artTypeId") REFERENCES "PortfolioArtType"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View File

@ -160,24 +160,47 @@ model PortfolioImage {
originalFile String @unique
nsfw Boolean @default(false)
published Boolean @default(false)
setAsHeader Boolean @default(false)
altText String?
description String?
fileType String?
group String?
kind String?
layoutGroup String?
name String?
series String?
slug String?
type String?
fileSize Int?
layoutOrder Int?
month Int?
year Int?
creationDate DateTime?
metadata ImageMetadata?
artTypeId String?
artType PortfolioArtType? @relation(fields: [artTypeId], references: [id])
metadata ImageMetadata?
categories PortfolioCategory[]
colors ImageColor[]
tags PortfolioTag[]
variants ImageVariant[]
}
model PortfolioArtType {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sortIndex Int @default(0)
name String @unique
slug String?
description String?
images PortfolioImage[]
}
model PortfolioCategory {
id String @id @default(cuid())
createdAt DateTime @default(now())