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

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

      add :equipment_id, references(:equipment, type: :binary_id, on_delete: :delete_all),
        null: false

      add :sys_descr, :text
      add :sys_object_id, :string
      add :sys_name, :string
      add :sys_uptime, :bigint
      add :sys_contact, :string
      add :sys_location, :string
      add :manufacturer, :string
      add :model, :string
      add :firmware_version, :string

      timestamps(type: :utc_datetime)
    end

    create unique_index(:snmp_devices, [:equipment_id])
  end
end
