Commit e38cc303 authored by Benjamin Eberlei's avatar Benjamin Eberlei

DBAL-50 - Fix bug in Postgres Schema Manager not handling column names in...

DBAL-50 - Fix bug in Postgres Schema Manager not handling column names in composite foreign keys correctly.
parent e951f74c
...@@ -84,7 +84,7 @@ abstract class AbstractAsset ...@@ -84,7 +84,7 @@ abstract class AbstractAsset
$identifier = trim(implode("_", $parts), '_'); $identifier = trim(implode("_", $parts), '_');
// using implicit schema support of DB2 and Postgres there might be dots in the auto-generated // using implicit schema support of DB2 and Postgres there might be dots in the auto-generated
// identifier names which can easily be replaced by underscores. // identifier names which can easily be replaced by underscores.
$identifier = str_replace(array(".", " "), "_", $identifier); $identifier = str_replace(".", "_", $identifier);
if (is_numeric(substr($identifier, 0, 1))) { if (is_numeric(substr($identifier, 0, 1))) {
$identifier = "i" . substr($identifier, 0, strlen($identifier)-1); $identifier = "i" . substr($identifier, 0, strlen($identifier)-1);
......
...@@ -46,8 +46,8 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager ...@@ -46,8 +46,8 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
} }
if (preg_match('/FOREIGN KEY \((.+)\) REFERENCES (.+)\((.+)\)/', $tableForeignKey['condef'], $values)) { if (preg_match('/FOREIGN KEY \((.+)\) REFERENCES (.+)\((.+)\)/', $tableForeignKey['condef'], $values)) {
$localColumns = explode(",", $values[1]); $localColumns = array_map('trim', explode(",", $values[1]));
$foreignColumns = explode(",", $values[3]); $foreignColumns = array_map('trim', explode(",", $values[3]));
$foreignTable = $values[2]; $foreignTable = $values[2];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment