Mod: Migrationファイルを再作成

This commit is contained in:
鴇峰 朔華 2024-11-18 21:20:27 +09:00
parent 26652949cb
commit 0301e86aff
2 changed files with 16 additions and 20 deletions

View File

@ -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"`);
}
}

View File

@ -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"`);
}
}