From 0301e86aff45d6011ac933955dee6d6de62f06ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B4=87=E5=B3=B0=20=E6=9C=94=E8=8F=AF?= Date: Mon, 18 Nov 2024 21:20:27 +0900 Subject: [PATCH] =?UTF-8?q?Mod:=20Migration=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=82=92=E5=86=8D=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1731898598469-addBlockingReactionUser.js | 20 ------------------- .../1731932268436-addBlockingReactionUser.js | 16 +++++++++++++++ 2 files changed, 16 insertions(+), 20 deletions(-) delete mode 100644 packages/backend/migration/1731898598469-addBlockingReactionUser.js create mode 100644 packages/backend/migration/1731932268436-addBlockingReactionUser.js diff --git a/packages/backend/migration/1731898598469-addBlockingReactionUser.js b/packages/backend/migration/1731898598469-addBlockingReactionUser.js deleted file mode 100644 index 6cf9d4ca87..0000000000 --- a/packages/backend/migration/1731898598469-addBlockingReactionUser.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and misskey-project - * SPDX-License-Identifier: AGPL-3.0-only - */ - -export class AddBlockingReactionUser1731898598469 { - name = 'AddBlockingReactionUser1731898598469' - - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "blocking" ADD "isReactionBlock" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`COMMENT ON COLUMN "blocking"."isReactionBlock" IS 'Whether the blockee is a reaction block.'`); - await queryRunner.query(`CREATE INDEX "IDX_7b0698c38d27a5554bed4858bd" ON "blocking" ("isReactionBlock") `); - } - - async down(queryRunner) { - await queryRunner.query(`DELETE FROM blocking WHERE "isReactionBlock" = 'true'`); // blockingテーブルのisReactionBlockカラムがtrueの行を削除する - await queryRunner.query(`DROP INDEX "IDX_7b0698c38d27a5554bed4858bd"`); - await queryRunner.query(`ALTER TABLE "blocking" DROP COLUMN "isReactionBlock"`); - } -} diff --git a/packages/backend/migration/1731932268436-addBlockingReactionUser.js b/packages/backend/migration/1731932268436-addBlockingReactionUser.js new file mode 100644 index 0000000000..62033fb434 --- /dev/null +++ b/packages/backend/migration/1731932268436-addBlockingReactionUser.js @@ -0,0 +1,16 @@ +export class AddBlockingReactionUser1731932268436 { + name = 'AddBlockingReactionUser1731932268436' + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "blocking" ADD "blockType" character varying NOT NULL DEFAULT 'user'`); + await queryRunner.query(`COMMENT ON COLUMN "blocking"."blockType" IS 'Block type.'`); + await queryRunner.query(`CREATE INDEX "IDX_cd38e7ea08163899a2d1f4427d" ON "blocking" ("blockType") `); + } + + async down(queryRunner) { + await queryRunner.query(`DELETE FROM blocking WHERE "blockType" = 'reaction'`); // blockingテーブルのblockTypeがreactionの行を削除 + await queryRunner.query(`DROP INDEX "public"."IDX_cd38e7ea08163899a2d1f4427d"`); + await queryRunner.query(`COMMENT ON COLUMN "blocking"."blockType" IS 'Block type.'`); + await queryRunner.query(`ALTER TABLE "blocking" DROP COLUMN "blockType"`); + } +}