Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How to migrate db when we have multiple tenant db #1217


User avatar
0
Qloud created

Hello,

mutli tenant - multi db is very good concept.

I have just few question here. Suppose our application have multi-tenant - multi db concept. and we got new 100 db and meanwhile we are working with few custom fields or custom table on application then how it will done for all db? means how we can migrate easily? Or do you have system like if we add one custom field/table then it will create for all current tenant db automatically? and for this scenario what is the solution when application is live already then some minor customization needed then how our customer will migrate? or how we can help them. Many questions :shock:

Please advice.

Awaiting for your response.

Thanks


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    This problem is a general problem beside AspNet Zero. But since we have also this problem, we provide one solution to that problem: Migrator.exe (<a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/tree/master/src/Tools/MyCompanyName.AbpZeroTemplate.Migrator">https://github.com/aspnetzero/aspnet-ze ... e.Migrator</a>) It can update host database + all tenant databases in one run. So, you can run this tool to upgrade all databases.

    But, surely, it can take long time if you have 10,000 tenant databases. What to do in this situation? You may want to upgrade a tenant's database when it's first accesed. But this has another problems: migration can take long time for that customer and he will wait until it finishes. Also, in that case we use iis process to run migrations, which is not good (iis maybe restarted anytime). And also, we may reach to database from another application (which does not run migrations) and database may be very old if it's not used for a long time and so on...

    As you see, this are tradeoffs. That's why we provided the simplest solution. You can change it or create another solution for your application needs. By the time, we may provide additional options as we get feedbacks from our customers.