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.
26 lines
930 B
Ruby
26 lines
930 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "../model"
|
|
|
|
class Address < Sequel::Model
|
|
one_to_many :assigned_vm_addresses, key: :address_id, class: :AssignedVmAddress
|
|
one_to_many :assigned_host_addresses, key: :address_id, class: :AssignedHostAddress
|
|
|
|
include ResourceMethods
|
|
end
|
|
|
|
# Table: address
|
|
# Columns:
|
|
# id | uuid | PRIMARY KEY
|
|
# cidr | cidr | NOT NULL
|
|
# is_failover_ip | boolean | NOT NULL DEFAULT false
|
|
# routed_to_host_id | uuid | NOT NULL
|
|
# Indexes:
|
|
# address_pkey | PRIMARY KEY btree (id)
|
|
# address_cidr_key | UNIQUE btree (cidr)
|
|
# Foreign key constraints:
|
|
# address_routed_to_host_id_fkey | (routed_to_host_id) REFERENCES vm_host(id)
|
|
# Referenced By:
|
|
# assigned_host_address | assigned_host_address_address_id_fkey | (address_id) REFERENCES address(id)
|
|
# assigned_vm_address | assigned_vm_address_address_id_fkey | (address_id) REFERENCES address(id)
|