From 8ff88238fbe441b99a8d1a0e0c507591ced0f83e Mon Sep 17 00:00:00 2001 From: Jan Skrasek Date: Wed, 30 Oct 2024 12:50:34 +0100 Subject: [PATCH] [postgres] retrive foreign keys in determinist order 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 --- src/Platforms/PostgreSqlPlatform.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Platforms/PostgreSqlPlatform.php b/src/Platforms/PostgreSqlPlatform.php index 2f9dd36..4b2fc29 100644 --- a/src/Platforms/PostgreSqlPlatform.php +++ b/src/Platforms/PostgreSqlPlatform.php @@ -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) {