towerops/priv/repo/migrations/20260103191854_create_snmp_interfaces.exs
2026-01-03 14:41:28 -06:00

28 lines
855 B
Elixir

defmodule Towerops.Repo.Migrations.CreateSnmpInterfaces do
use Ecto.Migration
def change do
create table(:snmp_interfaces, primary_key: false) do
add :id, :binary_id, primary_key: true
add :snmp_device_id, references(:snmp_devices, type: :binary_id, on_delete: :delete_all),
null: false
add :if_index, :integer, null: false
add :if_name, :string
add :if_descr, :string
add :if_alias, :string
add :if_type, :integer
add :if_speed, :bigint
add :if_phys_address, :string
add :if_admin_status, :string
add :if_oper_status, :string
add :monitored, :boolean, default: true, null: false
timestamps(type: :utc_datetime)
end
create index(:snmp_interfaces, [:snmp_device_id])
create unique_index(:snmp_interfaces, [:snmp_device_id, :if_index])
end
end