Add config option database_dump_file_use_connection_name #1785
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Code and tests are added. Documentation update was omitted because a similar config
database_dump_file_timestamp_format
is not documented. I'm happy to add documentation should that be required for a merge.This PR adds a config option at
config('backup.backup.database_dump_file_use_connection_name')
of type boolean, defaulting tonull
and thus uses the database name as it always has.This config, if set to true, uses the connection's key from
config('database.connections')
in the dump file name instead of the database nameUse Case
I have 2 connections defined to the same database, each with different db-dumper options. I have one to dump only the schema (see my PR to spatie/db-dumper#208) and a second to dump the data of the database, minus the data from large tables (large as in disk space) that I can recreate.
As the package stand now, it names the dump files for these 2 connections the same based on the database name and I only get one file in the zipped archive.
With this PR, I now have both files in the zipped archive, one for each connection.
I'm happy to make any recommended modifications or additions!