How Do I Migrate Tenant Databases and Host Databas

2019-07-24 19:59发布

I am using the ASP.NET ZERO framework with ASP.NET Core and Angular for my current project.

I am also using the 'MultiTenancy - MultiDatabase' feature of ASP.Net ZERO.

In application I have added a 'Tenant1-Database' connection string in create new Tenant.

enter image description here

Now i have two databases:

  1. Host-Database
  2. Tenant1-Database

When I create a new Tenant, 'Tenant1-Database' is automatically update as per previous migration files.

But when I update the model with a new property and try to migrate the database using code-first approach, I see that 'Host-Database' is the only db migrated with the new properties and Tenant1-Database is not migrated.

My question is: How can I migrate into both databases using a single migration file?

1条回答
祖国的老花朵
2楼-- · 2019-07-24 20:15

Yeah.. I Got the Solution

In the ASP.Net Zero, whole sample template have project with Projectname.Migrator

ASP.Net Zero already provides the Host database and all Tenant Databases migrations by console application

Just need to Create a migration file and execute project with Projectname.Migrator

查看更多
登录 后发表回答