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

[3.x] DB users (#382)

* Initial draft

* Apply fixes from StyleCI

* Use CI on master branch too

* Pass correct argument to queued DB creators/deleters

* Apply fixes from StyleCI

* Remove new interface from MySQLDBManager

* Make phpunit run

* Apply fixes from StyleCI

* Fix static property

* Default databaseName

* Use database transactions for creating users & granting permissions

* Apply fixes from StyleCI

* Get old tests to pass

* Apply fixes from StyleCI

* Add tests for PermissionControlledMySQLDatabaseManager

* Apply fixes from StyleCI

* Write test for extra config, fix bug with extra config

* Apply fixes from StyleCI
This commit is contained in:
Samuel Štancl 2020-05-03 18:12:27 +02:00 committed by GitHub
parent 60665517a0
commit 3bb2759fe2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 756 additions and 286 deletions

View file

@ -100,7 +100,7 @@ return [
* The connection that will be used as a template for the dynamically created tenant connection.
* Set to null to use the default connection.
*/
'based_on' => null,
'template_connection' => null,
/**
* Tenant database names are created like this:
@ -108,8 +108,6 @@ return [
*/
'prefix' => 'tenant',
'suffix' => '',
'separate_by' => 'database', // database or schema (only supported by pgsql)
],
/**
@ -197,9 +195,14 @@ return [
'pgsql' => Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLDatabaseManager::class,
/**
* Disable the pgsql manager above, enable the one below, and set the
* tenancy.database.separate_by config key to 'schema' if you would
* like to separate tenant DBs by schemas rather than databases.
* Use this database manager for MySQL to have a DB user created for each tenant database.
* You can customize the grants given to these users by changing the $grants property.
*/
// 'mysql' => Stancl\Tenancy\TenantDatabaseManagers\PermissionControlledMySQLDatabaseManager::class,
/**
* Disable the pgsql manager above, and enable the one below if you
* want to separate tenant DBs by schemas rather than databases.
*/
// 'pgsql' => Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLSchemaManager::class, // Separate by schema instead of database
],
@ -252,8 +255,8 @@ return [
*/
'migrate_after_creation' => false,
'migration_parameters' => [
// '--force' => true, // Set this to true to be able to run migrations in production
// '--path' => [], // If you need to customize paths to tenant migrations
'--force' => true, // Set this to true to be able to run migrations in production
// '--path' => [database_path('migrations/tenant')], // If you need to customize paths to tenant migrations
],
/**