From 438e164fcb2d8fe719d2944b98ee7fba08dcac26 Mon Sep 17 00:00:00 2001 From: Bright Date: Mon, 24 Feb 2025 17:31:03 +0700 Subject: [PATCH] migrate --- src/entities/ProfileSalary.ts | 2 +- .../1740392430192-updateProfileSalary.ts | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/migration/1740392430192-updateProfileSalary.ts diff --git a/src/entities/ProfileSalary.ts b/src/entities/ProfileSalary.ts index 4ff74553..2ef4b4cf 100644 --- a/src/entities/ProfileSalary.ts +++ b/src/entities/ProfileSalary.ts @@ -242,7 +242,7 @@ export class ProfileSalary extends EntityBase { } export class CreateProfileSalary { - profileId: string; + profileId: string | null; commandDateAffect?: Date | null; commandDateSign?: Date | null; amount?: Double | null; diff --git a/src/migration/1740392430192-updateProfileSalary.ts b/src/migration/1740392430192-updateProfileSalary.ts new file mode 100644 index 00000000..6671212f --- /dev/null +++ b/src/migration/1740392430192-updateProfileSalary.ts @@ -0,0 +1,20 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateProfileSalary1740392430192 implements MigrationInterface { + name = 'UpdateProfileSalary1740392430192' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`commandNo\``); + await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`commandNo\` varchar(255) NULL COMMENT 'เลขที่คำสั่ง'`); + await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`commandNo\``); + await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`commandNo\` varchar(255) NULL COMMENT 'เลขที่คำสั่ง'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`commandNo\``); + await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`commandNo\` int NULL COMMENT 'เลขที่คำสั่ง'`); + await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`commandNo\``); + await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`commandNo\` int NULL COMMENT 'เลขที่คำสั่ง'`); + } + +}