mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 10:14:04 +00:00
Use $tenant->database()->getUsername(), default to $tenant->getTenantKey()
This commit is contained in:
parent
57df6e2b30
commit
2461f76e59
3 changed files with 4 additions and 3 deletions
|
|
@ -28,8 +28,9 @@ class PostgresTenancyBootstrapper implements TenancyBootstrapper
|
|||
/** @var TenantWithDatabase $tenant */
|
||||
$this->database->purge('central');
|
||||
|
||||
$this->config->set('database.connections.pgsql.username', $tenant->getTenantKey());
|
||||
$this->config->set('database.connections.pgsql.username', $tenant->database()->getUsername() ?? $tenant->getTenantKey());
|
||||
$this->config->set('database.connections.pgsql.password', $tenant->database()->getPassword() ?? 'password');
|
||||
|
||||
$this->config->set('database.connections.central', $this->config->get('database.connections.pgsql'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class CreatePostgresUserForTenant implements ShouldQueue
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
$name = $this->tenant->getTenantKey();
|
||||
$name = $this->tenant->database()->getUsername() ?? $this->tenant->getTenantKey();
|
||||
$password = $this->tenant->database()->getPassword() ?? 'password';
|
||||
|
||||
// Create the user only if it doesn't already exist
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class DeleteTenantsPostgresUser implements ShouldQueue
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
$name = $this->tenant->getTenantKey();
|
||||
$name = $this->tenant->database()->getUsername() ?? $this->tenant->getTenantKey();
|
||||
|
||||
// Revoke all permissions of a Postgres user before dropping it
|
||||
// Skip dropping permissions if the user doesn't exist
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue