Fixed #19120 - added DB_DUMP_SINGLE_TRANSACTION to .env for RDS support

This commit is contained in:
snipe
2026-06-03 11:40:33 +01:00
parent a6e55fb462
commit 79732a9151
3 changed files with 9 additions and 1 deletions
+1
View File
@@ -37,6 +37,7 @@ MYSQL_ROOT_PASSWORD=changeme1234
DB_PREFIX=null
DB_DUMP_PATH='/usr/bin'
DB_DUMP_SKIP_SSL=true
DB_DUMP_SINGLE_TRANSACTION=false
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci
+1
View File
@@ -32,6 +32,7 @@ DB_PASSWORD=null
DB_PREFIX=null
DB_DUMP_PATH='/usr/bin'
DB_DUMP_SKIP_SSL=false
DB_DUMP_SINGLE_TRANSACTION=false
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci
DB_SANITIZE_BY_DEFAULT=false
+7 -1
View File
@@ -11,12 +11,18 @@
// This is used by the mysql dump options in spatie backup
$dump_options = [
'dump_binary_path' => env('DB_DUMP_PATH', '/usr/local/bin'), // only the path, so without 'mysqldump'
'use_single_transaction' => false,
'timeout' => 60 * 5, // 5 minute timeout
// 'exclude_tables' => ['table1', 'table2'],
// 'add_extra_option' => '--optionname=optionvalue',
];
// spatie/laravel-backup 9.x treats false and null identically in callMethodOnDumper,
// so the only way to disable single-transaction mode is to omit the key entirely.
// Set DB_DUMP_SINGLE_TRANSACTION=true to opt in (required for non-RDS MySQL).
if (env('DB_DUMP_SINGLE_TRANSACTION') == 'true') {
$dump_options['use_single_transaction'] = true;
}
// For modern versions of mysqldump, use --ssl-mode=DISABLED
if (env('DB_DUMP_SKIP_SSL') == 'true') {
// Correctly add the option as a string to the 'add_extra_option' key.