Skip to content

Commit

Permalink
changes config to a string instead of boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
jbraband authored and freekmurze committed May 2, 2024
1 parent ce01bc1 commit 10d0db5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions config/backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,12 @@
'database_dump_file_timestamp_format' => null,

/*
* If specified, the database dumped file name will contain the connection name in place of the database name.
* The base of the dump filename, either 'database' or 'connection'
*
* If 'database' (default), the dumped filename will contain the database name.
* If 'connection', the dumped filename will contain the connection name.
*/
'database_dump_file_use_connection_name' => null,
'database_dump_filename_base' => 'database',

/*
* The file extension used for the database dump files.
Expand Down
3 changes: 2 additions & 1 deletion src/Tasks/Backup/BackupJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ protected function dumpDatabases(): array

$dbType = mb_strtolower(basename(str_replace('\\', '/', get_class($dbDumper))));

if (config('backup.backup.database_dump_file_use_connection_name')) {

if (config('backup.backup.database_dump_filename_base') === 'connection') {
$dbName = $key;
} else if ($dbDumper instanceof Sqlite) {
$dbName = $key . '-database';
Expand Down
2 changes: 1 addition & 1 deletion tests/Commands/BackupCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@

it('uses connection name in place of database name for dump filename', function () {
config()->set('backup.backup.source.databases', ['db1']);
config()->set('backup.backup.database_dump_file_use_connection_name', true);
config()->set('backup.backup.database_dump_filename_base', 'connection');

$this->setUpDatabase(app());

Expand Down

0 comments on commit 10d0db5

Please sign in to comment.