Commit d7242054 authored by Valery Sizov's avatar Valery Sizov

add pg_schema to backup config

parent 1eb3dde4
......@@ -54,6 +54,7 @@ v 8.0.0 (unreleased)
- Sort users autocomplete lists by user (Allister Antosik)
- Webhook for issue now contains repository field (Jungkook Park)
- Add ability to add custom text to the help page (Jeroen van Baarsen)
- Add pg_schema to backup config
v 7.14.3
- No changes
......
......@@ -306,6 +306,7 @@ production: &base
path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)
# archive_permissions: 0640 # Permissions for the resulting backup.tar file (default: 0600)
# keep_time: 604800 # default: 0 (forever) (in seconds)
# pg_schema: public # default: nil, it means that all schemas will be backed up
# upload:
# # Fog storage connection settings, see http://fog.io/storage/ .
# connection:
......
......@@ -219,6 +219,7 @@ def base_gitlab_url
#
Settings['backup'] ||= Settingslogic.new({})
Settings.backup['keep_time'] ||= 0
Settings.backup['pg_schema'] = nil
Settings.backup['path'] = File.expand_path(Settings.backup['path'] || "tmp/backups/", Rails.root)
Settings.backup['archive_permissions'] ||= 0600
Settings.backup['upload'] ||= Settingslogic.new({ 'remote_directory' => nil, 'connection' => nil })
......
......@@ -25,8 +25,12 @@ def dump
when "postgresql" then
$progress.print "Dumping PostgreSQL database #{config['database']} ... "
pg_env
# Pass '--clean' to include 'DROP TABLE' statements in the DB dump.
system('pg_dump', '--clean', config['database'], out: db_file_name)
pgsql_args = ["--clean"] # Pass '--clean' to include 'DROP TABLE' statements in the DB dump.
if Gitlab.config.backup.pg_schema
pgsql_args << "-n"
pgsql_args << Gitlab.config.backup.pg_schema
end
system('pg_dump', *pgsql_args, config['database'], out: db_file_name)
end
report_success(success)
abort 'Backup failed' unless success
......
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