Skip to content

Commit cbf22d4

Browse files
committed
Structure::analyzeForeignKeys() fixed lowercased name [Closes #122]
1 parent 9d465ad commit cbf22d4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Database/Structure.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,14 @@ protected function analyzePrimaryKey(array $columns)
217217

218218
protected function analyzeForeignKeys(& $structure, $table)
219219
{
220+
$lowerTable = strtolower($table);
220221
foreach ($this->connection->getSupplementalDriver()->getForeignKeys($table) as $row) {
221-
$structure['belongsTo'][strtolower($table)][$row['local']] = $row['table'];
222+
$structure['belongsTo'][$lowerTable][$row['local']] = $row['table'];
222223
$structure['hasMany'][strtolower($row['table'])][$table][] = $row['local'];
223224
}
224225

225-
if (isset($structure['belongsTo'][$table])) {
226-
uksort($structure['belongsTo'][$table], function ($a, $b) {
226+
if (isset($structure['belongsTo'][$lowerTable])) {
227+
uksort($structure['belongsTo'][$lowerTable], function ($a, $b) {
227228
return strlen($a) - strlen($b);
228229
});
229230
}

0 commit comments

Comments
 (0)