Base solution for your next web application
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)