1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 16:24:03 +00:00

Quote schema names in GRANT statements

PermissionControlledPostgreSQLDatabaseManager now uses the same quoting in GRANT statements as its schema counterpart.
This commit is contained in:
lukinovec 2026-05-04 11:58:24 +02:00
parent fec170ada9
commit 98a808bb98

View file

@ -34,10 +34,10 @@ class PermissionControlledPostgreSQLDatabaseManager extends PostgreSQLDatabaseMa
$this->connection()->reconnect(); $this->connection()->reconnect();
// Grant permissions to create and use tables in the configured schema ("public" by default) to the user // Grant permissions to create and use tables in the configured schema ("public" by default) to the user
$this->connection()->statement("GRANT USAGE, CREATE ON SCHEMA {$schema} TO \"{$username}\""); $this->connection()->statement("GRANT USAGE, CREATE ON SCHEMA \"{$schema}\" TO \"{$username}\"");
// Grant permissions to use sequences in the current schema to the user // Grant permissions to use sequences in the current schema to the user
$this->connection()->statement("GRANT USAGE ON ALL SEQUENCES IN SCHEMA {$schema} TO \"{$username}\""); $this->connection()->statement("GRANT USAGE ON ALL SEQUENCES IN SCHEMA \"{$schema}\" TO \"{$username}\"");
// Reconnect to central database // Reconnect to central database
config(["database.connections.{$connectionName}.database" => $centralDatabase]); config(["database.connections.{$connectionName}.database" => $centralDatabase]);