-
-
Notifications
You must be signed in to change notification settings - Fork 767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add config option database_dump_file_use_connection_name #1785
Conversation
…the dump fiel with connection name in place of database name
config/backup.php
Outdated
/* | ||
* If specified, the database dumped file name will contain the connection name in place of the database name. | ||
*/ | ||
'database_dump_file_use_connection_name' => null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this is a bool value, shoud it be false
by default instead of null
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree, false
would be a better default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Had a thought though to change the config to a string, either 'database' or 'connection' and default it to connection.
I updated to that. It feels better that the 'database' option is visible in the config as default instead of a boolean to change behavior.
I'm happy to change it back to a boolean if that is preferred.
Thanks for this! Could you also add docs? |
Docs added. I also added docs for database_dump_file_timestamp_format which were missing. |
Thanks! |
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!