Fix Gitlab::Geo::DatabaseTasks.pending_migrations method

parent 12eb567d
......@@ -40,14 +40,14 @@ module Gitlab
end
def pending_migrations
with_geo_db do
migration_context.open.pending_migrations
end
end
def migration_context
with_geo_db do
ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
end
end
def abort_if_no_geo_config!
@geo_config_exists ||= File.exist?(Rails.root.join(GEO_DATABASE_CONFIG)) # rubocop:disable Gitlab/ModuleWithInstanceVariables
......@@ -79,15 +79,19 @@ module Gitlab
version = ENV['VERSION'] ? ENV['VERSION'].to_i : nil
raise 'VERSION is required' unless version
Gitlab::Geo::DatabaseTasks.with_geo_db do
Gitlab::Geo::DatabaseTasks.migration_context.run(:up, version)
end
end
def down
version = ENV['VERSION'] ? ENV['VERSION'].to_i : nil
raise 'VERSION is required - To go down one migration, run db:rollback' unless version
Gitlab::Geo::DatabaseTasks.with_geo_db do
Gitlab::Geo::DatabaseTasks.migration_context.run(:down, version)
end
end
def status
Gitlab::Geo::DatabaseTasks.with_geo_db do
......
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