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

Dump dropped policies

This commit is contained in:
lukinovec 2023-06-16 10:47:35 +02:00
parent 43d167bb48
commit 89d9e20c38

View file

@ -34,7 +34,8 @@ class CreateRLSPoliciesForTenantTables extends Command
$table = $model->getTable();
$tenantKey = tenancy()->tenantKeyColumn();
// DB::statement("DROP POLICY IF EXISTS {$table}_rls_policy ON {$table}");
dump($model::class, 'dropping policy of ' . $table);
DB::statement("DROP POLICY IF EXISTS {$table}_rls_policy ON {$table}");
if (tenancy()->modelBelongsToTenant($model)) {
DB::statement("CREATE POLICY {$table}_rls_policy ON {$table} USING ({$tenantKey}::TEXT = current_user);");