1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 05:44:04 +00:00
This commit is contained in:
lukinovec 2023-04-26 14:02:18 +02:00
parent e15eb01c7f
commit 910da724e4

View file

@ -52,14 +52,6 @@ test('correct rls policies get created using the command', function() {
], ],
]); ]);
$tableExists = DB::selectOne('SELECT EXISTS (
SELECT 1
FROM pg_tables
WHERE schemaname = ? AND tablename = ?
) AS table_exists;', ['pg_catalog', 'pg_policies'])->table_exists;
dump($tableExists);
$getRlsPolicies = fn () => DB::select('select * from pg_policies'); $getRlsPolicies = fn () => DB::select('select * from pg_policies');
$getModelTables = fn () => collect(config('tenancy.models.rls'))->map(fn (string $model) => (new $model)->getTable()); $getModelTables = fn () => collect(config('tenancy.models.rls'))->map(fn (string $model) => (new $model)->getTable());
$getRlsTables = fn() => $getModelTables()->map(fn ($table) => DB::select('select relname, relrowsecurity, relforcerowsecurity from pg_class WHERE oid = ' . "'$table'::regclass"))->collapse(); $getRlsTables = fn() => $getModelTables()->map(fn ($table) => DB::select('select relname, relrowsecurity, relforcerowsecurity from pg_class WHERE oid = ' . "'$table'::regclass"))->collapse();