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 'เลขที่คำสั่ง'`); + } + +}