Files
ubicloud/model/storage_device.rb
Jeremy Evans 30247a3800 Include model annotations at the bottom of all model files
This makes it easier for developers new to the codebase to
easily get important information on the model's table in the
same file as the model code.

To ensure the model annotations stay accurate, run them on
test_up/test_down.  In CI, regenerate the annotations, and
check for no changes, similar to how the linters work.
2024-11-13 09:13:30 -08:00

33 lines
1.1 KiB
Ruby

# frozen_string_literal: true
require_relative "../model"
class StorageDevice < Sequel::Model
include ResourceMethods
many_to_one :vm_host
def self.ubid_type
UBID::TYPE_ETC
end
end
# Table: storage_device
# Columns:
# id | uuid | PRIMARY KEY
# name | text | NOT NULL
# total_storage_gib | integer | NOT NULL
# available_storage_gib | integer | NOT NULL
# enabled | boolean | NOT NULL DEFAULT true
# vm_host_id | uuid |
# Indexes:
# storage_device_pkey | PRIMARY KEY btree (id)
# storage_device_vm_host_id_name_key | UNIQUE btree (vm_host_id, name)
# Check constraints:
# available_storage_gib_less_than_or_equal_to_total | (available_storage_gib <= total_storage_gib)
# available_storage_gib_non_negative | (available_storage_gib >= 0)
# Foreign key constraints:
# storage_device_vm_host_id_fkey | (vm_host_id) REFERENCES vm_host(id)
# Referenced By:
# vm_storage_volume | vm_storage_volume_storage_device_id_fkey | (storage_device_id) REFERENCES storage_device(id)