From d9fe1266d8fc04740fe959257b5227906913de66 Mon Sep 17 00:00:00 2001 From: Artem Niehrieiev Date: Fri, 24 Oct 2025 11:36:25 +0000 Subject: [PATCH] feat: update TableCategoriesEntity to allow nullable category_id and add migration for category_color --- .../entities/table-categories/table-categories.entity.ts | 2 +- ...oryColorPropertyAndCategoryIdToTableCategoriesEntity.ts} | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename backend/src/migrations/{1761142678373-AddCategoryColorPropertyAndCategoryIdToTableCategoriesEntity.ts => 1761305606579-AddCategoryColorPropertyAndCategoryIdToTableCategoriesEntity.ts} (84%) diff --git a/backend/src/entities/table-categories/table-categories.entity.ts b/backend/src/entities/table-categories/table-categories.entity.ts index 22f4ef083..66eefbfc5 100644 --- a/backend/src/entities/table-categories/table-categories.entity.ts +++ b/backend/src/entities/table-categories/table-categories.entity.ts @@ -9,7 +9,7 @@ export class TableCategoriesEntity { @Column({ type: 'varchar', length: 255 }) category_name: string; - @Column({ type: 'varchar', length: 255, nullable: false }) + @Column({ type: 'varchar', length: 255, nullable: true, default: null }) category_id: string; @Column({ type: 'varchar', length: 255, default: null, nullable: true }) diff --git a/backend/src/migrations/1761142678373-AddCategoryColorPropertyAndCategoryIdToTableCategoriesEntity.ts b/backend/src/migrations/1761305606579-AddCategoryColorPropertyAndCategoryIdToTableCategoriesEntity.ts similarity index 84% rename from backend/src/migrations/1761142678373-AddCategoryColorPropertyAndCategoryIdToTableCategoriesEntity.ts rename to backend/src/migrations/1761305606579-AddCategoryColorPropertyAndCategoryIdToTableCategoriesEntity.ts index 3dd6e2a73..d84ca94fa 100644 --- a/backend/src/migrations/1761142678373-AddCategoryColorPropertyAndCategoryIdToTableCategoriesEntity.ts +++ b/backend/src/migrations/1761305606579-AddCategoryColorPropertyAndCategoryIdToTableCategoriesEntity.ts @@ -1,10 +1,10 @@ import { MigrationInterface, QueryRunner } from 'typeorm'; -export class AddCategoryColorPropertyAndCategoryIdToTableCategoriesEntity1761142678373 implements MigrationInterface { - name = 'AddCategoryColorPropertyAndCategoryIdToTableCategoriesEntity1761142678373'; +export class AddCategoryColorPropertyAndCategoryIdToTableCategoriesEntity1761305606579 implements MigrationInterface { + name = 'AddCategoryColorPropertyAndCategoryIdToTableCategoriesEntity1761305606579'; public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "table_categories" ADD "category_id" character varying(255) NOT NULL`); + await queryRunner.query(`ALTER TABLE "table_categories" ADD "category_id" character varying(255)`); await queryRunner.query(`ALTER TABLE "table_categories" ADD "category_color" character varying(255)`); }