import { MigrationInterface, QueryRunner } from "typeorm";

export class UpdataTablePosmasterAddCondition1730381986173 implements MigrationInterface {
    name = 'UpdataTablePosmasterAddCondition1730381986173'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE \`metaStateOperator\` DROP COLUMN \`Column18\``);
        await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`isCondition\` tinyint NOT NULL COMMENT 'ตำแหน่งติดเงื่อนไข' DEFAULT 0`);
        await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`conditionReason\` text NULL COMMENT 'หมายเหตุตำแหน่งติดเงื่อนไข'`);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`conditionReason\``);
        await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`isCondition\``);
        await queryRunner.query(`ALTER TABLE \`metaStateOperator\` ADD \`Column18\` varchar(50) NULL`);
    }

}
