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

  def change do
    create table(:nexrad_observations, primary_key: false) do
      add :id, :binary_id, primary_key: true, null: false
      add :observed_at, :utc_datetime, null: false
      add :lat, :float, null: false
      add :lon, :float, null: false
      add :mean_reflectivity_dbz, :float
      add :max_reflectivity_dbz, :float
      add :texture_variance, :float
      add :pixel_count, :integer

      timestamps(type: :utc_datetime)
    end

    create unique_index(:nexrad_observations, [:lat, :lon, :observed_at])
    create index(:nexrad_observations, [:observed_at])
  end
end
