diff --git a/lib/evm_database_ops.rb b/lib/evm_database_ops.rb index fdcd68eb83d..1822e40dbc9 100644 --- a/lib/evm_database_ops.rb +++ b/lib/evm_database_ops.rb @@ -114,13 +114,14 @@ def self.restore(db_opts, connect_opts = {}) connect_opts[:uri] = File.dirname(connect_opts[:uri]) else connect_opts[:remote_file_name] ||= File.basename(backup_file_name(action)) - backup_folder = action == :dump ? "db_dump" : "db_backup" # # If the passed in URI contains query parameters, ignore them # when creating the dump file name. They'll be used in the session object. # - connect_opts_uri = connect_opts[:uri].split('?')[0] - uri = File.join(connect_opts_uri, backup_folder, connect_opts[:remote_file_name]) + uri_parts = [connect_opts[:uri].split('?')[0]] + uri_parts << (action == :dump ? "db_dump" : "db_backup") unless connect_opts[:skip_directory] + uri_parts << connect_opts[:remote_file_name] + uri = File.join(uri_parts) end else uri = db_opts[:local_file] diff --git a/lib/tasks/evm_dba.rake b/lib/tasks/evm_dba.rake index 21c0da2c3b5..7562cbaf98e 100644 --- a/lib/tasks/evm_dba.rake +++ b/lib/tasks/evm_dba.rake @@ -33,6 +33,7 @@ module EvmDba when :local_file opt :local_file, "Destination file", :type => :string, :required => true when :remote_file + opt :skip_directory, "Don't add backup directory", :type => :boolean, :default => false opt :remote_file_name, "Destination depot filename", :type => :string when :splitable opt :byte_count, "Size to split files into", :type => :string @@ -57,7 +58,7 @@ module EvmDba db_opts end - CONNECT_OPT_KEYS = [:uri, :uri_username, :uri_password, :aws_region, :remote_file_name].freeze + CONNECT_OPT_KEYS = %i(uri uri_username uri_password aws_region remote_file_name skip_directory).freeze def self.collect_connect_opts(opts) connect_opts = {} CONNECT_OPT_KEYS.each { |k| connect_opts[k] = opts[k] if opts[k] }