-
-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple database setup issue #99
Comments
Don't you ever change your landlord connection anyway if you switch from I tried to simulate your code: the SQLite migration for landlord works, but without switching the landlord connection to Why can't you use an environment variable to set up the landlord/tenant database connection? Should switch easier using .env and phpunit.xml. Please help me to understand. |
@masterix21 Thanks for your reply. So the tests are run on the If there is a convenient way to continue using like before, that would be great. My workaround at the moment is to change the environment variables to get things to work. |
Yes, I think you have already found the best solution: switching to environment variables, you'll retake full control of your code (using .env and phpunit.xml). // config/multitenancy.php
'landlord_database_connection_name' => env('DB_CONNECTION_LANDLORD', 'landlord');
'tenant_database_connection_name' => env('DB_CONNECTION_TENANT', 'tenant'), |
A new issue has come up after introduction of #92
I have a
mysql
database setup which hastenant
andlandlord
databases and another set onsqlite
(used for testing). Before introduction of the above PR I was able to migrate and seed these databases by just specifying the connections on the artisan commands.I.e. the below commands all worked without issues:
php artisan migrate:fresh --path=database/migrations/landlord php artisan tenants:artisan "migrate:fresh --seed --database=tenant"
for mysql. And:
php artisan migrate:fresh --path=database/migrations/landlord --database=testing_landlord php artisan tenants:artisan "migrate:fresh --seed --database=testing_tenant"
for sqlite setup. However, since the connections must be specified in the config file now this setup no longer works without having to change the config file before working on each database.
If this is the intended behavior going forward, it would be great to know the correct way to work through this issue.
The text was updated successfully, but these errors were encountered: