Skip to content

Commit

Permalink
Make activityByMonth field of crag entity non nullable.
Browse files Browse the repository at this point in the history
  • Loading branch information
salamca committed Oct 6, 2023
1 parent 8054c27 commit b359a7c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/crags/entities/crag.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export class Crag extends BaseEntity {
@Column({ name: 'user_id', nullable: true })
userId: string;

@Column({ type: 'int', array: true, nullable: true })
@Field(() => [Int], { nullable: true })
@Column({ type: 'int', array: true })
@Field(() => [Int])
activityByMonth: number[];
}
19 changes: 19 additions & 0 deletions src/migration/1696588233248-activityByMonthNonNullable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

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

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "crag" ALTER COLUMN "activity_by_month" SET NOT NULL`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "crag" ALTER COLUMN "activity_by_month" DROP NOT NULL`,
);
}
}

0 comments on commit b359a7c

Please sign in to comment.