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

  def change do
    # Add snmp_transport to organizations (default UDP)
    alter table(:organizations) do
      add :snmp_transport, :string, default: "udp", null: false
    end

    # Add snmp_transport to sites (nullable - inherits from organization)
    alter table(:sites) do
      add :snmp_transport, :string
    end

    # Add snmp_transport and source tracking to devices
    alter table(:devices) do
      add :snmp_transport, :string, default: "udp", null: false
      add :snmp_transport_source, :string, default: "organization", null: false
    end
  end
end
