mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-04 19:24:02 +00:00
Query log
This commit is contained in:
parent
9aee480a80
commit
92ed22ef19
1 changed files with 3 additions and 14 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue