24 lines
834 B
Elixir
24 lines
834 B
Elixir
defmodule Microwaveprop.Repo.Migrations.CreateFixedStations do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:fixed_stations, primary_key: false) do
|
|
add :id, :binary_id, primary_key: true, null: false
|
|
add :user_id, references(:users, type: :binary_id, on_delete: :delete_all), null: false
|
|
add :callsign, :string, null: false
|
|
add :grid, :string
|
|
add :lat, :float, null: false
|
|
add :lon, :float, null: false
|
|
add :elevation_m, :integer
|
|
add :selected, :boolean, null: false, default: true
|
|
add :position, :integer, null: false, default: 0
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
create index(:fixed_stations, [:user_id])
|
|
|
|
create unique_index(:fixed_stations, [:user_id, :callsign],
|
|
name: :fixed_stations_user_id_callsign_index
|
|
)
|
|
end
|
|
end
|