import { MigrationInterface, QueryRunner } from 'typeorm';

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

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      ALTER TABLE freight.warehouse_fee_rules
        ADD COLUMN IF NOT EXISTS tiers jsonb NOT NULL DEFAULT '[]';
    `);
  }

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