import { MigrationInterface, QueryRunner } from 'typeorm';

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

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE freight.cargo_types ADD COLUMN IF NOT EXISTS unit_of_measure VARCHAR(16);`,
    );
  }

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