Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4f418a1c
Commit
4f418a1c
authored
Oct 18, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a common base class to centralize access to Geo secondary DB
parent
43b89802
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
27 deletions
+19
-27
app/models/geo/base_fdw.rb
app/models/geo/base_fdw.rb
+1
-3
app/models/geo/base_registry.rb
app/models/geo/base_registry.rb
+1
-3
app/models/geo/tracking_base.rb
app/models/geo/tracking_base.rb
+17
-0
ee/app/models/concerns/ee/geo/geo_trackable.rb
ee/app/models/concerns/ee/geo/geo_trackable.rb
+0
-21
No files found.
app/models/geo/base_fdw.rb
View file @
4f418a1c
class
Geo::BaseFdw
<
ActiveRecord
::
Base
include
::
EE
::
Geo
::
GeoTrackable
class
Geo::BaseFdw
<
Geo
::
TrackingBase
self
.
abstract_class
=
true
end
app/models/geo/base_registry.rb
View file @
4f418a1c
class
Geo::BaseRegistry
<
ActiveRecord
::
Base
include
::
EE
::
Geo
::
GeoTrackable
class
Geo::BaseRegistry
<
Geo
::
TrackingBase
self
.
abstract_class
=
true
end
app/models/geo/tracking_base.rb
0 → 100644
View file @
4f418a1c
# This module is intended to centralize all database access to the secondary
# tracking database for Geo.
module
Geo
class
TrackingBase
<
ActiveRecord
::
Base
self
.
abstract_class
=
true
if
::
Gitlab
::
Geo
.
geo_database_configured?
establish_connection
Rails
.
configuration
.
geo_database
end
def
self
.
connection
raise
'Geo secondary database is not configured'
unless
::
Gitlab
::
Geo
.
geo_database_configured?
super
end
end
end
ee/app/models/concerns/ee/geo/geo_trackable.rb
deleted
100644 → 0
View file @
43b89802
module
EE
module
Geo
module
GeoTrackable
extend
ActiveSupport
::
Concern
included
do
if
::
Gitlab
::
Geo
.
geo_database_configured?
establish_connection
Rails
.
configuration
.
geo_database
end
end
class_methods
do
def
self
.
connection
raise
'Geo secondary database is not configured'
unless
::
Gitlab
::
Geo
.
geo_database_configured?
super
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment