prop/priv/repo/migrations/20260503160908_rename_rover_location_statuses.exs
Graham McIntire 209244f364
refactor(rover-locations): rename status atoms ideal→good, off_limits→bad
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
2026-05-03 11:13:18 -05:00

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