From 3d56dd3ae30d7ba195b30214810577ee1dc75ce6 Mon Sep 17 00:00:00 2001 From: hpkoh Date: Sun, 6 Nov 2022 02:42:27 +0800 Subject: [PATCH] [questions][chore] consildate migration --- .../20221104091537_add_tags/migration.sql | 28 ------------------- .../migration.sql | 25 ----------------- .../migration.sql | 19 ------------- 3 files changed, 72 deletions(-) delete mode 100644 apps/portal/prisma/migrations/20221104091537_add_tags/migration.sql delete mode 100644 apps/portal/prisma/migrations/20221104093450_update_tag_table_name/migration.sql rename apps/portal/prisma/migrations/{20221105174834_update_tag_name => 20221105184208_add_tag_schema}/migration.sql (64%) diff --git a/apps/portal/prisma/migrations/20221104091537_add_tags/migration.sql b/apps/portal/prisma/migrations/20221104091537_add_tags/migration.sql deleted file mode 100644 index 71352a89..00000000 --- a/apps/portal/prisma/migrations/20221104091537_add_tags/migration.sql +++ /dev/null @@ -1,28 +0,0 @@ --- CreateTable -CREATE TABLE "QuestionTags" ( - "id" TEXT NOT NULL, - "tag" TEXT NOT NULL, - - CONSTRAINT "QuestionTags_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "QuestionQuestionTagEntry" ( - "id" TEXT NOT NULL, - "questionId" TEXT NOT NULL, - "tagId" TEXT NOT NULL, - - CONSTRAINT "QuestionQuestionTagEntry_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "QuestionTags_tag_key" ON "QuestionTags"("tag"); - --- CreateIndex -CREATE UNIQUE INDEX "QuestionQuestionTagEntry_questionId_tagId_key" ON "QuestionQuestionTagEntry"("questionId", "tagId"); - --- AddForeignKey -ALTER TABLE "QuestionQuestionTagEntry" ADD CONSTRAINT "QuestionQuestionTagEntry_questionId_fkey" FOREIGN KEY ("questionId") REFERENCES "QuestionsQuestion"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "QuestionQuestionTagEntry" ADD CONSTRAINT "QuestionQuestionTagEntry_tagId_fkey" FOREIGN KEY ("tagId") REFERENCES "QuestionTags"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/apps/portal/prisma/migrations/20221104093450_update_tag_table_name/migration.sql b/apps/portal/prisma/migrations/20221104093450_update_tag_table_name/migration.sql deleted file mode 100644 index e02291d0..00000000 --- a/apps/portal/prisma/migrations/20221104093450_update_tag_table_name/migration.sql +++ /dev/null @@ -1,25 +0,0 @@ -/* - Warnings: - - - You are about to drop the `QuestionTags` table. If the table is not empty, all the data it contains will be lost. - -*/ --- DropForeignKey -ALTER TABLE "QuestionQuestionTagEntry" DROP CONSTRAINT "QuestionQuestionTagEntry_tagId_fkey"; - --- DropTable -DROP TABLE "QuestionTags"; - --- CreateTable -CREATE TABLE "QuestionTag" ( - "id" TEXT NOT NULL, - "tag" TEXT NOT NULL, - - CONSTRAINT "QuestionTag_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "QuestionTag_tag_key" ON "QuestionTag"("tag"); - --- AddForeignKey -ALTER TABLE "QuestionQuestionTagEntry" ADD CONSTRAINT "QuestionQuestionTagEntry_tagId_fkey" FOREIGN KEY ("tagId") REFERENCES "QuestionTag"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/apps/portal/prisma/migrations/20221105174834_update_tag_name/migration.sql b/apps/portal/prisma/migrations/20221105184208_add_tag_schema/migration.sql similarity index 64% rename from apps/portal/prisma/migrations/20221105174834_update_tag_name/migration.sql rename to apps/portal/prisma/migrations/20221105184208_add_tag_schema/migration.sql index cbbe9636..a5feca59 100644 --- a/apps/portal/prisma/migrations/20221105174834_update_tag_name/migration.sql +++ b/apps/portal/prisma/migrations/20221105184208_add_tag_schema/migration.sql @@ -1,22 +1,3 @@ -/* - Warnings: - - - You are about to drop the `QuestionQuestionTagEntry` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `QuestionTag` table. If the table is not empty, all the data it contains will be lost. - -*/ --- DropForeignKey -ALTER TABLE "QuestionQuestionTagEntry" DROP CONSTRAINT "QuestionQuestionTagEntry_questionId_fkey"; - --- DropForeignKey -ALTER TABLE "QuestionQuestionTagEntry" DROP CONSTRAINT "QuestionQuestionTagEntry_tagId_fkey"; - --- DropTable -DROP TABLE "QuestionQuestionTagEntry"; - --- DropTable -DROP TABLE "QuestionTag"; - -- CreateTable CREATE TABLE "QuestionsQuestionTag" ( "id" TEXT NOT NULL,