From 93a327c6341e34a4c1553b96f7fcc5ec642f93dc Mon Sep 17 00:00:00 2001 From: Citali Date: Mon, 2 Feb 2026 14:52:27 +0100 Subject: [PATCH] Add migration --- .../20260202121413_tags_02/migration.sql | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 prisma/migrations/20260202121413_tags_02/migration.sql diff --git a/prisma/migrations/20260202121413_tags_02/migration.sql b/prisma/migrations/20260202121413_tags_02/migration.sql new file mode 100644 index 0000000..4cf856d --- /dev/null +++ b/prisma/migrations/20260202121413_tags_02/migration.sql @@ -0,0 +1,65 @@ +/* + Warnings: + + - You are about to drop the `ArtTag` table. If the table is not empty, all the data it contains will be lost. + - You are about to drop the `ArtTagAlias` table. If the table is not empty, all the data it contains will be lost. + - You are about to drop the `_ArtCategoryToArtTag` table. If the table is not empty, all the data it contains will be lost. + - You are about to drop the `_ArtTagToArtwork` table. If the table is not empty, all the data it contains will be lost. + - You are about to drop the `_ArtworkTagsV2` table. If the table is not empty, all the data it contains will be lost. + +*/ +-- DropForeignKey +ALTER TABLE "ArtTag" DROP CONSTRAINT "ArtTag_parentId_fkey"; + +-- DropForeignKey +ALTER TABLE "ArtTagAlias" DROP CONSTRAINT "ArtTagAlias_tagId_fkey"; + +-- DropForeignKey +ALTER TABLE "_ArtCategoryToArtTag" DROP CONSTRAINT "_ArtCategoryToArtTag_A_fkey"; + +-- DropForeignKey +ALTER TABLE "_ArtCategoryToArtTag" DROP CONSTRAINT "_ArtCategoryToArtTag_B_fkey"; + +-- DropForeignKey +ALTER TABLE "_ArtTagToArtwork" DROP CONSTRAINT "_ArtTagToArtwork_A_fkey"; + +-- DropForeignKey +ALTER TABLE "_ArtTagToArtwork" DROP CONSTRAINT "_ArtTagToArtwork_B_fkey"; + +-- DropForeignKey +ALTER TABLE "_ArtworkTagsV2" DROP CONSTRAINT "_ArtworkTagsV2_A_fkey"; + +-- DropForeignKey +ALTER TABLE "_ArtworkTagsV2" DROP CONSTRAINT "_ArtworkTagsV2_B_fkey"; + +-- DropTable +DROP TABLE "ArtTag"; + +-- DropTable +DROP TABLE "ArtTagAlias"; + +-- DropTable +DROP TABLE "_ArtCategoryToArtTag"; + +-- DropTable +DROP TABLE "_ArtTagToArtwork"; + +-- DropTable +DROP TABLE "_ArtworkTagsV2"; + +-- CreateTable +CREATE TABLE "_ArtworkTags" ( + "A" TEXT NOT NULL, + "B" TEXT NOT NULL, + + CONSTRAINT "_ArtworkTags_AB_pkey" PRIMARY KEY ("A","B") +); + +-- CreateIndex +CREATE INDEX "_ArtworkTags_B_index" ON "_ArtworkTags"("B"); + +-- AddForeignKey +ALTER TABLE "_ArtworkTags" ADD CONSTRAINT "_ArtworkTags_A_fkey" FOREIGN KEY ("A") REFERENCES "Artwork"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "_ArtworkTags" ADD CONSTRAINT "_ArtworkTags_B_fkey" FOREIGN KEY ("B") REFERENCES "Tag"("id") ON DELETE CASCADE ON UPDATE CASCADE;