Hi,
I am playing around with multi tenancy in Laravel and it looks nice. With subdomains and seperate .env files for them I can have seperate 'instances' for different tenants. This all works fine. But now I am thinking about the development, test, production environment.
I am having one development environment and that is sufficient. But I am thinking about mulitple test environments and multiple production environments. I am going to do this as:
Production (1 Prod Laravel instance as develop - 2):
customer1.domain.com, customer2.domain.com, customer3.domain.com
Test (1 Test Laravel Instance as develop -1):
customer1.test.domain.com, customer2.test.domain.com, customer3.test.domain.com
But now I am thinking about upgrading all the databases, since each customer has a seperate database (as well for test and production). When I do the database migration it will only take my 'default' instance. But I need to migrate all databases at once.
All databases will have the same naming convention: domain_prod_customer1 and domain_test_customer1.
How can I upgrade all databases at once after I have updated my laravel application code? For the test environment I want to test the prod upgrade as well, so prior to migrating the database, I first copy the last one from prod to test and then do the migrate there. So I would like to:
Upgrade test:
For each database in domain_test_* (I can do this with SQL);
Drop database; Copy domain_prod_x to domain_test_x
Migrate database domain_test_x
Upgrade prod:
Just a simple migrate.
Any ideas how to accomplish this?