import { MigrationInterface, QueryRunner } from "typeorm";

export class UpdateCommandAddIsAttachment1727081490162 implements MigrationInterface {
    name = 'UpdateCommandAddIsAttachment1727081490162'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE \`commandSys\` ADD \`order\` int NULL COMMENT 'ลำดับแสดงผล'`);
        await queryRunner.query(`ALTER TABLE \`command\` ADD \`isAttachment\` tinyint NOT NULL COMMENT 'สถานะบัญชีแนบท้าย' DEFAULT 1`);
        await queryRunner.query(`ALTER TABLE \`HR_POSITION_OFFICER\` ADD \`FLAG_PERSON_TYPE\` text NULL`);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE \`HR_POSITION_OFFICER\` DROP COLUMN \`FLAG_PERSON_TYPE\``);
        await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isAttachment\``);
        await queryRunner.query(`ALTER TABLE \`commandSys\` DROP COLUMN \`order\``);
    }

}
