From 19cc22f0313cd3c3ec2d5dbb135eb7de651a685f Mon Sep 17 00:00:00 2001 From: Tim Kelty Date: Thu, 2 May 2024 14:20:31 -0400 Subject: [PATCH] Bugfix/single transaction (#14928) * correct logic for database backup single-transaction (#14925) * Changelog * Simplify condition * Changelog tweak --------- Co-authored-by: Erin --- CHANGELOG.md | 1 + src/db/mysql/Schema.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1703511da28..09558c44c81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Fixed a bug where disclosure menus weren’t releasing their `scroll` and `resize` event listeners on hide. ([#14911](https://github.com/craftcms/cms/pull/14911]), [#14510](https://github.com/craftcms/cms/issues/14510)) +- Fixed a bug where MySQL backups weren’t restorable on certain environments. ([#14925](https://github.com/craftcms/cms/pull/14925)) ## 4.9.0 - 2024-04-30 diff --git a/src/db/mysql/Schema.php b/src/db/mysql/Schema.php index c3f829c6b2c..2c6eaf5fde0 100644 --- a/src/db/mysql/Schema.php +++ b/src/db/mysql/Schema.php @@ -173,8 +173,8 @@ public function getDefaultBackupCommand(?array $ignoreTables = null): string // https://bugs.mysql.com/bug.php?id=109685 $useSingleTransaction = - ($isMySQL5 && version_compare($serverVersion, '5.7.41', '>=')) || - ($isMySQL8 && version_compare($serverVersion, '8.0.32', '>=')); + ($isMySQL5 && version_compare($serverVersion, '5.7.41', '<')) || + ($isMySQL8 && version_compare($serverVersion, '8.0.32', '<')); if ($useSingleTransaction) { $baseCommand->addArg('--single-transaction');