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.
24 lines
688 B
Ruby
24 lines
688 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "../model"
|
|
|
|
class AssignedHostAddress < Sequel::Model
|
|
many_to_one :vm_host, key: :host_id
|
|
many_to_one :address, key: :address_id
|
|
|
|
include ResourceMethods
|
|
end
|
|
|
|
# Table: assigned_host_address
|
|
# Columns:
|
|
# id | uuid | PRIMARY KEY
|
|
# ip | cidr | NOT NULL
|
|
# address_id | uuid | NOT NULL
|
|
# host_id | uuid | NOT NULL
|
|
# Indexes:
|
|
# assigned_host_address_pkey | PRIMARY KEY btree (id)
|
|
# assigned_host_address_ip_key | UNIQUE btree (ip)
|
|
# Foreign key constraints:
|
|
# assigned_host_address_address_id_fkey | (address_id) REFERENCES address(id)
|
|
# assigned_host_address_host_id_fkey | (host_id) REFERENCES vm_host(id)
|