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

  def up do
    # Disable the database MikroTik profile to use the hardcoded profile instead
    # The hardcoded profile has comprehensive sensor discovery including:
    # - CPU load (per core)
    # - Memory and storage (via HOST-RESOURCES-MIB walks)
    # - DHCP leases
    # - Connection tracking
    # - POE sensors
    # - Optical/SFP sensors
    #
    # The database profile system doesn't yet support table walks,
    # so we fall back to the hardcoded profile for full discovery.
    execute("UPDATE device_profiles SET enabled = false WHERE name = 'mikrotik'")
  end

  def down do
    # Re-enable the database profile
    execute("UPDATE device_profiles SET enabled = true WHERE name = 'mikrotik'")
  end
end
