extended patron attributes tables & syspref (DB rev 081)
[koha.git] / installer / data / mysql / kohastructure.sql
index f0130c5..2a4ea30 100644 (file)
@@ -494,6 +494,41 @@ CREATE TABLE `borrowers` (
   CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+--
+-- Table structure for table `borrower_attribute_types`
+--
+
+DROP TABLE IF EXISTS `borrower_attribute_types`;
+CREATE TABLE `borrower_attribute_types` (
+  `code` varchar(10) NOT NULL,
+  `description` varchar(255) NOT NULL,
+  `repeatable` tinyint(1) NOT NULL default 0,
+  `unique_id` tinyint(1) NOT NULL default 0,
+  `opac_display` tinyint(1) NOT NULL default 0,
+  `password_allowed` tinyint(1) NOT NULL default 0,
+  `staff_searchable` tinyint(1) NOT NULL default 0,
+  `authorised_value_category` varchar(10) default NULL,
+  PRIMARY KEY  (`code`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `borrower_attributes`
+--
+
+DROP TABLE IF EXISTS `borrower_attributes`;
+CREATE TABLE `borrower_attributes` (
+  `borrowernumber` int(11) NOT NULL,
+  `code` varchar(10) NOT NULL,
+  `attribute` varchar(30) default NULL,
+  `password` varchar(30) default NULL,
+  KEY `borrowernumber` (`borrowernumber`),
+  KEY `code_attribute` (`code`, `attribute`),
+  CONSTRAINT `borrower_attributes_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
+    ON DELETE CASCADE ON UPDATE CASCADE,
+  CONSTRAINT `borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`)
+    ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
 --
 -- Table structure for table `branchcategories`
 --