From 3194e563405e5d687442d5560e34860c052fbec9 Mon Sep 17 00:00:00 2001 From: kakiuchi-shigenao <87973394+endou-mame@users.noreply.github.com> Date: Thu, 23 May 2024 08:38:43 +0000 Subject: [PATCH] Fix: for Issue with Model Generation in PostgreSQL with Multiple Schemas --- src/Meta/Postgres/Schema.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Meta/Postgres/Schema.php b/src/Meta/Postgres/Schema.php index abe2c455..41295e40 100644 --- a/src/Meta/Postgres/Schema.php +++ b/src/Meta/Postgres/Schema.php @@ -132,7 +132,16 @@ protected function fillConstraints(Blueprint $blueprint) LEFT JOIN pg_attribute parent on parent.attnum = ANY (p.confkey) AND parent.attrelid = p.confrelid LEFT JOIN pg_class parent_class on parent_class.oid = p.confrelid - WHERE child_class.relkind = \'r\'::char + WHERE child.attrelid in ( + SELECT oid + FROM pg_class + WHERE relnamespace in ( + SELECT oid + FROM pg_namespace + WHERE nspname = \'public\' + ) + ) + AND child_class.relkind = \'r\'::char AND child_class.relname = \''.$blueprint->table().'\' AND child.attnum > 0 AND contype IS NOT NULL