1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-12 05:38:51 +09:00
MisskeyIO/packages/backend/migration/1675053125067-fixforeignkeyreports.js
riku6460 8d06a6475e
chore: 著作権とライセンスについての情報を各ファイルに追加する (#141)
* chore: 著作権とライセンスについての情報を各ファイルに追加する

* chore: Add the SPDX information to each file

Add copyright and licensing information as defined in version 3.0 of
the REUSE Specification.

* tweak format

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>

* chore: Add SPDX-License-Identifier [skip ci]

* add missing SPDX-License-Identifier

* remove unused file

---------

Co-authored-by: Shun Sakai <sorairolake@protonmail.ch>
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Co-authored-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com>
2023-08-15 02:52:38 +09:00

21 lines
1.1 KiB
JavaScript

/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class fixforeignkeyreports1675053125067 {
name = 'fixforeignkeyreports1675053125067'
async up(queryRunner) {
await queryRunner.query(`CREATE INDEX IF NOT EXISTS "IDX_a9021cc2e1feb5f72d3db6e9f5" ON "abuse_user_report" ("targetUserId")`);
await queryRunner.query(`DELETE FROM "abuse_user_report" WHERE "targetUserId" NOT IN (SELECT "id" FROM "user")`);
await queryRunner.query(`ALTER TABLE "abuse_user_report" DROP CONSTRAINT IF EXISTS "FK_a9021cc2e1feb5f72d3db6e9f5f"`);
await queryRunner.query(`ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_a9021cc2e1feb5f72d3db6e9f5f" FOREIGN KEY ("targetUserId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
}
async down(queryRunner) {
await queryRunner.query(`DROP INDEX "public"."IDX_a9021cc2e1feb5f72d3db6e9f5"`);
await queryRunner.query(`ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_a9021cc2e1feb5f72d3db6e9f5f"`);
}
}