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
