Skip to content

Commit 38e05f9

Browse files
committed
Merge remote-tracking branch 'origin/AC-11995' into Hammer-Platform-Health-Delivery-13Aug24
2 parents d625068 + dde4bbe commit 38e05f9

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

app/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,6 +1858,7 @@
18581858
<arguments>
18591859
<argument name="supportedVersionPatterns" xsi:type="array">
18601860
<item name="MySQL-8" xsi:type="string">^8\.0\.</item>
1861+
<item name="MySQL-8.4" xsi:type="string">^8\.4\.</item>
18611862
<item name="MySQL-5.7" xsi:type="string">^5\.7\.</item>
18621863
<item name="MariaDB-(10.2-10.6)" xsi:type="string">^10\.[2-6]\.</item>
18631864
</argument>

lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,13 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface, Rese
251251
*/
252252
private $parentConnections = [];
253253

254+
/***
255+
* Get exact version of MySQL
256+
*
257+
* @var string
258+
*/
259+
private $mysqlversion;
260+
254261
/**
255262
* Constructor
256263
*
@@ -3069,7 +3076,11 @@ public function startSetup()
30693076
$this->rawQuery("SET SQL_MODE=''");
30703077
$this->rawQuery("SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0");
30713078
$this->rawQuery("SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO'");
3072-
3079+
$this->mysqlversion = $this->fetchPairs("SHOW variables LIKE 'version'")['version'] ?? '';
3080+
if ($this->isMysql8EngineUsed() && str_contains($this->mysqlversion, '8.4')) {
3081+
$this->rawQuery("SET @OLD_RESTRICT_FK_ON_NON_STANDARD_KEY=@@RESTRICT_FK_ON_NON_STANDARD_KEY");
3082+
$this->rawQuery("SET RESTRICT_FK_ON_NON_STANDARD_KEY=0");
3083+
}
30733084
return $this;
30743085
}
30753086

@@ -3082,7 +3093,9 @@ public function endSetup()
30823093
{
30833094
$this->rawQuery("SET SQL_MODE=IFNULL(@OLD_SQL_MODE,'')");
30843095
$this->rawQuery("SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS=0, 0, 1)");
3085-
3096+
if ($this->isMysql8EngineUsed() && str_contains($this->mysqlversion, '8.4')) {
3097+
$this->rawQuery("SET RESTRICT_FK_ON_NON_STANDARD_KEY=IF(@OLD_RESTRICT_FK_ON_NON_STANDARD_KEY=0, 0, 1)");
3098+
}
30863099
return $this;
30873100
}
30883101

lib/internal/Magento/Framework/DB/Adapter/SqlVersionProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class SqlVersionProvider
3535

3636
public const MARIA_DB_10_4_27_VERSION = '10.4.27';
3737

38+
public const MYSQL_8_4_VERSION = '8.4.';
39+
3840
/**#@-*/
3941

4042
/**

lib/internal/Magento/Framework/Test/Unit/DB/Adapter/SqlVersionProviderTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class SqlVersionProviderTest extends TestCase
4949
*/
5050
private $supportedVersionPatterns = [
5151
'MySQL-8' => '^8\.0\.',
52+
'MySQL-8.4' => '^8\.4\.',
5253
'MySQL-5.7' => '^5\.7\.',
5354
'MariaDB-(10.2-10.6)' => '^10\.[2-6]\.'
5455
];
@@ -126,6 +127,10 @@ public static function executeDataProvider(): array
126127
['version' => '8.0.19'],
127128
SqlVersionProvider::MYSQL_8_0_VERSION,
128129
],
130+
'MySQL-8.4' => [
131+
['version' => '8.4.0'],
132+
SqlVersionProvider::MYSQL_8_4_VERSION,
133+
],
129134
'Percona' => [
130135
['version' => '5.7.29-32'],
131136
SqlVersionProvider::MYSQL_5_7_VERSION,

0 commit comments

Comments
 (0)