summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-01-25 20:00:59 +0100
committerRémy Coutable <remy@rymai.me>2016-01-25 20:00:59 +0100
commitcd22da3ebda969779c47f1652f3876daa5edd7f2 (patch)
tree070d4f361f9d1715374e0d15fc1d24f882861ec0
parent8b3285bfdffc3ee6a2fbd65a8d7981214344deda (diff)
downloadgitlab-ce-cd22da3ebda969779c47f1652f3876daa5edd7f2.tar.gz
Fix preventing migration from crashing in very specific cases
See https://gitlab.com/gitlab-org/gitlab-ce/issues/12606 for details
-rw-r--r--lib/gitlab/current_settings.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb
index ea054255820..429f1f9bb56 100644
--- a/lib/gitlab/current_settings.rb
+++ b/lib/gitlab/current_settings.rb
@@ -39,6 +39,13 @@ module Gitlab
end
use_db && ActiveRecord::Base.connection.active? &&
+ # The following condition is important: if a migrations adds a
+ # column to the application_settings table and a validation in
+ # the ApplicationSetting uses this new column we might end-up in
+ # a vicious circle where migration crash before being done.
+ # See https://gitlab.com/gitlab-org/gitlab-ce/issues/12606 for
+ # a thorough explanation.
+ !ActiveRecord::Migrator.needs_migration? &&
ActiveRecord::Base.connection.table_exists?('application_settings')
rescue ActiveRecord::NoDatabaseError