diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index d61eeff..df832f0 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -18,6 +18,7 @@ Yii Framework 2 Change Log - Bug #7868: Fixed creating raw sql (for logging) by skipping object and resource params (nineinchnick) - Bug #7868: Fixed Schema::getLastInsertID() by quoting sequence name (nineinchnick) - Bug #7957: Removed extra `parseFloat()` call for the `compare` js validator (CthulhuDen) +- Bug #8012: Fixed fetching multiple relations between two tables for pgsql (nineinchnick) - Bug #8014: Fixed setting incorrect form "action" property after submitting a form using a link with "data-method" and containing "action" among "data-params" (samdark) - Enh #6895: Added `ignoreCategories` config option for message command to ignore categories specified (samdark) - Enh #6975: Pressing arrows while focused in inputs of Active Form with `validateOnType` enabled no longer triggers validation (slinstj) diff --git a/framework/db/pgsql/Schema.php b/framework/db/pgsql/Schema.php index c79e0a1..0435b9e 100644 --- a/framework/db/pgsql/Schema.php +++ b/framework/db/pgsql/Schema.php @@ -225,12 +225,13 @@ SQL; $sql = << $columns) { - $citem = [$foreignTable]; - foreach ($columns as $column => $foreignColumn) { - $citem[$column] = $foreignColumn; + $name = $constraint['constraint_name']; + if (!isset($constraints[$name])) { + $constraints[$name] = [ + 'tableName' => $foreignTable, + 'columns' => [], + ]; } - $table->foreignKeys[] = $citem; + $constraints[$name]['columns'][$constraint['column_name']] = $constraint['foreign_column_name']; + } + foreach ($constraints as $constraint) { + $table->foreignKeys[] = array_merge([$constraint['tableName']], $constraint['columns']); } }