From 1f1564539ee14a1903a7ba6ae499bbd293b5265c Mon Sep 17 00:00:00 2001 From: Rory& Date: Wed, 28 Jan 2026 22:42:29 +0100 Subject: [PATCH] Regenerate migrations for threads --- .../postgres/1764622231800-threadGoof.ts | 15 ----------- ...04-threads.ts => 1769636200774-Threads.ts} | 8 ++++-- .../postgres/1764609924756-threads.ts | 25 ------------------- .../postgres/1764610059742-threadtypo.ts | 25 ------------------- 4 files changed, 6 insertions(+), 67 deletions(-) delete mode 100644 src/util/migration/postgres/1764622231800-threadGoof.ts rename src/util/migration/postgres/{1764612754204-threads.ts => 1769636200774-Threads.ts} (71%) delete mode 100644 src/util/migrations/postgres/1764609924756-threads.ts delete mode 100644 src/util/migrations/postgres/1764610059742-threadtypo.ts diff --git a/src/util/migration/postgres/1764622231800-threadGoof.ts b/src/util/migration/postgres/1764622231800-threadGoof.ts deleted file mode 100644 index 3a2737eac..000000000 --- a/src/util/migration/postgres/1764622231800-threadGoof.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class ThreadGoof1764622231800 implements MigrationInterface { - name = "ThreadGoof1764622231800"; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE "messages" ADD CONSTRAINT "FK_bb3af7f695d50083e6523290d41" FOREIGN KEY ("thread_id") REFERENCES "channels"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "messages" DROP CONSTRAINT "FK_bb3af7f695d50083e6523290d41"`); - } -} diff --git a/src/util/migration/postgres/1764612754204-threads.ts b/src/util/migration/postgres/1769636200774-Threads.ts similarity index 71% rename from src/util/migration/postgres/1764612754204-threads.ts rename to src/util/migration/postgres/1769636200774-Threads.ts index e3690dacc..1a8f8fdd2 100644 --- a/src/util/migration/postgres/1764612754204-threads.ts +++ b/src/util/migration/postgres/1769636200774-Threads.ts @@ -1,7 +1,7 @@ import { MigrationInterface, QueryRunner } from "typeorm"; -export class Threads1764612754204 implements MigrationInterface { - name = "Threads1764612754204"; +export class Threads1769636200774 implements MigrationInterface { + name = "Threads1769636200774"; public async up(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "messages" ADD "thread_id" character varying`); @@ -9,9 +9,13 @@ export class Threads1764612754204 implements MigrationInterface { await queryRunner.query(`ALTER TABLE "channels" ADD "member_count" integer`); await queryRunner.query(`ALTER TABLE "channels" ADD "message_count" integer`); await queryRunner.query(`ALTER TABLE "channels" ADD "total_message_sent" integer`); + await queryRunner.query( + `ALTER TABLE "messages" ADD CONSTRAINT "FK_bb3af7f695d50083e6523290d41" FOREIGN KEY ("thread_id") REFERENCES "channels"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); } public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "messages" DROP CONSTRAINT "FK_bb3af7f695d50083e6523290d41"`); await queryRunner.query(`ALTER TABLE "channels" DROP COLUMN "total_message_sent"`); await queryRunner.query(`ALTER TABLE "channels" DROP COLUMN "message_count"`); await queryRunner.query(`ALTER TABLE "channels" DROP COLUMN "member_count"`); diff --git a/src/util/migrations/postgres/1764609924756-threads.ts b/src/util/migrations/postgres/1764609924756-threads.ts deleted file mode 100644 index efa2ce7f4..000000000 --- a/src/util/migrations/postgres/1764609924756-threads.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class Threads1764609924756 implements MigrationInterface { - name = "Threads1764609924756"; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "messages" DROP CONSTRAINT "FK_bb3af7f695d50083e6523290d41"`); - await queryRunner.query(`ALTER TABLE "channels" DROP COLUMN "total_message_sent"`); - await queryRunner.query(`ALTER TABLE "channels" ADD "total_messsage_sent" integer`); - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "thread_metadata" DROP NOT NULL`); - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "member_count" DROP NOT NULL`); - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "message_count" DROP NOT NULL`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "message_count" SET NOT NULL`); - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "member_count" SET NOT NULL`); - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "thread_metadata" SET NOT NULL`); - await queryRunner.query(`ALTER TABLE "channels" DROP COLUMN "total_messsage_sent"`); - await queryRunner.query(`ALTER TABLE "channels" ADD "total_message_sent" integer NOT NULL`); - await queryRunner.query( - `ALTER TABLE "messages" ADD CONSTRAINT "FK_bb3af7f695d50083e6523290d41" FOREIGN KEY ("thread_id") REFERENCES "channels"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - } -} diff --git a/src/util/migrations/postgres/1764610059742-threadtypo.ts b/src/util/migrations/postgres/1764610059742-threadtypo.ts deleted file mode 100644 index 2fe2a985a..000000000 --- a/src/util/migrations/postgres/1764610059742-threadtypo.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class Threadtypo1764610059742 implements MigrationInterface { - name = "Threadtypo1764610059742"; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "messages" DROP CONSTRAINT "FK_bb3af7f695d50083e6523290d41"`); - await queryRunner.query(`ALTER TABLE "channels" DROP COLUMN "total_message_sent"`); - await queryRunner.query(`ALTER TABLE "channels" ADD "total_messsage_sent" integer`); - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "thread_metadata" DROP NOT NULL`); - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "member_count" DROP NOT NULL`); - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "message_count" DROP NOT NULL`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "message_count" SET NOT NULL`); - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "member_count" SET NOT NULL`); - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "thread_metadata" SET NOT NULL`); - await queryRunner.query(`ALTER TABLE "channels" DROP COLUMN "total_messsage_sent"`); - await queryRunner.query(`ALTER TABLE "channels" ADD "total_message_sent" integer NOT NULL`); - await queryRunner.query( - `ALTER TABLE "messages" ADD CONSTRAINT "FK_bb3af7f695d50083e6523290d41" FOREIGN KEY ("thread_id") REFERENCES "channels"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - } -}