1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-04 18:44:04 +00:00

Fix RLS tree generation (specify schema name in generateTrees())

This commit is contained in:
lukinovec 2025-02-25 14:11:02 +01:00
parent 4790a3e999
commit 0f8eb2ec6a

View file

@ -75,7 +75,10 @@ class TableRLSManager implements RLSPolicyManager
$builder = $this->database->getSchemaBuilder(); $builder = $this->database->getSchemaBuilder();
// We loop through each table in the database // We loop through each table in the database
foreach ($builder->getTableListing() as $table) { foreach ($builder->getTableListing(schema: $this->database->getConfig('search_path')) as $table) {
// E.g. "public.table_name" -> "table_name"
$table = str($table)->afterLast('.')->toString();
// For each table, we get a list of all foreign key columns // For each table, we get a list of all foreign key columns
$foreignKeys = collect($builder->getForeignKeys($table))->map(function ($foreign) use ($table) { $foreignKeys = collect($builder->getForeignKeys($table))->map(function ($foreign) use ($table) {
return $this->formatForeignKey($foreign, $table); return $this->formatForeignKey($foreign, $table);