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

  def change do
    create table(:propagation_scores, primary_key: false) do
      add :id, :binary_id, primary_key: true
      add :lat, :float, null: false
      add :lon, :float, null: false
      add :valid_time, :utc_datetime, null: false
      add :band_mhz, :integer, null: false
      add :score, :integer, null: false
      add :factors, :map, null: false

      timestamps(type: :utc_datetime)
    end

    create unique_index(:propagation_scores, [:lat, :lon, :valid_time, :band_mhz])
    create index(:propagation_scores, [:valid_time])
    create index(:propagation_scores, [:band_mhz, :valid_time])
  end
end
