summary refs log tree commit diff
path: root/src/util/migration
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-02-23 06:53:08 +0100
committerRory& <root@rory.gay>2026-02-23 06:53:08 +0100
commit2775d5aa0bd2f0a9ca085cee2ba976b51e3084cd (patch)
treeb9cf22bab4f388acdb0d77cf0998600034db412a /src/util/migration
parentDiscovery fixes, nix updates (diff)
downloadserver-ts-2775d5aa0bd2f0a9ca085cee2ba976b51e3084cd.tar.xz
Faster pings
Diffstat (limited to 'src/util/migration')
-rw-r--r--src/util/migration/postgres/1771825341528-MoreReadStateFields.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/util/migration/postgres/1771825341528-MoreReadStateFields.ts b/src/util/migration/postgres/1771825341528-MoreReadStateFields.ts
new file mode 100644

index 00000000..3b0d05af --- /dev/null +++ b/src/util/migration/postgres/1771825341528-MoreReadStateFields.ts
@@ -0,0 +1,25 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class MoreReadStateFields1771825341528 implements MigrationInterface { + name = "MoreReadStateFields1771825341528"; + + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(`ALTER TABLE "read_states" DROP COLUMN "public_ack"`); + await queryRunner.query(`ALTER TABLE "read_states" ADD "last_acked_id" character varying`); + await queryRunner.query(`ALTER TABLE "read_states" ADD "badge_count" integer NOT NULL DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE "read_states" ADD "read_state_type" integer NOT NULL DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE "read_states" ADD "flags" integer NOT NULL DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE "read_states" ALTER COLUMN "mention_count" SET NOT NULL`); + await queryRunner.query(`ALTER TABLE "read_states" ALTER COLUMN "mention_count" SET DEFAULT '0'`); + } + + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(`ALTER TABLE "read_states" ALTER COLUMN "mention_count" DROP DEFAULT`); + await queryRunner.query(`ALTER TABLE "read_states" ALTER COLUMN "mention_count" DROP NOT NULL`); + await queryRunner.query(`ALTER TABLE "read_states" DROP COLUMN "flags"`); + await queryRunner.query(`ALTER TABLE "read_states" DROP COLUMN "read_state_type"`); + await queryRunner.query(`ALTER TABLE "read_states" DROP COLUMN "badge_count"`); + await queryRunner.query(`ALTER TABLE "read_states" DROP COLUMN "last_acked_id"`); + await queryRunner.query(`ALTER TABLE "read_states" ADD "public_ack" character varying`); + } +}