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

Fix command

This commit is contained in:
lukinovec 2023-04-27 13:44:45 +02:00
parent b66773da80
commit 2745f824aa

View file

@ -44,16 +44,11 @@ class CreateRLSPoliciesForTenantTables extends Command
)"); )");
DB::statement("ALTER TABLE {$table} FORCE ROW LEVEL SECURITY"); DB::statement("ALTER TABLE {$table} FORCE ROW LEVEL SECURITY");
return Command::SUCCESS;
} else { } else {
$modelName = $model::class; $modelName = $model::class;
$this->components->info("Table '$table' is not related to tenant. Make sure $modelName uses the BelongsToPrimaryModel trait."); $this->components->info("Table '$table' is not related to tenant. Make sure $modelName uses the BelongsToPrimaryModel trait.");
return Command::FAILURE;
} }
} } else {
DB::statement("CREATE POLICY {$table}_rls_policy ON {$table} USING ({$tenantKey}::TEXT = current_user);"); DB::statement("CREATE POLICY {$table}_rls_policy ON {$table} USING ({$tenantKey}::TEXT = current_user);");
DB::statement("ALTER TABLE {$table} FORCE ROW LEVEL SECURITY"); DB::statement("ALTER TABLE {$table} FORCE ROW LEVEL SECURITY");
@ -61,6 +56,8 @@ class CreateRLSPoliciesForTenantTables extends Command
$this->components->info("Created RLS policy for table '$table'"); $this->components->info("Created RLS policy for table '$table'");
} }
}
return Command::SUCCESS; return Command::SUCCESS;
} }