Bug 12395: Save order line's creator
[koha.git] / installer / data / mysql / kohastructure.sql
index b3926e9..c6f7f01 100644 (file)
@@ -458,6 +458,7 @@ CREATE TABLE `currency` (
   `rate` float(15,5) default NULL,
   `active` tinyint(1) default NULL,
   `archived` tinyint(1) DEFAULT 0,
+  `p_sep_by_space` tinyint(1) DEFAULT 0,
   PRIMARY KEY  (`currency`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
@@ -637,6 +638,7 @@ CREATE TABLE `deleteditems` (
   `stack` tinyint(1) default NULL,
   `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
   `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
+  `damaged_on` datetime DEFAULT NULL, -- the date and time an item was last marked as damaged, NULL if not damaged
   `itemlost` tinyint(1) NOT NULL default 0, -- authorized value defining this item as lost (MARC21 952$1)
   `itemlost_on` datetime DEFAULT NULL, -- the date and time an item was last marked as lost, NULL if not lost
   `withdrawn` tinyint(1) NOT NULL default 0, -- authorized value defining this item as withdrawn (MARC21 952$0)
@@ -835,6 +837,7 @@ CREATE TABLE `issuingrules` ( -- circulation and fine rules
   `fine` decimal(28,6) default NULL, -- fine amount
   `finedays` int(11) default NULL, -- suspension in days
   `maxsuspensiondays` int(11) default NULL, -- max suspension days
+  `suspension_chargeperiod` int(11) default '1', -- how often the finedays is charged
   `firstremind` int(11) default NULL, -- fine grace period
   `chargeperiod` int(11) default NULL, -- how often the fine amount is charged
   `chargeperiod_charge_at` tinyint(1) NOT NULL DEFAULT '0', -- Should fine be given at the start ( 1 ) or the end ( 0 ) of the period
@@ -897,6 +900,7 @@ CREATE TABLE `items` ( -- holdings/item information
   `stack` tinyint(1) default NULL,
   `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
   `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
+  `damaged_on` datetime DEFAULT NULL, -- the date and time an item was last marked as damaged, NULL if not damaged
   `itemlost` tinyint(1) NOT NULL default 0, -- authorized value defining this item as lost (MARC21 952$1)
   `itemlost_on` datetime DEFAULT NULL, -- the date and time an item was last marked as lost, NULL if not lost
   `withdrawn` tinyint(1) NOT NULL default 0, -- authorized value defining this item as withdrawn (MARC21 952$0)
@@ -1137,6 +1141,8 @@ CREATE TABLE `marc_tag_structure` (
   `repeatable` tinyint(4) NOT NULL default 0,
   `mandatory` tinyint(4) NOT NULL default 0,
   `authorised_value` varchar(10) default NULL,
+  `ind1_defaultvalue` varchar(1) NOT NULL default '',
+  `ind2_defaultvalue` varchar(1) NOT NULL default '',
   `frameworkcode` varchar(4) NOT NULL default '',
   PRIMARY KEY  (`frameworkcode`,`tagfield`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@@ -1453,7 +1459,7 @@ CREATE TABLE `search_field` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `name` varchar(255) NOT NULL COMMENT 'the name of the field as it will be stored in the search engine',
   `label` varchar(255) NOT NULL COMMENT 'the human readable name of the field, for display',
-  `type` ENUM('', 'string', 'date', 'number', 'boolean', 'sum') 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') NOT NULL COMMENT 'what type of data this holds, relevant when storing it in the search engine',
   PRIMARY KEY (`id`),
   UNIQUE KEY (`name` (191))
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@@ -1707,6 +1713,26 @@ CREATE TABLE borrower_sync (
   CONSTRAINT borrower_sync_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
+--
+-- Table structure for table api_keys
+--
+
+DROP TABLE IF EXISTS `api_keys`;
+CREATE TABLE `api_keys` (
+    `client_id`   VARCHAR(191) NOT NULL,           -- API client ID
+    `secret`      VARCHAR(191) NOT NULL,           -- API client secret used for API authentication
+    `description` VARCHAR(255) NOT NULL,           -- API client description
+    `patron_id`   INT(11) NOT NULL,                -- Foreign key to the borrowers table
+    `active`      TINYINT(1) DEFAULT 1 NOT NULL,   -- 0 means this API key is revoked
+    PRIMARY KEY `client_id` (`client_id`),
+    UNIQUE KEY `secret` (`secret`),
+    KEY `patron_id` (`patron_id`),
+    CONSTRAINT `api_keys_fk_patron_id`
+      FOREIGN KEY (`patron_id`)
+      REFERENCES `borrowers` (`borrowernumber`)
+      ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
 --
 -- Table structure for table `issues`
 --
@@ -2679,6 +2705,7 @@ CREATE TABLE `accountlines` (
   `description` LONGTEXT,
   `dispute` LONGTEXT,
   `accounttype` varchar(5) default NULL,
+  `payment_type` varchar(80) default NULL, -- optional authorised value PAYMENT_TYPE
   `amountoutstanding` decimal(28,6) default NULL,
   `lastincrement` decimal(28,6) default NULL,
   `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
@@ -3132,6 +3159,7 @@ CREATE TABLE `aqorders` ( -- information related to the basket line items
   `unitprice_tax_excluded` decimal(28,6) default NULL, -- the unit price excluding tax (on receiving)
   `unitprice_tax_included` decimal(28,6) default NULL, -- the unit price including tax (on receiving)
   `quantityreceived` smallint(6) NOT NULL default 0, -- the quantity that have been received so far
+  `created_by` int(11) NULL DEFAULT NULL, -- the borrowernumber of order line's creator
   `datecancellationprinted` date default NULL, -- the date the line item was deleted
   `cancellationreason` MEDIUMTEXT default NULL, -- reason of cancellation
   `order_internalnote` LONGTEXT, -- notes related to this order line, made for staff
@@ -3442,7 +3470,7 @@ CREATE TABLE uploaded_files (
     dir MEDIUMTEXT NOT NULL,
     filesize int(11),
     dtcreated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-    uploadcategorycode tinytext,
+    uploadcategorycode TEXT,
     owner int(11),
     public tinyint,
     permanent tinyint,
@@ -3965,7 +3993,7 @@ CREATE TABLE deletedbiblio_metadata (
 
 CREATE TABLE IF NOT EXISTS club_templates (
   id int(11) NOT NULL AUTO_INCREMENT,
-  `name` tinytext NOT NULL,
+  `name` TEXT NOT NULL,
   description MEDIUMTEXT,
   is_enrollable_from_opac tinyint(1) NOT NULL DEFAULT '0',
   is_email_required tinyint(1) NOT NULL DEFAULT '0',
@@ -3985,7 +4013,7 @@ CREATE TABLE IF NOT EXISTS club_templates (
 CREATE TABLE IF NOT EXISTS clubs (
   id int(11) NOT NULL AUTO_INCREMENT,
   club_template_id int(11) NOT NULL,
-  `name` tinytext NOT NULL,
+  `name` TEXT NOT NULL,
   description MEDIUMTEXT,
   date_start date DEFAULT NULL,
   date_end date DEFAULT NULL,
@@ -4028,7 +4056,7 @@ CREATE TABLE IF NOT EXISTS club_enrollments (
 CREATE TABLE IF NOT EXISTS club_template_enrollment_fields (
   id int(11) NOT NULL AUTO_INCREMENT,
   club_template_id int(11) NOT NULL,
-  `name` tinytext NOT NULL,
+  `name` TEXT NOT NULL,
   description MEDIUMTEXT,
   authorised_value_category varchar(16) DEFAULT NULL,
   PRIMARY KEY (id),
@@ -4059,7 +4087,7 @@ CREATE TABLE IF NOT EXISTS club_enrollment_fields (
 CREATE TABLE IF NOT EXISTS club_template_fields (
   id int(11) NOT NULL AUTO_INCREMENT,
   club_template_id int(11) NOT NULL,
-  `name` tinytext NOT NULL,
+  `name` TEXT NOT NULL,
   description MEDIUMTEXT,
   authorised_value_category varchar(16) DEFAULT NULL,
   PRIMARY KEY (id),
@@ -4152,7 +4180,19 @@ CREATE TABLE library_groups (
     FOREIGN KEY (parent_id) REFERENCES library_groups(id) ON UPDATE CASCADE ON DELETE CASCADE,
     FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON UPDATE CASCADE ON DELETE CASCADE,
     UNIQUE KEY title ( title )
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table 'oauth_access_tokens'
+--
+
+DROP TABLE IF EXISTS `oauth_access_tokens`;
+CREATE TABLE `oauth_access_tokens` (
+    `access_token` VARCHAR(191) NOT NULL, -- generarated access token
+    `client_id`    VARCHAR(191) NOT NULL, -- the client id the access token belongs to
+    `expires`      INT NOT NULL,          -- expiration time in seconds
+    PRIMARY KEY (`access_token`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;