Set many album artists

This commit is contained in:
jeffvli
2022-10-14 19:57:08 -07:00
parent 968e80a6d8
commit 5f844ef975
2 changed files with 40 additions and 3 deletions
@@ -0,0 +1,35 @@
/*
Warnings:
- You are about to drop the column `albumArtistId` on the `Album` table. All the data in the column will be lost.
*/
-- DropForeignKey
ALTER TABLE "Album" DROP CONSTRAINT "Album_albumArtistId_fkey";
-- AlterTable
ALTER TABLE "Album" DROP COLUMN "albumArtistId";
-- AlterTable
ALTER TABLE "Song" ADD COLUMN "albumArtistId" UUID;
-- CreateTable
CREATE TABLE "_AlbumToAlbumArtist" (
"A" UUID NOT NULL,
"B" UUID NOT NULL
);
-- CreateIndex
CREATE UNIQUE INDEX "_AlbumToAlbumArtist_AB_unique" ON "_AlbumToAlbumArtist"("A", "B");
-- CreateIndex
CREATE INDEX "_AlbumToAlbumArtist_B_index" ON "_AlbumToAlbumArtist"("B");
-- AddForeignKey
ALTER TABLE "Song" ADD CONSTRAINT "Song_albumArtistId_fkey" FOREIGN KEY ("albumArtistId") REFERENCES "AlbumArtist"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_AlbumToAlbumArtist" ADD CONSTRAINT "_AlbumToAlbumArtist_A_fkey" FOREIGN KEY ("A") REFERENCES "Album"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_AlbumToAlbumArtist" ADD CONSTRAINT "_AlbumToAlbumArtist_B_fkey" FOREIGN KEY ("B") REFERENCES "AlbumArtist"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+5 -3
View File
@@ -320,6 +320,7 @@ model AlbumArtist {
ratings AlbumArtistRating[]
images Image[]
favorites Favorite[]
songs Song[]
server Server @relation(fields: [serverId], references: [id], onDelete: Cascade)
serverId String @db.Uuid
@@ -342,15 +343,13 @@ model Album {
songs Song[]
genres Genre[]
artists Artist[]
albumArtists AlbumArtist[]
externals External[]
serverFolders ServerFolder[]
ratings AlbumRating[]
images Image[]
favorites Favorite[]
albumArtist AlbumArtist? @relation(fields: [albumArtistId], references: [id])
albumArtistId String? @db.Uuid
server Server @relation(fields: [serverId], references: [id], onDelete: Cascade)
serverId String @db.Uuid
@@ -413,6 +412,9 @@ model Song {
images Image[]
favorites Favorite[]
albumArtist AlbumArtist? @relation(fields: [albumArtistId], references: [id])
albumArtistId String? @db.Uuid
album Album? @relation(fields: [albumId], references: [id])
albumId String? @db.Uuid