Files
ubicloud/model/assigned_vm_address.rb
Furkan Sahin 4a8a679c1b Add VPC related resources table and flex null restrictions - Migration
Here we are adding a new table called private_subnet_aws_resource to
keep track of the resource ids on the AWS side that simply makes up a
functioning private subnet on the Ubicloud side. That is especially
important to clean-up after the destroy operation.

We are also making it a bit more flexible to add resources to the system
by allowing assigned_vm_address.address_id to be nil since it doesn't
map to a pre provisioned subnet and vm_storage_volume related references
since these are not referencing a host now. They are basically resources
that comes with a VM and goes when the VM is destroyed.
2025-04-02 12:34:20 +02:00

25 lines
778 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 |
# 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)