Skip to content

Commit

Permalink
[postgres] retrive foreign keys in determinist order
Browse files Browse the repository at this point in the history
this failed on my macos as it returned keys in a different order,
e.g. nextras orm's users_x_users was returning pk foregin keys backwards
  • Loading branch information
hrach committed Oct 30, 2024
1 parent ce53029 commit 8ff8823
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Platforms/PostgreSqlPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ public function getForeignKeys(string $table, ?string $schema = null): array
count($tableArgs) > 1
? "AND cl.oid = '%table.%table'::regclass"
: "AND cl.oid = '%table'::regclass"
), ...$tableArgs);
) . '
ORDER BY atf.attnum
', ...$tableArgs);

$keys = [];
foreach ($result as $row) {
Expand Down

0 comments on commit 8ff8823

Please sign in to comment.