feat: create migration for add column type on report-bookmark table
parent
e2135c841f
commit
1d8cc6e13d
|
@ -0,0 +1,21 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||||
|
|
||||||
|
export class AddColumnTypeReportBookmark1719982860855
|
||||||
|
implements MigrationInterface
|
||||||
|
{
|
||||||
|
name = 'AddColumnTypeReportBookmark1719982860855';
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(
|
||||||
|
`CREATE TYPE "public"."report_bookmark_type_enum" AS ENUM('TABLE_CONFIG', 'FILTER_TABLE')`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "report_bookmark" ADD "type" "public"."report_bookmark_type_enum" NOT NULL DEFAULT 'TABLE_CONFIG'`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "report_bookmark" DROP COLUMN "type"`);
|
||||||
|
await queryRunner.query(`DROP TYPE "public"."report_bookmark_type_enum"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
export enum REPORT_BOOKMARK_TYPE {
|
export enum REPORT_BOOKMARK_TYPE {
|
||||||
table_config = 'table_config',
|
TABLE_CONFIG = 'TABLE_CONFIG',
|
||||||
filter = 'filter',
|
FILTER_TABLE = 'FILTER_TABLE',
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,10 @@ export class ReportBookmarkModel
|
||||||
@Column('json', { nullable: true })
|
@Column('json', { nullable: true })
|
||||||
configuration: any;
|
configuration: any;
|
||||||
|
|
||||||
@Column('varchar')
|
@Column('enum', {
|
||||||
|
name: 'type',
|
||||||
|
enum: REPORT_BOOKMARK_TYPE,
|
||||||
|
default: REPORT_BOOKMARK_TYPE.TABLE_CONFIG,
|
||||||
|
})
|
||||||
type: REPORT_BOOKMARK_TYPE;
|
type: REPORT_BOOKMARK_TYPE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue