towerops/priv/repo/migrations/20260121164729_create_snmp_storage.exs
Graham McIntire 1fc066d95b
feat: add memory pool and storage discovery (Phase 1.5)
- Add snmp_memory_pools table and MemoryPool schema
- Add snmp_storage table and Storage schema
- Add discover_memory_pools/1 for HOST-RESOURCES-MIB RAM/swap
- Add discover_storage/1 for HOST-RESOURCES-MIB disk storage
- Add comprehensive tests for schema validation and discovery
- Completes Phase 1 of discovery improvements
2026-01-21 10:57:08 -06:00

29 lines
897 B
Elixir

defmodule Towerops.Repo.Migrations.CreateSnmpStorage do
use Ecto.Migration
def change do
create table(:snmp_storage, 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 :storage_index, :integer, null: false
add :storage_type, :string, null: false
add :description, :string
add :device_name, :string
add :total_bytes, :bigint
add :used_bytes, :bigint
add :allocation_units, :integer
add :last_checked_at, :utc_datetime
add :metadata, :map, default: %{}
timestamps(type: :utc_datetime)
end
create index(:snmp_storage, [:snmp_device_id])
create unique_index(:snmp_storage, [:snmp_device_id, :storage_index])
create index(:snmp_storage, [:storage_type])
end
end