Add basic CRUD for artists
This commit is contained in:
32
prisma/migrations/20250625102620_artist_social/migration.sql
Normal file
32
prisma/migrations/20250625102620_artist_social/migration.sql
Normal 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;
|
@ -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])
|
||||
}
|
||||
|
Reference in New Issue
Block a user