22 lines
732 B
Elixir
22 lines
732 B
Elixir
defmodule Towerops.Repo.Migrations.AddProcessorReadings do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:snmp_processor_readings, primary_key: false) do
|
|
add :id, :binary_id, primary_key: true
|
|
|
|
add :processor_id, references(:snmp_processors, type: :binary_id, on_delete: :delete_all),
|
|
null: false
|
|
|
|
add :load_percent, :float
|
|
add :status, :string, null: false, default: "ok"
|
|
add :checked_at, :utc_datetime, null: false
|
|
|
|
timestamps(type: :utc_datetime, updated_at: false)
|
|
end
|
|
|
|
create index(:snmp_processor_readings, [:processor_id])
|
|
create index(:snmp_processor_readings, [:checked_at])
|
|
create index(:snmp_processor_readings, [:processor_id, :checked_at])
|
|
end
|
|
end
|