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
f10bd091
Commit
f10bd091
authored
Mar 05, 2019
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move EE code out of Gitlab::Database
parent
206d4e2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
30 deletions
+32
-30
ee/lib/ee/gitlab/database.rb
ee/lib/ee/gitlab/database.rb
+30
-26
lib/gitlab/database.rb
lib/gitlab/database.rb
+2
-4
No files found.
ee/lib/ee/gitlab/database.rb
View file @
f10bd091
...
...
@@ -3,41 +3,45 @@
module
EE
module
Gitlab
module
Database
extend
::
Gitlab
::
Utils
::
Override
extend
ActiveSupport
::
Concern
override
:read_only?
def
read_only?
::
Gitlab
::
Geo
.
secondary?
end
class_methods
do
extend
::
Gitlab
::
Utils
::
Override
def
healthy?
return
true
unless
postgresql?
override
:read_only?
def
read_only?
::
Gitlab
::
Geo
.
secondary?
end
!
Postgresql
::
ReplicationSlot
.
lag_too_great
?
end
def
healthy
?
return
true
unless
postgresql?
# Disables prepared statements for the current database connection.
def
disable_prepared_statements
config
=
ActiveRecord
::
Base
.
configurations
[
Rails
.
env
]
config
[
'prepared_statements'
]
=
false
!
Postgresql
::
ReplicationSlot
.
lag_too_great?
end
ActiveRecord
::
Base
.
establish_connection
(
config
)
end
# Disables prepared statements for the current database connection.
def
disable_prepared_statements
config
=
ActiveRecord
::
Base
.
configurations
[
Rails
.
env
]
config
[
'prepared_statements'
]
=
false
ActiveRecord
::
Base
.
establish_connection
(
config
)
end
override
:add_post_migrate_path_to_rails
def
add_post_migrate_path_to_rails
(
force:
false
)
super
override
:add_post_migrate_path_to_rails
def
add_post_migrate_path_to_rails
(
force:
false
)
super
migrate_paths
=
Rails
.
application
.
config
.
paths
[
'db/migrate'
].
to_a
migrate_paths
.
each
do
|
migrate_path
|
relative_migrate_path
=
Pathname
.
new
(
migrate_path
).
realpath
(
Rails
.
root
).
relative_path_from
(
Rails
.
root
)
ee_migrate_path
=
Rails
.
root
.
join
(
'ee/'
,
relative_migrate_path
)
migrate_paths
=
Rails
.
application
.
config
.
paths
[
'db/migrate'
].
to_a
migrate_paths
.
each
do
|
migrate_path
|
relative_migrate_path
=
Pathname
.
new
(
migrate_path
).
realpath
(
Rails
.
root
).
relative_path_from
(
Rails
.
root
)
ee_migrate_path
=
Rails
.
root
.
join
(
'ee/'
,
relative_migrate_path
)
next
if
relative_migrate_path
.
to_s
.
start_with?
(
'ee/'
)
||
Rails
.
application
.
config
.
paths
[
'db/migrate'
].
include?
(
ee_migrate_path
.
to_s
)
next
if
relative_migrate_path
.
to_s
.
start_with?
(
'ee/'
)
||
Rails
.
application
.
config
.
paths
[
'db/migrate'
].
include?
(
ee_migrate_path
.
to_s
)
Rails
.
application
.
config
.
paths
[
'db/migrate'
]
<<
ee_migrate_path
.
to_s
ActiveRecord
::
Migrator
.
migrations_paths
<<
ee_migrate_path
.
to_s
Rails
.
application
.
config
.
paths
[
'db/migrate'
]
<<
ee_migrate_path
.
to_s
ActiveRecord
::
Migrator
.
migrations_paths
<<
ee_migrate_path
.
to_s
end
end
end
end
...
...
lib/gitlab/database.rb
View file @
f10bd091
...
...
@@ -11,10 +11,6 @@ module Gitlab
# https://dev.mysql.com/doc/refman/5.7/en/datetime.html
MAX_TIMESTAMP_VALUE
=
Time
.
at
((
1
<<
31
)
-
1
).
freeze
class
<<
self
prepend
EE
::
Gitlab
::
Database
# rubocop: disable Cop/InjectEnterpriseEditionModule
end
def
self
.
config
ActiveRecord
::
Base
.
configurations
[
Rails
.
env
]
end
...
...
@@ -274,3 +270,5 @@ module Gitlab
end
end
end
Gitlab
::
Database
.
prepend
(
EE
::
Gitlab
::
Database
)
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