Commit 9d6434ac authored by DJ Mountney's avatar DJ Mountney

Merge remote-tracking branch 'origin/master' into ce-to-ee-2018-09-19

parents 51927b30 d01079cd
# Post deployment migrations are included by default. This file must be loaded
# before other initializers as Rails may otherwise memoize a list of migrations
# excluding the post deployment migrations.
<<<<<<< HEAD
unless ENV['SKIP_POST_DEPLOYMENT_MIGRATIONS']
Rails.application.config.paths['db'].each do |db_path|
path = Rails.root.join(db_path, 'post_migrate').to_s
Rails.application.config.paths['db/migrate'] << path
# Rails memoizes migrations at certain points where it won't read the above
# path just yet. As such we must also update the following list of paths.
ActiveRecord::Migrator.migrations_paths << path
end
end
migrate_paths = Rails.application.config.paths['db/migrate'].to_a
migrate_paths.each do |migrate_path|
absolute_migrate_path = Pathname.new(migrate_path).realpath(Rails.root)
ee_migrate_path = Rails.root.join('ee/', absolute_migrate_path.relative_path_from(Rails.root))
Rails.application.config.paths['db/migrate'] << ee_migrate_path.to_s
ActiveRecord::Migrator.migrations_paths << ee_migrate_path.to_s
end
=======
Gitlab::Database.add_post_migrate_path_to_rails
>>>>>>> upstream/master
module EE
module Gitlab
module Database
extend ::Gitlab::Utils::Override
override :add_post_migrate_path_to_rails
def add_post_migrate_path_to_rails(force: false)
super
migrate_paths = Rails.application.config.paths['db/migrate'].to_a
migrate_paths.each do |migrate_path|
relative_migrate_path = Pathname.new(migrate_path).realpath(Rails.root).relative_path_from(Rails.root)
ee_migrate_path = Rails.root.join('ee/', relative_migrate_path)
next if relative_migrate_path.to_s.start_with?('ee/') ||
Rails.application.config.paths['db/migrate'].include?(ee_migrate_path.to_s)
Rails.application.config.paths['db/migrate'] << ee_migrate_path.to_s
ActiveRecord::Migrator.migrations_paths << ee_migrate_path.to_s
end
end
end
end
end
......@@ -9,6 +9,10 @@ module Gitlab
# https://dev.mysql.com/doc/refman/5.7/en/datetime.html
MAX_TIMESTAMP_VALUE = Time.at((1 << 31) - 1).freeze
class << self
prepend EE::Gitlab::Database
end
def self.config
ActiveRecord::Base.configurations[Rails.env]
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