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

  def up do
    execute("UPDATE rover_locations SET status = 'good' WHERE status = 'ideal'")
    execute("UPDATE rover_locations SET status = 'bad' WHERE status = 'off_limits'")
    execute("ALTER TABLE rover_locations ALTER COLUMN status SET DEFAULT 'good'")
  end

  def down do
    execute("ALTER TABLE rover_locations ALTER COLUMN status SET DEFAULT 'ideal'")
    execute("UPDATE rover_locations SET status = 'off_limits' WHERE status = 'bad'")
    execute("UPDATE rover_locations SET status = 'ideal' WHERE status = 'good'")
  end
end
