我有一张桌子
1.
CREATE TABLE `Parent` (
`ID` bigint(19) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2.
CREATE TABLE `Child_1` (
`ParentID` bigint(19) NOT NULL DEFAULT '0',
`ID` bigint(19) NOT NULL DEFAULT '0',
PRIMARY KEY (`ParentID`,`ID`),
KEY `Child_1_FK1_IDX` (`ParentID`,`ID`),
CONSTRAINT `Child_1_FK1` FOREIGN KEY (`ParentID`, `ID`) REFERENCES `Child_2` (`ParentID`, `ID`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3.
CREATE TABLE `Child_2` (
`ParentID` bigint(19) NOT NULL DEFAULT '0',
`ID` bigint(19) NOT NULL DEFAULT '0',
PRIMARY KEY (`ParentID`,`ID`),
KEY `Child_2_FK1_IDX` (`ParentID`),
CONSTRAINT `Child_2_FK1` FOREIGN KEY (`ParentID`) REFERENCES `Parent` (`ParentID`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
不幸的是,我删除了第二个表约束。
CONSTRAINT `Child_1_FK1` FOREIGN KEY (`ParentID`, `ID`) REFERENCES `Child_2` (`ParentID`, `ID`) ON DELETE CASCADE
我怎样才能恢复呢?