Bug 30392: (QA follow-up) Correct COMMENT
[koha-ffzg.git] / installer / data / mysql / kohastructure.sql
index 6ddacee..3f524ae 100644 (file)
@@ -175,6 +175,7 @@ CREATE TABLE `action_logs` (
   `object` int(11) DEFAULT NULL COMMENT 'the object that the action was taken against (could be a borrowernumber, itemnumber, etc)',
   `info` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'information about the action (usually includes SQL statement)',
   `interface` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the context this action was taken in',
+  `script` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the name of the cron script that caused this change',
   PRIMARY KEY (`action_id`),
   KEY `timestamp_idx` (`timestamp`),
   KEY `user_idx` (`user`),
@@ -1880,6 +1881,37 @@ CREATE TABLE `club_fields` (
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
+-- Table structure for table `item_groups`
+--
+
+DROP TABLE IF EXISTS `item_groups`;
+CREATE TABLE `item_groups` (
+  `item_group_id` INT(11) NOT NULL auto_increment COMMENT "id for the items group",
+  `biblio_id` INT(11) NOT NULL DEFAULT 0 COMMENT "id for the bibliographic record the group belongs to",
+  `display_order` INT(4) NOT NULL DEFAULT 0 COMMENT "The 'sort order' for item_groups",
+  `description` MEDIUMTEXT default NULL COMMENT "A group description",
+  `created_on` TIMESTAMP NULL COMMENT "Time and date the group was created",
+  `updated_on` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT "Time and date of the latest change on the group",
+  PRIMARY KEY  (`item_group_id`),
+  CONSTRAINT `item_groups_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `item_group_items`
+--
+
+DROP TABLE IF EXISTS `item_group_items`;
+CREATE TABLE `item_group_items` (
+  `item_group_items_id` int(11) NOT NULL auto_increment COMMENT "id for the group/item link",
+  `item_group_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key making this table a 1 to 1 join from items to item groups",
+  `item_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key linking this table to the items table",
+  PRIMARY KEY  (`item_group_items_id`),
+  UNIQUE KEY (`item_id`),
+  CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
+  CONSTRAINT `item_group_items_gifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
 -- Table structure for table `club_holds`
 --
 
@@ -2294,6 +2326,77 @@ CREATE TABLE `creator_templates` (
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
+-- Table structure for table `curbside_pickup_policy`
+--
+
+DROP TABLE IF EXISTS `curbside_pickup_policy`;
+CREATE TABLE `curbside_pickup_policy` (
+  `id` int(11) NOT NULL auto_increment,
+  `branchcode` varchar(10) NOT NULL,
+  `enabled` TINYINT(1) NOT NULL DEFAULT 0,
+  `enable_waiting_holds_only` TINYINT(1) NOT NULL DEFAULT 0,
+  `pickup_interval` INT(2) NOT NULL DEFAULT 0,
+  `patrons_per_interval` INT(2) NOT NULL DEFAULT 0,
+  `patron_scheduled_pickup` TINYINT(1) NOT NULL DEFAULT 0,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY (`branchcode`),
+  FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `curbside_pickup_opening_slots`
+--
+
+DROP TABLE IF EXISTS `curbside_pickup_opening_slots`;
+CREATE TABLE `curbside_pickup_opening_slots` (
+    `id` INT(11) NOT NULL AUTO_INCREMENT,
+    `curbside_pickup_policy_id` INT(11) NOT NULL,
+    `day` TINYINT(1) NOT NULL,
+    `start_hour` INT(2) NOT NULL,
+    `start_minute` INT(2) NOT NULL,
+    `end_hour` INT(2) NOT NULL,
+    `end_minute` INT(2) NOT NULL,
+    PRIMARY KEY (`id`),
+    FOREIGN KEY (curbside_pickup_policy_id) REFERENCES curbside_pickup_policy(id) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `curbside_pickups`
+--
+
+DROP TABLE IF EXISTS `curbside_pickups`;
+CREATE TABLE `curbside_pickups` (
+  `id` int(11) NOT NULL auto_increment,
+  `borrowernumber` int(11) NOT NULL,
+  `branchcode` varchar(10) NOT NULL,
+  `scheduled_pickup_datetime` datetime NOT NULL,
+  `staged_datetime` datetime NULL DEFAULT NULL,
+  `staged_by` int(11) NULL DEFAULT NULL,
+  `arrival_datetime` datetime NULL DEFAULT NULL,
+  `delivered_datetime` datetime NULL DEFAULT NULL,
+  `delivered_by` int(11) NULL DEFAULT NULL,
+  `notes` text NULL DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE ON UPDATE CASCADE,
+  FOREIGN KEY (borrowernumber) REFERENCES borrowers(borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE,
+  FOREIGN KEY (staged_by) REFERENCES borrowers(borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `curbside_pickup_issues`
+--
+
+DROP TABLE IF EXISTS `curbside_pickup_issues`;
+CREATE TABLE `curbside_pickup_issues` (
+  `id` int(11) NOT NULL auto_increment,
+  `curbside_pickup_id` int(11) NOT NULL,
+  `issue_id` int(11) NOT NULL,
+  `reserve_id` int(11) NOT NULL,
+  PRIMARY KEY (`id`),
+  FOREIGN KEY (curbside_pickup_id) REFERENCES curbside_pickups(id) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
 -- Table structure for table `currency`
 --
 
@@ -2547,6 +2650,7 @@ CREATE TABLE `deleteditems` (
   `itemnotes_nonpublic` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
   `holdingbranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
+  `deleted_on` DATETIME DEFAULT NULL COMMENT 'date/time of deletion',
   `location` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
   `permanent_location` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
   `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
@@ -3108,6 +3212,7 @@ CREATE TABLE `items` (
   `itemnotes_nonpublic` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
   `holdingbranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
+  `deleted_on` DATETIME DEFAULT NULL COMMENT 'date/time of deletion',
   `location` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
   `permanent_location` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
   `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
@@ -3143,6 +3248,23 @@ CREATE TABLE `items` (
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
+-- Table structure for table item_bundles
+--
+
+DROP TABLE IF EXISTS `item_bundles`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `item_bundles` (
+  `item` int(11) NOT NULL,
+  `host` int(11) NOT NULL,
+  PRIMARY KEY (`host`, `item`),
+  UNIQUE KEY `item_bundles_uniq_1` (`item`),
+  CONSTRAINT `item_bundles_ibfk_1` FOREIGN KEY (`item`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
+  CONSTRAINT `item_bundles_ibfk_2` FOREIGN KEY (`host`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
 -- Table structure for table `items_last_borrower`
 --
 
@@ -4408,7 +4530,7 @@ CREATE TABLE `reserves` (
   `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
   `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
   `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
-  `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
+  `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
   `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
   `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
   `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
@@ -4446,6 +4568,21 @@ CREATE TABLE `reserves` (
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
+-- Table structure for table `hold_cancellation_requests`
+--
+
+DROP TABLE IF EXISTS `hold_cancellation_requests`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `hold_cancellation_requests` (
+  `hold_cancellation_request_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the cancellation request',
+  `hold_id` int(11) NOT null COMMENT 'ID of the hold',
+  `creation_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Time and date the cancellation request was created',
+  PRIMARY KEY (`hold_cancellation_request_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
 -- Table structure for table `return_claims`
 --
 
@@ -4466,7 +4603,7 @@ CREATE TABLE `return_claims` (
   `resolved_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was resolved',
   `resolved_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that resolved the claim',
   PRIMARY KEY (`id`),
-  UNIQUE KEY `issue_id` (`issue_id`),
+  UNIQUE KEY `item_issue` (`itemnumber`, `issue_id`),
   KEY `itemnumber` (`itemnumber`),
   KEY `rc_borrowers_ibfk` (`borrowernumber`),
   KEY `rc_created_by_ibfk` (`created_by`),
@@ -4558,7 +4695,7 @@ CREATE TABLE `search_field` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the name of the field as it will be stored in the search engine',
   `label` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the human readable name of the field, for display',
-  `type` enum('','string','date','number','boolean','sum','isbn','stdno','year') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'what type of data this holds, relevant when storing it in the search engine',
+  `type` enum('','string','date','number','boolean','sum','isbn','stdno','year','callnumber') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'what type of data this holds, relevant when storing it in the search engine',
   `weight` decimal(5,2) DEFAULT NULL,
   `facet_order` tinyint(4) DEFAULT NULL COMMENT 'the order place of the field in facet list if faceted',
   `staff_client` tinyint(1) NOT NULL DEFAULT 1,
@@ -4899,8 +5036,8 @@ CREATE TABLE `subscription` (
   `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'default branches (items.homebranch)',
   `lastbranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
   `serialsadditems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'does receiving this serial create an item record',
-  `staffdisplaycount` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'how many issues to show to the staff',
-  `opacdisplaycount` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'how many issues to show to the public',
+  `staffdisplaycount` INT(11) NULL DEFAULT NULL COMMENT 'how many issues to show to the staff',
+  `opacdisplaycount` INT(11) NULL DEFAULT NULL COMMENT 'how many issues to show to the public',
   `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
   `enddate` date DEFAULT NULL COMMENT 'subscription end date',
   `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',