Commit eb2e39b9 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch '3148-move-geo-files' into 'master'

Resolve "Move all Geo related files to EE specific dirs"

Closes #3148

See merge request gitlab-org/gitlab-ee!3706
parents 38b06690 8021b8cb
...@@ -51,6 +51,10 @@ module Gitlab ...@@ -51,6 +51,10 @@ module Gitlab
#{config.root}/ee/app/helpers #{config.root}/ee/app/helpers
]) ])
# Rake tasks ignore the eager loading settings, so we need to set the
# autoload paths explicitly
config.autoload_paths = config.eager_load_paths.dup
# Only load the plugins named here, in the order given (default is alphabetical). # Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named. # :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ] # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
......
require 'gitlab/geo'
require 'gitlab/geo/database_tasks'
require 'gitlab/geo/geo_tasks'
task spec: ['geo:db:test:prepare'] task spec: ['geo:db:test:prepare']
namespace :geo do namespace :geo do
...@@ -9,12 +5,12 @@ namespace :geo do ...@@ -9,12 +5,12 @@ namespace :geo do
namespace :db do |ns| namespace :db do |ns|
desc 'Drops the Geo tracking database from config/database_geo.yml for the current RAILS_ENV.' desc 'Drops the Geo tracking database from config/database_geo.yml for the current RAILS_ENV.'
task :drop do task drop: [:environment] do
Gitlab::Geo::DatabaseTasks.drop_current Gitlab::Geo::DatabaseTasks.drop_current
end end
desc 'Creates the Geo tracking database from config/database_geo.yml for the current RAILS_ENV.' desc 'Creates the Geo tracking database from config/database_geo.yml for the current RAILS_ENV.'
task :create do task create: [:environment] do
Gitlab::Geo::DatabaseTasks.create_current Gitlab::Geo::DatabaseTasks.create_current
end end
...@@ -60,7 +56,7 @@ namespace :geo do ...@@ -60,7 +56,7 @@ namespace :geo do
end end
desc 'Refresh Foreign Tables definition in Geo Secondary node' desc 'Refresh Foreign Tables definition in Geo Secondary node'
task :refresh_foreign_tables do task refresh_foreign_tables: [:environment] do
if Gitlab::Geo::GeoTasks.foreign_server_configured? if Gitlab::Geo::GeoTasks.foreign_server_configured?
print "\nRefreshing foreign tables for FDW: #{Gitlab::Geo::FDW_SCHEMA} ... " print "\nRefreshing foreign tables for FDW: #{Gitlab::Geo::FDW_SCHEMA} ... "
Gitlab::Geo::GeoTasks.refresh_foreign_tables! Gitlab::Geo::GeoTasks.refresh_foreign_tables!
...@@ -72,7 +68,7 @@ namespace :geo do ...@@ -72,7 +68,7 @@ namespace :geo do
end end
# IMPORTANT: This task won't dump the schema if ActiveRecord::Base.dump_schema_after_migration is set to false # IMPORTANT: This task won't dump the schema if ActiveRecord::Base.dump_schema_after_migration is set to false
task :_dump do task _dump: [:environment] do
if Gitlab::Geo::DatabaseTasks.dump_schema_after_migration? if Gitlab::Geo::DatabaseTasks.dump_schema_after_migration?
ns["schema:dump"].invoke ns["schema:dump"].invoke
end end
...@@ -156,7 +152,7 @@ namespace :geo do ...@@ -156,7 +152,7 @@ namespace :geo do
Gitlab::Geo::DatabaseTasks::Test.purge Gitlab::Geo::DatabaseTasks::Test.purge
end end
task :refresh_foreign_tables do task refresh_foreign_tables: [:environment] do
old_env = ActiveRecord::Tasks::DatabaseTasks.env old_env = ActiveRecord::Tasks::DatabaseTasks.env
ActiveRecord::Tasks::DatabaseTasks.env = 'test' ActiveRecord::Tasks::DatabaseTasks.env = 'test'
......
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