summary refs log tree commit diff
path: root/src/util/migration/postgres
diff options
context:
space:
mode:
authorMathMan05 <mathmanrm@gmail.com>2026-02-03 19:37:21 -0600
committerRory& <root@rory.gay>2026-02-04 03:25:48 +0100
commiteaa2be281f59ca1aeeee35a09493008146d1a9d3 (patch)
tree1a75f0d28adaae88910bc747a9d477f1fc6b5cef /src/util/migration/postgres
parentunscrew up (diff)
downloadserver-ts-eaa2be281f59ca1aeeee35a09493008146d1a9d3.tar.xz
some fixes
Diffstat (limited to 'src/util/migration/postgres')
-rw-r--r--src/util/migration/postgres/1770168396106-threadMembers.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/util/migration/postgres/1770168396106-threadMembers.ts b/src/util/migration/postgres/1770168396106-threadMembers.ts
new file mode 100644

index 000000000..b7df8c814 --- /dev/null +++ b/src/util/migration/postgres/1770168396106-threadMembers.ts
@@ -0,0 +1,23 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class ThreadMembers1770168396106 implements MigrationInterface { + name = "ThreadMembers1770168396106"; + + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(`ALTER TABLE "thread_members" DROP CONSTRAINT "FK_606ac45e8756d3440c584477f4e"`); + await queryRunner.query(`DROP INDEX "public"."IDX_bde0970b6a26bdbd83508addd2"`); + await queryRunner.query(`CREATE UNIQUE INDEX "IDX_38d4f704373da3f0dc9b352acs9" ON "thread_members" ("id", "member_idx") `); + await queryRunner.query( + `ALTER TABLE "thread_members" ADD CONSTRAINT "FK_4721015b4e24ad29da55dbd2de0" FOREIGN KEY ("member_idx") REFERENCES "members"("index") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(`ALTER TABLE "thread_members" DROP CONSTRAINT "FK_4721015b4e24ad29da55dbd2de0"`); + await queryRunner.query(`DROP INDEX "public"."IDX_38d4f704373da3f0dc9b352ac9"`); + await queryRunner.query(`CREATE UNIQUE INDEX "IDX_bde0970b6a26bdbd83508addd2" ON "thread_members" ("id", "member_idx") `); + await queryRunner.query( + `ALTER TABLE "thread_members" ADD CONSTRAINT "FK_606ac45e8756d3440c584477f4e" FOREIGN KEY ("member_idx") REFERENCES "members"("index") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } +}