Files
ubicloud/model/assigned_vm_address.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

25 lines
787 B
Ruby

# frozen_string_literal: true
require_relative "../model"
class AssignedVmAddress < Sequel::Model
one_to_one :vm, key: :id, primary_key: :dst_vm_id
many_to_one :address, key: :address_id
one_to_one :active_billing_record, class: :BillingRecord, key: :resource_id do |ds| ds.active end
include ResourceMethods
end
# Table: assigned_vm_address
# Columns:
# id | uuid | PRIMARY KEY
# ip | cidr | NOT NULL
# address_id | uuid | NOT NULL
# dst_vm_id | uuid | NOT NULL
# Indexes:
# assigned_vm_address_pkey | PRIMARY KEY btree (id)
# assigned_vm_address_ip_key | UNIQUE btree (ip)
# Foreign key constraints:
# assigned_vm_address_address_id_fkey | (address_id) REFERENCES address(id)
# assigned_vm_address_dst_vm_id_fkey | (dst_vm_id) REFERENCES vm(id)