From 46b89fd0ec2ae1545eb0553dc3de35539ee2c7b6 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Fri, 16 Jun 2023 10:26:15 +0200 Subject: [PATCH] Delete dump, put getModels into transaction --- src/Commands/CreateRLSPoliciesForTenantTables.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Commands/CreateRLSPoliciesForTenantTables.php b/src/Commands/CreateRLSPoliciesForTenantTables.php index bf94339a..eee3533d 100644 --- a/src/Commands/CreateRLSPoliciesForTenantTables.php +++ b/src/Commands/CreateRLSPoliciesForTenantTables.php @@ -19,7 +19,9 @@ class CreateRLSPoliciesForTenantTables extends Command public function handle(): int { - tenancy()->getModels()->each(fn (Model $model) => $this->useRlsOnModel($model)); + DB::transaction(function () { + tenancy()->getModels()->each(fn (Model $model) => $this->useRlsOnModel($model)); + }); return Command::SUCCESS; } @@ -57,7 +59,6 @@ class CreateRLSPoliciesForTenantTables extends Command )) ) )"); - dump(DB::select('SELECT * FROM pg_policies')); $this->enableRls($table);