Commit 8021b8cb authored by Nick Thomas's avatar Nick Thomas

Fix Geo rake tasks

parent e7a789f3
......@@ -51,6 +51,10 @@ module Gitlab
#{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).
# :all can be used as a placeholder for all plugins not explicitly named.
# 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']
namespace :geo do
......@@ -9,12 +5,12 @@ namespace :geo do
namespace :db do |ns|
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
end
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
end
......@@ -60,7 +56,7 @@ namespace :geo do
end
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?
print "\nRefreshing foreign tables for FDW: #{Gitlab::Geo::FDW_SCHEMA} ... "
Gitlab::Geo::GeoTasks.refresh_foreign_tables!
......@@ -72,7 +68,7 @@ namespace :geo do
end
# 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?
ns["schema:dump"].invoke
end
......@@ -156,7 +152,7 @@ namespace :geo do
Gitlab::Geo::DatabaseTasks::Test.purge
end
task :refresh_foreign_tables do
task refresh_foreign_tables: [:environment] do
old_env = ActiveRecord::Tasks::DatabaseTasks.env
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