The ALTER TABLE statement conflicted with the FOREIGN KEY constrain

I've been trying to apply a new migration and I was getting the following error:

The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_dbo.Parent_dbo.Childs_ChildId". The conflict occurred in database "parents_db", table "dbo.Childs", column 'ChildId'.

In my case, the table contained data. Therefore, either you have to assign a default value, set it as nullable or delete data from the database.

Leave Comment

Your email address will not be published.

Please type the characters of this captcha image in the input box

Please type the characters of this captcha image in the input box