Bug 21294: Replace BOOLEAN with TINYINT(1) in our DB structure
[srvgit] / installer / data / mysql / kohastructure.sql
index 124c583..d8d5788 100644 (file)
@@ -119,6 +119,7 @@ CREATE TABLE `authorised_values` ( -- stores values for authorized values catego
   KEY `name` (`category`),
   KEY `lib` (`lib` (191)),
   KEY `auth_value_idx` (`authorised_value`),
+  CONSTRAINT `av_uniq` UNIQUE (`category`,`authorised_value`),
   CONSTRAINT `authorised_values_authorised_values_category` FOREIGN KEY (`category`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
@@ -637,7 +638,7 @@ CREATE TABLE `deleteditems` (
   `withdrawn_on` datetime DEFAULT NULL, -- the date and time an item was last marked as withdrawn, NULL if not withdrawn
   `itemcallnumber` varchar(255) default NULL, -- call number for this item (MARC21 952$o)
   `coded_location_qualifier` varchar(10) default NULL, -- coded location qualifier(MARC21 952$f)
-  `issues` smallint(6) default NULL, -- number of times this item has been checked out
+  `issues` smallint(6) default 0, -- number of times this item has been checked out
   `renewals` smallint(6) default NULL, -- number of times this item has been renewed
   `reserves` smallint(6) default NULL, -- number of times this item has been placed on hold/reserved
   `restricted` tinyint(1) default NULL, -- authorized value defining use restrictions for this item (MARC21 952$5)
@@ -842,7 +843,7 @@ CREATE TABLE `items` ( -- holdings/item information
   `withdrawn_on` datetime DEFAULT NULL, -- the date and time an item was last marked as withdrawn, NULL if not withdrawn
   `itemcallnumber` varchar(255) default NULL, -- call number for this item (MARC21 952$o)
   `coded_location_qualifier` varchar(10) default NULL, -- coded location qualifier(MARC21 952$f)
-  `issues` smallint(6) default NULL, -- number of times this item has been checked out/issued
+  `issues` smallint(6) default 0, -- number of times this item has been checked out/issued
   `renewals` smallint(6) default NULL, -- number of times this item has been renewed
   `reserves` smallint(6) default NULL, -- number of times this item has been placed on hold/reserved
   `restricted` tinyint(1) default NULL, -- authorized value defining use restrictions for this item (MARC21 952$5)
@@ -1325,7 +1326,7 @@ CREATE TABLE saved_sql ( -- saved sql reports
    `type` varchar(255) default NULL, -- always 1 for tabular
    `notes` MEDIUMTEXT, -- the notes or description given to this report
    `cache_expiry` int NOT NULL default 300,
-   `public` boolean NOT NULL default FALSE,
+   `public` tinyint(1) NOT NULL default FALSE,
     report_area varchar(6) default NULL,
     report_group varchar(80) default NULL,
     report_subgroup varchar(80) default NULL,
@@ -1394,7 +1395,7 @@ DROP TABLE IF EXISTS search_marc_map;
 CREATE TABLE `search_marc_map` (
   id int(11) NOT NULL AUTO_INCREMENT,
   index_name ENUM('biblios','authorities') NOT NULL COMMENT 'what storage index this map is for',
-  marc_type ENUM('marc21', 'unimarc', 'normarc') NOT NULL COMMENT 'what MARC type this map is for',
+  marc_type ENUM('marc21', 'unimarc', 'normarc') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'what MARC type this map is for',
   marc_field VARCHAR(255) NOT NULL COLLATE utf8mb4_bin COMMENT 'the MARC specifier for this field',
   PRIMARY KEY(`id`),
   UNIQUE key `index_name` (`index_name`, `marc_field` (191), `marc_type`),
@@ -1410,39 +1411,15 @@ CREATE TABLE `search_marc_to_field` (
   search tinyint(1) NOT NULL DEFAULT 1,
   search_marc_map_id int(11) NOT NULL,
   search_field_id int(11) NOT NULL,
-  facet boolean DEFAULT FALSE COMMENT 'true if a facet field should be generated for this',
-  suggestible boolean DEFAULT FALSE COMMENT 'true if this field can be used to generate suggestions for browse',
-  sort boolean DEFAULT NULL COMMENT 'true/false creates special sort handling, null doesn''t',
+  facet tinyint(1) DEFAULT FALSE COMMENT 'true if a facet field should be generated for this',
+  suggestible tinyint(1) DEFAULT FALSE COMMENT 'true if this field can be used to generate suggestions for browse',
+  sort tinyint(1) DEFAULT NULL COMMENT 'true/false creates special sort handling, null doesn''t',
   PRIMARY KEY(search_marc_map_id, search_field_id),
   FOREIGN KEY(search_marc_map_id) REFERENCES search_marc_map(id) ON DELETE CASCADE ON UPDATE CASCADE,
   FOREIGN KEY(search_field_id) REFERENCES search_field(id) ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 --
--- Table structure for table `serial`
---
-
-DROP TABLE IF EXISTS `serial`;
-CREATE TABLE `serial` ( -- issues related to subscriptions
-  `serialid` int(11) NOT NULL auto_increment, -- unique key for the issue
-  `biblionumber` varchar(100) NOT NULL default '', -- foreign key for the biblio.biblionumber that this issue is attached to
-  `subscriptionid` varchar(100) NOT NULL default '', -- foreign key to the subscription.subscriptionid that this issue is part of
-  `serialseq` varchar(100) NOT NULL default '', -- issue information (volume, number, etc)
-  `serialseq_x` varchar( 100 ) NULL DEFAULT NULL, -- first part of issue information
-  `serialseq_y` varchar( 100 ) NULL DEFAULT NULL, -- second part of issue information
-  `serialseq_z` varchar( 100 ) NULL DEFAULT NULL, -- third part of issue information
-  `status` tinyint(4) NOT NULL default 0, -- status code for this issue (see manual for full descriptions)
-  `planneddate` date default NULL, -- date expected
-  `notes` MEDIUMTEXT, -- notes
-  `publisheddate` date default NULL, -- date published
-  publisheddatetext varchar(100) default NULL, -- date published (descriptive)
-  `claimdate` date default NULL, -- date claimed
-  claims_count int(11) default 0, -- number of claims made related to this issue
-  `routingnotes` MEDIUMTEXT, -- notes from the routing list
-  PRIMARY KEY (`serialid`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-
---
 -- Table structure for table `sessions`
 --
 
@@ -1634,7 +1611,7 @@ CREATE TABLE `issues` ( -- information related to check outs or issues
   `returndate` datetime default NULL, -- date the item was returned, will be NULL until moved to old_issues
   `lastreneweddate` datetime default NULL, -- date the item was last renewed
   `renewals` tinyint(4) NOT NULL default 0, -- lists the number of times the item was renewed
-  `auto_renew` BOOLEAN default FALSE, -- automatic renewal
+  `auto_renew` tinyint(1) default FALSE, -- automatic renewal
   `auto_renew_error` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, -- automatic renewal error
   `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
   `issuedate` datetime default NULL, -- date the item was checked out or issued
@@ -1666,7 +1643,7 @@ CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r
   `returndate` datetime default NULL, -- date the item was returned
   `lastreneweddate` datetime default NULL, -- date the item was last renewed
   `renewals` tinyint(4) NOT NULL default 0, -- lists the number of times the item was renewed
-  `auto_renew` BOOLEAN default FALSE, -- automatic renewal
+  `auto_renew` tinyint(1) default FALSE, -- automatic renewal
   `auto_renew_error` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, -- automatic renewal error
   `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
   `issuedate` datetime default NULL, -- date the item was checked out or issued
@@ -1782,10 +1759,10 @@ CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha
   `waitingdate` date default NULL, -- the date the item was marked as waiting for the patron at the library
   `expirationdate` DATE DEFAULT NULL, -- the date the hold expires (usually the date entered by the patron to say they don't need the hold after a certain date)
   `lowestPriority` tinyint(1) NOT NULL DEFAULT 0,
-  `suspend` BOOLEAN NOT NULL DEFAULT 0,
+  `suspend` tinyint(1) NOT NULL DEFAULT 0,
   `suspend_until` DATETIME NULL DEFAULT NULL,
   `itemtype` VARCHAR(10) NULL DEFAULT NULL, -- If record level hold, the optional itemtype of the item the patron is requesting
-  `item_level_hold` BOOLEAN NOT NULL DEFAULT 0, -- Is the hpld placed at item level
+  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0, -- Is the hpld placed at item level
   PRIMARY KEY (`reserve_id`),
   KEY priorityfoundidx (priority,found),
   KEY `borrowernumber` (`borrowernumber`),
@@ -1822,10 +1799,10 @@ CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have b
   `waitingdate` date default NULL, -- the date the item was marked as waiting for the patron at the library
   `expirationdate` DATE DEFAULT NULL, -- the date the hold expires (usually the date entered by the patron to say they don't need the hold after a certain date)
   `lowestPriority` tinyint(1) NOT NULL DEFAULT 0, -- has this hold been pinned to the lowest priority in the holds queue (1 for yes, 0 for no)
-  `suspend` BOOLEAN NOT NULL DEFAULT 0, -- in this hold suspended (1 for yes, 0 for no)
+  `suspend` tinyint(1) NOT NULL DEFAULT 0, -- in this hold suspended (1 for yes, 0 for no)
   `suspend_until` DATETIME NULL DEFAULT NULL, -- the date this hold is suspended until (NULL for infinitely)
   `itemtype` VARCHAR(10) NULL DEFAULT NULL, -- If record level hold, the optional itemtype of the item the patron is requesting
-  `item_level_hold` BOOLEAN NOT NULL DEFAULT 0, -- Is the hpld placed at item level
+  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0, -- Is the hpld placed at item level
   PRIMARY KEY (`reserve_id`),
   KEY `old_reserves_borrowernumber` (`borrowernumber`),
   KEY `old_reserves_biblionumber` (`biblionumber`),
@@ -1955,7 +1932,7 @@ CREATE TABLE subscription_numberpatterns (
 
 DROP TABLE IF EXISTS `subscription`;
 CREATE TABLE `subscription` ( -- information related to the subscription
-  `biblionumber` int(11) NOT NULL default 0, -- foreign key for biblio.biblionumber that this subscription is attached to
+  `biblionumber` int(11) NOT NULL, -- foreign key for biblio.biblionumber that this subscription is attached to
   `subscriptionid` int(11) NOT NULL auto_increment, -- unique key for this subscription
   `librarian` varchar(100) default '', -- the librarian's username from borrowers.userid
   `startdate` date default NULL, -- start date for this subscription
@@ -1978,7 +1955,7 @@ CREATE TABLE `subscription` ( -- information related to the subscription
   `firstacquidate` date default NULL, -- first issue received date
   `manualhistory` tinyint(1) NOT NULL default 0, -- yes or no to managing the history manually
   `irregularity` MEDIUMTEXT, -- any irregularities in the subscription
-  skip_serialseq BOOLEAN NOT NULL DEFAULT 0,
+  skip_serialseq tinyint(1) NOT NULL DEFAULT 0,
   `letter` varchar(20) default NULL,
   `numberpattern` integer default null, -- the numbering pattern used links to subscription_numberpatterns.id
   locale VARCHAR(80) DEFAULT NULL, -- for foreign language subscriptions to display months, seasons, etc correctly
@@ -1993,15 +1970,41 @@ CREATE TABLE `subscription` ( -- information related to the subscription
   `opacdisplaycount` VARCHAR(10) NULL, -- how many issues to show to the public
   `graceperiod` int(11) NOT NULL default '0', -- grace period in days
   `enddate` date default NULL, -- subscription end date
-  `closed` INT(1) NOT NULL DEFAULT 0, -- yes / no if the subscription is closed
+  `closed` TINYINT(1) NOT NULL DEFAULT 0, -- yes / no if the subscription is closed
   `reneweddate` date default NULL, -- date of last renewal for the subscription
   `itemtype` VARCHAR( 10 ) NULL,
   `previousitemtype` VARCHAR( 10 ) NULL,
   `mana_id` int(11) NULL DEFAULT NULL,
   PRIMARY KEY  (`subscriptionid`),
-  KEY `by_biblionumber` (`biblionumber`),
   CONSTRAINT subscription_ibfk_1 FOREIGN KEY (periodicity) REFERENCES subscription_frequencies (id) ON DELETE SET NULL ON UPDATE CASCADE,
-  CONSTRAINT subscription_ibfk_2 FOREIGN KEY (numberpattern) REFERENCES subscription_numberpatterns (id) ON DELETE SET NULL ON UPDATE CASCADE
+  CONSTRAINT subscription_ibfk_2 FOREIGN KEY (numberpattern) REFERENCES subscription_numberpatterns (id) ON DELETE SET NULL ON UPDATE CASCADE,
+  CONSTRAINT subscription_ibfk_3 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `serial`
+--
+
+DROP TABLE IF EXISTS `serial`;
+CREATE TABLE `serial` ( -- issues related to subscriptions
+  `serialid` int(11) NOT NULL auto_increment, -- unique key for the issue
+  `biblionumber` int(11) NOT NULL, -- foreign key for the biblio.biblionumber that this issue is attached to
+  `subscriptionid` int(11) NOT NULL, -- foreign key to the subscription.subscriptionid that this issue is part of
+  `serialseq` varchar(100) NOT NULL default '', -- issue information (volume, number, etc)
+  `serialseq_x` varchar( 100 ) NULL DEFAULT NULL, -- first part of issue information
+  `serialseq_y` varchar( 100 ) NULL DEFAULT NULL, -- second part of issue information
+  `serialseq_z` varchar( 100 ) NULL DEFAULT NULL, -- third part of issue information
+  `status` tinyint(4) NOT NULL default 0, -- status code for this issue (see manual for full descriptions)
+  `planneddate` date default NULL, -- date expected
+  `notes` MEDIUMTEXT, -- notes
+  `publisheddate` date default NULL, -- date published
+  publisheddatetext varchar(100) default NULL, -- date published (descriptive)
+  `claimdate` date default NULL, -- date claimed
+  claims_count int(11) default 0, -- number of claims made related to this issue
+  `routingnotes` MEDIUMTEXT, -- notes from the routing list
+  PRIMARY KEY (`serialid`),
+  CONSTRAINT serial_ibfk_1 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE,
+  CONSTRAINT serial_ibfk_2 FOREIGN KEY (subscriptionid) REFERENCES subscription (subscriptionid) ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 --
@@ -2010,8 +2013,8 @@ CREATE TABLE `subscription` ( -- information related to the subscription
 
 DROP TABLE IF EXISTS `subscriptionhistory`;
 CREATE TABLE `subscriptionhistory` (
-  `biblionumber` int(11) NOT NULL default 0,
-  `subscriptionid` int(11) NOT NULL default 0,
+  `biblionumber` int(11) NOT NULL,
+  `subscriptionid` int(11) NOT NULL,
   `histstartdate` date default NULL,
   `histenddate` date default NULL,
   `missinglist` LONGTEXT NOT NULL,
@@ -2019,7 +2022,8 @@ CREATE TABLE `subscriptionhistory` (
   `opacnote` LONGTEXT NULL,
   `librariannote` LONGTEXT NULL,
   PRIMARY KEY  (`subscriptionid`),
-  KEY `biblionumber` (`biblionumber`)
+  CONSTRAINT subscription_history_ibfk_1 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE,
+  CONSTRAINT subscription_history_ibfk_2 FOREIGN KEY (subscriptionid) REFERENCES subscription (subscriptionid) ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 --
@@ -2783,13 +2787,8 @@ CREATE TABLE `aqbooksellers` ( -- information about the vendors listed in acquis
   `address3` LONGTEXT, -- third line of vendor physical address
   `address4` LONGTEXT, -- fourth line of vendor physical address
   `phone` varchar(30) default NULL, -- vendor phone number
-  `accountnumber` LONGTEXT, -- unused in Koha
-  `othersupplier` LONGTEXT,  -- unused in Koha
-  `currency` varchar(10) NOT NULL default '', -- unused in Koha
-  `booksellerfax` LONGTEXT, -- vendor fax number
+  `accountnumber` LONGTEXT, -- vendor account number
   `notes` LONGTEXT, -- order notes
-  `bookselleremail` LONGTEXT, -- vendor email
-  `booksellerurl` LONGTEXT, -- unused in Koha
   `postal` LONGTEXT, -- vendor postal address (all lines)
   `url` varchar(255) default NULL, -- vendor web address
   `active` tinyint(4) default NULL, -- is this vendor active (1 for yes, 0 for no)
@@ -2926,11 +2925,11 @@ CREATE TABLE aqcontacts (
   fax varchar(100) default NULL,  -- contact's fax number
   email varchar(100) default NULL, -- contact's email address
   notes LONGTEXT, -- notes related to the contact
-  orderacquisition BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive acquisition orders
-  claimacquisition BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive acquisitions claims
-  claimissues BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive serial claims
-  acqprimary BOOLEAN NOT NULL DEFAULT 0, -- is this the primary contact for acquisitions messages
-  serialsprimary BOOLEAN NOT NULL DEFAULT 0, -- is this the primary contact for serials messages
+  orderacquisition tinyint(1) NOT NULL DEFAULT 0, -- should this contact receive acquisition orders
+  claimacquisition tinyint(1) NOT NULL DEFAULT 0, -- should this contact receive acquisitions claims
+  claimissues tinyint(1) NOT NULL DEFAULT 0, -- should this contact receive serial claims
+  acqprimary tinyint(1) NOT NULL DEFAULT 0, -- is this the primary contact for acquisitions messages
+  serialsprimary tinyint(1) NOT NULL DEFAULT 0, -- is this the primary contact for serials messages
   booksellerid int(11) not NULL,
   PRIMARY KEY  (id),
   CONSTRAINT booksellerid_aqcontacts_fk FOREIGN KEY (booksellerid)
@@ -3015,7 +3014,10 @@ CREATE TABLE `suggestions` ( -- purchase suggestions
    accepteddate date default NULL, -- date the suggestion was marked as accepted
    rejectedby INT(11) default NULL, -- borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table
    rejecteddate date default NULL, -- date the suggestion was marked as rejected
+   lastmodificationby INT(11) default NULL, -- borrowernumber for the librarian who edit the suggestion for the last time
+   lastmodificationdate date default NULL, -- date of the last modification
   `STATUS` varchar(10) NOT NULL default '', -- suggestion status (ASKED, CHECKED, ACCEPTED, or REJECTED)
+  `archived` TINYINT(1) NOT NULL DEFAULT 0, -- is the suggestion archived?
   `note` LONGTEXT, -- note entered on the suggestion
   `author` varchar(80) default NULL, -- author of the suggested item
   `title` varchar(255) default NULL, -- title of the suggested item
@@ -3050,6 +3052,7 @@ CREATE TABLE `suggestions` ( -- purchase suggestions
   CONSTRAINT `suggestions_ibfk_managedby` FOREIGN KEY (`managedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
   CONSTRAINT `suggestions_ibfk_acceptedby` FOREIGN KEY (`acceptedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
   CONSTRAINT `suggestions_ibfk_rejectedby` FOREIGN KEY (`rejectedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
+  CONSTRAINT `suggestions_ibfk_lastmodificationby` FOREIGN KEY (`lastmodificationby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
   CONSTRAINT `suggestions_ibfk_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
   CONSTRAINT `suggestions_budget_id_fk` FOREIGN KEY (`budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
   CONSTRAINT `suggestions_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
@@ -3102,7 +3105,7 @@ CREATE TABLE IF NOT EXISTS edifact_messages (
   basketno INT(11) REFERENCES aqbasket( basketno),
   raw_msg LONGTEXT,
   filename MEDIUMTEXT,
-  deleted BOOLEAN NOT NULL DEFAULT 0,
+  deleted tinyint(1) NOT NULL DEFAULT 0,
   PRIMARY KEY  (id),
   KEY vendorid ( vendor_id),
   KEY ediacct (edi_acct),
@@ -3387,7 +3390,7 @@ CREATE TABLE borrower_attribute_types_branches( -- association table between bor
 CREATE TABLE IF NOT EXISTS `borrower_modifications` (
   `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   `verification_token` varchar(255) NOT NULL DEFAULT '',
-  `changed_fields` MEDIUMTEXT NOT NULL,
+  `changed_fields` MEDIUMTEXT DEFAULT NULL,
   `borrowernumber` int(11) NOT NULL DEFAULT '0',
   `cardnumber` varchar(32) DEFAULT NULL,
   `surname` LONGTEXT,
@@ -3815,9 +3818,17 @@ CREATE TABLE `course_items` (
   `ci_id` int(11) NOT NULL AUTO_INCREMENT, -- course item id
   `itemnumber` int(11) NOT NULL, -- items.itemnumber for the item on reserve
   `itype` varchar(10) DEFAULT NULL, -- new itemtype for the item to have while on reserve (optional)
+  `itype_enabled` tinyint(1) NOT NULL DEFAULT 0, -- indicates if itype should be changed while on course reserve
+  `itype_storage` varchar(10) DEFAULT NULL, -- a place to store the itype when item is on course reserve
   `ccode` varchar(80) DEFAULT NULL, -- new category code for the item to have while on reserve (optional)
+  `ccode_enabled` tinyint(1) NOT NULL DEFAULT 0, -- indicates if ccode should be changed while on course reserve
+  `ccode_storage` varchar(80) DEFAULT NULL, -- a place to store the ccode when item is on course reserve
   `holdingbranch` varchar(10) DEFAULT NULL, -- new holding branch for the item to have while on reserve (optional)
+  `holdingbranch_enabled` tinyint(1) NOT NULL DEFAULT 0, -- indicates if itype should be changed while on course reserve
+  `holdingbranch_storage` varchar(10) DEFAULT NULL, -- a place to store the holdingbranch when item is on course reserve
   `location` varchar(80) DEFAULT NULL, -- new shelving location for the item to have while on reseve (optional)
+  `location_enabled` tinyint(1) NOT NULL DEFAULT 0, -- indicates if itype should be changed while on course reserve
+  `location_storage` varchar(80) DEFAULT NULL, -- a place to store the location when the item is on course reserve
   `enabled` enum('yes','no') NOT NULL DEFAULT 'no', -- if at least one enabled course has this item on reseve, this field will be 'yes', otherwise it will be 'no'
   `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`ci_id`),
@@ -4438,6 +4449,27 @@ CREATE TABLE return_claims (
     CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
+--
+-- Table structure for table `problem_reports`
+--
+
+DROP TABLE IF EXISTS `problem_reports`;
+CREATE TABLE `problem_reports` (
+    `reportid` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
+    `title` varchar(40) NOT NULL default '', -- report subject line
+    `content` varchar(255) NOT NULL default '', -- report message content
+    `borrowernumber` int(11) NOT NULL default 0, -- the user who created the problem report
+    `branchcode` varchar(10) NOT NULL default '', -- borrower's branch
+    `username` varchar(75) default NULL, -- OPAC username
+    `problempage` TEXT default NULL, -- page the user triggered the problem report form from
+    `recipient` enum('admin','library') NOT NULL default 'library', -- the 'to-address' of the problem report
+    `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of report submission
+    `status` varchar(6) NOT NULL default 'New', -- status of the report. New, Viewed, Closed
+    PRIMARY KEY (`reportid`),
+    CONSTRAINT `problem_reports_ibfk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
+    CONSTRAINT `problem_reports_ibfk2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;