Files
ubicloud/migrate/20240123_remove_fwrules_ps_rel.rb
Furkan Sahin 15fade2c3e Cleanup for migration of firewall_rules under firewall entity
Drop and delete operations in the schema. Mainly separated to its own
commit to handle the deployment without a respirate restart.
2024-02-01 11:30:43 +01:00

23 lines
459 B
Ruby

# frozen_string_literal: true
Sequel.migration do
up do
run <<~SQL
DELETE FROM firewall_rule
WHERE private_subnet_id IS NOT NULL;
SQL
alter_table(:firewall_rule) do
drop_column :private_subnet_id
set_column_not_null :firewall_id
end
end
down do
alter_table(:firewall_rule) do
add_foreign_key :private_subnet_id, :private_subnet, type: :uuid, null: true
set_column_allow_null :firewall_id
end
end
end