fix (backend): incorrect database indices (renote_mute & reply_mute)
This commit is contained in:
parent
387bfd5af8
commit
c61e6cd255
2 changed files with 69 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
BEGIN;
|
||||
|
||||
DELETE FROM "migrations" WHERE name IN (
|
||||
'FixMutingIndices1710690239308',
|
||||
'RemoveMentionedUsersColumn1710688552234',
|
||||
'NoteFile1710304584214',
|
||||
'RenameMetaColumns1705944717480',
|
||||
|
@ -18,6 +19,17 @@ DELETE FROM "migrations" WHERE name IN (
|
|||
'RemoveNativeUtilsMigration1705877093218'
|
||||
);
|
||||
|
||||
-- fix-muting-indices
|
||||
DROP INDEX "IDX_renote_muting_createdAt";
|
||||
DROP INDEX "IDX_renote_muting_muteeId";
|
||||
DROP INDEX "IDX_renote_muting_muterId";
|
||||
DROP INDEX "IDX_reply_muting_createdAt";
|
||||
DROP INDEX "IDX_reply_muting_muteeId";
|
||||
DROP INDEX "IDX_reply_muting_muterId";
|
||||
CREATE INDEX "IDX_renote_muting_createdAt" ON "muting" ("createdAt");
|
||||
CREATE INDEX "IDX_renote_muting_muteeId" ON "muting" ("muteeId");
|
||||
CREATE INDEX "IDX_renote_muting_muterId" ON "muting" ("muterId");
|
||||
|
||||
-- remove-mentioned-users-column
|
||||
ALTER TABLE "note" ADD "mentionedRemoteUsers" text NOT NULL DEFAULT '[]'::text;
|
||||
CREATE TABLE "temp_mentions_1710688552234" AS
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class FixMutingIndices1710690239308 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_renote_muting_createdAt"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_renote_muting_muteeId"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_renote_muting_muterId"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_reply_muting_createdAt"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_reply_muting_muteeId"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_reply_muting_muterId"`);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_renote_muting_createdAt" ON "renote_muting" ("createdAt")`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_renote_muting_muteeId" ON "renote_muting" ("muteeId")`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_renote_muting_muterId" ON "renote_muting" ("muterId")`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_reply_muting_createdAt" ON "reply_muting" ("createdAt")`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_reply_muting_muteeId" ON "reply_muting" ("muteeId")`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_reply_muting_muterId" ON "reply_muting" ("muterId")`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_renote_muting_createdAt"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_renote_muting_muteeId"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_renote_muting_muterId"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_reply_muting_createdAt"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_reply_muting_muteeId"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_reply_muting_muterId"`);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_renote_muting_createdAt" ON "muting" ("createdAt")`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_renote_muting_muteeId" ON "muting" ("muteeId")`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_renote_muting_muterId" ON "muting" ("muterId")`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_reply_muting_createdAt" ON "muting" ("createdAt")`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_reply_muting_muteeId" ON "muting" ("muteeId")`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_reply_muting_muterId" ON "muting" ("muterId")`,
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue