diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-05 18:06:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-05 18:06:17 +0300 |
commit | 4c464055fbcdab02bb8334b148c0e35b981b239e (patch) | |
tree | 861562d77b4e8684d0498f25979d8ac85dd8f25a /lib/gitlab/database | |
parent | 791785af5540d18eaa97da24f9ff8638e1960b72 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/database')
-rw-r--r-- | lib/gitlab/database/migration_helpers.rb | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index ae29546cdac..6bada921ad4 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -108,9 +108,7 @@ module Gitlab 'in the body of your migration class' end - if supports_drop_index_concurrently? - options = options.merge({ algorithm: :concurrently }) - end + options = options.merge({ algorithm: :concurrently }) unless index_exists?(table_name, column_name, options) Rails.logger.warn "Index not removed because it does not exist (this may be due to an aborted migration or similar): table_name: #{table_name}, column_name: #{column_name}" # rubocop:disable Gitlab/RailsLogger @@ -136,9 +134,7 @@ module Gitlab 'in the body of your migration class' end - if supports_drop_index_concurrently? - options = options.merge({ algorithm: :concurrently }) - end + options = options.merge({ algorithm: :concurrently }) unless index_exists_by_name?(table_name, index_name) Rails.logger.warn "Index not removed because it does not exist (this may be due to an aborted migration or similar): table_name: #{table_name}, index_name: #{index_name}" # rubocop:disable Gitlab/RailsLogger @@ -150,13 +146,6 @@ module Gitlab end end - # Only available on Postgresql >= 9.2 - def supports_drop_index_concurrently? - version = select_one("SELECT current_setting('server_version_num') AS v")['v'].to_i - - version >= 90200 - end - # Adds a foreign key with only minimal locking on the tables involved. # # This method only requires minimal locking |