Fix Gitlab::Geo::DatabaseTasks.pending_migrations method

parent 12eb567d
...@@ -40,13 +40,13 @@ module Gitlab ...@@ -40,13 +40,13 @@ module Gitlab
end end
def pending_migrations def pending_migrations
migration_context.open.pending_migrations with_geo_db do
migration_context.open.pending_migrations
end
end end
def migration_context def migration_context
with_geo_db do ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
end
end end
def abort_if_no_geo_config! def abort_if_no_geo_config!
...@@ -79,14 +79,18 @@ module Gitlab ...@@ -79,14 +79,18 @@ module Gitlab
version = ENV['VERSION'] ? ENV['VERSION'].to_i : nil version = ENV['VERSION'] ? ENV['VERSION'].to_i : nil
raise 'VERSION is required' unless version raise 'VERSION is required' unless version
Gitlab::Geo::DatabaseTasks.migration_context.run(:up, version) Gitlab::Geo::DatabaseTasks.with_geo_db do
Gitlab::Geo::DatabaseTasks.migration_context.run(:up, version)
end
end end
def down def down
version = ENV['VERSION'] ? ENV['VERSION'].to_i : nil version = ENV['VERSION'] ? ENV['VERSION'].to_i : nil
raise 'VERSION is required - To go down one migration, run db:rollback' unless version raise 'VERSION is required - To go down one migration, run db:rollback' unless version
Gitlab::Geo::DatabaseTasks.migration_context.run(:down, version) Gitlab::Geo::DatabaseTasks.with_geo_db do
Gitlab::Geo::DatabaseTasks.migration_context.run(:down, version)
end
end end
def status def status
......
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