Add basic CRUD for artists

This commit is contained in:
2025-06-25 12:52:10 +02:00
parent 27535e45f0
commit 887b0ead93
16 changed files with 380 additions and 3 deletions

View File

@ -0,0 +1,32 @@
-- CreateTable
CREATE TABLE "Artist" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"displayName" TEXT NOT NULL,
"slug" TEXT NOT NULL,
"nickname" TEXT,
CONSTRAINT "Artist_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Social" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"name" TEXT,
"handle" TEXT,
"url" TEXT,
"type" TEXT,
"icon" TEXT,
"artistId" TEXT,
CONSTRAINT "Social_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Artist_slug_key" ON "Artist"("slug");
-- AddForeignKey
ALTER TABLE "Social" ADD CONSTRAINT "Social_artistId_fkey" FOREIGN KEY ("artistId") REFERENCES "Artist"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View File

@ -47,3 +47,35 @@ model Album {
// images Image[]
}
model Artist {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
displayName String
slug String @unique
nickname String?
// mentionUrl String?
// contact String?
// urls String[]
socials Social[]
// images Image[]
}
model Social {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String?
handle String?
url String?
type String?
icon String?
artistId String?
artist Artist? @relation(fields: [artistId], references: [id])
}