Enhance tags
This commit is contained in:
5
prisma/migrations/20251220224429_artwork_4/migration.sql
Normal file
5
prisma/migrations/20251220224429_artwork_4/migration.sql
Normal file
@ -0,0 +1,5 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "ArtTag" ADD COLUMN "parentId" TEXT;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "ArtTag" ADD CONSTRAINT "ArtTag_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "ArtTag"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
22
prisma/migrations/20251220231156_artwork_5/migration.sql
Normal file
22
prisma/migrations/20251220231156_artwork_5/migration.sql
Normal file
@ -0,0 +1,22 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "ArtTagAlias" (
|
||||
"id" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"alias" TEXT NOT NULL,
|
||||
"tagId" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "ArtTagAlias_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "ArtTagAlias_alias_key" ON "ArtTagAlias"("alias");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ArtTagAlias_alias_idx" ON "ArtTagAlias"("alias");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "ArtTagAlias_tagId_alias_key" ON "ArtTagAlias"("tagId", "alias");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "ArtTagAlias" ADD CONSTRAINT "ArtTagAlias_tagId_fkey" FOREIGN KEY ("tagId") REFERENCES "ArtTag"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@ -106,8 +106,27 @@ model ArtTag {
|
||||
|
||||
description String?
|
||||
|
||||
aliases ArtTagAlias[]
|
||||
artworks Artwork[]
|
||||
categories ArtCategory[]
|
||||
|
||||
parentId String?
|
||||
parent ArtTag? @relation("TagHierarchy", fields: [parentId], references: [id], onDelete: SetNull)
|
||||
children ArtTag[] @relation("TagHierarchy")
|
||||
}
|
||||
|
||||
model ArtTagAlias {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
alias String @unique
|
||||
|
||||
tagId String
|
||||
tag ArtTag @relation(fields: [tagId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([tagId, alias])
|
||||
@@index([alias])
|
||||
}
|
||||
|
||||
model Color {
|
||||
|
||||
Reference in New Issue
Block a user