Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2018-06-09 21:13:50 +0300
committerJan Provaznik <jprovaznik@gitlab.com>2018-06-21 23:06:50 +0300
commit1ec356a0b5b6594ef0df3fb764cb57c0859ca86f (patch)
treeb75ffcc6ec975429457a4ac7e0d6c701ee3bfc95 /config/application.rb
parente3a1b825f4c787e2fb29f852c530138347014d31 (diff)
Mysql fixes for Rails 5
* `MysqlDateTimeWithTimeZone` inherits from `ActiveRecord::Type::DateTime` (`MysqlDateTime` is not present in Rails 5) * explicitly set `NULL` default value for `merge_request_diff_files`'s `diff` column (otherwise empty string is used in a migration) and empty string is not allowed for text/blob fields in Mysql * disable NO_ZERO_DATE mode for all Mysql DB connections, otherwise SQL queries fail on inserting `0` value for `created_at` column
Diffstat (limited to 'config/application.rb')
-rw-r--r--config/application.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/config/application.rb b/config/application.rb
index 202e5d5e327..d9483cd806d 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -5,6 +5,12 @@ require 'rails/all'
Bundler.require(:default, Rails.env)
module Gitlab
+ # This method is used for smooth upgrading from the current Rails 4.x to Rails 5.0.
+ # https://gitlab.com/gitlab-org/gitlab-ce/issues/14286
+ def self.rails5?
+ ENV["RAILS5"].in?(%w[1 true])
+ end
+
class Application < Rails::Application
require_dependency Rails.root.join('lib/gitlab/redis/wrapper')
require_dependency Rails.root.join('lib/gitlab/redis/cache')
@@ -14,6 +20,11 @@ module Gitlab
require_dependency Rails.root.join('lib/gitlab/current_settings')
require_dependency Rails.root.join('lib/gitlab/middleware/read_only')
+ # This needs to be loaded before DB connection is made
+ # to make sure that all connections have NO_ZERO_DATE
+ # setting disabled
+ require_dependency Rails.root.join('lib/mysql_zero_date')
+
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
@@ -211,10 +222,4 @@ module Gitlab
Gitlab::Routing.add_helpers(MilestonesRoutingHelper)
end
end
-
- # This method is used for smooth upgrading from the current Rails 4.x to Rails 5.0.
- # https://gitlab.com/gitlab-org/gitlab-ce/issues/14286
- def self.rails5?
- ENV["RAILS5"].in?(%w[1 true])
- end
end