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

前端 未结 18 963
天涯浪人
天涯浪人 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:06

    I ran into the same problem and stuck for a long. The following steps saved me. Go through the constraints and change the onDelete ReferentialAction to NoAction from Cascade

      constraints: table =>
      {
          table.PrimaryKey("PK_table1", x => x.Id);
          table.ForeignKey(
             name: "FK_table1_table2_table2Id",
             column: x => x.table2Id,
             principalTable: "table2",
             principalColumn: "Id",
             onDelete: ReferentialAction.NoAction);
      });
    

提交回复
热议问题