-- Table structure for table `attractions`
CREATE TABLE IF NOT EXISTS `attractions` (
`attID` int(11) NOT NULL AUTO_INCREMENT,
`attName` varchar(255) NOT NULL,
`adultPrice` double(5,2) NOT NULL,
`childPrice` double(5,2) NOT NULL,
`referenceID` varchar(255) NOT NULL,
PRIMARY KEY (`attID`)
) ENGINE=InnoDB;
-- Table structure for table `packages`
CREATE TABLE IF NOT EXISTS `packages` (
`pacID` int(11) NOT NULL AUTO_INCREMENT,
`packagePrice` double NOT NULL,
PRIMARY KEY (`pacID`)
) ENGINE=InnoDB;
-- Table Structure for attraction_packages
CREATE TABLE IF NOT EXISTS `attraction_packages` (
`attID` INT(8) NOT NULL,
`pacID` INT(8) NOT NULL,
INDEX (attID),
FOREIGN KEY (`attID`) REFERENCES `attractions` (`attID`),
ON UPDATE CASCADE ON DELETE CASCADE,
INDEX (`pacID `),
FOREIGN KEY (`pacID `) REFERENCES `a_packages` (`pacID `),
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB;
Im confused as to which constraint reference option that i should be using.
I have the above mentioned DB set up at the moment, and have set up my constraints however i'm rethinking my FK constraints. Should i be using the cascade reference option or should i be using restrict ?