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

Cannot add Organization Unit at same level after deleting an OU #8838


User avatar
0
atideveloper created

This might be related to the changes made back in January (https://github.com/aspnetzero/aspnet-zero-core/issues/2892) or with the DB migration 20200305082815_Upgraded_To_Abp_5_3 but not sure. If I change the index specified in the error to not be unique I can then create an OU again but I am not sure what impact that might have on the system.

If I add an OU at the root level and then delete it and try to add another OU at the root level I get the following error in my logs. I also get this error if I add, delete and then try to add a child OU. Also, when I look at my DB I do have a row for Tenant 2 and Code 00002 but it is flagged as IsDeleted.

Cannot insert duplicate key row in object 'dbo.AbpOrganizationUnits' with unique index 'IX_AbpOrganizationUnits_TenantId_Code'. The duplicate key value is (2, 00002)


5 Answer(s)
  • User Avatar
    0
    atideveloper created

    It sounds like this is already being discussed and possibly worked on? https://github.com/aspnetboilerplate/aspnetboilerplate/issues/5457#issuecomment-608965880

  • User Avatar
    0
    maliming created
    Support Team

    8.5 shouldn't have this problem, I have fixed it here temporarily https://github.com/aspnetzero/aspnet-zero-core/commit/f53c7c05bad82adff2d8cd3eb7075748d8cbb7fd.

    https://github.com/aspnetzero/aspnet-zero-core/issues/3141

  • User Avatar
    0
    atideveloper created

    I will give that a try and will post results here this week (hopefully). It will be a good chance for us to test updating our code to a new version of ASP.NET ZERO.
    Thanks!

  • User Avatar
    0
    maliming created
    Support Team

    Waiting for your good news. : )

  • User Avatar
    0
    atideveloper created

    I have tested this in 8.7.0 and it seems to be working!

    Thanks!