I cannot import a solution containing a relationship set to Hierarchical=Yes. If I change the relationship to Hierarchical=No the import works just fine.
The issue occurs when an unmanaged solution containing only the Contact entity with Hierarchical=Yes set on a custom relationship is imported to a target environment. No errors are shown in the log.
Further debugging shows that it is not possible to change the same relationship to Hierarchical=Yes in the affected target environments, because it fails with:
A SQL Server error occurred
Tracing on the server reveals that:
The operation failed because an index or statistics with name 'ndx_for_cascaderelationship_publisher_relationshipname' already exists on table 'ContactBase'.
I can confirm that the index indeed already exists in the table. We have not created any indexes in the database ourselves.
You can resolve this issue by:
This works even if you are deploying unmanaged solutions.