defmodule Microwaveprop.Repo.Migrations.RenameBeaconPowerToMw do
  use Ecto.Migration

  def up do
    rename table(:beacons), :power_watts, to: :power_mw
    execute "UPDATE beacons SET power_mw = power_mw * 1000"
  end

  def down do
    execute "UPDATE beacons SET power_mw = power_mw / 1000"
    rename table(:beacons), :power_mw, to: :power_watts
  end
end
