1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 14:34:04 +00:00

[4.x] Use a dedicated DB connection for creating/deleting tenant databases (#946)

* create host connection for creating, deleting tenants

* purge connection and add more tests

* remove unused method

* Improvements

* test named

* remove host connection name config key

* Revert "remove host connection name config key"

This reverts commit 42acb823e8.

* Update DatabaseConfig.php

* Update assets/config.php

Co-authored-by: Samuel Štancl <samuel@archte.ch>

* Update DatabaseConfig.php

* todo and comments

* remove debug code

* Update DatabaseConfig.php

* strict assertions

* Update TenantDatabaseManagerTest.php

* Update src/Database/DatabaseConfig.php

Co-authored-by: Samuel Štancl <samuel@archte.ch>

* purge connection improvements

* Update DatabaseConfig.php

* Update DatabaseConfig.php

* Update DatabaseConfig.php

* improve comments

* remove "ensuring connection exists" check

* remove test because it's duplicate

* removing test because other two tests are using the same logic, so this test kinda already covered

* Update TenantDatabaseManagerTest.php

* Update DatabaseConfig.php

* Revert "Update TenantDatabaseManagerTest.php"

This reverts commit b8e0a1c982.

* add default

* Update src/Database/DatabaseConfig.php

Co-authored-by: Samuel Štancl <samuel@archte.ch>

* update comment

* remove unness mysql config and add a comment

* tenancy_db_connection tenant config test

* Update TenantDatabaseManagerTest.php

* update test name and improve assertions

* typo

* change inline variable name

* Update TenantDatabaseManagerTest.php

* Update TenantDatabaseManagerTest.php

* add DB::purge() calls

* add new assertions [ci skip]

* Fix code style (php-cs-fixer)

* replace hostManager with manager

* fix test

* method rename

Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
This commit is contained in:
Abrar Ahmad 2022-10-31 16:13:54 +05:00 committed by GitHub
parent 15dc40839b
commit bf504f4c79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 229 additions and 19 deletions

View file

@ -98,6 +98,11 @@ return [
*/
'template_tenant_connection' => null,
/**
* The name of the temporary connection used for creating and deleting tenant databases.
*/
'tenant_host_connection_name' => 'tenant_host_connection',
/**
* Tenant database names are created like this:
* prefix + tenant_id + suffix.