Starts in:
0 DAY
22 HRS
45 MIN
7 SEC
Starts in:
0 D
22 H
45 M
7 S
Open Closed

DbMigrator for multi tenant + multi db #1087


User avatar
0
yuemy@sph.com.sg created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v4.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:

I have the following DB Setup

  • 1 DB for all ABP commercial modules
  • 1 DB for additional customisrd ABP modules

On top of it, every new Tenant should have separate DB, that is, one more DB for all ABP commercial modules for this tenant and one more db for additional customisrd ABP modules for this tenant. So I will need 4 DBs if I have 1 host + 1 tenant.

Now i already followed the guide here https://docs.abp.io/en/abp/latest/Entity-Framework-Core-Migrations to achieve the multiple db migrations. So the DB migrator works fine if I only run it for the Host. But if I added a Tenant, and from the SaaS UI, i can only indicate 1 connection string, I will not be able to acheive the setup that I desired. Because i am not able to configure the db connection string for the customised ABP modules for the tenant.

Please advise how can I acheive my desire setup.


5 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director

    @galip fyi

  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    I have the following DB Setup

    • 1 DB for all ABP commercial modules
    • 1 DB for additional customisrd ABP modules

    What do you mean by different db for commercial modules? Identity, Account, IdentityServer are commercial modules, how and why would you like to separate them?

    If you want to enable/disable a pro module (like File Management) for a tenant please check this answer.

    With version 4.3, we will have optional EntityFrameworkCore.SeparateDbMigrations project which will allow separate Migration DbContext's for tenants. With this, you can determine if an entity belongs to Host or Tenant or Both.

  • User Avatar
    0
    yuemy@sph.com.sg created

    What do you mean by different db for commercial modules? Identity, Account, IdentityServer are commercial modules, how and why would you like to separate them?

    my connection strings:

    "Default": "Server=localhost;Port=3306;Database=default_db;Uid=root;Pwd=Password123;", "ProductModule": "Server=localhost;Port=3306;Database=product_module_db;Uid=root;Pwd=Password123;"

    I already have separate DB migration project for each db.

    So when I run the DB Migrator, both migration project will be migrated smoothly for the Host.

    Then i proceed to add a Tenant. In the Edit Tenant Connection String UI, we can only specify one connection string though.

    So after that I run the DB migrator again, but this time round both migration will be migrated to the same tenant db which is not what I would like it to be.

  • User Avatar
    0
    alper created
    Support Team Director

    @yuemy although it's supported by the infrastructure, it's not supported at UI level. you've a Business license, I guess you can implement it on your side. if you need consultancy, an ABP team member can work with you. contact me if you're interested in info@abp.io

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06