mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 19:14:03 +00:00
Wrap makeModelUseRls() in transaction
This commit is contained in:
parent
3ef1c38414
commit
61519ecec3
1 changed files with 3 additions and 5 deletions
|
|
@ -20,7 +20,7 @@ class CreateRLSPoliciesForTenantTables extends Command
|
|||
/** @var Model $model */
|
||||
$model = new $modelClass;
|
||||
|
||||
$this->makeModelUseRls($model);
|
||||
DB::transaction(fn () => $this->makeModelUseRls($model));
|
||||
}
|
||||
|
||||
return Command::SUCCESS;
|
||||
|
|
@ -79,9 +79,7 @@ class CreateRLSPoliciesForTenantTables extends Command
|
|||
|
||||
protected function enableRls(string $table): void
|
||||
{
|
||||
DB::transaction(function () use ($table) {
|
||||
DB::statement("ALTER TABLE {$table} ENABLE ROW LEVEL SECURITY");
|
||||
DB::statement("ALTER TABLE {$table} FORCE ROW LEVEL SECURITY");
|
||||
});
|
||||
DB::statement("ALTER TABLE {$table} ENABLE ROW LEVEL SECURITY");
|
||||
DB::statement("ALTER TABLE {$table} FORCE ROW LEVEL SECURITY");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue