Regenerate migrations for threads

This commit is contained in:
Rory&
2026-01-28 22:42:29 +01:00
parent 22241a714f
commit 1f1564539e
4 changed files with 6 additions and 67 deletions
@@ -1,15 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class ThreadGoof1764622231800 implements MigrationInterface {
name = "ThreadGoof1764622231800";
public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
await queryRunner.query(`ALTER TABLE "messages" DROP CONSTRAINT "FK_bb3af7f695d50083e6523290d41"`);
}
}
@@ -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<void> {
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<void> {
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"`);
@@ -1,25 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class Threads1764609924756 implements MigrationInterface {
name = "Threads1764609924756";
public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
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`,
);
}
}
@@ -1,25 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class Threadtypo1764610059742 implements MigrationInterface {
name = "Threadtypo1764610059742";
public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
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`,
);
}
}