Skip to content

Commit 1331970

Browse files
committed
AC-11995:Add compatibility with MySQL 8.4 LTS for Magento CE
1 parent ab476d6 commit 1331970

File tree

2 files changed

+3
-33
lines changed

2 files changed

+3
-33
lines changed

dev/tests/setup-integration/testsuite/Magento/Setup/DeclarativeInstallerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ public function testInstallationWithConstraintsModification()
208208
['Magento_TestSetupDeclarationModule1']
209209
);
210210
$this->updateDbSchemaRevision('constraint_modifications');
211+
$adapter = $this->resourceConnection->getConnection("default");
212+
$adapter->query("SET @OLD_RESTRICT_FK_ON_NON_STANDARD_KEY=@@GLOBAL.RESTRICT_FK_ON_NON_STANDARD_KEY, @@GLOBAL.RESTRICT_FK_ON_NON_STANDARD_KEY=0");
211213
$this->cliCommand->upgrade();
212214

213215
$diff = $this->schemaDiff->diff(
@@ -217,6 +219,7 @@ public function testInstallationWithConstraintsModification()
217219
self::assertNull($diff->getAll());
218220
$shardData = $this->describeTable->describeShard(Sharding::DEFAULT_CONNECTION);
219221
$this->assertTableCreationStatements($this->getTrimmedData(), $shardData);
222+
$adapter->query("SET @@GLOBAL.RESTRICT_FK_ON_NON_STANDARD_KEY=IF(@OLD_RESTRICT_FK_ON_NON_STANDARD_KEY=0, 0, 1)");
220223
}
221224

222225
/**

setup/src/Magento/Setup/Model/Installer.php

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -910,16 +910,10 @@ public function installSchema(array $request)
910910
$this->assertDbAccessible();
911911
$setup = $this->setupFactory->create($this->context->getResources());
912912
$this->setupModuleRegistry($setup);
913-
914-
$this->disableRestrictFKOnNonStandardKey($setup);
915-
916913
$this->setupCoreTables($setup);
917914
$this->cleanMemoryTables($setup);
918915
$this->log->logMeta('Schema creation/updates:');
919916
$this->declarativeInstallSchema($request);
920-
921-
$this->revertRestrictFKOnNonStandardKey($setup);
922-
923917
$this->handleDBSchemaData($setup, 'schema', $request);
924918
/** @var Mysql $adapter */
925919
$adapter = $setup->getConnection();
@@ -1833,31 +1827,4 @@ private function setIndexerModeSchedule(): void
18331827
$this->log->log(__("We couldn't change indexer(s)' mode because of an error: ".$e->getMessage()));
18341828
}
18351829
}
1836-
1837-
/***
1838-
* use of non-unique or partial keys as foreign keys is deprecated in MySQL8.4
1839-
*
1840-
* @param $setup
1841-
* @return void
1842-
*/
1843-
private function disableRestrictFKOnNonStandardKey($setup): void
1844-
{
1845-
$setup->getConnection()->query("
1846-
SET @OLD_RESTRICT_FK_ON_NON_STANDARD_KEY=@@GLOBAL.RESTRICT_FK_ON_NON_STANDARD_KEY,
1847-
@@GLOBAL.RESTRICT_FK_ON_NON_STANDARD_KEY=0
1848-
");
1849-
}
1850-
1851-
/***
1852-
* revert RESTRICT_FK_ON_NON_STANDARD_KEY to previous saved db value
1853-
*
1854-
* @param $setup
1855-
* @return void
1856-
*/
1857-
private function revertRestrictFKOnNonStandardKey($setup): void
1858-
{
1859-
// $setup->getConnection()->query("
1860-
// SET @@GLOBAL.RESTRICT_FK_ON_NON_STANDARD_KEY=IF(@OLD_RESTRICT_FK_ON_NON_STANDARD_KEY=0, 0, 1)"
1861-
// );
1862-
}
18631830
}

0 commit comments

Comments
 (0)