Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anzalna Nazar 8 posts 82 karma points
    Jul 30, 2024 @ 13:18
    Anzalna Nazar
    0

    Issue while adding Umbraco form in Uskinned components

    Hello,

    I am experiencing an issue with my Uskinned in Umbraco setup where I encounter a UNIQUE KEY constraint violation on the umbracoRelation table. The error message is as follows:

    enter image description here

    I have checked the umbracoRelation table and found that there are already two records with the following details:

    SELECT * FROM umbracoRelation WHERE parentId = 6367 AND childId = 6365 AND relationType = 6;

    One record with relType = 4 and another record with relType = 6

    It seems like the system is trying to insert a duplicate key for the relation type 6.

    I got the issue while adding Umbraco form inside a Uskinned component.

    Umbraco version is 12.3.10

    Umbraco Forms: 12.2.2

    Uskinned: 5.2.0

    How can I resolve this issue?

  • Afreed 54 posts 262 karma points
    Jul 30, 2024 @ 14:46
    Afreed
    0

    I've investigated the UNIQUE KEY constraint violation on the umbracoRelation table you're encountering while adding an Umbraco form with uSkinned components. The only workaround I've found is to remove the constraint.

    While dropping the constraint can indeed resolve the issue, I recommend proceeding with caution. This approach bypasses the immediate problem but may introduce potential data integrity challenges in the future.

    If this solution is necessary for your project to proceed, ensure you have a good backup and consider implementing additional checks or processes to maintain data integrity. If a better solution becomes available or if Umbraco provides a fix in a future update, it would be wise to revisit this modification.

    There might be someone else who experienced the same or might have to look into the code as to why it's not doing an update instead of inserting a new row.

    Here are the SQL commands to drop and optionally re-add the constraint:

    -- Dropping the constraint
    ALTER TABLE [umbracoRelation]
    DROP CONSTRAINT [IX_umbracoRelation_parentChildType];
    
    -- Re-adding the constraint if needed
    ALTER TABLE [umbracoRelation] 
    ADD CONSTRAINT [IX_umbracoRelation_parentChildType] 
    UNIQUE NONCLUSTERED ([parentId], [childId], [relType]);
    
  • Anzalna Nazar 8 posts 82 karma points
    Jul 31, 2024 @ 07:31
    Anzalna Nazar
    0

    There is no update available for Umbraco 12 regarding this issue. However, it has already been fixed in Umbraco 13.

    The current way is to add the following workaround to the appsettings or upgrade to 13.

    "Umbraco": {
      "Forms": {,
        "Options": {
          "DisableRelationTracking": true
        },
      }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft