Renames the rover-location status enum and every label that referenced it. Existing rows are migrated in place. Also touches the consumers: - Rover.Location enum + default - RoverLocationsLive index, status filter, form, show, badges - Rover.Compute and rover_live (only_ideal_locations → only_good_locations) - RoverPlanning context candidate filter (status == :good) - RoverPlanning.Show / Form copy - All rover-related tests
15 lines
633 B
Elixir
15 lines
633 B
Elixir
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
|