2023-10-13 18:17:29 +02:00
|
|
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
|
|
export class channelUnread1597459042300 implements MigrationInterface {
|
2023-04-07 03:56:46 +02:00
|
|
|
constructor() {
|
|
|
|
this.name = "channelUnread1597459042300";
|
|
|
|
}
|
2023-10-13 18:17:29 +02:00
|
|
|
async up(queryRunner: QueryRunner): Promise<void> {
|
2023-04-07 03:56:46 +02:00
|
|
|
await queryRunner.query(`TRUNCATE TABLE "note_unread"`, undefined);
|
|
|
|
await queryRunner.query(
|
|
|
|
`ALTER TABLE "channel_following" DROP COLUMN "readCursor"`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`ALTER TABLE "note_unread" ADD "isMentioned" boolean NOT NULL`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`ALTER TABLE "note_unread" ADD "noteChannelId" character varying(32)`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`CREATE INDEX "IDX_25b1dd384bec391b07b74b861c" ON "note_unread" ("isMentioned") `,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`CREATE INDEX "IDX_89a29c9237b8c3b6b3cbb4cb30" ON "note_unread" ("isSpecified") `,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`CREATE INDEX "IDX_29e8c1d579af54d4232939f994" ON "note_unread" ("noteUserId") `,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`CREATE INDEX "IDX_6a57f051d82c6d4036c141e107" ON "note_unread" ("noteChannelId") `,
|
|
|
|
);
|
|
|
|
}
|
2023-10-13 18:17:29 +02:00
|
|
|
async down(queryRunner: QueryRunner): Promise<void> {
|
2023-04-07 03:56:46 +02:00
|
|
|
await queryRunner.query(`DROP INDEX "IDX_6a57f051d82c6d4036c141e107"`);
|
|
|
|
await queryRunner.query(`DROP INDEX "IDX_29e8c1d579af54d4232939f994"`);
|
|
|
|
await queryRunner.query(`DROP INDEX "IDX_89a29c9237b8c3b6b3cbb4cb30"`);
|
|
|
|
await queryRunner.query(`DROP INDEX "IDX_25b1dd384bec391b07b74b861c"`);
|
|
|
|
await queryRunner.query(
|
|
|
|
`ALTER TABLE "note_unread" DROP COLUMN "noteChannelId"`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`ALTER TABLE "note_unread" DROP COLUMN "isMentioned"`,
|
|
|
|
);
|
|
|
|
await queryRunner.query(
|
|
|
|
`ALTER TABLE "channel_following" ADD "readCursor" TIMESTAMP WITH TIME ZONE NOT NULL`,
|
|
|
|
);
|
|
|
|
}
|
2020-08-18 15:44:21 +02:00
|
|
|
}
|