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

  def change do
    create table(:commercial_links, primary_key: false) do
      add :id, :binary_id, primary_key: true
      add :label, :string, null: false
      add :host, :string, null: false
      add :community, :string, null: false
      add :radio_type, :string, null: false, default: "af11x"
      add :endpoint_a, :map
      add :endpoint_b, :map
      add :weather_station, :string
      add :enabled, :boolean, null: false, default: true

      timestamps(type: :utc_datetime)
    end

    create unique_index(:commercial_links, [:label])
    create index(:commercial_links, [:enabled])
  end
end
