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

Best-Practice - moving tenant from in-host to separate database #9029


User avatar
0
deltavision created

Hi,

using: Core, MVC, jQuery project - v7.2.2

How can you change a tenant from in-host to separate database? From Tenant menu in Host - not possible to change to/from in-host.

So is the only way:

  • Create a new tenant
  • Move data (somehow...)
  • Deleted old tenant
  • Change tenantID on new tenant DB to match the new tenantID

And - to move the tenant to separate database:

  1. Backup host DB
  2. Restore the host DB backup to new tenant DB
  3. Remove other tenants data in the new tenant DB, specific on user defined tables.
  4. Which tables "Abp..." can you empty or must keep tenant data?
  5. Which tables "App..." can you empty or must keep tenant data?

Or is there a tool for this tenant change/move :-) ?


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @deltavision

    You are right, it is not possible using the UI since existing tenant might have data in Host database. So, you need to do it manually. You can set ConnectionString in database, create a new database for Tenant and move its data from Host database to newly created tenant database.

  • User Avatar
    0
    deltavision created

    Hi @ismcagdas

    the ConnectionString in database is encrypted - so is that possible to change manually?

    In regards to the "Abp..." and "App..." tables - anything we should be aware of? or delete from new Tenant database?

    And for the host DB:

    • Tenant data for moved Tenant (user defined tables) should be removed - correct?

    And for new Tenant DB:

    • Other Tenants data (user defined tables) should be removed - correct?
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    the ConnectionString in database is encrypted - so is that possible to change manually?

    You are right, sorry. You can write a simple tool which uses same encryption algorith used during tenant creation if that's going to make migration easy for you.

    In regards to the "Abp..." and "App..." tables - anything we should be aware of? or delete from new Tenant database?

    I suggest not to delete any table becasue it will cause problems about migrations.

    And for the host DB: Tenant data for moved Tenant (user defined tables) should be removed - correct?

    Correct.

    Other Tenants data (user defined tables) should be removed - correct?

    Yes, correct. Normally you shouldn't transfer other tenant's data to new tenant's database if you can.

  • User Avatar
    0
    deltavision created

    Hi,

    Regarding "Abp..." and "App..." tables - the intention was not to delete/remove the tables :-)

    But remove any data that could be relatede to tenans (other) in the new Tenant database.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @deltavision

    In that case, yes, you can delete those data.

  • User Avatar
    0
    deltavision created

    Thank you