import { MigrationInterface, QueryRunner } from 'typeorm';

/**
 * Acquisitions describe WHAT was acquired (vehicle, parts, equipment…) — the
 * vehicle link is optional and only for acquisitions that ARE a fleet vehicle.
 */
export class AddAcquisitionItemName2470000000000 implements MigrationInterface {
  name = 'AddAcquisitionItemName2470000000000';

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      ALTER TABLE freight.asset_acquisitions
        ADD COLUMN IF NOT EXISTS item_name varchar(200)
    `);
  }

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