Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
feat: change episode to allow null images
Browse files Browse the repository at this point in the history
  • Loading branch information
coder2000 committed May 11, 2020
1 parent 40e727b commit b48ac0e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/server/src/db/dto/episode.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class EpisodeDto {
@Field()
url: string;

@Field()
@Field({ nullable: true })
image: string;

@Field()
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/db/entities/episode.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class EpisodeEntity {
@Column()
url: string;

@Column()
@Column({ nullable: true })
image: string;

@Column()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class ChangeEpisodeImageToAllowNull1589228321950
implements MigrationInterface {
name = 'ChangeEpisodeImageToAllowNull1589228321950';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "episode" ALTER COLUMN "image" DROP NOT NULL`,
undefined,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "episode" ALTER COLUMN "image" SET NOT NULL`,
undefined,
);
}
}

0 comments on commit b48ac0e

Please sign in to comment.