Skip to content

Commit

Permalink
Merge pull request #5664 from morozov/remove-non-innodb-fk-leftovers
Browse files Browse the repository at this point in the history
Remove leftovers of handling foreign keys on non-InnoDB engines for MySQL
  • Loading branch information
morozov authored Sep 12, 2022
2 parents b4e4c74 + f84cf59 commit 06732b8
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/Platforms/AbstractMySQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
use function is_numeric;
use function sprintf;
use function str_replace;
use function strtoupper;
use function trim;

/**
* Provides the base implementation for the lowest versions of supported MySQL-like database platforms.
Expand Down Expand Up @@ -253,7 +251,6 @@ protected function _getCreateTableSQL(string $name, array $columns, array $optio

$sql = [implode(' ', $sql)];

// Propagate foreign key constraints only for InnoDB.
if (isset($options['foreignKeys'])) {
foreach ($options['foreignKeys'] as $definition) {
$sql[] = $this->getCreateForeignKeySQL($definition, $name);
Expand Down Expand Up @@ -450,19 +447,6 @@ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff): array
}
}

$engine = 'INNODB';

if ($diff->fromTable instanceof Table && $diff->fromTable->hasOption('engine')) {
$engine = strtoupper(trim($diff->fromTable->getOption('engine')));
}

// Suppress foreign key constraint propagation on non-supporting engines.
if ($engine !== 'INNODB') {
$diff->addedForeignKeys = [];
$diff->changedForeignKeys = [];
$diff->removedForeignKeys = [];
}

return array_merge(
$sql,
$this->getPreAlterTableAlterIndexForeignKeySQL($diff),
Expand Down

0 comments on commit 06732b8

Please sign in to comment.