From 10d0db5c74d75db39c4dcf91bf2b574c05121472 Mon Sep 17 00:00:00 2001 From: Jeremy Braband Date: Thu, 2 May 2024 07:46:11 -0500 Subject: [PATCH] changes config to a string instead of boolean --- config/backup.php | 7 +++++-- src/Tasks/Backup/BackupJob.php | 3 ++- tests/Commands/BackupCommandTest.php | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/config/backup.php b/config/backup.php index b4aa20ce..7e49ebbf 100644 --- a/config/backup.php +++ b/config/backup.php @@ -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. diff --git a/src/Tasks/Backup/BackupJob.php b/src/Tasks/Backup/BackupJob.php index efd7c4a2..56fb9f2f 100644 --- a/src/Tasks/Backup/BackupJob.php +++ b/src/Tasks/Backup/BackupJob.php @@ -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'; diff --git a/tests/Commands/BackupCommandTest.php b/tests/Commands/BackupCommandTest.php index b5460d64..446af30b 100644 --- a/tests/Commands/BackupCommandTest.php +++ b/tests/Commands/BackupCommandTest.php @@ -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());