TradeTariffBackend::DataMigrator.migration do
  name "Remove 0% measure on Cigarettes Other"

  up do
    applicable {
      Measure::Operation.where(measure_sid: -491537).where(measure_type_id: 'FAA').where(goods_nomenclature_item_id: '2402209000').any?
    }
    apply {
      Measure::Operation.where(measure_sid: -491537).where(measure_type_id: 'FAA').where(goods_nomenclature_item_id: '2402209000').delete
      Measure::Operation.where(measure_sid: -490645).update(validity_end_date: nil)
    }
  end

  down do
    applicable {
      false
    }
    apply {
      # noop
    }
  end
end

Add data migration to resolve 0% measure
Add data migration to resolve 0% measure

It was reported that the Erga Omnes value for cigarettes other was
showing as 0%. Upon investigation we discovered an incorrect measure had
been supplied in the CHIEF file on 28/11/2018, to resolve this we've
implemented a data migration that removes the incorrect measure and sets
the `validity_end_date` on the previous measure to NULL to restore it.
