feat: create migration for add column type on report-bookmark table #9
|
@ -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 {
|
||||
table_config = 'table_config',
|
||||
filter = 'filter',
|
||||
TABLE_CONFIG = 'TABLE_CONFIG',
|
||||
FILTER_TABLE = 'FILTER_TABLE',
|
||||
}
|
||||
|
|
|
@ -24,6 +24,10 @@ export class ReportBookmarkModel
|
|||
@Column('json', { nullable: true })
|
||||
configuration: any;
|
||||
|
||||
@Column('varchar')
|
||||
@Column('enum', {
|
||||
name: 'type',
|
||||
enum: REPORT_BOOKMARK_TYPE,
|
||||
default: REPORT_BOOKMARK_TYPE.TABLE_CONFIG,
|
||||
})
|
||||
type: REPORT_BOOKMARK_TYPE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue