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

Query log

This commit is contained in:
lukinovec 2023-06-16 09:41:09 +02:00
parent 9aee480a80
commit 92ed22ef19

View file

@ -48,18 +48,7 @@ class CreateRLSPoliciesForTenantTables extends Command
$parentKey = $model->$parentName()->getForeignKeyName();
$parentTable = $model->$parentName()->make()->getTable();
dump("CREATE POLICY {$table}_rls_policy ON {$table} USING (
{$parentKey} IN (
SELECT id
FROM {$parentTable}
WHERE ({$tenantKey} = (
SELECT {$tenantKey}
FROM {$parentTable}
WHERE id = {$parentKey}
))
)
)");
DB::enableQueryLog();
DB::statement("CREATE POLICY {$table}_rls_policy ON {$table} USING (
{$parentKey} IN (
SELECT id
@ -71,8 +60,8 @@ class CreateRLSPoliciesForTenantTables extends Command
))
)
)");
dump('statement completed');
dump(DB::getQueryLog());
DB::disableQueryLog();
$this->enableRls($table);