ubicloud/migrate/20251104_add_stack_to_lb_vm_port.rb
Furkan Sahin 688889576a Add stack column to LoadBalancerVmPort - migration
We are also removing the UNIQUE index on [load_balancer_port_id,
load_balancer_vm_id] because we will have multiple of these rows per
stack for dual stack load balancers. This is why we are adding a new
index on [load_balancer_port_id, load_balancer_vm_id, stack].
2025-11-10 15:07:15 +01:00

18 lines
476 B
Ruby

# frozen_string_literal: true
Sequel.migration do
up do
alter_table(:load_balancer_vm_port) do
set_column_default :id, Sequel.lit("gen_random_ubid_uuid(55)") # UBID.to_base32_n("1q") => 55 ubid type
add_column :stack, :text, null: true
add_constraint(:stack_check, Sequel.lit("stack in ('ipv4', 'ipv6')"))
end
end
down do
alter_table(:load_balancer_vm_port) do
drop_column :stack
set_column_default :id, nil
end
end
end