KEY `categorycode` (`categorycode`),
KEY `branchcode` (`branchcode`),
KEY `userid` (`userid`),
+ KEY `guarantorid` (`guarantorid`),
CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `subscriptionroutinglist`;
CREATE TABLE `subscriptionroutinglist` (
`routingid` int(11) NOT NULL auto_increment,
- `borrowernumber` int(11) default NULL,
+ `borrowernumber` int(11) NOT NULL,
`ranking` int(11) default NULL,
- `subscriptionid` int(11) default NULL,
- PRIMARY KEY (`routingid`)
+ `subscriptionid` int(11) NOT NULL,
+ PRIMARY KEY (`routingid`),
+ UNIQUE (`subscriptionid`, `borrowernumber`),
+ CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`)
+ ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--