Skip to content

Commit 3149060

Browse files
committed
Quote MySQL constraint names for foreign keys
MariaDB 12.1 introduces InnoDB Foreign key names of a digit which requires quoting. closes #7021
1 parent 3cf87f0 commit 3149060

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Schema/MySQLSchemaManager.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ protected function _getPortableTableForeignKeysList(array $rows): array
280280
}
281281

282282
$list[$row['constraint_name']] = [
283-
'name' => $row['constraint_name'],
283+
'name' => $this->getQuotedIdentifierName($row['constraint_name']),
284284
'local' => [],
285285
'foreign' => [],
286286
'foreignTable' => $row['referenced_table_name'],
@@ -524,4 +524,14 @@ private function getDefaultTableOptions(): DefaultTableOptions
524524

525525
return $this->defaultTableOptions;
526526
}
527+
528+
/** Returns the quoted representation of the given identifier name. */
529+
private function getQuotedIdentifierName(?string $identifier): ?string
530+
{
531+
if ($identifier === null) {
532+
return null;
533+
}
534+
535+
return $this->platform->quoteSingleIdentifier($identifier);
536+
}
527537
}

0 commit comments

Comments
 (0)