Introducing FOREIGN KEY constraint may cause cycles or multiple cascade paths - why?

前端 未结 18 1373
天涯浪人
天涯浪人 2020-11-22 02:37

I\'ve been wrestling with this for a while and can\'t quite figure out what\'s happening. I have a Card entity which contains Sides (usually 2) - and both Cards and Sides h

18条回答
  •  半阙折子戏
    2020-11-22 03:15

    The existing answers are great I just wanted to add that I ran into this error because of a different reason. I wanted to create an Initial EF migration on an existing DB but I didn't use the -IgnoreChanges flag and applied the Update-Database command on an empty Database (also on the existing fails).

    Instead I had to run this command when the current db structure is the current one:

    Add-Migration Initial -IgnoreChanges
    

    There is likely a real problem in the db structure but save the world one step at a time...

提交回复
热议问题