prop/priv/repo/migrations/20260426180436_create_rover_locations.exs
Graham McIntire 140351c0f6
feat(rover-locations): add /rover-locations page with CRUD
New globally-shared list of rover-friendly (or off-limits) parking
spots. Anyone can view; logged-in users can add new locations and
edit/delete their own. Each location stores lat/lon, free-text notes,
and a status enum (:ideal | :off_limits).

  * Microwaveprop.Rover.Location schema + migration
  * Rover.list_locations/0, create_location/2, update_location/3,
    delete_location/2 (mutations require User; ownership-scoped)
  * /rover-locations LiveView in the public live_session — Add button
    is disabled for anonymous visitors, Edit/Delete buttons render
    only on the user's own entries
  * Tests for context + LiveView covering anonymous read, owner-only
    edit/delete, and form submission
2026-04-26 13:08:27 -05:00

18 lines
616 B
Elixir

defmodule Microwaveprop.Repo.Migrations.CreateRoverLocations do
use Ecto.Migration
def change do
create table(:rover_locations, primary_key: false) do
add :id, :binary_id, primary_key: true, null: false
add :user_id, references(:users, type: :binary_id, on_delete: :nilify_all), null: false
add :lat, :float, null: false
add :lon, :float, null: false
add :status, :string, null: false, default: "ideal"
add :notes, :text
timestamps(type: :utc_datetime)
end
create index(:rover_locations, [:user_id])
create index(:rover_locations, [:status])
end
end