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

Wrap makeModelUseRls() in transaction

This commit is contained in:
lukinovec 2023-05-31 07:53:21 +02:00
parent 3ef1c38414
commit 61519ecec3

View file

@ -20,7 +20,7 @@ class CreateRLSPoliciesForTenantTables extends Command
/** @var Model $model */ /** @var Model $model */
$model = new $modelClass; $model = new $modelClass;
$this->makeModelUseRls($model); DB::transaction(fn () => $this->makeModelUseRls($model));
} }
return Command::SUCCESS; return Command::SUCCESS;
@ -79,9 +79,7 @@ class CreateRLSPoliciesForTenantTables extends Command
protected function enableRls(string $table): void 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} ENABLE ROW LEVEL SECURITY"); DB::statement("ALTER TABLE {$table} FORCE ROW LEVEL SECURITY");
DB::statement("ALTER TABLE {$table} FORCE ROW LEVEL SECURITY");
});
} }
} }