Base solution for your next web application
Open Closed

EF Error during migration #8249


User avatar
0
carelearning created

Hello Volosoft Representatives,

We are pulling the latest updates (ABP 5.1) into our project. This requires an update from EF 6.2.0 to EF 6.4.0. When we run update-database we get this error:

System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Invalid object name 'dbo.AbpTenants'.
  

We are using the "Single deployment/hybrid databases" approach as explained here: https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy#single-deployment-hybrid-databases. Our tenant databases do not have an abptenants table. The schema migrates and then we get an error during seeding. How can we investigate this error? We commented out the seed method seen here . Any information would be appreciated.


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

    Hi @carelearning

    Sorry for our late reply. Did you solve this problem ? If not, could you share your old ABP version as well ?

    Thanks,

  • User Avatar
    0
    carelearning created

    Dear @ismcagdas

    We were migrating from this commit be0fc34b5c270a9743a9ad830ebed0f5e4dc24ba which is targeting Abp 4.11.0. Is this information you need?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @carelearning

    Sorry for my late reply. I couldn't find anything which can cause this problem on ABP side. Is it possible to share your project ifyou haven't solved this problem via email ?

  • User Avatar
    0
    carelearning created

    Dear @ismcagdas ,

    We were able to narrow down the error to the IAbpZeroDbMigrator.CreateOrMigrateForHost(); call.

    However we were able to get the new tooling working by replacing migrate with ef6 with the following code.

    EF 6.2.0 (old)
    migrate.exe "MyCompanyName.AbpZeroTemplate.EntityFramework.dll" /StartUpDirectory=.\ MyCompanyName.AbpZeroTemplate.AbpZeroTemplateHost.Configuration /startupConfigurationFile="../web.config"
    
    EF 6.3.0+ (new)
    ef6.exe database update --assembly "MyCompanyName.AbpZeroTemplate.EntityFramework.dll" --migrations-config "MyCompanyName.AbpZeroTemplate.AbpZeroTemplateHost.Configuration" --config "../web.config"
    

    Thank you for your time and energy.