26 lines
788 B
Elixir
26 lines
788 B
Elixir
defmodule Towerops.Repo.Migrations.AddPrinterSupplies do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:printer_supplies, primary_key: false) do
|
|
add :id, :binary_id, primary_key: true
|
|
|
|
add :snmp_device_id, references(:snmp_devices, on_delete: :delete_all, type: :binary_id),
|
|
null: false
|
|
|
|
add :supply_index, :string, null: false
|
|
add :supply_type, :string
|
|
add :supply_description, :string
|
|
add :supply_unit, :string
|
|
add :max_capacity, :integer
|
|
add :current_level, :integer
|
|
add :color_name, :string
|
|
add :part_number, :string
|
|
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
create index(:printer_supplies, [:snmp_device_id])
|
|
create unique_index(:printer_supplies, [:snmp_device_id, :supply_index])
|
|
end
|
|
end
|