Skip to content

A free open source IT asset/license management system

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

snipe79732a9151b6
diff --git a/.env.docker b/.env.docker
index 2ebcf99694..6a7bc2b3cb 100644
--- a/.env.docker
+++ b/.env.docker
@@ -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
diff --git a/.env.example b/.env.example
index 47937af615..dfce45fa54 100644
--- a/.env.example
+++ b/.env.example
@@ -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
diff --git a/config/database.php b/config/database.php
index 3a3b3eff1b..9a2447fbe2 100755
--- a/config/database.php
+++ b/config/database.php
@@ -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.