`rule_name` varchar(32) NOT NULL,
`rule_value` varchar(32) NOT NULL,
PRIMARY KEY (`id`),
- KEY `branchcode` (`branchcode`),
- KEY `categorycode` (`categorycode`),
- KEY `itemtype` (`itemtype`),
+
+ CONSTRAINT `circ_rules_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `circ_rules_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `circ_rules_ibfk_3` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
KEY `rule_name` (`rule_name`),
UNIQUE (`branchcode`,`categorycode`,`itemtype`,`rule_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
`rule_name` varchar(32) NOT NULL,
`rule_value` varchar(32) NOT NULL,
PRIMARY KEY (`id`),
- KEY `branchcode` (`branchcode`),
- KEY `categorycode` (`categorycode`),
- KEY `itemtype` (`itemtype`),
+ CONSTRAINT `circ_rules_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `circ_rules_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `circ_rules_ibfk_3` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
KEY `rule_name` (`rule_name`),
UNIQUE (`branchcode`,`categorycode`,`itemtype`,`rule_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;