How do we automate the process of adding migrations and updating tenant databases automatically for a multi-tenant application ? Our product is single web app and database per tenant. Right now we are manually updating each tenant database individually.
Please inform how we can maintain and automate the code first migrations and update database for all tenants at the same time whenever a new migration is added.
For adding migrations, you need to add migrations using Visual Studio on development time. But, for updating all tenant databases and host database, you can use Migrator tool included in your downloaded solution.
You need to run this tool in a machine which has access to host db and all tenant DBs.
If your local machine cannot access DBs on azure, I think of two ways.
You can place migration code into your web app's startup, the code exists in Migrator tool for now. And run it in every app start.
Or you can create a dummy application which contains Migration code exists in Migrator tool and deploy it to azure. In this way, you can update all of your DBs when you want.
What do you think ?