35 lines
1.1 KiB
Elixir
35 lines
1.1 KiB
Elixir
defmodule Towerops.Repo.Migrations.CreateSnmpEntityPhysical do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:snmp_entity_physical, 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 :entity_index, :string, null: false
|
|
add :parent_index, :string
|
|
add :parent_id, references(:snmp_entity_physical, type: :binary_id, on_delete: :nilify_all)
|
|
|
|
add :entity_class, :string
|
|
add :entity_type, :string
|
|
add :name, :string
|
|
add :description, :text
|
|
add :serial_number, :string
|
|
add :model, :string
|
|
add :manufacturer, :string
|
|
add :hardware_revision, :string
|
|
add :firmware_revision, :string
|
|
add :software_revision, :string
|
|
add :physical_index, :integer
|
|
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
create index(:snmp_entity_physical, [:snmp_device_id])
|
|
create unique_index(:snmp_entity_physical, [:snmp_device_id, :entity_index])
|
|
create index(:snmp_entity_physical, [:parent_id])
|
|
create index(:snmp_entity_physical, [:entity_class])
|
|
end
|
|
end
|