Files
ubicloud/migrate/20250128_make_lbvms_id_not_null.rb
Furkan Sahin 26d174a1c3 Remove state_counter and update keys in load_balancers_vms
The primary key is changed to id, state_counter is not needed and id
cannot be null anymore.
2025-01-29 16:34:15 +01:00

22 lines
540 B
Ruby

# frozen_string_literal: true
Sequel.migration do
up do
alter_table(:load_balancers_vms) do
set_column_not_null :id
drop_column :state_counter
drop_constraint :load_balancers_vms_pkey
add_primary_key [:id]
end
end
down do
alter_table(:load_balancers_vms) do
add_column :state_counter, Integer, null: false, default: 0
drop_constraint :load_balancers_vms_pkey
add_constraint :load_balancers_vms_pkey, [:load_balancer_id, :vm_id]
set_column_allow_null :id
end
end
end