From 6cc6bed80622a7289ff2baf0346d459f12afddd3 Mon Sep 17 00:00:00 2001 From: Adisak Date: Tue, 4 Nov 2025 15:16:53 +0700 Subject: [PATCH] migration --- src/entities/ApiHistory.ts | 6 +++--- ...rApi_and_tokenApi_field_ApiHistoryTable.ts | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 src/migration/1762243747843-update_size_headerApi_and_tokenApi_field_ApiHistoryTable.ts diff --git a/src/entities/ApiHistory.ts b/src/entities/ApiHistory.ts index c5f640d0..e84263b6 100644 --- a/src/entities/ApiHistory.ts +++ b/src/entities/ApiHistory.ts @@ -6,17 +6,17 @@ import { ApiName } from "./ApiName"; @Entity("apiHistory") export class ApiHistory extends EntityBase { @Column({ + type: 'longtext', nullable: true, comment: "header", - length: 255, - default: null, + default: null, }) headerApi: string; @Column({ + type: 'longtext', nullable: true, comment: "token", - length: 255, default: null, }) tokenApi: string; diff --git a/src/migration/1762243747843-update_size_headerApi_and_tokenApi_field_ApiHistoryTable.ts b/src/migration/1762243747843-update_size_headerApi_and_tokenApi_field_ApiHistoryTable.ts new file mode 100644 index 00000000..bed2927e --- /dev/null +++ b/src/migration/1762243747843-update_size_headerApi_and_tokenApi_field_ApiHistoryTable.ts @@ -0,0 +1,20 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateSizeHeaderApiAndTokenApiFieldApiHistoryTable1762243747843 implements MigrationInterface { + name = 'UpdateSizeHeaderApiAndTokenApiFieldApiHistoryTable1762243747843' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`apiHistory\` DROP COLUMN \`headerApi\``); + await queryRunner.query(`ALTER TABLE \`apiHistory\` ADD \`headerApi\` longtext NULL COMMENT 'header'`); + await queryRunner.query(`ALTER TABLE \`apiHistory\` DROP COLUMN \`tokenApi\``); + await queryRunner.query(`ALTER TABLE \`apiHistory\` ADD \`tokenApi\` longtext NULL COMMENT 'token'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`apiHistory\` DROP COLUMN \`tokenApi\``); + await queryRunner.query(`ALTER TABLE \`apiHistory\` ADD \`tokenApi\` varchar(255) NULL COMMENT 'token'`); + await queryRunner.query(`ALTER TABLE \`apiHistory\` DROP COLUMN \`headerApi\``); + await queryRunner.query(`ALTER TABLE \`apiHistory\` ADD \`headerApi\` varchar(255) NULL COMMENT 'header'`); + } + +}