kohabug 2076 - remove three tables (DB rev 077)
[koha.git] / installer / data / mysql / kohastructure.sql
index 834bb1f..8dd16fd 100644 (file)
@@ -596,18 +596,6 @@ CREATE TABLE `categories` (
   UNIQUE KEY `categorycode` (`categorycode`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
---
--- Table structure for table `categorytable`
---
-
-DROP TABLE IF EXISTS `categorytable`;
-CREATE TABLE `categorytable` (
-  `categorycode` varchar(5) NOT NULL default '',
-  `description` text,
-  `itemtypecodes` text,
-  PRIMARY KEY  (`categorycode`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
 --
 -- Table structure for table `cities`
 --
@@ -872,7 +860,9 @@ CREATE TABLE `import_batches` (
   `num_biblios` int(11) NOT NULL default 0,
   `num_items` int(11) NOT NULL default 0,
   `upload_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
-  `overlay_action` enum('replace', 'create_new', 'use_template') NOT NULL default 'create_new',
+  `overlay_action` enum('replace', 'create_new', 'use_template', 'ignore') NOT NULL default 'create_new',
+  `nomatch_action` enum('create_new', 'ignore') NOT NULL default 'create_new',
+  `item_action` enum('always_add', 'add_only_for_matches', 'add_only_for_new', 'ignore') NOT NULL default 'always_add',
   `import_status` enum('staging', 'staged', 'importing', 'imported', 'reverting', 'reverted', 'cleaned') NOT NULL default 'staging',
   `batch_type` enum('batch', 'z3950') NOT NULL default 'batch',
   `file_name` varchar(100),
@@ -898,7 +888,7 @@ CREATE TABLE `import_records` (
   `marcxml_old` longtext NOT NULL,
   `record_type` enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio',
   `overlay_status` enum('no_match', 'auto_match', 'manual_match', 'match_applied') NOT NULL default 'no_match',
-  `status` enum('error', 'staged', 'imported', 'reverted', 'items_reverted') NOT NULL default 'staged',
+  `status` enum('error', 'staged', 'imported', 'reverted', 'items_reverted', 'ignored') NOT NULL default 'staged',
   `import_error` mediumtext,
   `encoding` varchar(40) NOT NULL default '',
   `z3950random` varchar(40) default NULL,
@@ -954,7 +944,7 @@ CREATE TABLE `import_items` (
   `import_record_id` int(11) NOT NULL,
   `itemnumber` int(11) default NULL,
   `branchcode` varchar(10) default NULL,
-  `status` enum('error', 'staged', 'imported', 'reverted') NOT NULL default 'staged',
+  `status` enum('error', 'staged', 'imported', 'reverted', 'ignored') NOT NULL default 'staged',
   `marcxml` longtext NOT NULL,
   `import_error` mediumtext,
   PRIMARY KEY (`import_items_id`),
@@ -1109,7 +1099,7 @@ CREATE TABLE `labels_conf` (
   `itemtype` int(1) default '0',
   `barcode` int(1) default '0',
   `dewey` int(1) default '0',
-  `class` int(1) default NULL,
+  `classification` int(1) default NULL,
   `subclass` int(1) default '0',
   `itemcallnumber` int(1) default '0',
   `author` int(1) default '0',
@@ -1117,6 +1107,7 @@ CREATE TABLE `labels_conf` (
   `isbn` int(1) default '0',
   `startlabel` int(2) NOT NULL default '1',
   `printingtype` char(32) default 'BAR',
+  `formatstring` varchar(64) default NULL,
   `layoutname` char(20) NOT NULL default 'TEST',
   `guidebox` int(1) default '0',
   `active` tinyint(1) default '1',
@@ -1317,18 +1308,6 @@ CREATE TABLE `matchchecks` (
   REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
---
--- Table structure for table `mediatypetable`
---
-
-DROP TABLE IF EXISTS `mediatypetable`;
-CREATE TABLE `mediatypetable` (
-  `mediatypecode` varchar(5) NOT NULL default '',
-  `description` text,
-  `itemtypecodes` text,
-  PRIMARY KEY  (`mediatypecode`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
 --
 -- Table structure for table `notifys`
 --
@@ -1723,18 +1702,6 @@ DROP TABLE IF EXISTS `stopwords`;
   `word` varchar(255) default NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
---
--- Table structure for table `subcategorytable`
---
-
-DROP TABLE IF EXISTS `subcategorytable`;
-CREATE TABLE `subcategorytable` (
-  `subcategorycode` varchar(5) NOT NULL default '',
-  `description` text,
-  `itemtypecodes` text,
-  PRIMARY KEY  (`subcategorycode`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
 --
 -- Table structure for table `subscription`
 --
@@ -1873,6 +1840,58 @@ CREATE TABLE `tags` (
   PRIMARY KEY  (`entry`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+--
+-- Table structure for table `tags_all`
+--
+
+CREATE TABLE `tags_all` (
+  `tag_id`         int(11) NOT NULL auto_increment,
+  `borrowernumber` int(11) NOT NULL,
+  `biblionumber`   int(11) NOT NULL,
+  `term`      varchar(255) NOT NULL,
+  `language`       int(4) default NULL,
+  `date_created` datetime  NOT NULL,
+  PRIMARY KEY  (`tag_id`),
+  KEY `tags_borrowers_fk_1` (`borrowernumber`),
+  KEY `tags_biblionumber_fk_1` (`biblionumber`),
+  CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`)
+        REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
+  CONSTRAINT `tags_biblionumber_fk_1` FOREIGN KEY (`biblionumber`)
+        REFERENCES `biblio`     (`biblionumber`)  ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `tags_approval`
+--
+
+CREATE TABLE `tags_approval` (
+  `term`   varchar(255) NOT NULL,
+  `approved`     int(1) NOT NULL default '0',
+  `date_approved` datetime       default NULL,
+  `approved_by` int(11)          default NULL,
+  `weight_total` int(9) NOT NULL default '1',
+  PRIMARY KEY  (`term`),
+  KEY `tags_approval_borrowers_fk_1` (`approved_by`),
+  CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`)
+        REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `tags_index`
+--
+
+CREATE TABLE `tags_index` (
+  `term`    varchar(255) NOT NULL,
+  `biblionumber` int(11) NOT NULL,
+  `weight`        int(9) NOT NULL default '1',
+  PRIMARY KEY  (`term`,`biblionumber`),
+  KEY `tags_index_biblionumber_fk_1` (`biblionumber`),
+  CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`)
+        REFERENCES `tags_approval` (`term`)  ON DELETE CASCADE ON UPDATE CASCADE,
+  CONSTRAINT `tags_index_biblionumber_fk_1` FOREIGN KEY (`biblionumber`)
+        REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
 --
 -- Table structure for table `userflags`
 --
@@ -2011,6 +2030,16 @@ CREATE TABLE language_script_mapping (
         KEY `language_subtag` (`language_subtag`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+DROP TABLE IF EXISTS `permissions`;
+CREATE TABLE `permissions` (
+  `module_bit` int(11) NOT NULL DEFAULT 0,
+  `code` varchar(30) DEFAULT NULL,
+  `description` varchar(255) DEFAULT NULL,
+  PRIMARY KEY  (`module_bit`, `code`),
+  CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`)
+    ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
 DROP TABLE IF EXISTS serialitems;
 CREATE TABLE serialitems (
         serialid int(11) NOT NULL,
@@ -2018,6 +2047,17 @@ CREATE TABLE serialitems (
         UNIQUE KEY `serialididx` (`serialid`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+DROP TABLE IF EXISTS `user_permissions`;
+CREATE TABLE `user_permissions` (
+  `borrowernumber` int(11) NOT NULL DEFAULT 0,
+  `module_bit` int(11) NOT NULL DEFAULT 0,
+  `code` varchar(30) DEFAULT NULL,
+  CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
+    ON DELETE CASCADE ON UPDATE CASCADE,
+  CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`)
+    ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;