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
46521222
Commit
46521222
authored
Dec 07, 2017
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Refresh Foreign Tables work for test environment as well
parent
068a53dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
+20
-11
lib/tasks/geo.rake
lib/tasks/geo.rake
+20
-11
No files found.
lib/tasks/geo.rake
View file @
46521222
...
...
@@ -59,6 +59,17 @@ namespace :geo do
puts
Rails
.
application
.
secrets
.
db_key_base
end
desc
'Refresh Foreign Tables definition in Geo Secondary node'
task
:refresh_foreign_tables
do
if
Gitlab
::
Geo
::
GeoTasks
.
foreign_server_configured?
print
"
\n
Refreshing foreign tables for FDW:
#{
Gitlab
::
Geo
::
FDW_SCHEMA
}
... "
Gitlab
::
Geo
::
GeoTasks
.
refresh_foreign_tables!
puts
'Done!'
else
puts
"Warning: Cannot refresh foreign tables, there is no foreign server configured."
end
end
# IMPORTANT: This task won't dump the schema if ActiveRecord::Base.dump_schema_after_migration is set to false
task
:_dump
do
if
Gitlab
::
Geo
::
DatabaseTasks
.
dump_schema_after_migration?
...
...
@@ -143,6 +154,15 @@ namespace :geo do
task
purge:
[
:environment
]
do
Gitlab
::
Geo
::
DatabaseTasks
::
Test
.
purge
end
task
:refresh_foreign_tables
do
old_env
=
ActiveRecord
::
Tasks
::
DatabaseTasks
.
env
ActiveRecord
::
Tasks
::
DatabaseTasks
.
env
=
'test'
ns
[
'geo:db:refresh_foreign_tables'
].
invoke
ActiveRecord
::
Tasks
::
DatabaseTasks
.
env
=
old_env
end
end
end
...
...
@@ -176,15 +196,4 @@ namespace :geo do
current_node
.
update!
(
primary:
true
)
end
end
desc
'Refresh Foreign Tables definition in Geo Secondary node'
task
:refresh_foreign_tables
do
if
Gitlab
::
Geo
::
GeoTasks
.
foreign_server_configured?
print
"
\n
Refreshing foreign tables for FDW:
#{
Gitlab
::
Geo
::
FDW_SCHEMA
}
... "
Gitlab
::
Geo
::
GeoTasks
.
refresh_foreign_tables!
puts
'Done!'
else
puts
"Warning: Cannot refresh foreign tables, there is no foreign server configured."
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