defmodule Microwaveprop.Repo.Migrations.CreateBeaconMonitors do use Ecto.Migration def change do create table(:beacon_monitors, primary_key: false) do add :id, :binary_id, primary_key: true add :user_id, references(:users, type: :binary_id, on_delete: :delete_all), null: false add :name, :string, null: false add :token, :string, null: false add :last_seen_at, :utc_datetime timestamps(type: :utc_datetime) end create index(:beacon_monitors, [:user_id]) create unique_index(:beacon_monitors, [:token]) end end