Skip to content
Snippets Groups Projects

Introduce :gitlab_geo schema for Geo tracking DB

All threads resolved!
Compare and Show latest version
12 files
+ 56
67
Compare changes
  • Side-by-side
  • Inline
Files
12
@@ -6,9 +6,6 @@ module Geo
@@ -6,9 +6,6 @@ module Geo
class TrackingBase < ApplicationRecord
class TrackingBase < ApplicationRecord
self.abstract_class = true
self.abstract_class = true
NOT_CONFIGURED_MSG = 'Geo secondary database is not configured'
SecondaryNotConfigured = Class.new(StandardError)
if ::Gitlab::Geo.geo_database_configured?
if ::Gitlab::Geo.geo_database_configured?
connects_to database: { writing: :geo, reading: :geo }
connects_to database: { writing: :geo, reading: :geo }
end
end
@@ -20,16 +17,8 @@ def self.connected?
@@ -20,16 +17,8 @@ def self.connected?
end
end
def self.connection
def self.connection
unless ::Gitlab::Geo.geo_database_configured?
message = NOT_CONFIGURED_MSG
message = "#{message}\nIn the GDK root, try running `make geo-setup`" if Rails.env.development?
raise SecondaryNotConfigured, message
end
# Don't call super because LoadBalancing::ActiveRecordProxy will intercept it
# Don't call super because LoadBalancing::ActiveRecordProxy will intercept it
retrieve_connection
retrieve_connection
rescue ActiveRecord::NoDatabaseError
raise SecondaryNotConfigured, NOT_CONFIGURED_MSG
end
end
class SchemaMigration < TrackingBase
class SchemaMigration < TrackingBase
Loading