diff --git a/backend/src/entities/connection-properties/connection-properties.entity.ts b/backend/src/entities/connection-properties/connection-properties.entity.ts index f3afccc7b..8645043bf 100644 --- a/backend/src/entities/connection-properties/connection-properties.entity.ts +++ b/backend/src/entities/connection-properties/connection-properties.entity.ts @@ -13,10 +13,10 @@ export class ConnectionPropertiesEntity { @Column({ default: null }) logo_url: string; - @Column({ default: null }) + @Column({ default: '' }) primary_color: string; - @Column({ default: null }) + @Column({ default: '' }) secondary_color: string; @Column({ default: null }) diff --git a/backend/src/migrations/1762258082256-ChangeDefultColorValuesInConnectionProperties.ts b/backend/src/migrations/1762258082256-ChangeDefultColorValuesInConnectionProperties.ts new file mode 100644 index 000000000..53697f8fc --- /dev/null +++ b/backend/src/migrations/1762258082256-ChangeDefultColorValuesInConnectionProperties.ts @@ -0,0 +1,21 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class ChangeDefultColorValuesInConnectionProperties1762258082256 implements MigrationInterface { + name = 'ChangeDefultColorValuesInConnectionProperties1762258082256'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "connectionProperties" ALTER COLUMN "primary_color" SET DEFAULT ''`); + await queryRunner.query(`UPDATE "connectionProperties" SET "primary_color" = '' WHERE "primary_color" IS NULL`); + await queryRunner.query(`ALTER TABLE "connectionProperties" ALTER COLUMN "primary_color" SET NOT NULL`); + await queryRunner.query(`ALTER TABLE "connectionProperties" ALTER COLUMN "secondary_color" SET DEFAULT ''`); + await queryRunner.query(`UPDATE "connectionProperties" SET "secondary_color" = '' WHERE "secondary_color" IS NULL`); + await queryRunner.query(`ALTER TABLE "connectionProperties" ALTER COLUMN "secondary_color" SET NOT NULL`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "connectionProperties" ALTER COLUMN "secondary_color" DROP DEFAULT`); + await queryRunner.query(`ALTER TABLE "connectionProperties" ALTER COLUMN "secondary_color" DROP NOT NULL`); + await queryRunner.query(`ALTER TABLE "connectionProperties" ALTER COLUMN "primary_color" DROP DEFAULT`); + await queryRunner.query(`ALTER TABLE "connectionProperties" ALTER COLUMN "primary_color" DROP NOT NULL`); + } +}