From 4b29b41ae20dca956a95fba284fca7ae3fa55ee8 Mon Sep 17 00:00:00 2001 From: Niek Candaele <22315101+niekcandaele@users.noreply.github.com> Date: Sun, 26 Jul 2020 00:10:59 +0200 Subject: [PATCH] Allow demo URL to be null (#30) --- entities/match.entity.ts | 2 +- .../1595714632487-allow-demoUrl-null.ts | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 migrations/1595714632487-allow-demoUrl-null.ts diff --git a/entities/match.entity.ts b/entities/match.entity.ts index 72fc723..88fc47e 100644 --- a/entities/match.entity.ts +++ b/entities/match.entity.ts @@ -38,7 +38,7 @@ export class Match extends BaseEntity { /** * URL to download the demo file */ - @Column() + @Column({ nullable: true }) demoUrl: string; /** diff --git a/migrations/1595714632487-allow-demoUrl-null.ts b/migrations/1595714632487-allow-demoUrl-null.ts new file mode 100644 index 0000000..8e16de8 --- /dev/null +++ b/migrations/1595714632487-allow-demoUrl-null.ts @@ -0,0 +1,19 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class allowDemoUrlNull1595714632487 implements MigrationInterface { + name = "allowDemoUrlNull1595714632487"; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "match" ALTER COLUMN "demoUrl" DROP NOT NULL`, + undefined + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "match" ALTER COLUMN "demoUrl" SET NOT NULL`, + undefined + ); + } +}