defmodule Towerops.Repo.Migrations.CreateDeviceLinkEvidence do
  use Ecto.Migration

  def change do
    create table(:device_link_evidence, primary_key: false) do
      add :id, :binary_id, primary_key: true

      add :device_link_id, references(:device_links, type: :binary_id, on_delete: :delete_all),
        null: false

      add :evidence_type, :string, null: false
      add :evidence_data, :map, default: %{}
      add :observed_at, :utc_datetime, null: false
      timestamps(type: :utc_datetime)
    end

    create index(:device_link_evidence, [:device_link_id])
    create index(:device_link_evidence, [:observed_at])
  end
end
