With the multi stage migration, we are making sure the deployment goes through with zero downtime. With the 2nd commit, we are switching the controlplane to start using the new model without destroying the existing HetznerHost model. Now, with this commit, we can safely delete the HetznerHost table.
20 lines
453 B
Ruby
20 lines
453 B
Ruby
# frozen_string_literal: true
|
|
|
|
Sequel.migration do
|
|
up do
|
|
drop_table :hetzner_host
|
|
end
|
|
|
|
down do
|
|
create_table :hetzner_host do
|
|
foreign_key :id, :vm_host, type: :uuid
|
|
column :server_identifier, :text, null: false
|
|
primary_key [:server_identifier]
|
|
end
|
|
|
|
run <<-SQL
|
|
INSERT INTO hetzner_host (id, server_identifier) SELECT id, server_identifier FROM host_provider WHERE provider_name = 'hetzner';
|
|
SQL
|
|
end
|
|
end
|