import { MigrationInterface, QueryRunner } from "typeorm";

export class UpdateCommandAddIsSign1727151717676 implements MigrationInterface {
    name = 'UpdateCommandAddIsSign1727151717676'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE \`command\` ADD \`isSignature\` tinyint NULL COMMENT 'ออกคำสั่งแบบ Digital Signature'`);
        await queryRunner.query(`ALTER TABLE \`command\` ADD \`isDraft\` tinyint NOT NULL COMMENT 'ยืนยันทำแบบร่าง' DEFAULT 0`);
        await queryRunner.query(`ALTER TABLE \`command\` ADD \`isSign\` tinyint NOT NULL COMMENT 'ผู้มีอำนาจลงนาม' DEFAULT 0`);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isSign\``);
        await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isDraft\``);
        await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isSignature\``);
    }

}
