import { MigrationInterface, QueryRunner } from "typeorm";

export class UpdateCommandReciveAddSalary1727246671059 implements MigrationInterface {
    name = 'UpdateCommandReciveAddSalary1727246671059'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`order\` int NULL COMMENT 'ลำดับแสดงผล'`);
        await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`remarkVertical\` text NULL COMMENT 'หมายเหตุแนวตั้ง'`);
        await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`remarkHorizontal\` text NULL COMMENT 'หมายเหตุแนวนอน'`);
        await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`amount\` double NULL COMMENT 'เงินเดือนฐาน' DEFAULT '0'`);
        await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`positionSalaryAmount\` double NULL COMMENT 'เงินประจำตำแหน่ง' DEFAULT '0'`);
        await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`mouthSalaryAmount\` double NULL COMMENT 'เงินค่าตอบแทนรายเดือน' DEFAULT '0'`);
    }

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

}
