Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class SavedDbQueryEntity {
@Column({ type: 'text', default: null, nullable: true })
description: string | null;

@Column({ type: 'varchar' })
@Column({ type: 'varchar', nullable: true, default: DashboardWidgetTypeEnum.Chart })
widget_type: DashboardWidgetTypeEnum;

Copilot AI Feb 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TypeScript type for widget_type is declared as non-nullable (DashboardWidgetTypeEnum), but the column decorator marks it as nullable with a default value. This creates a type mismatch. The property type should be changed to 'DashboardWidgetTypeEnum | null' to accurately reflect the database schema, or the nullable option should be removed if widget_type should always have a value.

Suggested change
widget_type: DashboardWidgetTypeEnum;
widget_type: DashboardWidgetTypeEnum | null;

Copilot uses AI. Check for mistakes.

@Column({ type: 'varchar', default: null, nullable: true })
Expand All @@ -36,7 +36,7 @@ export class SavedDbQueryEntity {
@Column('json', { default: null, nullable: true })
widget_options: string | null;

@Column({ type: 'text' })
@Column({ type: 'text', nullable: true, default: null })
query_text: string;

Copilot AI Feb 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TypeScript type for query_text is declared as non-nullable (string), but the column decorator marks it as nullable. This creates a type mismatch. The property type should be changed to 'string | null' to match the database schema and prevent potential runtime errors when accessing this field.

Suggested change
query_text: string;
query_text: string | null;

Copilot uses AI. Check for mistakes.

@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class MovedDashboardWidgetPropertiesToSavedQuery1770116525022 implements MigrationInterface {
name = 'MovedDashboardWidgetPropertiesToSavedQuery1770116525022';
export class MovedDashboardWidgetPropertiesToSavedQuery1770126075082 implements MigrationInterface {
name = 'MovedDashboardWidgetPropertiesToSavedQuery1770126075082';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "dashboard_widget" DROP COLUMN "widget_options"`);
await queryRunner.query(`ALTER TABLE "dashboard_widget" DROP COLUMN "widget_type"`);
await queryRunner.query(`ALTER TABLE "dashboard_widget" DROP COLUMN "name"`);
await queryRunner.query(`ALTER TABLE "dashboard_widget" DROP COLUMN "description"`);
await queryRunner.query(`ALTER TABLE "dashboard_widget" DROP COLUMN "chart_type"`);
await queryRunner.query(`ALTER TABLE "saved_db_query" ADD "widget_type" character varying NOT NULL`);
await queryRunner.query(`ALTER TABLE "saved_db_query" ADD "widget_type" character varying DEFAULT 'chart'`);
await queryRunner.query(`ALTER TABLE "saved_db_query" ADD "chart_type" character varying`);
await queryRunner.query(`ALTER TABLE "saved_db_query" ADD "widget_options" json`);
await queryRunner.query(`ALTER TABLE "saved_db_query" ALTER COLUMN "query_text" DROP NOT NULL`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "saved_db_query" ALTER COLUMN "query_text" SET NOT NULL`);
await queryRunner.query(`ALTER TABLE "saved_db_query" DROP COLUMN "widget_options"`);
await queryRunner.query(`ALTER TABLE "saved_db_query" DROP COLUMN "chart_type"`);
await queryRunner.query(`ALTER TABLE "saved_db_query" DROP COLUMN "widget_type"`);
Expand Down
Loading