Commit bd79e130 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'dm-skip-renaming-already-renamed-column' into 'master'

Skip renaming column in EE when it was already created with the new name in CE

Closes gitlab-qa#240

See merge request gitlab-org/gitlab-ee!5667
parents 284cd594 dc2fbdc6
...@@ -6,10 +6,15 @@ class RenameRemoteMirrorAvailableToMirrorAvailable < ActiveRecord::Migration ...@@ -6,10 +6,15 @@ class RenameRemoteMirrorAvailableToMirrorAvailable < ActiveRecord::Migration
disable_ddl_transaction! disable_ddl_transaction!
def up def up
# When moving from CE to EE, the column may already have been renamed.
return if column_exists?(:application_settings, :mirror_available)
rename_column_concurrently :application_settings, :remote_mirror_available, :mirror_available rename_column_concurrently :application_settings, :remote_mirror_available, :mirror_available
end end
def down def down
return unless column_exists?(:application_settings, :mirror_available)
cleanup_concurrent_column_rename :application_settings, :mirror_available, :remote_mirror_available cleanup_concurrent_column_rename :application_settings, :mirror_available, :remote_mirror_available
end end
end end
...@@ -6,10 +6,15 @@ class CleanupRemoteMirrorAvailableRename < ActiveRecord::Migration ...@@ -6,10 +6,15 @@ class CleanupRemoteMirrorAvailableRename < ActiveRecord::Migration
disable_ddl_transaction! disable_ddl_transaction!
def up def up
# When moving from CE to EE, the column may already have been renamed.
return unless column_exists?(:application_settings, :remote_mirror_available)
cleanup_concurrent_column_rename :application_settings, :remote_mirror_available, :mirror_available cleanup_concurrent_column_rename :application_settings, :remote_mirror_available, :mirror_available
end end
def down def down
return if column_exists?(:application_settings, :remote_mirror_available)
rename_column_concurrently :application_settings, :mirror_available, :remote_mirror_available rename_column_concurrently :application_settings, :mirror_available, :remote_mirror_available
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment