Migrate db: on event delete cascade event_revision

This commit is contained in:
Amit Jakubowicz 2019-12-05 15:57:55 +01:00
parent e51d493911
commit 315defb57e
1 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,16 @@
import {MigrationInterface, QueryRunner} from "typeorm";
export class default1575557500612 implements MigrationInterface {
name = 'default1575557500612'
public async up(queryRunner: QueryRunner): Promise<any> {
await queryRunner.query(`ALTER TABLE "event_revision" DROP CONSTRAINT "FK_425cb7725e4aa21d2e818d40094"`, undefined);
await queryRunner.query(`ALTER TABLE "event_revision" ADD CONSTRAINT "FK_425cb7725e4aa21d2e818d40094" FOREIGN KEY ("eventId") REFERENCES "event"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined);
}
public async down(queryRunner: QueryRunner): Promise<any> {
await queryRunner.query(`ALTER TABLE "event_revision" DROP CONSTRAINT "FK_425cb7725e4aa21d2e818d40094"`, undefined);
await queryRunner.query(`ALTER TABLE "event_revision" ADD CONSTRAINT "FK_425cb7725e4aa21d2e818d40094" FOREIGN KEY ("eventId") REFERENCES "event"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, undefined);
}
}