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

Seed Data not Inserting to Tenant DB #3265


User avatar
0
shyamjith created

Hi,

I am using Abp version 0.9.5.0. My application is a Single App Multiple DB SAAS .

I have a Host DB Called Host and three tenants DBs called T1, T2 and T3. I have seed for Inserting Admin Users and Default Roles and some other Initial Data, So I did run the migration tool which provided in the ABP Package, unfortunately, seed data are not inserted to Tenant DBs.

Here is the output I am getting

2017-05-25 17:52:35 | Host database: Default
2017-05-25 17:52:35 | Continue to migration for this host database and all tenan
ts..? (Y/N):
Y
2017-05-25 17:52:39 | HOST database migration started...
2017-05-25 17:52:52 | HOST database migration completed.
2017-05-25 17:52:52 | --------------------------------------------------------
2017-05-25 17:52:52 | Tenant database migration started... (1 / 2)
2017-05-25 17:52:52 | Name              : T1
2017-05-25 17:52:52 | TenancyName       : T1
2017-05-25 17:52:52 | Tenant Id         : 3
2017-05-25 17:52:52 | Connection string : Server=localhost; Database=T1; User ID=*****;password=******;
2017-05-25 17:52:55 | Tenant database migration completed. (1 / 2)
2017-05-25 17:52:55 | --------------------------------------------------------
2017-05-25 17:52:55 | Tenant database migration started... (2 / 2)
2017-05-25 17:52:55 | Name              : T2
2017-05-25 17:52:55 | TenancyName       : T2
2017-05-25 17:52:55 | Tenant Id         : 5
2017-05-25 17:52:55 |  Connection string : Server=localhost; Database=T2; User ID=*****;password=******;
2017-05-25 17:52:58 | Tenant database migration completed. (2 / 2)
2017-05-25 17:52:58 | --------------------------------------------------------
2017-05-25 17:52:58 | All databases have been migrated.
Press ENTER to exit...

But still, data are not inserted to tenant db


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

    Hi,

    Can you check if your seed method hits by VS in debug mode when you debug Migrator tool ? If not, does it insert seed data when you create databases from scratch ?

    Thanks.

  • User Avatar
    0
    shyamjith created

    Hi,

    1. Yes seed method hits by VS in debug mode when you debug Migrator tool.
    2. "does it insert seed data when you create databases from scratch ?" Yes In case of host DB and not in case of tenant DB
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Shyamjith,

    Thanks for your feedback. Lastly, can you share your Seed method's code ?

    Thanks.

  • User Avatar
    0
    shyamjith created

    Hi

    Sorry, [it was my mistake. I was not passing the tenantId properly to the method.

    new TenantRoleAndUserBuilder(context, Tenant.Id).Create();
    

    Issue fixed

  • User Avatar
    0
    ismcagdas created
    Support Team

    Great :)