summary refs log tree commit diff
path: root/src/util/migration/postgres/1764622231800-threadGoof.ts
blob: 3a2737eac1603614517df630f0b972df1a289da4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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"`);
    }
}