import { MigrationInterface, QueryRunner } from 'typeorm';

export class DropCargoTypeShowFreeTextBox1830000000000 implements MigrationInterface {
  name = 'DropCargoTypeShowFreeTextBox1830000000000';

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      ALTER TABLE freight.cargo_types
      DROP COLUMN IF EXISTS show_free_text_box
    `);
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      ALTER TABLE freight.cargo_types
      ADD COLUMN IF NOT EXISTS show_free_text_box boolean NOT NULL DEFAULT false
    `);
  }
}
