Learn More, Pay Less!
Limited Time Offer!
Open Closed

Duplicate tables in migrations from different modules #8735


User avatar
0
bmulinari created
  • ABP Framework version: v9.0.0
  • UI Type: Blazor Server
  • Database System: EF Core (SQL Server)
  • Steps to reproduce the issue:

Hi! We are having an issue with Entity Framework migrations in our solution which consists of an application and multiple custom modules. Each module has its own DbContext, like in the approach shown here. It's worth pointing out that we are using a separate database for the tenant.

To put it simply, here's the issue we are facing:

  • Module A creates Table_A
  • Migration correctly adds Table_A
  • Module B creates Table_B, which has a relationship to Table_A (one-to-many)
  • Migration incorrectly tries to add Table_A again, in addition to Table_B

This obviously results in the error "Table_A already exists" when running the migrator. I'm not sure what we are doing wrong, but we tried a bunch of different things and the migration for Table_B is always wrong (it shouldn't try to recreate Table_A).

Any help is appreciated. Thanks!


10 Answer(s)
  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi, can you please check this answer and see if it answers your question?

  • User Avatar
    0
    rcalv002 created

    Hello, Negative, the issue is at the moment of generating migration it includes in the up code a table that was already in previous migration up code. The issue is not at the moment of applying migration as far as I can see.

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hello, Negative, the issue is at the moment of generating migration it includes in the up code a table that was already in previous migration up code. The issue is not at the moment of applying migration as far as I can see.

    Hi, by any chance, can you share your application via email (to support@abp.io with the ticket number), so I can better assist you.

    Regards.

  • User Avatar
    0
    bmulinari created

    Hi, @EngincanV. As requested, I've sent the application code and added a bit of context to the issue mentioned here.

    Let me know if you need anything else, thanks!

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi, @EngincanV. As requested, I've sent the application code and added a bit of context to the issue mentioned here.

    Let me know if you need anything else, thanks!

    Thank you, I got your project. I will examine it and try to write you back asap.

    Regards.

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi, @EngincanV. As requested, I've sent the application code and added a bit of context to the issue mentioned here.

    Let me know if you need anything else, thanks!

    Hi again @bmulinari, I'm trying to download the application but it says "page not found" when clicking to the link and providing the password. Can you please check it and let me know about the final status?

    Regards.

  • User Avatar
    0
    bmulinari created

    Hi! I apologize for the broken link. I've shared a new by mail.

    Let me know if you need anything.

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi! I apologize for the broken link. I've shared a new by mail.

    Let me know if you need anything.

    Hi, thanks for updating the link. I will examine your project today and write back to you asap.

    Regards.

  • User Avatar
    0
    rcalv002 created

    Hello, your feedback please.

  • User Avatar
    0
    rcalv002 created

    Hello. Your feedback please

Made with ❤️ on ABP v9.2.0-preview. Updated on February 13, 2025, 10:35