Upgrade Error

Hi everyone, 

I have one problem and I can't solve. This error appears in my Service Studio when I try to publish my module and I don't know how I can solve this. I want to change the delete rule property of my attribute.

Is this error:  "Upgrade Error

Could not create foreign key constraint. This may have happened because there are 'PersonId' values of entity 'UserPersonRating' with no corresponding value in entity 'Person', or attribute 'PersonId' of entity 'UserPersonRating' is creating a circular dependency between entities. Check the Error Log for more information. "

How I can solve this?




Hello Fábio,

Hope you're doing well.

It seems that you have some data in UserPersonRating entity for the attribute PersonId with no corresponding values in Person entity. This means that, for example, you have a record with value PersonId = 1 in UserPersonRating entity, but there is no record with value Id = 1 in Person entity.

This is probably happening because you have the Delete Rule of PersonId attribute set to Ignore in your UserPersonRating entity. So if you deleted some data in Person entity, this may lead into some inconsistencies in the database for this attribute in UserPersonRating entity. With that said, you won't be able to change this property without cleaning this (inconsistent) data.

Please try to delete your data from entity UserPersonRating and you should be able to change that property and publish successfully after that. You don't need to delete your entire data, only the records where you have these inconsistencies.

Also, you can check this documentation about Delete Rules. It's very helpful to understand the advantages and constraints of each rule.

Hope that this helps you!

Kind regards,

Rui Barradas


Hi Fabio, 

As Rui said, you can check this Documentation , it will help you to understand. 

Thanks and Happy coding!! 

Hi Shweta,

Thanks for the share.

Best regards,



Always happy to help Fabio.

Happy Coding!!

Hi @Rui Barradas 

Thanks for the explanation and help.

It works perfectly!!!


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.