import { MigrationInterface, QueryRunner } from "typeorm";

export class UpdataTableProfileAddSalary11730774144012 implements MigrationInterface {
    name = 'UpdataTableProfileAddSalary11730774144012'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`amount\` double NULL COMMENT 'เงินเดือนฐาน' DEFAULT '0'`);
        await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`positionSalaryAmount\` double NULL COMMENT 'เงินประจำตำแหน่ง' DEFAULT '0'`);
        await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`mouthSalaryAmount\` double NULL COMMENT 'เงินค่าตอบแทนรายเดือน' DEFAULT '0'`);
        await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`amount\` double NULL COMMENT 'เงินเดือนฐาน' DEFAULT '0'`);
        await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`positionSalaryAmount\` double NULL COMMENT 'เงินประจำตำแหน่ง' DEFAULT '0'`);
        await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`mouthSalaryAmount\` double NULL COMMENT 'เงินค่าตอบแทนรายเดือน' DEFAULT '0'`);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`mouthSalaryAmount\``);
        await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`positionSalaryAmount\``);
        await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`amount\``);
        await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`mouthSalaryAmount\``);
        await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`positionSalaryAmount\``);
        await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`amount\``);
    }

}
