134
Views
3
Comments
Solved
Could not create foreign key constraint

There are two entities Main entity and a child entity. The delete rule was set to protect in child entity. 

Then by mistake, I changed it to ignore. Now when I am trying to revert it to protect it is giving me this error:

"Could not create foreign key constraint".

Need help on this.

2024-01-31 05-29-41
Akshay Deshpande
Solution

Hello
  Delete that fk of entity B and create again(if possible) create again 

because its not regarding the rules its due to circular dependency so to give delete you need to give delete to both

https://success.outsystems.com/Support/Enterprise_Customers/Troubleshooting/Troubleshoot_%22Could_not_create_Foreign_Key%22_errors_during_deployment

go through this for better understanding

More discussion on this in below URL similar problem
https://www.outsystems.com/forums/discussion/50692/problem-creating-entities-foreign-keys/

https://www.outsystems.com/forums/discussion/66241/upgrade-error/

https://www.outsystems.com/forums/discussion/68007/cannot-add-or-update-a-child-row-a-foreign-key-constraint-fails/

Thanks and Regards,

Akshay Deshpande

 

2021-06-14 08-03-27
Supriya Bawali

Hi @Akshay Deshpande šŸš€ 

Thank you for the reply, luckily I found the exact row which was causing the issue in table B, so I have deleted that row and again set the delete rule to protect and it works.

2024-01-31 05-29-41
Akshay Deshpande
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.