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 commit42acb823e8. * 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 commitb8e0a1c982. * 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:
parent
15dc40839b
commit
bf504f4c79
3 changed files with 229 additions and 19 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue