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.
27 lines
728 B
Ruby
27 lines
728 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "../model"
|
|
|
|
class IpsecTunnel < Sequel::Model
|
|
many_to_one :src_nic, key: :src_nic_id, class: :Nic
|
|
many_to_one :dst_nic, key: :dst_nic_id, class: :Nic
|
|
|
|
include ResourceMethods
|
|
|
|
def vm_name(nic)
|
|
nic.vm.inhost_name.shellescape
|
|
end
|
|
end
|
|
|
|
# Table: ipsec_tunnel
|
|
# Columns:
|
|
# id | uuid | PRIMARY KEY
|
|
# src_nic_id | uuid |
|
|
# dst_nic_id | uuid |
|
|
# Indexes:
|
|
# ipsec_tunnel_pkey | PRIMARY KEY btree (id)
|
|
# ipsec_tunnel_src_nic_id_dst_nic_id_key | UNIQUE btree (src_nic_id, dst_nic_id)
|
|
# Foreign key constraints:
|
|
# ipsec_tunnel_dst_nic_id_fkey | (dst_nic_id) REFERENCES nic(id)
|
|
# ipsec_tunnel_src_nic_id_fkey | (src_nic_id) REFERENCES nic(id)
|