summary refs log tree commit diff
path: root/src/database/migration/postgres
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-08-07 23:58:01 +0200
committerRory& <root@rory.gay>2026-08-08 00:08:52 +0200
commit0452c0680fdf660417787133bc022e125d6b985f (patch)
tree4530d61ed573bdb923cb02d78f1fb343557945c4 /src/database/migration/postgres
parentAssert that requesting user is a member of (group/) DM before allowing them t... (diff)
downloadserver-ts-0452c0680fdf660417787133bc022e125d6b985f.tar.xz
Fix categories type
Diffstat (limited to 'src/database/migration/postgres')
-rw-r--r--src/database/migration/postgres/1786139482251-Int2CategoryId.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/database/migration/postgres/1786139482251-Int2CategoryId.ts b/src/database/migration/postgres/1786139482251-Int2CategoryId.ts
new file mode 100644

index 000000000..fa94fd442 --- /dev/null +++ b/src/database/migration/postgres/1786139482251-Int2CategoryId.ts
@@ -0,0 +1,15 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class Int2CategoryId1786139482251 implements MigrationInterface { + name = "Int2CategoryId1786139482251"; + + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(`ALTER TABLE guilds ALTER COLUMN primary_category_id TYPE int2 USING primary_category_id::int2`); + await queryRunner.query(`ALTER TABLE categories ALTER COLUMN id TYPE smallserial USING id::smallserial`); + } + + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(`ALTER TABLE guilds ALTER COLUMN primary_category_id TYPE bigint USING primary_category_id::bigint`); + await queryRunner.query(`ALTER TABLE categories ALTER COLUMN id TYPE bigint USING id::bigint`); + } +}