From 19d665fd69882c95b6cfcaa3de16c75665cbf9bb Mon Sep 17 00:00:00 2001 From: Adisak Date: Mon, 3 Nov 2025 15:57:41 +0700 Subject: [PATCH] migration --- src/entities/ApiKey.ts | 2 +- src/entities/ProfileTraining.ts | 4 ++-- .../1762159481993-update_size_keyapi_field.ts | 17 +++++++++++++++++ .../1762159824907-update_size_place_field.ts | 16 ++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 src/migration/1762159481993-update_size_keyapi_field.ts create mode 100644 src/migration/1762159824907-update_size_place_field.ts diff --git a/src/entities/ApiKey.ts b/src/entities/ApiKey.ts index 8f220fea..c8e099e8 100644 --- a/src/entities/ApiKey.ts +++ b/src/entities/ApiKey.ts @@ -14,9 +14,9 @@ export class ApiKey extends EntityBase { name: string; @Column({ + type: 'longtext', nullable: true, comment: "keyApi", - length: 255, default: null, }) keyApi: string; diff --git a/src/entities/ProfileTraining.ts b/src/entities/ProfileTraining.ts index e4b29b70..2afaa17a 100644 --- a/src/entities/ProfileTraining.ts +++ b/src/entities/ProfileTraining.ts @@ -55,9 +55,9 @@ export class ProfileTraining extends EntityBase { topic: string; @Column({ + type: 'longtext', nullable: true, - length: 200, - comment: "สถานที่ฝึกอบรม/ดูงาน ", + comment: "สถานที่ฝึกอบรม/ดูงาน", default: null, }) place: string; diff --git a/src/migration/1762159481993-update_size_keyapi_field.ts b/src/migration/1762159481993-update_size_keyapi_field.ts new file mode 100644 index 00000000..17b1b0d2 --- /dev/null +++ b/src/migration/1762159481993-update_size_keyapi_field.ts @@ -0,0 +1,17 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateSizeKeyapiField1762159481993 implements MigrationInterface { + name = 'UpdateSizeKeyapiField1762159481993' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`apiKey\` DROP COLUMN \`keyApi\``); + await queryRunner.query(`ALTER TABLE \`apiKey\` ADD \`keyApi\` longtext NULL COMMENT 'keyApi'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`apiKey\` DROP COLUMN \`keyApi\``); + await queryRunner.query(`ALTER TABLE \`apiKey\` ADD \`keyApi\` varchar(255) NULL COMMENT 'keyApi'`); + + } + +} diff --git a/src/migration/1762159824907-update_size_place_field.ts b/src/migration/1762159824907-update_size_place_field.ts new file mode 100644 index 00000000..56976d9f --- /dev/null +++ b/src/migration/1762159824907-update_size_place_field.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateSizePlaceField1762159824907 implements MigrationInterface { + name = 'UpdateSizePlaceField1762159824907' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileTraining\` DROP COLUMN \`place\``); + await queryRunner.query(`ALTER TABLE \`profileTraining\` ADD \`place\` longtext NULL COMMENT 'สถานที่ฝึกอบรม/ดูงาน'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileTraining\` DROP COLUMN \`place\``); + await queryRunner.query(`ALTER TABLE \`profileTraining\` ADD \`place\` varchar(200) NULL COMMENT 'สถานที่ฝึกอบรม/ดูงาน '`); + } + +}