summaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2020-07-27 13:34:20 +0900
committerGitHub <noreply@github.com>2020-07-27 13:34:20 +0900
commitcf43dd6ec530ba4a3f589ae917e89533b352f6a3 (patch)
tree76f35d06299b40370ec061ee5ed58182847d2e6e /migration
parentrefactor(client): Do not mutate prop directly (diff)
downloadsharkey-cf43dd6ec530ba4a3f589ae917e89533b352f6a3.tar.gz
sharkey-cf43dd6ec530ba4a3f589ae917e89533b352f6a3.tar.bz2
sharkey-cf43dd6ec530ba4a3f589ae917e89533b352f6a3.zip
ワードミュート (#6594)
* wip * wip * wip * wip * wip * wip * wip * wip * wip
Diffstat (limited to 'migration')
-rw-r--r--migration/1595771249699-word-mute.ts30
-rw-r--r--migration/1595782306083-word-mute2.ts18
2 files changed, 48 insertions, 0 deletions
diff --git a/migration/1595771249699-word-mute.ts b/migration/1595771249699-word-mute.ts
new file mode 100644
index 0000000000..1a9114d921
--- /dev/null
+++ b/migration/1595771249699-word-mute.ts
@@ -0,0 +1,30 @@
+import {MigrationInterface, QueryRunner} from "typeorm";
+
+export class wordMute1595771249699 implements MigrationInterface {
+ name = 'wordMute1595771249699'
+
+ public async up(queryRunner: QueryRunner): Promise<void> {
+ await queryRunner.query(`CREATE TABLE "muted_note" ("id" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, CONSTRAINT "PK_897e2eff1c0b9b64e55ca1418a4" PRIMARY KEY ("id"))`);
+ await queryRunner.query(`CREATE INDEX "IDX_70ab9786313d78e4201d81cdb8" ON "muted_note" ("noteId") `);
+ await queryRunner.query(`CREATE INDEX "IDX_d8e07aa18c2d64e86201601aec" ON "muted_note" ("userId") `);
+ await queryRunner.query(`CREATE UNIQUE INDEX "IDX_a8c6bfd637d3f1d67a27c48e27" ON "muted_note" ("noteId", "userId") `);
+ await queryRunner.query(`ALTER TABLE "user_profile" ADD "enableWordMute" boolean NOT NULL DEFAULT false`);
+ await queryRunner.query(`ALTER TABLE "user_profile" ADD "mutedWords" jsonb NOT NULL DEFAULT '[]'`);
+ await queryRunner.query(`CREATE INDEX "IDX_3befe6f999c86aff06eb0257b4" ON "user_profile" ("enableWordMute") `);
+ await queryRunner.query(`ALTER TABLE "muted_note" ADD CONSTRAINT "FK_70ab9786313d78e4201d81cdb89" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
+ await queryRunner.query(`ALTER TABLE "muted_note" ADD CONSTRAINT "FK_d8e07aa18c2d64e86201601aec1" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<void> {
+ await queryRunner.query(`ALTER TABLE "muted_note" DROP CONSTRAINT "FK_d8e07aa18c2d64e86201601aec1"`);
+ await queryRunner.query(`ALTER TABLE "muted_note" DROP CONSTRAINT "FK_70ab9786313d78e4201d81cdb89"`);
+ await queryRunner.query(`DROP INDEX "IDX_3befe6f999c86aff06eb0257b4"`);
+ await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "mutedWords"`);
+ await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "enableWordMute"`);
+ await queryRunner.query(`DROP INDEX "IDX_a8c6bfd637d3f1d67a27c48e27"`);
+ await queryRunner.query(`DROP INDEX "IDX_d8e07aa18c2d64e86201601aec"`);
+ await queryRunner.query(`DROP INDEX "IDX_70ab9786313d78e4201d81cdb8"`);
+ await queryRunner.query(`DROP TABLE "muted_note"`);
+ }
+
+}
diff --git a/migration/1595782306083-word-mute2.ts b/migration/1595782306083-word-mute2.ts
new file mode 100644
index 0000000000..d68c12740e
--- /dev/null
+++ b/migration/1595782306083-word-mute2.ts
@@ -0,0 +1,18 @@
+import {MigrationInterface, QueryRunner} from "typeorm";
+
+export class wordMute21595782306083 implements MigrationInterface {
+ name = 'wordMute21595782306083'
+
+ public async up(queryRunner: QueryRunner): Promise<void> {
+ await queryRunner.query(`CREATE TYPE "muted_note_reason_enum" AS ENUM('word', 'manual', 'spam', 'other')`);
+ await queryRunner.query(`ALTER TABLE "muted_note" ADD "reason" "muted_note_reason_enum" NOT NULL`);
+ await queryRunner.query(`CREATE INDEX "IDX_636e977ff90b23676fb5624b25" ON "muted_note" ("reason") `);
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<void> {
+ await queryRunner.query(`DROP INDEX "IDX_636e977ff90b23676fb5624b25"`);
+ await queryRunner.query(`ALTER TABLE "muted_note" DROP COLUMN "reason"`);
+ await queryRunner.query(`DROP TYPE "muted_note_reason_enum"`);
+ }
+
+}