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.
24 lines
612 B
Ruby
24 lines
612 B
Ruby
# frozen_string_literal: true
|
|
|
|
Sequel.migration do
|
|
change do
|
|
create_table(:private_subnet_aws_resource) do
|
|
foreign_key :id, :private_subnet, type: :uuid, primary_key: true
|
|
column :vpc_id, :text
|
|
column :subnet_id, :text
|
|
column :internet_gateway_id, :text
|
|
column :route_table_id, :text
|
|
column :security_group_id, :text
|
|
end
|
|
|
|
alter_table(:assigned_vm_address) do
|
|
set_column_allow_null :address_id
|
|
end
|
|
|
|
alter_table(:vm_storage_volume) do
|
|
set_column_allow_null :spdk_installation_id
|
|
set_column_allow_null :storage_device_id
|
|
end
|
|
end
|
|
end
|