Bug 12029: DBRev 22.12.00.022
[koha.git] / installer / data / mysql / kohastructure.sql
1 -- MariaDB dump 10.19  Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64)
2 --
3 -- Host: db    Database: koha_kohadev
4 -- ------------------------------------------------------
5 -- Server version       10.10.2-MariaDB-1:10.10.2+maria~ubu2204
6
7 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 /*!40101 SET NAMES utf8mb4 */;
11 /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 /*!40103 SET TIME_ZONE='+00:00' */;
13 /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17
18 --
19 -- Table structure for table `account_credit_types`
20 --
21
22 DROP TABLE IF EXISTS `account_credit_types`;
23 /*!40101 SET @saved_cs_client     = @@character_set_client */;
24 /*!40101 SET character_set_client = utf8 */;
25 CREATE TABLE `account_credit_types` (
26   `code` varchar(80) NOT NULL,
27   `description` varchar(200) DEFAULT NULL,
28   `can_be_added_manually` tinyint(4) NOT NULL DEFAULT 1,
29   `credit_number_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is autogeneration of credit number enabled for this credit type',
30   `is_system` tinyint(1) NOT NULL DEFAULT 0,
31   `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote if this till is archived or not',
32   PRIMARY KEY (`code`)
33 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
34 /*!40101 SET character_set_client = @saved_cs_client */;
35
36 --
37 -- Table structure for table `account_credit_types_branches`
38 --
39
40 DROP TABLE IF EXISTS `account_credit_types_branches`;
41 /*!40101 SET @saved_cs_client     = @@character_set_client */;
42 /*!40101 SET character_set_client = utf8 */;
43 CREATE TABLE `account_credit_types_branches` (
44   `credit_type_code` varchar(80) DEFAULT NULL,
45   `branchcode` varchar(10) DEFAULT NULL,
46   KEY `credit_type_code` (`credit_type_code`),
47   KEY `branchcode` (`branchcode`),
48   CONSTRAINT `account_credit_types_branches_ibfk_1` FOREIGN KEY (`credit_type_code`) REFERENCES `account_credit_types` (`code`) ON DELETE CASCADE,
49   CONSTRAINT `account_credit_types_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
50 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
51 /*!40101 SET character_set_client = @saved_cs_client */;
52
53 --
54 -- Table structure for table `account_debit_types`
55 --
56
57 DROP TABLE IF EXISTS `account_debit_types`;
58 /*!40101 SET @saved_cs_client     = @@character_set_client */;
59 /*!40101 SET character_set_client = utf8 */;
60 CREATE TABLE `account_debit_types` (
61   `code` varchar(80) NOT NULL,
62   `description` varchar(200) DEFAULT NULL,
63   `can_be_invoiced` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'boolean flag to denote if this debit type is available for manual invoicing',
64   `can_be_sold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote if this debit type is available at point of sale',
65   `default_amount` decimal(28,6) DEFAULT NULL,
66   `is_system` tinyint(1) NOT NULL DEFAULT 0,
67   `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote if this till is archived or not',
68   PRIMARY KEY (`code`)
69 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
70 /*!40101 SET character_set_client = @saved_cs_client */;
71
72 --
73 -- Table structure for table `account_debit_types_branches`
74 --
75
76 DROP TABLE IF EXISTS `account_debit_types_branches`;
77 /*!40101 SET @saved_cs_client     = @@character_set_client */;
78 /*!40101 SET character_set_client = utf8 */;
79 CREATE TABLE `account_debit_types_branches` (
80   `debit_type_code` varchar(80) DEFAULT NULL,
81   `branchcode` varchar(10) DEFAULT NULL,
82   KEY `debit_type_code` (`debit_type_code`),
83   KEY `branchcode` (`branchcode`),
84   CONSTRAINT `account_debit_types_branches_ibfk_1` FOREIGN KEY (`debit_type_code`) REFERENCES `account_debit_types` (`code`) ON DELETE CASCADE,
85   CONSTRAINT `account_debit_types_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
86 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
87 /*!40101 SET character_set_client = @saved_cs_client */;
88
89 --
90 -- Table structure for table `account_offsets`
91 --
92
93 DROP TABLE IF EXISTS `account_offsets`;
94 /*!40101 SET @saved_cs_client     = @@character_set_client */;
95 /*!40101 SET character_set_client = utf8 */;
96 CREATE TABLE `account_offsets` (
97   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each offset',
98   `credit_id` int(11) DEFAULT NULL COMMENT 'The id of the accountline the increased the patron''s balance',
99   `debit_id` int(11) DEFAULT NULL COMMENT 'The id of the accountline that decreased the patron''s balance',
100   `type` enum('CREATE','APPLY','VOID','OVERDUE_INCREASE','OVERDUE_DECREASE') NOT NULL COMMENT 'The type of offset this is',
101   `amount` decimal(26,6) NOT NULL COMMENT 'The amount of the change',
102   `created_on` timestamp NOT NULL DEFAULT current_timestamp(),
103   PRIMARY KEY (`id`),
104   KEY `account_offsets_ibfk_p` (`credit_id`),
105   KEY `account_offsets_ibfk_f` (`debit_id`),
106   CONSTRAINT `account_offsets_ibfk_f` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE,
107   CONSTRAINT `account_offsets_ibfk_p` FOREIGN KEY (`credit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE
108 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
109 /*!40101 SET character_set_client = @saved_cs_client */;
110
111 --
112 -- Table structure for table `accountlines`
113 --
114
115 DROP TABLE IF EXISTS `accountlines`;
116 /*!40101 SET @saved_cs_client     = @@character_set_client */;
117 /*!40101 SET character_set_client = utf8 */;
118 CREATE TABLE `accountlines` (
119   `accountlines_id` int(11) NOT NULL AUTO_INCREMENT,
120   `issue_id` int(11) DEFAULT NULL,
121   `borrowernumber` int(11) DEFAULT NULL,
122   `itemnumber` int(11) DEFAULT NULL,
123   `date` timestamp NULL DEFAULT NULL,
124   `amount` decimal(28,6) DEFAULT NULL,
125   `description` longtext DEFAULT NULL,
126   `credit_type_code` varchar(80) DEFAULT NULL,
127   `debit_type_code` varchar(80) DEFAULT NULL,
128   `credit_number` varchar(20) DEFAULT NULL COMMENT 'autogenerated number for credits',
129   `status` varchar(16) DEFAULT NULL,
130   `payment_type` varchar(80) DEFAULT NULL COMMENT 'optional authorised value PAYMENT_TYPE',
131   `amountoutstanding` decimal(28,6) DEFAULT NULL,
132   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
133   `note` mediumtext DEFAULT NULL,
134   `manager_id` int(11) DEFAULT NULL,
135   `register_id` int(11) DEFAULT NULL,
136   `interface` varchar(16) NOT NULL,
137   `branchcode` varchar(10) DEFAULT NULL COMMENT 'the branchcode of the library where a payment was made, a manual invoice created, etc.',
138   PRIMARY KEY (`accountlines_id`),
139   KEY `acctsborridx` (`borrowernumber`),
140   KEY `timeidx` (`timestamp`),
141   KEY `credit_type_code` (`credit_type_code`),
142   KEY `debit_type_code` (`debit_type_code`),
143   KEY `itemnumber` (`itemnumber`),
144   KEY `branchcode` (`branchcode`),
145   KEY `manager_id` (`manager_id`),
146   KEY `accountlines_ibfk_registers` (`register_id`),
147   CONSTRAINT `accountlines_ibfk_borrowers` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
148   CONSTRAINT `accountlines_ibfk_borrowers_2` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
149   CONSTRAINT `accountlines_ibfk_branches` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
150   CONSTRAINT `accountlines_ibfk_credit_type` FOREIGN KEY (`credit_type_code`) REFERENCES `account_credit_types` (`code`) ON UPDATE CASCADE,
151   CONSTRAINT `accountlines_ibfk_debit_type` FOREIGN KEY (`debit_type_code`) REFERENCES `account_debit_types` (`code`) ON UPDATE CASCADE,
152   CONSTRAINT `accountlines_ibfk_items` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
153   CONSTRAINT `accountlines_ibfk_registers` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
154 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
155 /*!40101 SET character_set_client = @saved_cs_client */;
156
157 --
158 -- Table structure for table `action_logs`
159 --
160
161 DROP TABLE IF EXISTS `action_logs`;
162 /*!40101 SET @saved_cs_client     = @@character_set_client */;
163 /*!40101 SET character_set_client = utf8 */;
164 CREATE TABLE `action_logs` (
165   `action_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each action',
166   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the action took place',
167   `user` int(11) NOT NULL DEFAULT 0 COMMENT 'the staff member who performed the action (borrowers.borrowernumber)',
168   `module` mediumtext DEFAULT NULL COMMENT 'the module this action was taken against',
169   `action` mediumtext DEFAULT NULL COMMENT 'the action (includes things like DELETED, ADDED, MODIFY, etc)',
170   `object` int(11) DEFAULT NULL COMMENT 'the object that the action was taken against (could be a borrowernumber, itemnumber, etc)',
171   `info` mediumtext DEFAULT NULL COMMENT 'information about the action (usually includes SQL statement)',
172   `interface` varchar(30) DEFAULT NULL COMMENT 'the context this action was taken in',
173   `script` varchar(255) DEFAULT NULL COMMENT 'the name of the cron script that caused this change',
174   `trace` TEXT DEFAULT NULL COMMENT 'An optional stack trace enabled by ActionLogsTraceDepth',
175   PRIMARY KEY (`action_id`),
176   KEY `timestamp_idx` (`timestamp`),
177   KEY `user_idx` (`user`),
178   KEY `module_idx` (`module`(191)),
179   KEY `action_idx` (`action`(191)),
180   KEY `object_idx` (`object`),
181   KEY `info_idx` (`info`(191)),
182   KEY `interface` (`interface`)
183 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
184 /*!40101 SET character_set_client = @saved_cs_client */;
185
186 --
187 -- Table structure for table `additional_contents`
188 --
189
190 DROP TABLE IF EXISTS `additional_contents`;
191 /*!40101 SET @saved_cs_client     = @@character_set_client */;
192 /*!40101 SET character_set_client = utf8 */;
193 CREATE TABLE `additional_contents` (
194   `idnew` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the additional content',
195   `category` varchar(20) NOT NULL COMMENT 'category for the additional content',
196   `code` varchar(100) NOT NULL COMMENT 'code to group content per lang',
197   `location` varchar(255) NOT NULL COMMENT 'location of the additional content',
198   `branchcode` varchar(10) DEFAULT NULL COMMENT 'branch code users to create branch specific additional content, NULL is every branch.',
199   `title` varchar(250) NOT NULL DEFAULT '' COMMENT 'title of the additional content',
200   `content` mediumtext NOT NULL COMMENT 'the body of your additional content',
201   `lang` varchar(50) NOT NULL DEFAULT '' COMMENT 'location for the additional content(koha is the staff interface, slip is the circulation receipt and language codes are for the opac)',
202   `published_on` date DEFAULT NULL COMMENT 'publication date',
203   `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
204   `expirationdate` date DEFAULT NULL COMMENT 'date the additional content is set to expire or no longer be visible',
205   `number` int(11) DEFAULT NULL COMMENT 'the order in which this additional content appears in that specific location',
206   `borrowernumber` int(11) DEFAULT NULL COMMENT 'The user who created the additional content',
207   PRIMARY KEY (`idnew`),
208   UNIQUE KEY `additional_contents_uniq` (`category`,`code`,`branchcode`,`lang`),
209   KEY `additional_contents_borrowernumber_fk` (`borrowernumber`),
210   KEY `additional_contents_branchcode_ibfk` (`branchcode`),
211   CONSTRAINT `additional_contents_branchcode_ibfk` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
212   CONSTRAINT `borrowernumber_fk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
213 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
214 /*!40101 SET character_set_client = @saved_cs_client */;
215
216 --
217 -- Table structure for table `additional_field_values`
218 --
219
220 DROP TABLE IF EXISTS `additional_field_values`;
221 /*!40101 SET @saved_cs_client     = @@character_set_client */;
222 /*!40101 SET character_set_client = utf8 */;
223 CREATE TABLE `additional_field_values` (
224   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
225   `field_id` int(11) NOT NULL COMMENT 'foreign key references additional_fields(id)',
226   `record_id` int(11) NOT NULL COMMENT 'record_id',
227   `value` varchar(255) NOT NULL DEFAULT '' COMMENT 'value for this field',
228   PRIMARY KEY (`id`),
229   UNIQUE KEY `field_record` (`field_id`,`record_id`),
230   CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
231 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
232 /*!40101 SET character_set_client = @saved_cs_client */;
233
234 --
235 -- Table structure for table `additional_fields`
236 --
237
238 DROP TABLE IF EXISTS `additional_fields`;
239 /*!40101 SET @saved_cs_client     = @@character_set_client */;
240 /*!40101 SET character_set_client = utf8 */;
241 CREATE TABLE `additional_fields` (
242   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
243   `tablename` varchar(255) NOT NULL DEFAULT '' COMMENT 'tablename of the new field',
244   `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the field',
245   `authorised_value_category` varchar(32) NOT NULL DEFAULT '' COMMENT 'is an authorised value category',
246   `marcfield` varchar(16) NOT NULL DEFAULT '' COMMENT 'contains the marc field to copied into the record',
247   `searchable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the field searchable?',
248   PRIMARY KEY (`id`),
249   UNIQUE KEY `fields_uniq` (`tablename`(191),`name`(191))
250 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
251 /*!40101 SET character_set_client = @saved_cs_client */;
252
253 --
254 -- Table structure for table `advanced_editor_macros`
255 --
256
257 DROP TABLE IF EXISTS `advanced_editor_macros`;
258 /*!40101 SET @saved_cs_client     = @@character_set_client */;
259 /*!40101 SET character_set_client = utf8 */;
260 CREATE TABLE `advanced_editor_macros` (
261   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the macro',
262   `name` varchar(80) NOT NULL COMMENT 'Name of the macro',
263   `macro` longtext DEFAULT NULL COMMENT 'The macro code itself',
264   `borrowernumber` int(11) DEFAULT NULL COMMENT 'ID of the borrower who created this macro',
265   `shared` tinyint(1) DEFAULT 0 COMMENT 'Bit to define if shared or private macro',
266   PRIMARY KEY (`id`),
267   KEY `borrower_macro_fk` (`borrowernumber`),
268   CONSTRAINT `borrower_macro_fk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
269 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
270 /*!40101 SET character_set_client = @saved_cs_client */;
271
272 --
273 -- Table structure for table `alert`
274 --
275
276 DROP TABLE IF EXISTS `alert`;
277 /*!40101 SET @saved_cs_client     = @@character_set_client */;
278 /*!40101 SET character_set_client = utf8 */;
279 CREATE TABLE `alert` (
280   `alertid` int(11) NOT NULL AUTO_INCREMENT,
281   `borrowernumber` int(11) NOT NULL DEFAULT 0,
282   `type` varchar(10) NOT NULL DEFAULT '',
283   `externalid` varchar(20) NOT NULL DEFAULT '',
284   PRIMARY KEY (`alertid`),
285   KEY `borrowernumber` (`borrowernumber`),
286   KEY `type` (`type`,`externalid`),
287   CONSTRAINT `alert_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
288 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
289 /*!40101 SET character_set_client = @saved_cs_client */;
290
291 --
292 -- Table structure for table `api_keys`
293 --
294
295 DROP TABLE IF EXISTS `api_keys`;
296 /*!40101 SET @saved_cs_client     = @@character_set_client */;
297 /*!40101 SET character_set_client = utf8 */;
298 CREATE TABLE `api_keys` (
299   `client_id` varchar(191) NOT NULL COMMENT 'API client ID',
300   `secret` varchar(191) NOT NULL COMMENT 'API client secret used for API authentication',
301   `description` varchar(255) NOT NULL COMMENT 'API client description',
302   `patron_id` int(11) NOT NULL COMMENT 'Foreign key to the borrowers table',
303   `active` tinyint(1) NOT NULL DEFAULT 1 COMMENT '0 means this API key is revoked',
304   PRIMARY KEY (`client_id`),
305   UNIQUE KEY `secret` (`secret`),
306   KEY `patron_id` (`patron_id`),
307   CONSTRAINT `api_keys_fk_patron_id` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
308 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
309 /*!40101 SET character_set_client = @saved_cs_client */;
310
311 --
312 -- Table structure for table `aqbasket`
313 --
314
315 DROP TABLE IF EXISTS `aqbasket`;
316 /*!40101 SET @saved_cs_client     = @@character_set_client */;
317 /*!40101 SET character_set_client = utf8 */;
318 CREATE TABLE `aqbasket` (
319   `basketno` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, Koha defined number',
320   `basketname` varchar(50) DEFAULT NULL COMMENT 'name given to the basket at creation',
321   `note` longtext DEFAULT NULL COMMENT 'the internal note added at basket creation',
322   `booksellernote` longtext DEFAULT NULL COMMENT 'the vendor note added at basket creation',
323   `contractnumber` int(11) DEFAULT NULL COMMENT 'links this basket to the aqcontract table (aqcontract.contractnumber)',
324   `creationdate` date DEFAULT NULL COMMENT 'the date the basket was created',
325   `closedate` date DEFAULT NULL COMMENT 'the date the basket was closed',
326   `booksellerid` int(11) NOT NULL DEFAULT 1 COMMENT 'the Koha assigned ID for the vendor (aqbooksellers.id)',
327   `authorisedby` varchar(10) DEFAULT NULL COMMENT 'the borrowernumber of the person who created the basket',
328   `booksellerinvoicenumber` longtext DEFAULT NULL COMMENT 'appears to always be NULL',
329   `basketgroupid` int(11) DEFAULT NULL COMMENT 'links this basket to its group (aqbasketgroups.id)',
330   `deliveryplace` varchar(10) DEFAULT NULL COMMENT 'basket delivery place',
331   `billingplace` varchar(10) DEFAULT NULL COMMENT 'basket billing place',
332   `branch` varchar(10) DEFAULT NULL COMMENT 'basket branch',
333   `is_standing` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'orders in this basket are standing',
334   `create_items` enum('ordering','receiving','cataloguing') DEFAULT NULL COMMENT 'when items should be created for orders in this basket',
335   PRIMARY KEY (`basketno`),
336   KEY `booksellerid` (`booksellerid`),
337   KEY `basketgroupid` (`basketgroupid`),
338   KEY `contractnumber` (`contractnumber`),
339   KEY `authorisedby` (`authorisedby`),
340   KEY `aqbasket_ibfk_4` (`branch`),
341   CONSTRAINT `aqbasket_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE,
342   CONSTRAINT `aqbasket_ibfk_2` FOREIGN KEY (`contractnumber`) REFERENCES `aqcontract` (`contractnumber`),
343   CONSTRAINT `aqbasket_ibfk_3` FOREIGN KEY (`basketgroupid`) REFERENCES `aqbasketgroups` (`id`) ON UPDATE CASCADE,
344   CONSTRAINT `aqbasket_ibfk_4` FOREIGN KEY (`branch`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
345 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
346 /*!40101 SET character_set_client = @saved_cs_client */;
347
348 --
349 -- Table structure for table `aqbasketgroups`
350 --
351
352 DROP TABLE IF EXISTS `aqbasketgroups`;
353 /*!40101 SET @saved_cs_client     = @@character_set_client */;
354 /*!40101 SET character_set_client = utf8 */;
355 CREATE TABLE `aqbasketgroups` (
356   `id` int(11) NOT NULL AUTO_INCREMENT,
357   `name` varchar(50) DEFAULT NULL,
358   `closed` tinyint(1) DEFAULT NULL,
359   `booksellerid` int(11) NOT NULL,
360   `deliveryplace` varchar(10) DEFAULT NULL,
361   `freedeliveryplace` mediumtext DEFAULT NULL,
362   `deliverycomment` varchar(255) DEFAULT NULL,
363   `billingplace` varchar(10) DEFAULT NULL,
364   PRIMARY KEY (`id`),
365   KEY `booksellerid` (`booksellerid`),
366   CONSTRAINT `aqbasketgroups_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
367 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
368 /*!40101 SET character_set_client = @saved_cs_client */;
369
370 --
371 -- Table structure for table `aqbasketusers`
372 --
373
374 DROP TABLE IF EXISTS `aqbasketusers`;
375 /*!40101 SET @saved_cs_client     = @@character_set_client */;
376 /*!40101 SET character_set_client = utf8 */;
377 CREATE TABLE `aqbasketusers` (
378   `basketno` int(11) NOT NULL,
379   `borrowernumber` int(11) NOT NULL,
380   PRIMARY KEY (`basketno`,`borrowernumber`),
381   KEY `aqbasketusers_ibfk_2` (`borrowernumber`),
382   CONSTRAINT `aqbasketusers_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
383   CONSTRAINT `aqbasketusers_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
384 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
385 /*!40101 SET character_set_client = @saved_cs_client */;
386
387 --
388 -- Table structure for table `aqbooksellers`
389 --
390
391 DROP TABLE IF EXISTS `aqbooksellers`;
392 /*!40101 SET @saved_cs_client     = @@character_set_client */;
393 /*!40101 SET character_set_client = utf8 */;
394 CREATE TABLE `aqbooksellers` (
395   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha',
396   `name` longtext NOT NULL COMMENT 'vendor name',
397   `address1` longtext DEFAULT NULL COMMENT 'first line of vendor physical address',
398   `address2` longtext DEFAULT NULL COMMENT 'second line of vendor physical address',
399   `address3` longtext DEFAULT NULL COMMENT 'third line of vendor physical address',
400   `address4` longtext DEFAULT NULL COMMENT 'fourth line of vendor physical address',
401   `phone` varchar(30) DEFAULT NULL COMMENT 'vendor phone number',
402   `accountnumber` longtext DEFAULT NULL COMMENT 'vendor account number',
403   `type` varchar(255) DEFAULT NULL,
404   `notes` longtext DEFAULT NULL COMMENT 'order notes',
405   `postal` longtext DEFAULT NULL COMMENT 'vendor postal address (all lines)',
406   `url` varchar(255) DEFAULT NULL COMMENT 'vendor web address',
407   `active` tinyint(4) DEFAULT NULL COMMENT 'is this vendor active (1 for yes, 0 for no)',
408   `listprice` varchar(10) DEFAULT NULL COMMENT 'currency code for list prices',
409   `invoiceprice` varchar(10) DEFAULT NULL COMMENT 'currency code for invoice prices',
410   `gstreg` tinyint(4) DEFAULT NULL COMMENT 'is your library charged tax (1 for yes, 0 for no)',
411   `listincgst` tinyint(4) DEFAULT NULL COMMENT 'is tax included in list prices (1 for yes, 0 for no)',
412   `invoiceincgst` tinyint(4) DEFAULT NULL COMMENT 'is tax included in invoice prices (1 for yes, 0 for no)',
413   `tax_rate` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate the library is charged',
414   `discount` float(6,4) DEFAULT NULL COMMENT 'discount offered on all items ordered from this vendor',
415   `fax` varchar(50) DEFAULT NULL COMMENT 'vendor fax number',
416   `deliverytime` int(11) DEFAULT NULL COMMENT 'vendor delivery time',
417   `external_id` varchar(255) DEFAULT NULL COMMENT 'external id of the vendor',
418   PRIMARY KEY (`id`),
419   KEY `listprice` (`listprice`),
420   KEY `invoiceprice` (`invoiceprice`),
421   KEY `name` (`name`(191)),
422   CONSTRAINT `aqbooksellers_ibfk_1` FOREIGN KEY (`listprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE,
423   CONSTRAINT `aqbooksellers_ibfk_2` FOREIGN KEY (`invoiceprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE
424 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
425 /*!40101 SET character_set_client = @saved_cs_client */;
426
427 --
428 -- Table structure for table `aqbookseller_aliases`
429 --
430
431 DROP TABLE IF EXISTS `aqbookseller_aliases`;
432 /*!40101 SET @saved_cs_client     = @@character_set_client */;
433 /*!40101 SET character_set_client = utf8 */;
434 CREATE TABLE `aqbookseller_aliases` (
435   `alias_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha',
436   `vendor_id` int(11) NOT NULL COMMENT 'link to the vendor',
437   `alias` varchar(255) NOT NULL COMMENT "the alias",
438   PRIMARY KEY (`alias_id`),
439   CONSTRAINT `aqbookseller_aliases_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
440 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
441 /*!40101 SET character_set_client = @saved_cs_client */;
442
443 --
444 -- Table structure for table `aqbudgetborrowers`
445 --
446
447 DROP TABLE IF EXISTS `aqbudgetborrowers`;
448 /*!40101 SET @saved_cs_client     = @@character_set_client */;
449 /*!40101 SET character_set_client = utf8 */;
450 CREATE TABLE `aqbudgetborrowers` (
451   `budget_id` int(11) NOT NULL,
452   `borrowernumber` int(11) NOT NULL,
453   PRIMARY KEY (`budget_id`,`borrowernumber`),
454   KEY `aqbudgetborrowers_ibfk_2` (`borrowernumber`),
455   CONSTRAINT `aqbudgetborrowers_ibfk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
456   CONSTRAINT `aqbudgetborrowers_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
457 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
458 /*!40101 SET character_set_client = @saved_cs_client */;
459
460 --
461 -- Table structure for table `aqbudgetperiods`
462 --
463
464 DROP TABLE IF EXISTS `aqbudgetperiods`;
465 /*!40101 SET @saved_cs_client     = @@character_set_client */;
466 /*!40101 SET character_set_client = utf8 */;
467 CREATE TABLE `aqbudgetperiods` (
468   `budget_period_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned by Koha',
469   `budget_period_startdate` date NOT NULL COMMENT 'date when the budget starts',
470   `budget_period_enddate` date NOT NULL COMMENT 'date when the budget ends',
471   `budget_period_active` tinyint(1) DEFAULT 0 COMMENT 'whether this budget is active or not (1 for yes, 0 for no)',
472   `budget_period_description` longtext DEFAULT NULL COMMENT 'description assigned to this budget',
473   `budget_period_total` decimal(28,6) DEFAULT NULL COMMENT 'total amount available in this budget',
474   `budget_period_locked` tinyint(1) DEFAULT NULL COMMENT 'whether this budget is locked or not (1 for yes, 0 for no)',
475   `sort1_authcat` varchar(10) DEFAULT NULL COMMENT 'statistical category for this budget',
476   `sort2_authcat` varchar(10) DEFAULT NULL COMMENT 'second statistical category for this budget',
477   PRIMARY KEY (`budget_period_id`)
478 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
479 /*!40101 SET character_set_client = @saved_cs_client */;
480
481 --
482 -- Table structure for table `aqbudgets`
483 --
484
485 DROP TABLE IF EXISTS `aqbudgets`;
486 /*!40101 SET @saved_cs_client     = @@character_set_client */;
487 /*!40101 SET character_set_client = utf8 */;
488 CREATE TABLE `aqbudgets` (
489   `budget_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned to each fund by Koha',
490   `budget_parent_id` int(11) DEFAULT NULL COMMENT 'if this fund is a child of another this will include the parent id (aqbudgets.budget_id)',
491   `budget_code` varchar(30) DEFAULT NULL COMMENT 'code assigned to the fund by the user',
492   `budget_name` varchar(80) DEFAULT NULL COMMENT 'name assigned to the fund by the user',
493   `budget_branchcode` varchar(10) DEFAULT NULL COMMENT 'branch that this fund belongs to (branches.branchcode)',
494   `budget_amount` decimal(28,6) DEFAULT 0.000000 COMMENT 'total amount for this fund',
495   `budget_encumb` decimal(28,6) DEFAULT 0.000000 COMMENT 'budget warning at percentage',
496   `budget_expend` decimal(28,6) DEFAULT 0.000000 COMMENT 'budget warning at amount',
497   `budget_notes` longtext DEFAULT NULL COMMENT 'notes related to this fund',
498   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this fund was last touched (created or modified)',
499   `budget_period_id` int(11) DEFAULT NULL COMMENT 'id of the budget that this fund belongs to (aqbudgetperiods.budget_period_id)',
500   `sort1_authcat` varchar(80) DEFAULT NULL COMMENT 'statistical category for this fund',
501   `sort2_authcat` varchar(80) DEFAULT NULL COMMENT 'second statistical category for this fund',
502   `budget_owner_id` int(11) DEFAULT NULL COMMENT 'borrowernumber of the person who owns this fund (borrowers.borrowernumber)',
503   `budget_permission` int(1) DEFAULT 0 COMMENT 'level of permission for this fund (used only by the owner, only by the library, or anyone)',
504   PRIMARY KEY (`budget_id`),
505   KEY `budget_parent_id` (`budget_parent_id`),
506   KEY `budget_code` (`budget_code`),
507   KEY `budget_branchcode` (`budget_branchcode`),
508   KEY `budget_period_id` (`budget_period_id`),
509   KEY `budget_owner_id` (`budget_owner_id`),
510   CONSTRAINT `aqbudgetperiods_ibfk_1` FOREIGN KEY (`budget_period_id`) REFERENCES `aqbudgetperiods` (`budget_period_id`) ON DELETE CASCADE ON UPDATE CASCADE
511 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
512 /*!40101 SET character_set_client = @saved_cs_client */;
513
514 --
515 -- Table structure for table `aqbudgets_planning`
516 --
517
518 DROP TABLE IF EXISTS `aqbudgets_planning`;
519 /*!40101 SET @saved_cs_client     = @@character_set_client */;
520 /*!40101 SET character_set_client = utf8 */;
521 CREATE TABLE `aqbudgets_planning` (
522   `plan_id` int(11) NOT NULL AUTO_INCREMENT,
523   `budget_id` int(11) NOT NULL,
524   `budget_period_id` int(11) NOT NULL,
525   `estimated_amount` decimal(28,6) DEFAULT NULL,
526   `authcat` varchar(30) NOT NULL,
527   `authvalue` varchar(30) NOT NULL,
528   `display` tinyint(1) DEFAULT 1,
529   PRIMARY KEY (`plan_id`),
530   KEY `budget_period_id` (`budget_period_id`),
531   KEY `aqbudgets_planning_ifbk_1` (`budget_id`),
532   CONSTRAINT `aqbudgets_planning_ifbk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE
533 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
534 /*!40101 SET character_set_client = @saved_cs_client */;
535
536 --
537 -- Table structure for table `aqcontacts`
538 --
539
540 DROP TABLE IF EXISTS `aqcontacts`;
541 /*!40101 SET @saved_cs_client     = @@character_set_client */;
542 /*!40101 SET character_set_client = utf8 */;
543 CREATE TABLE `aqcontacts` (
544   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned by Koha',
545   `name` varchar(100) DEFAULT NULL COMMENT 'name of contact at vendor',
546   `position` varchar(100) DEFAULT NULL COMMENT 'contact person''s position',
547   `phone` varchar(100) DEFAULT NULL COMMENT 'contact''s phone number',
548   `altphone` varchar(100) DEFAULT NULL COMMENT 'contact''s alternate phone number',
549   `fax` varchar(100) DEFAULT NULL COMMENT 'contact''s fax number',
550   `email` varchar(100) DEFAULT NULL COMMENT 'contact''s email address',
551   `notes` longtext DEFAULT NULL COMMENT 'notes related to the contact',
552   `orderacquisition` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive acquisition orders',
553   `claimacquisition` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive acquisitions claims',
554   `claimissues` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive serial claims',
555   `acqprimary` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is this the primary contact for acquisitions messages',
556   `serialsprimary` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is this the primary contact for serials messages',
557   `booksellerid` int(11) NOT NULL,
558   PRIMARY KEY (`id`),
559   KEY `booksellerid_aqcontacts_fk` (`booksellerid`),
560   CONSTRAINT `booksellerid_aqcontacts_fk` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
561 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
562 /*!40101 SET character_set_client = @saved_cs_client */;
563
564 --
565 -- Table structure for table `aqcontract`
566 --
567
568 DROP TABLE IF EXISTS `aqcontract`;
569 /*!40101 SET @saved_cs_client     = @@character_set_client */;
570 /*!40101 SET character_set_client = utf8 */;
571 CREATE TABLE `aqcontract` (
572   `contractnumber` int(11) NOT NULL AUTO_INCREMENT,
573   `contractstartdate` date DEFAULT NULL,
574   `contractenddate` date DEFAULT NULL,
575   `contractname` varchar(50) DEFAULT NULL,
576   `contractdescription` longtext DEFAULT NULL,
577   `booksellerid` int(11) NOT NULL,
578   PRIMARY KEY (`contractnumber`),
579   KEY `booksellerid_fk1` (`booksellerid`),
580   CONSTRAINT `booksellerid_fk1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
581 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
582 /*!40101 SET character_set_client = @saved_cs_client */;
583
584 --
585 -- Table structure for table `aqinvoice_adjustments`
586 --
587
588 DROP TABLE IF EXISTS `aqinvoice_adjustments`;
589 /*!40101 SET @saved_cs_client     = @@character_set_client */;
590 /*!40101 SET character_set_client = utf8 */;
591 CREATE TABLE `aqinvoice_adjustments` (
592   `adjustment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key for adjustments',
593   `invoiceid` int(11) NOT NULL COMMENT 'foreign key to link an adjustment to an invoice',
594   `adjustment` decimal(28,6) DEFAULT NULL COMMENT 'amount of adjustment',
595   `reason` varchar(80) DEFAULT NULL COMMENT 'reason for adjustment defined by authorised values in ADJ_REASON category',
596   `note` mediumtext DEFAULT NULL COMMENT 'text to explain adjustment',
597   `budget_id` int(11) DEFAULT NULL COMMENT 'optional link to budget to apply adjustment to',
598   `encumber_open` smallint(1) NOT NULL DEFAULT 1 COMMENT 'whether or not to encumber the funds when invoice is still open, 1 = yes, 0 = no',
599   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'timestamp  of last adjustment to adjustment',
600   PRIMARY KEY (`adjustment_id`),
601   KEY `aqinvoice_adjustments_fk_invoiceid` (`invoiceid`),
602   KEY `aqinvoice_adjustments_fk_budget_id` (`budget_id`),
603   CONSTRAINT `aqinvoice_adjustments_fk_budget_id` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
604   CONSTRAINT `aqinvoice_adjustments_fk_invoiceid` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE CASCADE ON UPDATE CASCADE
605 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
606 /*!40101 SET character_set_client = @saved_cs_client */;
607
608 --
609 -- Table structure for table `aqinvoices`
610 --
611
612 DROP TABLE IF EXISTS `aqinvoices`;
613 /*!40101 SET @saved_cs_client     = @@character_set_client */;
614 /*!40101 SET character_set_client = utf8 */;
615 CREATE TABLE `aqinvoices` (
616   `invoiceid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the invoice, primary key',
617   `invoicenumber` longtext NOT NULL COMMENT 'Name of invoice',
618   `booksellerid` int(11) NOT NULL COMMENT 'foreign key to aqbooksellers',
619   `shipmentdate` date DEFAULT NULL COMMENT 'date of shipment',
620   `billingdate` date DEFAULT NULL COMMENT 'date of billing',
621   `closedate` date DEFAULT NULL COMMENT 'invoice close date, NULL means the invoice is open',
622   `shipmentcost` decimal(28,6) DEFAULT NULL COMMENT 'shipment cost',
623   `shipmentcost_budgetid` int(11) DEFAULT NULL COMMENT 'foreign key to aqbudgets, link the shipment cost to a budget',
624   `message_id` int(11) DEFAULT NULL COMMENT 'foreign key to edifact invoice message',
625   PRIMARY KEY (`invoiceid`),
626   KEY `aqinvoices_fk_aqbooksellerid` (`booksellerid`),
627   KEY `edifact_msg_fk` (`message_id`),
628   KEY `aqinvoices_fk_shipmentcost_budgetid` (`shipmentcost_budgetid`),
629   CONSTRAINT `aqinvoices_fk_aqbooksellerid` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
630   CONSTRAINT `aqinvoices_fk_shipmentcost_budgetid` FOREIGN KEY (`shipmentcost_budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
631   CONSTRAINT `edifact_msg_fk` FOREIGN KEY (`message_id`) REFERENCES `edifact_messages` (`id`) ON DELETE SET NULL
632 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
633 /*!40101 SET character_set_client = @saved_cs_client */;
634
635 --
636 -- Table structure for table `aqorder_users`
637 --
638
639 DROP TABLE IF EXISTS `aqorder_users`;
640 /*!40101 SET @saved_cs_client     = @@character_set_client */;
641 /*!40101 SET character_set_client = utf8 */;
642 CREATE TABLE `aqorder_users` (
643   `ordernumber` int(11) NOT NULL COMMENT 'the order this patrons receive notifications from (aqorders.ordernumber)',
644   `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber for the patron receiving notifications for this order (borrowers.borrowernumber)',
645   PRIMARY KEY (`ordernumber`,`borrowernumber`),
646   KEY `aqorder_users_ibfk_2` (`borrowernumber`),
647   CONSTRAINT `aqorder_users_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
648   CONSTRAINT `aqorder_users_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
649 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
650 /*!40101 SET character_set_client = @saved_cs_client */;
651
652 --
653 -- Table structure for table `aqorders`
654 --
655
656 DROP TABLE IF EXISTS `aqorders`;
657 /*!40101 SET @saved_cs_client     = @@character_set_client */;
658 /*!40101 SET character_set_client = utf8 */;
659 CREATE TABLE `aqorders` (
660   `ordernumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha to each line',
661   `biblionumber` int(11) DEFAULT NULL COMMENT 'links the order to the biblio being ordered (biblio.biblionumber)',
662   `entrydate` date DEFAULT NULL COMMENT 'the date the bib was added to the basket',
663   `quantity` smallint(6) DEFAULT NULL COMMENT 'the quantity ordered',
664   `currency` varchar(10) DEFAULT NULL COMMENT 'the currency used for the purchase',
665   `listprice` decimal(28,6) DEFAULT NULL COMMENT 'the vendor price for this line item',
666   `datereceived` date DEFAULT NULL COMMENT 'the date this order was received',
667   `invoiceid` int(11) DEFAULT NULL COMMENT 'id of invoice',
668   `freight` decimal(28,6) DEFAULT NULL COMMENT 'shipping costs (not used)',
669   `unitprice` decimal(28,6) DEFAULT NULL COMMENT 'the actual cost entered when receiving this line item',
670   `unitprice_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the unit price excluding tax (on receiving)',
671   `unitprice_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the unit price including tax (on receiving)',
672   `quantityreceived` smallint(6) NOT NULL DEFAULT 0 COMMENT 'the quantity that have been received so far',
673   `created_by` int(11) DEFAULT NULL COMMENT 'the borrowernumber of order line''s creator',
674   `datecancellationprinted` date DEFAULT NULL COMMENT 'the date the line item was deleted',
675   `cancellationreason` mediumtext DEFAULT NULL COMMENT 'reason of cancellation',
676   `order_internalnote` longtext DEFAULT NULL COMMENT 'notes related to this order line, made for staff',
677   `order_vendornote` longtext DEFAULT NULL COMMENT 'notes related to this order line, made for vendor',
678   `purchaseordernumber` longtext DEFAULT NULL COMMENT 'not used? always NULL',
679   `basketno` int(11) DEFAULT NULL COMMENT 'links this order line to a specific basket (aqbasket.basketno)',
680   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this order line was last modified',
681   `rrp` decimal(13,2) DEFAULT NULL COMMENT 'the retail cost for this line item',
682   `replacementprice` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost for this line item',
683   `rrp_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost excluding tax',
684   `rrp_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost including tax',
685   `ecost` decimal(13,2) DEFAULT NULL COMMENT 'the replacement cost for this line item',
686   `ecost_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the estimated cost excluding tax',
687   `ecost_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the estimated cost including tax',
688   `tax_rate_bak` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate for this line item (%)',
689   `tax_rate_on_ordering` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate on ordering for this line item (%)',
690   `tax_rate_on_receiving` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate on receiving for this line item (%)',
691   `tax_value_bak` decimal(28,6) DEFAULT NULL COMMENT 'the tax value for this line item',
692   `tax_value_on_ordering` decimal(28,6) DEFAULT NULL COMMENT 'the tax value on ordering for this line item',
693   `tax_value_on_receiving` decimal(28,6) DEFAULT NULL COMMENT 'the tax value on receiving for this line item',
694   `discount` float(6,4) DEFAULT NULL COMMENT 'the discount for this line item (%)',
695   `budget_id` int(11) NOT NULL COMMENT 'the fund this order goes against (aqbudgets.budget_id)',
696   `budgetdate` date DEFAULT NULL COMMENT 'not used? always NULL',
697   `sort1` varchar(80) DEFAULT NULL COMMENT 'statistical field',
698   `sort2` varchar(80) DEFAULT NULL COMMENT 'second statistical field',
699   `sort1_authcat` varchar(10) DEFAULT NULL,
700   `sort2_authcat` varchar(10) DEFAULT NULL,
701   `uncertainprice` tinyint(1) DEFAULT NULL COMMENT 'was this price uncertain (1 for yes, 0 for no)',
702   `subscriptionid` int(11) DEFAULT NULL COMMENT 'links this order line to a subscription (subscription.subscriptionid)',
703   `parent_ordernumber` int(11) DEFAULT NULL COMMENT 'ordernumber of parent order line, or same as ordernumber if no parent',
704   `orderstatus` varchar(16) DEFAULT 'new' COMMENT 'the current status for this line item. Can be ''new'', ''ordered'', ''partial'', ''complete'' or ''cancelled''',
705   `line_item_id` varchar(35) DEFAULT NULL COMMENT 'Supplier''s article id for Edifact orderline',
706   `suppliers_reference_number` varchar(35) DEFAULT NULL COMMENT 'Suppliers unique edifact quote ref',
707   `suppliers_reference_qualifier` varchar(3) DEFAULT NULL COMMENT 'Type of number above usually ''QLI''',
708   `suppliers_report` mediumtext DEFAULT NULL COMMENT 'reports received from suppliers',
709   `estimated_delivery_date` date DEFAULT NULL COMMENT 'Estimated delivery date',
710   `invoice_unitprice` decimal(28,6) DEFAULT NULL COMMENT 'the unit price in foreign currency',
711   `invoice_currency` varchar(10) DEFAULT NULL COMMENT 'the currency of the invoice_unitprice',
712   PRIMARY KEY (`ordernumber`),
713   KEY `basketno` (`basketno`),
714   KEY `biblionumber` (`biblionumber`),
715   KEY `budget_id` (`budget_id`),
716   KEY `parent_ordernumber` (`parent_ordernumber`),
717   KEY `orderstatus` (`orderstatus`),
718   KEY `aqorders_created_by` (`created_by`),
719   KEY `aqorders_ibfk_3` (`invoiceid`),
720   KEY `aqorders_subscriptionid` (`subscriptionid`),
721   KEY `aqorders_currency` (`currency`),
722   CONSTRAINT `aqorders_budget_id_fk` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
723   CONSTRAINT `aqorders_created_by` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
724   CONSTRAINT `aqorders_currency` FOREIGN KEY (`currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
725   CONSTRAINT `aqorders_invoice_currency` FOREIGN KEY (`invoice_currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
726   CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
727   CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
728   CONSTRAINT `aqorders_ibfk_3` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE SET NULL ON UPDATE CASCADE,
729   CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
730 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
731 /*!40101 SET character_set_client = @saved_cs_client */;
732
733 --
734 -- Table structure for table `aqorders_claims`
735 --
736
737 DROP TABLE IF EXISTS `aqorders_claims`;
738 /*!40101 SET @saved_cs_client     = @@character_set_client */;
739 /*!40101 SET character_set_client = utf8 */;
740 CREATE TABLE `aqorders_claims` (
741   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the claims',
742   `ordernumber` int(11) NOT NULL COMMENT 'order linked to this claim',
743   `claimed_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date of the claims',
744   PRIMARY KEY (`id`),
745   KEY `aqorders_claims_ibfk_1` (`ordernumber`),
746   CONSTRAINT `aqorders_claims_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE
747 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
748 /*!40101 SET character_set_client = @saved_cs_client */;
749
750 --
751 -- Table structure for table `aqorders_items`
752 --
753
754 DROP TABLE IF EXISTS `aqorders_items`;
755 /*!40101 SET @saved_cs_client     = @@character_set_client */;
756 /*!40101 SET character_set_client = utf8 */;
757 CREATE TABLE `aqorders_items` (
758   `ordernumber` int(11) NOT NULL COMMENT 'the order this item is attached to (aqorders.ordernumber)',
759   `itemnumber` int(11) NOT NULL COMMENT 'the item number for this item (items.itemnumber)',
760   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this order item was last touched',
761   PRIMARY KEY (`itemnumber`),
762   KEY `ordernumber` (`ordernumber`),
763   CONSTRAINT `aqorders_items_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE
764 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
765 /*!40101 SET character_set_client = @saved_cs_client */;
766
767 --
768 -- Table structure for table `aqorders_transfers`
769 --
770
771 DROP TABLE IF EXISTS `aqorders_transfers`;
772 /*!40101 SET @saved_cs_client     = @@character_set_client */;
773 /*!40101 SET character_set_client = utf8 */;
774 CREATE TABLE `aqorders_transfers` (
775   `ordernumber_from` int(11) DEFAULT NULL,
776   `ordernumber_to` int(11) DEFAULT NULL,
777   `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
778   UNIQUE KEY `ordernumber_from` (`ordernumber_from`),
779   UNIQUE KEY `ordernumber_to` (`ordernumber_to`),
780   CONSTRAINT `aqorders_transfers_ordernumber_from` FOREIGN KEY (`ordernumber_from`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
781   CONSTRAINT `aqorders_transfers_ordernumber_to` FOREIGN KEY (`ordernumber_to`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE
782 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
783 /*!40101 SET character_set_client = @saved_cs_client */;
784
785 --
786 -- Table structure for table `article_requests`
787 --
788
789 DROP TABLE IF EXISTS `article_requests`;
790 /*!40101 SET @saved_cs_client     = @@character_set_client */;
791 /*!40101 SET character_set_client = utf8 */;
792 CREATE TABLE `article_requests` (
793   `id` int(11) NOT NULL AUTO_INCREMENT,
794   `borrowernumber` int(11) NOT NULL,
795   `biblionumber` int(11) NOT NULL,
796   `itemnumber` int(11) DEFAULT NULL,
797   `branchcode` varchar(10) DEFAULT NULL,
798   `title` mediumtext DEFAULT NULL,
799   `author` mediumtext DEFAULT NULL,
800   `volume` mediumtext DEFAULT NULL,
801   `issue` mediumtext DEFAULT NULL,
802   `date` mediumtext DEFAULT NULL,
803   `pages` mediumtext DEFAULT NULL,
804   `chapters` mediumtext DEFAULT NULL,
805   `patron_notes` mediumtext DEFAULT NULL,
806   `status` enum('REQUESTED','PENDING','PROCESSING','COMPLETED','CANCELED') NOT NULL DEFAULT 'REQUESTED',
807   `notes` mediumtext DEFAULT NULL,
808   `format` enum('PHOTOCOPY','SCAN') NOT NULL DEFAULT 'PHOTOCOPY',
809   `urls` mediumtext DEFAULT NULL,
810   `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value AR_CANCELLATION',
811   `debit_id` int(11) DEFAULT NULL COMMENT 'Debit line with cost for article scan request',
812   `created_on` timestamp NULL DEFAULT NULL COMMENT 'Be careful with two timestamps in one table not allowing NULL',
813   `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
814   `toc_request` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'borrower requested table of contents',
815   PRIMARY KEY (`id`),
816   KEY `borrowernumber` (`borrowernumber`),
817   KEY `biblionumber` (`biblionumber`),
818   KEY `itemnumber` (`itemnumber`),
819   KEY `branchcode` (`branchcode`),
820   KEY `debit_id` (`debit_id`),
821   CONSTRAINT `article_requests_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
822   CONSTRAINT `article_requests_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
823   CONSTRAINT `article_requests_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
824   CONSTRAINT `article_requests_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
825   CONSTRAINT `article_requests_ibfk_5` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE SET NULL ON UPDATE CASCADE
826 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
827 /*!40101 SET character_set_client = @saved_cs_client */;
828
829 --
830 -- Table structure for table `audio_alerts`
831 --
832
833 DROP TABLE IF EXISTS `audio_alerts`;
834 /*!40101 SET @saved_cs_client     = @@character_set_client */;
835 /*!40101 SET character_set_client = utf8 */;
836 CREATE TABLE `audio_alerts` (
837   `id` int(11) NOT NULL AUTO_INCREMENT,
838   `precedence` smallint(5) unsigned NOT NULL,
839   `selector` varchar(255) NOT NULL,
840   `sound` varchar(255) NOT NULL,
841   PRIMARY KEY (`id`),
842   KEY `precedence` (`precedence`)
843 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
844 /*!40101 SET character_set_client = @saved_cs_client */;
845
846 --
847 -- Table structure for table `auth_header`
848 --
849
850 DROP TABLE IF EXISTS `auth_header`;
851 /*!40101 SET @saved_cs_client     = @@character_set_client */;
852 /*!40101 SET character_set_client = utf8 */;
853 CREATE TABLE `auth_header` (
854   `authid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
855   `authtypecode` varchar(10) NOT NULL DEFAULT '',
856   `datecreated` date DEFAULT NULL,
857   `modification_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
858   `origincode` varchar(20) DEFAULT NULL,
859   `authtrees` longtext DEFAULT NULL,
860   `marc` blob DEFAULT NULL,
861   `linkid` bigint(20) DEFAULT NULL,
862   `marcxml` longtext NOT NULL,
863   PRIMARY KEY (`authid`),
864   KEY `origincode` (`origincode`)
865 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
866 /*!40101 SET character_set_client = @saved_cs_client */;
867
868 --
869 -- Table structure for table `auth_subfield_structure`
870 --
871
872 DROP TABLE IF EXISTS `auth_subfield_structure`;
873 /*!40101 SET @saved_cs_client     = @@character_set_client */;
874 /*!40101 SET character_set_client = utf8 */;
875 CREATE TABLE `auth_subfield_structure` (
876   `authtypecode` varchar(10) NOT NULL DEFAULT '',
877   `tagfield` varchar(3) NOT NULL DEFAULT '',
878   `tagsubfield` varchar(1) NOT NULL DEFAULT '',
879   `liblibrarian` varchar(255) NOT NULL DEFAULT '',
880   `libopac` varchar(255) NOT NULL DEFAULT '',
881   `repeatable` tinyint(4) NOT NULL DEFAULT 0,
882   `mandatory` tinyint(4) NOT NULL DEFAULT 0,
883   `tab` tinyint(1) DEFAULT NULL,
884   `authorised_value` varchar(32) DEFAULT NULL,
885   `value_builder` varchar(80) DEFAULT NULL,
886   `seealso` varchar(255) DEFAULT NULL,
887   `isurl` tinyint(1) DEFAULT NULL,
888   `hidden` tinyint(3) NOT NULL DEFAULT 0,
889   `linkid` tinyint(1) NOT NULL DEFAULT 0,
890   `kohafield` varchar(45) DEFAULT '',
891   `frameworkcode` varchar(10) NOT NULL DEFAULT '',
892   `defaultvalue` mediumtext DEFAULT NULL,
893   `display_order` int(2) NOT NULL DEFAULT 0,
894   PRIMARY KEY (`authtypecode`,`tagfield`,`tagsubfield`),
895   KEY `tab` (`authtypecode`,`tab`),
896   CONSTRAINT `auth_subfield_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
897 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
898 /*!40101 SET character_set_client = @saved_cs_client */;
899
900 --
901 -- Table structure for table `auth_tag_structure`
902 --
903
904 DROP TABLE IF EXISTS `auth_tag_structure`;
905 /*!40101 SET @saved_cs_client     = @@character_set_client */;
906 /*!40101 SET character_set_client = utf8 */;
907 CREATE TABLE `auth_tag_structure` (
908   `authtypecode` varchar(10) NOT NULL DEFAULT '',
909   `tagfield` varchar(3) NOT NULL DEFAULT '',
910   `liblibrarian` varchar(255) NOT NULL DEFAULT '',
911   `libopac` varchar(255) NOT NULL DEFAULT '',
912   `repeatable` tinyint(4) NOT NULL DEFAULT 0,
913   `mandatory` tinyint(4) NOT NULL DEFAULT 0,
914   `authorised_value` varchar(32) DEFAULT NULL,
915   PRIMARY KEY (`authtypecode`,`tagfield`),
916   CONSTRAINT `auth_tag_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
917 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
918 /*!40101 SET character_set_client = @saved_cs_client */;
919
920 --
921 -- Table structure for table `auth_types`
922 --
923
924 DROP TABLE IF EXISTS `auth_types`;
925 /*!40101 SET @saved_cs_client     = @@character_set_client */;
926 /*!40101 SET character_set_client = utf8 */;
927 CREATE TABLE `auth_types` (
928   `authtypecode` varchar(10) NOT NULL DEFAULT '',
929   `authtypetext` varchar(255) NOT NULL DEFAULT '',
930   `auth_tag_to_report` varchar(3) NOT NULL DEFAULT '',
931   `summary` longtext NOT NULL,
932   PRIMARY KEY (`authtypecode`)
933 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
934 /*!40101 SET character_set_client = @saved_cs_client */;
935
936 --
937 -- Table structure for table `authorised_value_categories`
938 --
939
940 DROP TABLE IF EXISTS `authorised_value_categories`;
941 /*!40101 SET @saved_cs_client     = @@character_set_client */;
942 /*!40101 SET character_set_client = utf8 */;
943 CREATE TABLE `authorised_value_categories` (
944   `category_name` varchar(32) NOT NULL DEFAULT '',
945   `is_system` tinyint(1) DEFAULT 0,
946   PRIMARY KEY (`category_name`)
947 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
948 /*!40101 SET character_set_client = @saved_cs_client */;
949
950 --
951 -- Table structure for table `authorised_values`
952 --
953
954 DROP TABLE IF EXISTS `authorised_values`;
955 /*!40101 SET @saved_cs_client     = @@character_set_client */;
956 /*!40101 SET character_set_client = utf8 */;
957 CREATE TABLE `authorised_values` (
958   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify the authorized value',
959   `category` varchar(32) NOT NULL DEFAULT '' COMMENT 'key used to identify the authorized value category',
960   `authorised_value` varchar(80) NOT NULL DEFAULT '' COMMENT 'code use to identify the authorized value',
961   `lib` varchar(200) DEFAULT NULL COMMENT 'authorized value description as printed in the staff interface',
962   `lib_opac` varchar(200) DEFAULT NULL COMMENT 'authorized value description as printed in the OPAC',
963   `imageurl` varchar(200) DEFAULT NULL COMMENT 'authorized value URL',
964   PRIMARY KEY (`id`),
965   UNIQUE KEY `av_uniq` (`category`,`authorised_value`),
966   KEY `name` (`category`),
967   KEY `lib` (`lib`(191)),
968   KEY `auth_value_idx` (`authorised_value`),
969   CONSTRAINT `authorised_values_authorised_values_category` FOREIGN KEY (`category`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE CASCADE ON UPDATE CASCADE
970 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
971 /*!40101 SET character_set_client = @saved_cs_client */;
972
973 --
974 -- Table structure for table `authorised_values_branches`
975 --
976
977 DROP TABLE IF EXISTS `authorised_values_branches`;
978 /*!40101 SET @saved_cs_client     = @@character_set_client */;
979 /*!40101 SET character_set_client = utf8 */;
980 CREATE TABLE `authorised_values_branches` (
981   `av_id` int(11) NOT NULL,
982   `branchcode` varchar(10) NOT NULL,
983   KEY `av_id` (`av_id`),
984   KEY `branchcode` (`branchcode`),
985   CONSTRAINT `authorised_values_branches_ibfk_1` FOREIGN KEY (`av_id`) REFERENCES `authorised_values` (`id`) ON DELETE CASCADE,
986   CONSTRAINT `authorised_values_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
987 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
988 /*!40101 SET character_set_client = @saved_cs_client */;
989
990 --
991 -- Table structure for table `background_jobs`
992 --
993
994 DROP TABLE IF EXISTS `background_jobs`;
995 /*!40101 SET @saved_cs_client     = @@character_set_client */;
996 /*!40101 SET character_set_client = utf8 */;
997 CREATE TABLE `background_jobs` (
998   `id` int(11) NOT NULL AUTO_INCREMENT,
999   `status` varchar(32) DEFAULT NULL,
1000   `progress` int(11) DEFAULT NULL,
1001   `size` int(11) DEFAULT NULL,
1002   `borrowernumber` int(11) DEFAULT NULL,
1003   `type` varchar(64) DEFAULT NULL,
1004   `queue` varchar(191) NOT NULL DEFAULT 'default' COMMENT 'Name of the queue the job is sent to',
1005   `data` longtext DEFAULT NULL,
1006   `context` longtext DEFAULT NULL COMMENT 'JSON-serialized context information for the job',
1007   `enqueued_on` datetime DEFAULT NULL,
1008   `started_on` datetime DEFAULT NULL,
1009   `ended_on` datetime DEFAULT NULL,
1010   PRIMARY KEY (`id`),
1011   KEY `borrowernumber` (`borrowernumber`),
1012   KEY `queue` (`queue`),
1013   KEY `status` (`status`)
1014 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1015 /*!40101 SET character_set_client = @saved_cs_client */;
1016
1017 --
1018 -- Table structure for table `biblio`
1019 --
1020
1021 DROP TABLE IF EXISTS `biblio`;
1022 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1023 /*!40101 SET character_set_client = utf8 */;
1024 CREATE TABLE `biblio` (
1025   `biblionumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned to each bibliographic record',
1026   `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'foreign key from the biblio_framework table to identify which framework was used in cataloging this record',
1027   `author` longtext DEFAULT NULL COMMENT 'statement of responsibility from MARC record (100$a in MARC21)',
1028   `title` longtext DEFAULT NULL COMMENT 'title (without the subtitle) from the MARC record (245$a in MARC21)',
1029   `medium` longtext DEFAULT NULL COMMENT 'medium from the MARC record (245$h in MARC21)',
1030   `subtitle` longtext DEFAULT NULL COMMENT 'remainder of the title from the MARC record (245$b in MARC21)',
1031   `part_number` longtext DEFAULT NULL COMMENT 'part number from the MARC record (245$n in MARC21)',
1032   `part_name` longtext DEFAULT NULL COMMENT 'part name from the MARC record (245$p in MARC21)',
1033   `unititle` longtext DEFAULT NULL COMMENT 'uniform title (without the subtitle) from the MARC record (240$a in MARC21)',
1034   `notes` longtext DEFAULT NULL COMMENT 'values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)',
1035   `serial` tinyint(1) DEFAULT NULL COMMENT 'Boolean indicating whether biblio is for a serial',
1036   `seriestitle` longtext DEFAULT NULL,
1037   `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'publication or copyright date from the MARC record',
1038   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
1039   `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
1040   `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
1041   PRIMARY KEY (`biblionumber`),
1042   KEY `blbnoidx` (`biblionumber`)
1043 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1044 /*!40101 SET character_set_client = @saved_cs_client */;
1045
1046 --
1047 -- Table structure for table `biblio_framework`
1048 --
1049
1050 DROP TABLE IF EXISTS `biblio_framework`;
1051 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1052 /*!40101 SET character_set_client = utf8 */;
1053 CREATE TABLE `biblio_framework` (
1054   `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'the unique code assigned to the framework',
1055   `frameworktext` varchar(255) NOT NULL DEFAULT '' COMMENT 'the description/name given to the framework',
1056   PRIMARY KEY (`frameworkcode`)
1057 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1058 /*!40101 SET character_set_client = @saved_cs_client */;
1059
1060 --
1061 -- Table structure for table `biblio_metadata`
1062 --
1063
1064 DROP TABLE IF EXISTS `biblio_metadata`;
1065 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1066 /*!40101 SET character_set_client = utf8 */;
1067 CREATE TABLE `biblio_metadata` (
1068   `id` int(11) NOT NULL AUTO_INCREMENT,
1069   `biblionumber` int(11) NOT NULL,
1070   `format` varchar(16) NOT NULL,
1071   `schema` varchar(16) NOT NULL,
1072   `metadata` longtext NOT NULL,
1073   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1074   PRIMARY KEY (`id`),
1075   UNIQUE KEY `biblio_metadata_uniq_key` (`biblionumber`,`format`,`schema`),
1076   KEY `timestamp` (`timestamp`),
1077   CONSTRAINT `record_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1078 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1079 /*!40101 SET character_set_client = @saved_cs_client */;
1080
1081 --
1082 -- Table structure for table `biblioitems`
1083 --
1084
1085 DROP TABLE IF EXISTS `biblioitems`;
1086 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1087 /*!40101 SET character_set_client = utf8 */;
1088 CREATE TABLE `biblioitems` (
1089   `biblioitemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, unique identifier assigned by Koha',
1090   `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the biblio table',
1091   `volume` longtext DEFAULT NULL,
1092   `number` longtext DEFAULT NULL,
1093   `itemtype` varchar(10) DEFAULT NULL COMMENT 'biblio level item type (MARC21 942$c)',
1094   `isbn` longtext DEFAULT NULL COMMENT 'ISBN (MARC21 020$a)',
1095   `issn` longtext DEFAULT NULL COMMENT 'ISSN (MARC21 022$a)',
1096   `ean` longtext DEFAULT NULL,
1097   `publicationyear` mediumtext DEFAULT NULL,
1098   `publishercode` varchar(255) DEFAULT NULL COMMENT 'publisher (MARC21 260$b)',
1099   `volumedate` date DEFAULT NULL,
1100   `volumedesc` mediumtext DEFAULT NULL COMMENT 'volume information (MARC21 362$a)',
1101   `collectiontitle` longtext DEFAULT NULL,
1102   `collectionissn` mediumtext DEFAULT NULL,
1103   `collectionvolume` longtext DEFAULT NULL,
1104   `editionstatement` mediumtext DEFAULT NULL,
1105   `editionresponsibility` mediumtext DEFAULT NULL,
1106   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1107   `illus` varchar(255) DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)',
1108   `pages` varchar(255) DEFAULT NULL COMMENT 'number of pages (MARC21 300$c)',
1109   `notes` longtext DEFAULT NULL,
1110   `size` varchar(255) DEFAULT NULL COMMENT 'material size (MARC21 300$c)',
1111   `place` varchar(255) DEFAULT NULL COMMENT 'publication place (MARC21 260$a)',
1112   `lccn` varchar(25) DEFAULT NULL COMMENT 'library of congress control number (MARC21 010$a)',
1113   `url` mediumtext DEFAULT NULL COMMENT 'url (MARC21 856$u)',
1114   `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source (MARC21 942$2)',
1115   `cn_class` varchar(30) DEFAULT NULL,
1116   `cn_item` varchar(10) DEFAULT NULL,
1117   `cn_suffix` varchar(10) DEFAULT NULL,
1118   `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized version of the call number used for sorting',
1119   `agerestriction` varchar(255) DEFAULT NULL COMMENT 'target audience/age restriction from the bib record (MARC21 521$a)',
1120   `totalissues` int(10) DEFAULT NULL,
1121   PRIMARY KEY (`biblioitemnumber`),
1122   KEY `bibinoidx` (`biblioitemnumber`),
1123   KEY `bibnoidx` (`biblionumber`),
1124   KEY `itemtype_idx` (`itemtype`),
1125   KEY `isbn` (`isbn`(191)),
1126   KEY `issn` (`issn`(191)),
1127   KEY `ean` (`ean`(191)),
1128   KEY `publishercode` (`publishercode`(191)),
1129   KEY `timestamp` (`timestamp`),
1130   CONSTRAINT `biblioitems_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1131 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1132 /*!40101 SET character_set_client = @saved_cs_client */;
1133
1134 --
1135 -- Table structure for table `borrower_attribute_types`
1136 --
1137
1138 DROP TABLE IF EXISTS `borrower_attribute_types`;
1139 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1140 /*!40101 SET character_set_client = utf8 */;
1141 CREATE TABLE `borrower_attribute_types` (
1142   `code` varchar(10) NOT NULL COMMENT 'unique key used to identify each custom field',
1143   `description` varchar(255) NOT NULL COMMENT 'description for each custom field',
1144   `repeatable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines whether one patron/borrower can have multiple values for this custom field  (1 for yes, 0 for no)',
1145   `unique_id` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this value needs to be unique (1 for yes, 0 for no)',
1146   `opac_display` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is visible to patrons on their account in the OPAC (1 for yes, 0 for no)',
1147   `opac_editable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is editable by patrons on their account in the OPAC (1 for yes, 0 for no)',
1148   `staff_searchable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is searchable via the patron search in the staff interface (1 for yes, 0 for no)',
1149   `authorised_value_category` varchar(32) DEFAULT NULL COMMENT 'foreign key from authorised_values that links this custom field to an authorized value category',
1150   `display_checkout` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field displays in checkout screens',
1151   `category_code` varchar(10) DEFAULT NULL COMMENT 'defines a category for an attribute_type',
1152   `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1153   `keep_for_pseudonymization` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is copied to anonymized_borrower_attributes (1 for yes, 0 for no)',
1154   `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1155   PRIMARY KEY (`code`),
1156   KEY `auth_val_cat_idx` (`authorised_value_category`),
1157   KEY `category_code` (`category_code`),
1158   CONSTRAINT `borrower_attribute_types_ibfk_1` FOREIGN KEY (`category_code`) REFERENCES `categories` (`categorycode`)
1159 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1160 /*!40101 SET character_set_client = @saved_cs_client */;
1161
1162 --
1163 -- Table structure for table `borrower_attribute_types_branches`
1164 --
1165
1166 DROP TABLE IF EXISTS `borrower_attribute_types_branches`;
1167 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1168 /*!40101 SET character_set_client = utf8 */;
1169 CREATE TABLE `borrower_attribute_types_branches` (
1170   `bat_code` varchar(10) DEFAULT NULL,
1171   `b_branchcode` varchar(10) DEFAULT NULL,
1172   KEY `bat_code` (`bat_code`),
1173   KEY `b_branchcode` (`b_branchcode`),
1174   CONSTRAINT `borrower_attribute_types_branches_ibfk_1` FOREIGN KEY (`bat_code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE,
1175   CONSTRAINT `borrower_attribute_types_branches_ibfk_2` FOREIGN KEY (`b_branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1176 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1177 /*!40101 SET character_set_client = @saved_cs_client */;
1178
1179 --
1180 -- Table structure for table `borrower_attributes`
1181 --
1182
1183 DROP TABLE IF EXISTS `borrower_attributes`;
1184 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1185 /*!40101 SET character_set_client = utf8 */;
1186 CREATE TABLE `borrower_attributes` (
1187   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
1188   `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines which patron/borrower has this attribute',
1189   `code` varchar(10) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
1190   `attribute` varchar(255) DEFAULT NULL COMMENT 'custom patron field value',
1191   PRIMARY KEY (`id`),
1192   KEY `borrowernumber` (`borrowernumber`),
1193   KEY `code_attribute` (`code`,`attribute`(191)),
1194   CONSTRAINT `borrower_attributes_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1195   CONSTRAINT `borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE
1196 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1197 /*!40101 SET character_set_client = @saved_cs_client */;
1198
1199 --
1200 -- Table structure for table `borrower_debarments`
1201 --
1202
1203 DROP TABLE IF EXISTS `borrower_debarments`;
1204 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1205 /*!40101 SET character_set_client = utf8 */;
1206 CREATE TABLE `borrower_debarments` (
1207   `borrower_debarment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the restriction',
1208   `borrowernumber` int(11) NOT NULL COMMENT 'foreign key for borrowers.borrowernumber for patron who is restricted',
1209   `expiration` date DEFAULT NULL COMMENT 'expiration date of the restriction',
1210   `type` varchar(50) NOT NULL COMMENT 'type of restriction, FK to restriction_types.code',
1211   `comment` mediumtext DEFAULT NULL COMMENT 'comments about the restriction',
1212   `manager_id` int(11) DEFAULT NULL COMMENT 'foreign key for borrowers.borrowernumber for the librarian managing the restriction',
1213   `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date the restriction was added',
1214   `updated` timestamp NULL DEFAULT NULL COMMENT 'date the restriction was updated',
1215   PRIMARY KEY (`borrower_debarment_id`),
1216   KEY `borrowernumber` (`borrowernumber`),
1217   KEY `borrower_debarments_ibfk_2` (`type`),
1218   CONSTRAINT `borrower_debarments_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1219   CONSTRAINT `borrower_debarments_ibfk_2` FOREIGN KEY (`type`) REFERENCES `restriction_types` (`code`) ON DELETE NO ACTION ON UPDATE CASCADE
1220 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1221 /*!40101 SET character_set_client = @saved_cs_client */;
1222
1223 --
1224 -- Table structure for table `borrower_files`
1225 --
1226
1227 DROP TABLE IF EXISTS `borrower_files`;
1228 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1229 /*!40101 SET character_set_client = utf8 */;
1230 CREATE TABLE `borrower_files` (
1231   `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
1232   `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking to the patron via the borrowernumber',
1233   `file_name` varchar(255) NOT NULL COMMENT 'file name',
1234   `file_type` varchar(255) NOT NULL COMMENT 'type of file',
1235   `file_description` varchar(255) DEFAULT NULL COMMENT 'description given to the file',
1236   `file_content` longblob NOT NULL COMMENT 'the file',
1237   `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
1238   PRIMARY KEY (`file_id`),
1239   KEY `borrowernumber` (`borrowernumber`),
1240   CONSTRAINT `borrower_files_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1241 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1242 /*!40101 SET character_set_client = @saved_cs_client */;
1243
1244 --
1245 -- Table structure for table `borrower_message_preferences`
1246 --
1247
1248 DROP TABLE IF EXISTS `borrower_message_preferences`;
1249 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1250 /*!40101 SET character_set_client = utf8 */;
1251 CREATE TABLE `borrower_message_preferences` (
1252   `borrower_message_preference_id` int(11) NOT NULL AUTO_INCREMENT,
1253   `borrowernumber` int(11) DEFAULT NULL,
1254   `categorycode` varchar(10) DEFAULT NULL,
1255   `message_attribute_id` int(11) DEFAULT 0,
1256   `days_in_advance` int(11) DEFAULT 0,
1257   `wants_digest` tinyint(1) NOT NULL DEFAULT 0,
1258   PRIMARY KEY (`borrower_message_preference_id`),
1259   KEY `borrowernumber` (`borrowernumber`),
1260   KEY `categorycode` (`categorycode`),
1261   KEY `message_attribute_id` (`message_attribute_id`),
1262   CONSTRAINT `borrower_message_preferences_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1263   CONSTRAINT `borrower_message_preferences_ibfk_2` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1264   CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
1265 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1266 /*!40101 SET character_set_client = @saved_cs_client */;
1267
1268 --
1269 -- Table structure for table `borrower_message_transport_preferences`
1270 --
1271
1272 DROP TABLE IF EXISTS `borrower_message_transport_preferences`;
1273 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1274 /*!40101 SET character_set_client = utf8 */;
1275 CREATE TABLE `borrower_message_transport_preferences` (
1276   `borrower_message_preference_id` int(11) NOT NULL DEFAULT 0,
1277   `message_transport_type` varchar(20) NOT NULL DEFAULT '0',
1278   PRIMARY KEY (`borrower_message_preference_id`,`message_transport_type`),
1279   KEY `message_transport_type` (`message_transport_type`),
1280   CONSTRAINT `borrower_message_transport_preferences_ibfk_1` FOREIGN KEY (`borrower_message_preference_id`) REFERENCES `borrower_message_preferences` (`borrower_message_preference_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1281   CONSTRAINT `borrower_message_transport_preferences_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
1282 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1283 /*!40101 SET character_set_client = @saved_cs_client */;
1284
1285 --
1286 -- Table structure for table `borrower_modifications`
1287 --
1288
1289 DROP TABLE IF EXISTS `borrower_modifications`;
1290 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1291 /*!40101 SET character_set_client = utf8 */;
1292 CREATE TABLE `borrower_modifications` (
1293   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1294   `verification_token` varchar(255) NOT NULL DEFAULT '',
1295   `changed_fields` mediumtext DEFAULT NULL,
1296   `borrowernumber` int(11) NOT NULL DEFAULT 0,
1297   `cardnumber` varchar(32) DEFAULT NULL,
1298   `surname` longtext DEFAULT NULL,
1299   `firstname` mediumtext DEFAULT NULL,
1300   `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1301   `title` longtext DEFAULT NULL,
1302   `othernames` longtext DEFAULT NULL,
1303   `initials` mediumtext DEFAULT NULL,
1304   `pronouns` longtext DEFAULT NULL,
1305   `streetnumber` varchar(10) DEFAULT NULL,
1306   `streettype` varchar(50) DEFAULT NULL,
1307   `address` longtext DEFAULT NULL,
1308   `address2` mediumtext DEFAULT NULL,
1309   `city` longtext DEFAULT NULL,
1310   `state` mediumtext DEFAULT NULL,
1311   `zipcode` varchar(25) DEFAULT NULL,
1312   `country` mediumtext DEFAULT NULL,
1313   `email` longtext DEFAULT NULL,
1314   `phone` mediumtext DEFAULT NULL,
1315   `mobile` varchar(50) DEFAULT NULL,
1316   `fax` longtext DEFAULT NULL,
1317   `emailpro` mediumtext DEFAULT NULL,
1318   `phonepro` mediumtext DEFAULT NULL,
1319   `B_streetnumber` varchar(10) DEFAULT NULL,
1320   `B_streettype` varchar(50) DEFAULT NULL,
1321   `B_address` varchar(100) DEFAULT NULL,
1322   `B_address2` mediumtext DEFAULT NULL,
1323   `B_city` longtext DEFAULT NULL,
1324   `B_state` mediumtext DEFAULT NULL,
1325   `B_zipcode` varchar(25) DEFAULT NULL,
1326   `B_country` mediumtext DEFAULT NULL,
1327   `B_email` mediumtext DEFAULT NULL,
1328   `B_phone` longtext DEFAULT NULL,
1329   `dateofbirth` date DEFAULT NULL,
1330   `branchcode` varchar(10) DEFAULT NULL,
1331   `categorycode` varchar(10) DEFAULT NULL,
1332   `dateenrolled` date DEFAULT NULL,
1333   `dateexpiry` date DEFAULT NULL,
1334   `date_renewed` date DEFAULT NULL,
1335   `gonenoaddress` tinyint(1) DEFAULT NULL,
1336   `lost` tinyint(1) DEFAULT NULL,
1337   `debarred` date DEFAULT NULL,
1338   `debarredcomment` varchar(255) DEFAULT NULL,
1339   `contactname` longtext DEFAULT NULL,
1340   `contactfirstname` mediumtext DEFAULT NULL,
1341   `contacttitle` mediumtext DEFAULT NULL,
1342   `borrowernotes` longtext DEFAULT NULL,
1343   `relationship` varchar(100) DEFAULT NULL,
1344   `sex` varchar(1) DEFAULT NULL,
1345   `password` varchar(30) DEFAULT NULL,
1346   `flags` bigint(11) DEFAULT NULL,
1347   `userid` varchar(75) DEFAULT NULL,
1348   `opacnote` longtext DEFAULT NULL,
1349   `contactnote` varchar(255) DEFAULT NULL,
1350   `sort1` varchar(80) DEFAULT NULL,
1351   `sort2` varchar(80) DEFAULT NULL,
1352   `altcontactfirstname` varchar(255) DEFAULT NULL,
1353   `altcontactsurname` varchar(255) DEFAULT NULL,
1354   `altcontactaddress1` varchar(255) DEFAULT NULL,
1355   `altcontactaddress2` varchar(255) DEFAULT NULL,
1356   `altcontactaddress3` varchar(255) DEFAULT NULL,
1357   `altcontactstate` mediumtext DEFAULT NULL,
1358   `altcontactzipcode` varchar(50) DEFAULT NULL,
1359   `altcontactcountry` mediumtext DEFAULT NULL,
1360   `altcontactphone` varchar(50) DEFAULT NULL,
1361   `smsalertnumber` varchar(50) DEFAULT NULL,
1362   `privacy` int(11) DEFAULT NULL,
1363   `extended_attributes` mediumtext DEFAULT NULL,
1364   `gdpr_proc_consent` datetime DEFAULT NULL COMMENT 'data processing consent',
1365   `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1366   PRIMARY KEY (`verification_token`(191),`borrowernumber`),
1367   KEY `verification_token` (`verification_token`(191)),
1368   KEY `borrowernumber` (`borrowernumber`)
1369 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1370 /*!40101 SET character_set_client = @saved_cs_client */;
1371
1372 --
1373 -- Table structure for table `borrower_password_recovery`
1374 --
1375
1376 DROP TABLE IF EXISTS `borrower_password_recovery`;
1377 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1378 /*!40101 SET character_set_client = utf8 */;
1379 CREATE TABLE `borrower_password_recovery` (
1380   `borrowernumber` int(11) NOT NULL COMMENT 'the user asking a password recovery',
1381   `uuid` varchar(128) NOT NULL COMMENT 'a unique string to identify a password recovery attempt',
1382   `valid_until` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'a time limit on the password recovery attempt',
1383   PRIMARY KEY (`borrowernumber`),
1384   KEY `borrowernumber` (`borrowernumber`)
1385 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1386 /*!40101 SET character_set_client = @saved_cs_client */;
1387
1388 --
1389 -- Table structure for table `borrower_relationships`
1390 --
1391
1392 DROP TABLE IF EXISTS `borrower_relationships`;
1393 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1394 /*!40101 SET character_set_client = utf8 */;
1395 CREATE TABLE `borrower_relationships` (
1396   `id` int(11) NOT NULL AUTO_INCREMENT,
1397   `guarantor_id` int(11) NOT NULL,
1398   `guarantee_id` int(11) NOT NULL,
1399   `relationship` varchar(100) NOT NULL,
1400   PRIMARY KEY (`id`),
1401   UNIQUE KEY `guarantor_guarantee_idx` (`guarantor_id`,`guarantee_id`),
1402   KEY `r_guarantee` (`guarantee_id`),
1403   CONSTRAINT `r_guarantee` FOREIGN KEY (`guarantee_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1404   CONSTRAINT `r_guarantor` FOREIGN KEY (`guarantor_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1405 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1406 /*!40101 SET character_set_client = @saved_cs_client */;
1407
1408 --
1409 -- Table structure for table `borrowers`
1410 --
1411
1412 DROP TABLE IF EXISTS `borrowers`;
1413 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1414 /*!40101 SET character_set_client = utf8 */;
1415 CREATE TABLE `borrowers` (
1416   `borrowernumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, Koha assigned ID number for patrons/borrowers',
1417   `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
1418   `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1419   `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
1420   `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1421   `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1422   `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
1423   `initials` mediumtext DEFAULT NULL COMMENT 'initials for your patron/borrower',
1424   `pronouns` longtext DEFAULT NULL COMMENT 'patron/borrower pronouns',
1425   `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',
1426   `streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s primary address',
1427   `address` longtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s primary address',
1428   `address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s primary address',
1429   `city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s primary address',
1430   `state` mediumtext DEFAULT NULL COMMENT 'the state or province for your patron/borrower''s primary address',
1431   `zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s primary address',
1432   `country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s primary address',
1433   `email` longtext DEFAULT NULL COMMENT 'the primary email address for your patron/borrower''s primary address',
1434   `phone` mediumtext DEFAULT NULL COMMENT 'the primary phone number for your patron/borrower''s primary address',
1435   `mobile` tinytext DEFAULT NULL COMMENT 'the other phone number for your patron/borrower''s primary address',
1436   `fax` longtext DEFAULT NULL COMMENT 'the fax number for your patron/borrower''s primary address',
1437   `emailpro` mediumtext DEFAULT NULL COMMENT 'the secondary email addres for your patron/borrower''s primary address',
1438   `phonepro` mediumtext DEFAULT NULL COMMENT 'the secondary phone number for your patron/borrower''s primary address',
1439   `B_streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address',
1440   `B_streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s alternate address',
1441   `B_address` mediumtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s alternate address',
1442   `B_address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s alternate address',
1443   `B_city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s alternate address',
1444   `B_state` mediumtext DEFAULT NULL COMMENT 'the state for your patron/borrower''s alternate address',
1445   `B_zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s alternate address',
1446   `B_country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s alternate address',
1447   `B_email` mediumtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate email address',
1448   `B_phone` longtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate phone number',
1449   `dateofbirth` date DEFAULT NULL COMMENT 'the patron/borrower''s date of birth (YYYY-MM-DD)',
1450   `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table, includes the code of the patron/borrower''s home branch',
1451   `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category',
1452   `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)',
1453   `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)',
1454   `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)',
1455   `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed',
1456   `gonenoaddress` tinyint(1) DEFAULT NULL COMMENT 'set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having an unconfirmed address',
1457   `lost` tinyint(1) DEFAULT NULL COMMENT 'set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having lost their card',
1458   `debarred` date DEFAULT NULL COMMENT 'until this date the patron can only check-in (no loans, no holds, etc.), is a fine based on days instead of money (YYYY-MM-DD)',
1459   `debarredcomment` varchar(255) DEFAULT NULL COMMENT 'comment on the stop of the patron',
1460   `contactname` longtext DEFAULT NULL COMMENT 'used for children and profesionals to include surname or last name of guarantor or organization name',
1461   `contactfirstname` mediumtext DEFAULT NULL COMMENT 'used for children to include first name of guarantor',
1462   `contacttitle` mediumtext DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor',
1463   `borrowernotes` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface',
1464   `relationship` varchar(100) DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor',
1465   `sex` varchar(1) DEFAULT NULL COMMENT 'patron/borrower''s gender',
1466   `password` varchar(60) DEFAULT NULL COMMENT 'patron/borrower''s Bcrypt encrypted password',
1467   `secret` mediumtext DEFAULT NULL COMMENT 'Secret for 2FA',
1468   `auth_method` enum('password','two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method',
1469   `flags` bigint(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions',
1470   `userid` varchar(75) DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in',
1471   `opacnote` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface',
1472   `contactnote` varchar(255) DEFAULT NULL COMMENT 'a note related to the patron/borrower''s alternate address',
1473   `sort1` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
1474   `sort2` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
1475   `altcontactfirstname` mediumtext DEFAULT NULL COMMENT 'first name of alternate contact for the patron/borrower',
1476   `altcontactsurname` mediumtext DEFAULT NULL COMMENT 'surname or last name of the alternate contact for the patron/borrower',
1477   `altcontactaddress1` mediumtext DEFAULT NULL COMMENT 'the first address line for the alternate contact for the patron/borrower',
1478   `altcontactaddress2` mediumtext DEFAULT NULL COMMENT 'the second address line for the alternate contact for the patron/borrower',
1479   `altcontactaddress3` mediumtext DEFAULT NULL COMMENT 'the city for the alternate contact for the patron/borrower',
1480   `altcontactstate` mediumtext DEFAULT NULL COMMENT 'the state for the alternate contact for the patron/borrower',
1481   `altcontactzipcode` mediumtext DEFAULT NULL COMMENT 'the zipcode for the alternate contact for the patron/borrower',
1482   `altcontactcountry` mediumtext DEFAULT NULL COMMENT 'the country for the alternate contact for the patron/borrower',
1483   `altcontactphone` mediumtext DEFAULT NULL COMMENT 'the phone number for the alternate contact for the patron/borrower',
1484   `smsalertnumber` varchar(50) DEFAULT NULL COMMENT 'the mobile phone number where the patron/borrower would like to receive notices (if SMS turned on)',
1485   `sms_provider_id` int(11) DEFAULT NULL COMMENT 'the provider of the mobile phone number defined in smsalertnumber',
1486   `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history',
1487   `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines',
1488   `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
1489   `checkprevcheckout` varchar(7) NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.',
1490   `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'time of last change could be useful for synchronization with external systems (among others)',
1491   `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
1492   `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
1493   `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
1494   `overdrive_auth_token` mediumtext DEFAULT NULL COMMENT 'persist OverDrive auth token',
1495   `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1496   `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1497   `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1498   PRIMARY KEY (`borrowernumber`),
1499   UNIQUE KEY `cardnumber` (`cardnumber`),
1500   UNIQUE KEY `userid` (`userid`),
1501   KEY `categorycode` (`categorycode`),
1502   KEY `branchcode` (`branchcode`),
1503   KEY `surname_idx` (`surname`(191)),
1504   KEY `firstname_idx` (`firstname`(191)),
1505   KEY `othernames_idx` (`othernames`(191)),
1506   KEY `sms_provider_id` (`sms_provider_id`),
1507   CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
1508   CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`),
1509   CONSTRAINT `borrowers_ibfk_3` FOREIGN KEY (`sms_provider_id`) REFERENCES `sms_providers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
1510 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1511 /*!40101 SET character_set_client = @saved_cs_client */;
1512
1513 --
1514 -- Table structure for table `branch_transfer_limits`
1515 --
1516
1517 DROP TABLE IF EXISTS `branch_transfer_limits`;
1518 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1519 /*!40101 SET character_set_client = utf8 */;
1520 CREATE TABLE `branch_transfer_limits` (
1521   `limitId` int(8) NOT NULL AUTO_INCREMENT,
1522   `toBranch` varchar(10) NOT NULL,
1523   `fromBranch` varchar(10) NOT NULL,
1524   `itemtype` varchar(10) DEFAULT NULL,
1525   `ccode` varchar(80) DEFAULT NULL,
1526   PRIMARY KEY (`limitId`)
1527 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1528 /*!40101 SET character_set_client = @saved_cs_client */;
1529
1530 --
1531 -- Table structure for table `branches`
1532 --
1533
1534 DROP TABLE IF EXISTS `branches`;
1535 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1536 /*!40101 SET character_set_client = utf8 */;
1537 CREATE TABLE `branches` (
1538   `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'a unique key assigned to each branch',
1539   `branchname` longtext NOT NULL COMMENT 'the name of your library or branch',
1540   `branchaddress1` longtext DEFAULT NULL COMMENT 'the first address line of for your library or branch',
1541   `branchaddress2` longtext DEFAULT NULL COMMENT 'the second address line of for your library or branch',
1542   `branchaddress3` longtext DEFAULT NULL COMMENT 'the third address line of for your library or branch',
1543   `branchzip` varchar(25) DEFAULT NULL COMMENT 'the zip or postal code for your library or branch',
1544   `branchcity` longtext DEFAULT NULL COMMENT 'the city or province for your library or branch',
1545   `branchstate` longtext DEFAULT NULL COMMENT 'the state for your library or branch',
1546   `branchcountry` mediumtext DEFAULT NULL COMMENT 'the county for your library or branch',
1547   `branchphone` longtext DEFAULT NULL COMMENT 'the primary phone for your library or branch',
1548   `branchfax` longtext DEFAULT NULL COMMENT 'the fax number for your library or branch',
1549   `branchemail` longtext DEFAULT NULL COMMENT 'the primary email address for your library or branch',
1550   `branchillemail` longtext DEFAULT NULL COMMENT 'the ILL staff email address for your library or branch',
1551   `branchreplyto` longtext DEFAULT NULL COMMENT 'the email to be used as a Reply-To',
1552   `branchreturnpath` longtext DEFAULT NULL COMMENT 'the email to be used as Return-Path',
1553   `branchurl` longtext DEFAULT NULL COMMENT 'the URL for your library or branch''s website',
1554   `issuing` tinyint(4) DEFAULT NULL COMMENT 'unused in Koha',
1555   `branchip` varchar(15) DEFAULT NULL COMMENT 'the IP address for your library or branch',
1556   `branchnotes` longtext DEFAULT NULL COMMENT 'notes related to your library or branch',
1557   `geolocation` varchar(255) DEFAULT NULL COMMENT 'geolocation of your library',
1558   `marcorgcode` varchar(16) DEFAULT NULL COMMENT 'MARC Organization Code, see http://www.loc.gov/marc/organizations/orgshome.html, when empty defaults to syspref MARCOrgCode',
1559   `pickup_location` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'the ability to act as a pickup location',
1560   `public` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'whether this library should show in the opac',
1561   PRIMARY KEY (`branchcode`)
1562 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1563 /*!40101 SET character_set_client = @saved_cs_client */;
1564
1565 --
1566 -- Table structure for table `branches_overdrive`
1567 --
1568
1569 DROP TABLE IF EXISTS `branches_overdrive`;
1570 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1571 /*!40101 SET character_set_client = utf8 */;
1572 CREATE TABLE `branches_overdrive` (
1573   `branchcode` varchar(10) NOT NULL,
1574   `authname` varchar(255) NOT NULL,
1575   PRIMARY KEY (`branchcode`),
1576   CONSTRAINT `branches_overdrive_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1577 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1578 /*!40101 SET character_set_client = @saved_cs_client */;
1579
1580 --
1581 -- Table structure for table `branchtransfers`
1582 --
1583
1584 DROP TABLE IF EXISTS `branchtransfers`;
1585 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1586 /*!40101 SET character_set_client = utf8 */;
1587 CREATE TABLE `branchtransfers` (
1588   `branchtransfer_id` int(12) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
1589   `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the itemnumber that it is in transit (items.itemnumber)',
1590   `daterequested` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date the transfer was requested',
1591   `datesent` datetime DEFAULT NULL COMMENT 'the date the transfer was initialized',
1592   `frombranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer is coming from',
1593   `datearrived` datetime DEFAULT NULL COMMENT 'the date the transfer arrived at its destination',
1594   `datecancelled` datetime DEFAULT NULL COMMENT 'the date the transfer was cancelled',
1595   `tobranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer was going to',
1596   `comments` longtext DEFAULT NULL COMMENT 'any comments related to the transfer',
1597   `reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation','Recall','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer',
1598   `cancellation_reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','ItemLost','WrongTransfer','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer cancellation',
1599   PRIMARY KEY (`branchtransfer_id`),
1600   KEY `frombranch` (`frombranch`),
1601   KEY `tobranch` (`tobranch`),
1602   KEY `itemnumber` (`itemnumber`),
1603   CONSTRAINT `branchtransfers_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1604   CONSTRAINT `branchtransfers_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1605   CONSTRAINT `branchtransfers_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1606 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1607 /*!40101 SET character_set_client = @saved_cs_client */;
1608
1609 --
1610 -- Table structure for table `browser`
1611 --
1612
1613 DROP TABLE IF EXISTS `browser`;
1614 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1615 /*!40101 SET character_set_client = utf8 */;
1616 CREATE TABLE `browser` (
1617   `level` int(11) NOT NULL,
1618   `classification` varchar(20) NOT NULL,
1619   `description` varchar(255) NOT NULL,
1620   `number` bigint(20) NOT NULL,
1621   `endnode` tinyint(4) NOT NULL
1622 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1623 /*!40101 SET character_set_client = @saved_cs_client */;
1624
1625 --
1626 -- Table structure for table `cash_register_actions`
1627 --
1628
1629 DROP TABLE IF EXISTS `cash_register_actions`;
1630 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1631 /*!40101 SET character_set_client = utf8 */;
1632 CREATE TABLE `cash_register_actions` (
1633   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each account register action',
1634   `code` varchar(24) NOT NULL COMMENT 'action code denoting the type of action recorded (enum),',
1635   `register_id` int(11) NOT NULL COMMENT 'id of cash_register this action belongs to,',
1636   `manager_id` int(11) NOT NULL COMMENT 'staff member performing the action',
1637   `amount` decimal(28,6) DEFAULT NULL COMMENT 'amount recorded in action (signed)',
1638   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1639   PRIMARY KEY (`id`),
1640   KEY `cash_register_actions_manager` (`manager_id`),
1641   KEY `cash_register_actions_register` (`register_id`),
1642   CONSTRAINT `cash_register_actions_manager` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1643   CONSTRAINT `cash_register_actions_register` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1644 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1645 /*!40101 SET character_set_client = @saved_cs_client */;
1646
1647 --
1648 -- Table structure for table `cash_registers`
1649 --
1650
1651 DROP TABLE IF EXISTS `cash_registers`;
1652 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1653 /*!40101 SET character_set_client = utf8 */;
1654 CREATE TABLE `cash_registers` (
1655   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each account register',
1656   `name` varchar(24) NOT NULL COMMENT 'the user friendly identifier for each account register',
1657   `description` longtext NOT NULL COMMENT 'the user friendly description for each account register',
1658   `branch` varchar(10) NOT NULL COMMENT 'the foreign key the library this account register belongs',
1659   `branch_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote that this till is the branch default',
1660   `starting_float` decimal(28,6) DEFAULT NULL COMMENT 'the starting float this account register should be assigned',
1661   `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote if this till is archived or not',
1662   PRIMARY KEY (`id`),
1663   UNIQUE KEY `name` (`name`,`branch`),
1664   KEY `cash_registers_branch` (`branch`),
1665   CONSTRAINT `cash_registers_branch` FOREIGN KEY (`branch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1666 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1667 /*!40101 SET character_set_client = @saved_cs_client */;
1668
1669 --
1670 -- Table structure for table `categories`
1671 --
1672
1673 DROP TABLE IF EXISTS `categories`;
1674 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1675 /*!40101 SET character_set_client = utf8 */;
1676 CREATE TABLE `categories` (
1677   `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'unique primary key used to idenfity the patron category',
1678   `description` longtext DEFAULT NULL COMMENT 'description of the patron category',
1679   `enrolmentperiod` smallint(6) DEFAULT NULL COMMENT 'number of months the patron is enrolled for (will be NULL if enrolmentperioddate is set)',
1680   `enrolmentperioddate` date DEFAULT NULL COMMENT 'date the patron is enrolled until (will be NULL if enrolmentperiod is set)',
1681   `password_expiry_days` smallint(6) DEFAULT NULL COMMENT 'number of days after which the patron must reset their password',
1682   `upperagelimit` smallint(6) DEFAULT NULL COMMENT 'age limit for the patron',
1683   `dateofbirthrequired` tinyint(1) DEFAULT NULL COMMENT 'the minimum age required for the patron category',
1684   `finetype` varchar(30) DEFAULT NULL COMMENT 'unused in Koha',
1685   `bulk` tinyint(1) DEFAULT NULL,
1686   `enrolmentfee` decimal(28,6) DEFAULT NULL COMMENT 'enrollment fee for the patron',
1687   `overduenoticerequired` tinyint(1) DEFAULT NULL COMMENT 'are overdue notices sent to this patron category (1 for yes, 0 for no)',
1688   `issuelimit` smallint(6) DEFAULT NULL COMMENT 'unused in Koha',
1689   `reservefee` decimal(28,6) DEFAULT NULL COMMENT 'cost to place holds',
1690   `hidelostitems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'are lost items shown to this category (1 for yes, 0 for no)',
1691   `category_type` varchar(1) NOT NULL DEFAULT 'A' COMMENT 'type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)',
1692   `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL DEFAULT -1 COMMENT 'wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions',
1693   `default_privacy` enum('default','never','forever') NOT NULL DEFAULT 'default' COMMENT 'Default privacy setting for this patron category',
1694   `checkprevcheckout` varchar(7) NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron category if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to syspref setting if ''inherit''.',
1695   `can_be_guarantee` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if patrons of this category can be guarantees',
1696   `reset_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can do the password reset flow,',
1697   `change_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can change their passwords in the OAPC',
1698   `min_password_length` smallint(6) DEFAULT NULL COMMENT 'set minimum password length for patrons in this category',
1699   `require_strong_password` tinyint(1) DEFAULT NULL COMMENT 'set required password strength for patrons in this category',
1700   `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude patrons of this category from local holds priority',
1701   PRIMARY KEY (`categorycode`),
1702   UNIQUE KEY `categorycode` (`categorycode`)
1703 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1704 /*!40101 SET character_set_client = @saved_cs_client */;
1705
1706 --
1707 -- Table structure for table `categories_branches`
1708 --
1709
1710 DROP TABLE IF EXISTS `categories_branches`;
1711 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1712 /*!40101 SET character_set_client = utf8 */;
1713 CREATE TABLE `categories_branches` (
1714   `categorycode` varchar(10) DEFAULT NULL,
1715   `branchcode` varchar(10) DEFAULT NULL,
1716   KEY `categorycode` (`categorycode`),
1717   KEY `branchcode` (`branchcode`),
1718   CONSTRAINT `categories_branches_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE,
1719   CONSTRAINT `categories_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1720 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1721 /*!40101 SET character_set_client = @saved_cs_client */;
1722
1723 --
1724 -- Table structure for table `checkout_renewals`
1725 --
1726
1727 DROP TABLE IF EXISTS `checkout_renewals`;
1728 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1729 /*!40101 SET character_set_client = utf8 */;
1730 CREATE TABLE `checkout_renewals` (
1731   `renewal_id` int(11) NOT NULL AUTO_INCREMENT,
1732   `checkout_id` int(11) DEFAULT NULL COMMENT 'the id of the checkout this renewal pertains to',
1733   `renewer_id` int(11) DEFAULT NULL COMMENT 'the id of the user who processed the renewal',
1734   `seen` tinyint(1) DEFAULT 0 COMMENT 'boolean denoting whether the item was present or not',
1735   `interface` varchar(16) NOT NULL COMMENT 'the interface this renewal took place on',
1736   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the renewal took place',
1737   `renewal_type` enum('Automatic', 'Manual') NOT NULL DEFAULT 'Manual' COMMENT 'whether the renewal was an automatic or manual renewal',
1738   PRIMARY KEY (`renewal_id`),
1739   KEY `renewer_id` (`renewer_id`),
1740   CONSTRAINT `renewals_renewer_id` FOREIGN KEY (`renewer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
1741 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1742 /*!40101 SET character_set_client = @saved_cs_client */;
1743
1744 --
1745 -- Table structure for table `circulation_rules`
1746 --
1747
1748 DROP TABLE IF EXISTS `circulation_rules`;
1749 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1750 /*!40101 SET character_set_client = utf8 */;
1751 CREATE TABLE `circulation_rules` (
1752   `id` int(11) NOT NULL AUTO_INCREMENT,
1753   `branchcode` varchar(10) DEFAULT NULL,
1754   `categorycode` varchar(10) DEFAULT NULL,
1755   `itemtype` varchar(10) DEFAULT NULL,
1756   `rule_name` varchar(32) NOT NULL,
1757   `rule_value` varchar(32) NOT NULL,
1758   PRIMARY KEY (`id`),
1759   UNIQUE KEY `branchcode` (`branchcode`,`categorycode`,`itemtype`,`rule_name`),
1760   KEY `circ_rules_ibfk_2` (`categorycode`),
1761   KEY `circ_rules_ibfk_3` (`itemtype`),
1762   KEY `rule_name` (`rule_name`),
1763   CONSTRAINT `circ_rules_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1764   CONSTRAINT `circ_rules_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
1765   CONSTRAINT `circ_rules_ibfk_3` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
1766 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1767 /*!40101 SET character_set_client = @saved_cs_client */;
1768
1769 --
1770 -- Table structure for table `cities`
1771 --
1772
1773 DROP TABLE IF EXISTS `cities`;
1774 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1775 /*!40101 SET character_set_client = utf8 */;
1776 CREATE TABLE `cities` (
1777   `cityid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier added by Koha',
1778   `city_name` varchar(100) NOT NULL DEFAULT '' COMMENT 'name of the city',
1779   `city_state` varchar(100) DEFAULT NULL COMMENT 'name of the state/province',
1780   `city_country` varchar(100) DEFAULT NULL COMMENT 'name of the country',
1781   `city_zipcode` varchar(20) DEFAULT NULL COMMENT 'zip or postal code',
1782   PRIMARY KEY (`cityid`)
1783 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1784 /*!40101 SET character_set_client = @saved_cs_client */;
1785
1786 --
1787 -- Table structure for table `class_sort_rules`
1788 --
1789
1790 DROP TABLE IF EXISTS `class_sort_rules`;
1791 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1792 /*!40101 SET character_set_client = utf8 */;
1793 CREATE TABLE `class_sort_rules` (
1794   `class_sort_rule` varchar(10) NOT NULL DEFAULT '',
1795   `description` longtext DEFAULT NULL,
1796   `sort_routine` varchar(30) NOT NULL DEFAULT '',
1797   PRIMARY KEY (`class_sort_rule`),
1798   UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
1799 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1800 /*!40101 SET character_set_client = @saved_cs_client */;
1801
1802 --
1803 -- Table structure for table `class_sources`
1804 --
1805
1806 DROP TABLE IF EXISTS `class_sources`;
1807 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1808 /*!40101 SET character_set_client = utf8 */;
1809 CREATE TABLE `class_sources` (
1810   `cn_source` varchar(10) NOT NULL DEFAULT '',
1811   `description` longtext DEFAULT NULL,
1812   `used` tinyint(4) NOT NULL DEFAULT 0,
1813   `class_sort_rule` varchar(10) NOT NULL DEFAULT '',
1814   `class_split_rule` varchar(10) NOT NULL DEFAULT '',
1815   PRIMARY KEY (`cn_source`),
1816   UNIQUE KEY `cn_source_idx` (`cn_source`),
1817   KEY `used_idx` (`used`),
1818   KEY `class_source_ibfk_1` (`class_sort_rule`),
1819   KEY `class_source_ibfk_2` (`class_split_rule`),
1820   CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`),
1821   CONSTRAINT `class_source_ibfk_2` FOREIGN KEY (`class_split_rule`) REFERENCES `class_split_rules` (`class_split_rule`)
1822 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1823 /*!40101 SET character_set_client = @saved_cs_client */;
1824
1825 --
1826 -- Table structure for table `class_split_rules`
1827 --
1828
1829 DROP TABLE IF EXISTS `class_split_rules`;
1830 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1831 /*!40101 SET character_set_client = utf8 */;
1832 CREATE TABLE `class_split_rules` (
1833   `class_split_rule` varchar(10) NOT NULL DEFAULT '',
1834   `description` longtext DEFAULT NULL,
1835   `split_routine` varchar(30) NOT NULL DEFAULT '',
1836   `split_regex` varchar(255) NOT NULL DEFAULT '',
1837   PRIMARY KEY (`class_split_rule`),
1838   UNIQUE KEY `class_split_rule_idx` (`class_split_rule`)
1839 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1840 /*!40101 SET character_set_client = @saved_cs_client */;
1841
1842 --
1843 -- Table structure for table `club_enrollment_fields`
1844 --
1845
1846 DROP TABLE IF EXISTS `club_enrollment_fields`;
1847 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1848 /*!40101 SET character_set_client = utf8 */;
1849 CREATE TABLE `club_enrollment_fields` (
1850   `id` int(11) NOT NULL AUTO_INCREMENT,
1851   `club_enrollment_id` int(11) NOT NULL,
1852   `club_template_enrollment_field_id` int(11) NOT NULL,
1853   `value` mediumtext NOT NULL,
1854   PRIMARY KEY (`id`),
1855   KEY `club_enrollment_id` (`club_enrollment_id`),
1856   KEY `club_template_enrollment_field_id` (`club_template_enrollment_field_id`),
1857   CONSTRAINT `club_enrollment_fields_ibfk_1` FOREIGN KEY (`club_enrollment_id`) REFERENCES `club_enrollments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1858   CONSTRAINT `club_enrollment_fields_ibfk_2` FOREIGN KEY (`club_template_enrollment_field_id`) REFERENCES `club_template_enrollment_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1859 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1860 /*!40101 SET character_set_client = @saved_cs_client */;
1861
1862 --
1863 -- Table structure for table `club_enrollments`
1864 --
1865
1866 DROP TABLE IF EXISTS `club_enrollments`;
1867 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1868 /*!40101 SET character_set_client = utf8 */;
1869 CREATE TABLE `club_enrollments` (
1870   `id` int(11) NOT NULL AUTO_INCREMENT,
1871   `club_id` int(11) NOT NULL,
1872   `borrowernumber` int(11) NOT NULL,
1873   `date_enrolled` timestamp NOT NULL DEFAULT current_timestamp(),
1874   `date_canceled` timestamp NULL DEFAULT NULL,
1875   `date_created` timestamp NULL DEFAULT NULL,
1876   `date_updated` timestamp NULL DEFAULT NULL,
1877   `branchcode` varchar(10) DEFAULT NULL,
1878   PRIMARY KEY (`id`),
1879   KEY `club_id` (`club_id`),
1880   KEY `borrowernumber` (`borrowernumber`),
1881   KEY `branchcode` (`branchcode`),
1882   CONSTRAINT `club_enrollments_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1883   CONSTRAINT `club_enrollments_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1884   CONSTRAINT `club_enrollments_ibfk_3` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
1885 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1886 /*!40101 SET character_set_client = @saved_cs_client */;
1887
1888 --
1889 -- Table structure for table `club_fields`
1890 --
1891
1892 DROP TABLE IF EXISTS `club_fields`;
1893 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1894 /*!40101 SET character_set_client = utf8 */;
1895 CREATE TABLE `club_fields` (
1896   `id` int(11) NOT NULL AUTO_INCREMENT,
1897   `club_template_field_id` int(11) NOT NULL,
1898   `club_id` int(11) NOT NULL,
1899   `value` mediumtext DEFAULT NULL,
1900   PRIMARY KEY (`id`),
1901   KEY `club_template_field_id` (`club_template_field_id`),
1902   KEY `club_id` (`club_id`),
1903   CONSTRAINT `club_fields_ibfk_3` FOREIGN KEY (`club_template_field_id`) REFERENCES `club_template_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1904   CONSTRAINT `club_fields_ibfk_4` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1905 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1906 /*!40101 SET character_set_client = @saved_cs_client */;
1907
1908 --
1909 -- Table structure for table `club_holds`
1910 --
1911
1912 DROP TABLE IF EXISTS `club_holds`;
1913 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1914 /*!40101 SET character_set_client = utf8 */;
1915 CREATE TABLE `club_holds` (
1916   `id` int(11) NOT NULL AUTO_INCREMENT,
1917   `club_id` int(11) NOT NULL COMMENT 'id for the club the hold was generated for',
1918   `biblio_id` int(11) NOT NULL COMMENT 'id for the bibliographic record the hold has been placed against',
1919   `item_id` int(11) DEFAULT NULL COMMENT 'If item-level, the id for the item the hold has been placed agains',
1920   `date_created` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Timestamp for the placed hold',
1921   PRIMARY KEY (`id`),
1922   KEY `clubs_holds_ibfk_1` (`club_id`),
1923   KEY `clubs_holds_ibfk_2` (`biblio_id`),
1924   KEY `clubs_holds_ibfk_3` (`item_id`),
1925   CONSTRAINT `clubs_holds_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1926   CONSTRAINT `clubs_holds_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1927   CONSTRAINT `clubs_holds_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1928 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1929 /*!40101 SET character_set_client = @saved_cs_client */;
1930
1931 --
1932 -- Table structure for table `club_holds_to_patron_holds`
1933 --
1934
1935 DROP TABLE IF EXISTS `club_holds_to_patron_holds`;
1936 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1937 /*!40101 SET character_set_client = utf8 */;
1938 CREATE TABLE `club_holds_to_patron_holds` (
1939   `id` int(11) NOT NULL AUTO_INCREMENT,
1940   `club_hold_id` int(11) NOT NULL,
1941   `patron_id` int(11) NOT NULL,
1942   `hold_id` int(11) DEFAULT NULL,
1943   `error_code` enum('damaged','ageRestricted','itemAlreadyOnHold','tooManyHoldsForThisRecord','tooManyReservesToday','tooManyReserves','notReservable','cannotReserveFromOtherBranches','libraryNotFound','libraryNotPickupLocation','cannotBeTransferred','noReservesAllowed') DEFAULT NULL,
1944   `error_message` varchar(100) DEFAULT NULL,
1945   PRIMARY KEY (`id`),
1946   KEY `clubs_holds_paton_holds_ibfk_1` (`club_hold_id`),
1947   KEY `clubs_holds_paton_holds_ibfk_2` (`patron_id`),
1948   KEY `clubs_holds_paton_holds_ibfk_3` (`hold_id`),
1949   CONSTRAINT `clubs_holds_paton_holds_ibfk_1` FOREIGN KEY (`club_hold_id`) REFERENCES `club_holds` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1950   CONSTRAINT `clubs_holds_paton_holds_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1951   CONSTRAINT `clubs_holds_paton_holds_ibfk_3` FOREIGN KEY (`hold_id`) REFERENCES `reserves` (`reserve_id`) ON DELETE CASCADE ON UPDATE CASCADE
1952 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1953 /*!40101 SET character_set_client = @saved_cs_client */;
1954
1955 --
1956 -- Table structure for table `club_template_enrollment_fields`
1957 --
1958
1959 DROP TABLE IF EXISTS `club_template_enrollment_fields`;
1960 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1961 /*!40101 SET character_set_client = utf8 */;
1962 CREATE TABLE `club_template_enrollment_fields` (
1963   `id` int(11) NOT NULL AUTO_INCREMENT,
1964   `club_template_id` int(11) NOT NULL,
1965   `name` text NOT NULL,
1966   `description` mediumtext DEFAULT NULL,
1967   `authorised_value_category` varchar(32) DEFAULT NULL,
1968   PRIMARY KEY (`id`),
1969   KEY `club_template_id` (`club_template_id`),
1970   CONSTRAINT `club_template_enrollment_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1971 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1972 /*!40101 SET character_set_client = @saved_cs_client */;
1973
1974 --
1975 -- Table structure for table `club_template_fields`
1976 --
1977
1978 DROP TABLE IF EXISTS `club_template_fields`;
1979 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1980 /*!40101 SET character_set_client = utf8 */;
1981 CREATE TABLE `club_template_fields` (
1982   `id` int(11) NOT NULL AUTO_INCREMENT,
1983   `club_template_id` int(11) NOT NULL,
1984   `name` text NOT NULL,
1985   `description` mediumtext DEFAULT NULL,
1986   `authorised_value_category` varchar(32) DEFAULT NULL,
1987   PRIMARY KEY (`id`),
1988   KEY `club_template_id` (`club_template_id`),
1989   CONSTRAINT `club_template_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1990 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1991 /*!40101 SET character_set_client = @saved_cs_client */;
1992
1993 --
1994 -- Table structure for table `club_templates`
1995 --
1996
1997 DROP TABLE IF EXISTS `club_templates`;
1998 /*!40101 SET @saved_cs_client     = @@character_set_client */;
1999 /*!40101 SET character_set_client = utf8 */;
2000 CREATE TABLE `club_templates` (
2001   `id` int(11) NOT NULL AUTO_INCREMENT,
2002   `name` text NOT NULL,
2003   `description` mediumtext DEFAULT NULL,
2004   `is_enrollable_from_opac` tinyint(1) NOT NULL DEFAULT 0,
2005   `is_email_required` tinyint(1) NOT NULL DEFAULT 0,
2006   `branchcode` varchar(10) DEFAULT NULL,
2007   `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
2008   `date_updated` timestamp NULL DEFAULT NULL,
2009   `is_deletable` tinyint(1) NOT NULL DEFAULT 1,
2010   PRIMARY KEY (`id`),
2011   KEY `ct_branchcode` (`branchcode`),
2012   CONSTRAINT `club_templates_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2013 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2014 /*!40101 SET character_set_client = @saved_cs_client */;
2015
2016 --
2017 -- Table structure for table `clubs`
2018 --
2019
2020 DROP TABLE IF EXISTS `clubs`;
2021 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2022 /*!40101 SET character_set_client = utf8 */;
2023 CREATE TABLE `clubs` (
2024   `id` int(11) NOT NULL AUTO_INCREMENT,
2025   `club_template_id` int(11) NOT NULL,
2026   `name` text NOT NULL,
2027   `description` mediumtext DEFAULT NULL,
2028   `date_start` date DEFAULT NULL,
2029   `date_end` date DEFAULT NULL,
2030   `branchcode` varchar(10) DEFAULT NULL,
2031   `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
2032   `date_updated` timestamp NULL DEFAULT NULL,
2033   PRIMARY KEY (`id`),
2034   KEY `club_template_id` (`club_template_id`),
2035   KEY `branchcode` (`branchcode`),
2036   CONSTRAINT `clubs_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2037   CONSTRAINT `clubs_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
2038 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2039 /*!40101 SET character_set_client = @saved_cs_client */;
2040
2041 --
2042 -- Table structure for table `collections`
2043 --
2044
2045 DROP TABLE IF EXISTS `collections`;
2046 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2047 /*!40101 SET character_set_client = utf8 */;
2048 CREATE TABLE `collections` (
2049   `colId` int(11) NOT NULL AUTO_INCREMENT,
2050   `colTitle` varchar(100) NOT NULL DEFAULT '',
2051   `colDesc` mediumtext NOT NULL,
2052   `colBranchcode` varchar(10) DEFAULT NULL COMMENT '''branchcode for branch where item should be held.''',
2053   PRIMARY KEY (`colId`),
2054   KEY `collections_ibfk_1` (`colBranchcode`),
2055   CONSTRAINT `collections_ibfk_1` FOREIGN KEY (`colBranchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2056 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2057 /*!40101 SET character_set_client = @saved_cs_client */;
2058
2059 --
2060 -- Table structure for table `collections_tracking`
2061 --
2062
2063 DROP TABLE IF EXISTS `collections_tracking`;
2064 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2065 /*!40101 SET character_set_client = utf8 */;
2066 CREATE TABLE `collections_tracking` (
2067   `collections_tracking_id` int(11) NOT NULL AUTO_INCREMENT,
2068   `colId` int(11) NOT NULL DEFAULT 0 COMMENT 'collections.colId',
2069   `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'items.itemnumber',
2070   PRIMARY KEY (`collections_tracking_id`),
2071   KEY `collectionst_ibfk_1` (`colId`),
2072   CONSTRAINT `collectionst_ibfk_1` FOREIGN KEY (`colId`) REFERENCES `collections` (`colId`) ON DELETE CASCADE ON UPDATE CASCADE
2073 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2074 /*!40101 SET character_set_client = @saved_cs_client */;
2075
2076 --
2077 -- Table structure for table `columns_settings`
2078 --
2079
2080 DROP TABLE IF EXISTS `columns_settings`;
2081 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2082 /*!40101 SET character_set_client = utf8 */;
2083 CREATE TABLE `columns_settings` (
2084   `module` varchar(255) NOT NULL,
2085   `page` varchar(255) NOT NULL,
2086   `tablename` varchar(255) NOT NULL,
2087   `columnname` varchar(255) NOT NULL,
2088   `cannot_be_toggled` int(1) NOT NULL DEFAULT 0,
2089   `is_hidden` int(1) NOT NULL DEFAULT 0,
2090   PRIMARY KEY (`module`(191),`page`(191),`tablename`(191),`columnname`(191))
2091 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2092 /*!40101 SET character_set_client = @saved_cs_client */;
2093
2094 --
2095 -- Table structure for table `course_instructors`
2096 --
2097
2098 DROP TABLE IF EXISTS `course_instructors`;
2099 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2100 /*!40101 SET character_set_client = utf8 */;
2101 CREATE TABLE `course_instructors` (
2102   `course_id` int(11) NOT NULL COMMENT 'foreign key to link to courses.course_id',
2103   `borrowernumber` int(11) NOT NULL COMMENT 'foreign key to link to borrowers.borrowernumber for instructor information',
2104   PRIMARY KEY (`course_id`,`borrowernumber`),
2105   KEY `borrowernumber` (`borrowernumber`),
2106   CONSTRAINT `course_instructors_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2107   CONSTRAINT `course_instructors_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`)
2108 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2109 /*!40101 SET character_set_client = @saved_cs_client */;
2110
2111 --
2112 -- Table structure for table `course_items`
2113 --
2114
2115 DROP TABLE IF EXISTS `course_items`;
2116 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2117 /*!40101 SET character_set_client = utf8 */;
2118 CREATE TABLE `course_items` (
2119   `ci_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'course item id',
2120   `itemnumber` int(11) DEFAULT NULL COMMENT 'items.itemnumber for the item on reserve',
2121   `biblionumber` int(11) NOT NULL COMMENT 'biblio.biblionumber for the bibliographic record on reserve',
2122   `itype` varchar(10) DEFAULT NULL COMMENT 'new itemtype for the item to have while on reserve (optional)',
2123   `itype_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2124   `itype_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the itype when item is on course reserve',
2125   `ccode` varchar(80) DEFAULT NULL COMMENT 'new category code for the item to have while on reserve (optional)',
2126   `ccode_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if ccode should be changed while on course reserve',
2127   `ccode_storage` varchar(80) DEFAULT NULL COMMENT 'a place to store the ccode when item is on course reserve',
2128   `homebranch` varchar(10) DEFAULT NULL COMMENT 'new home branch for the item to have while on reserve (optional)',
2129   `homebranch_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if homebranch should be changed while on course reserve',
2130   `homebranch_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the homebranch when item is on course reserve',
2131   `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'new holding branch for the item to have while on reserve (optional)',
2132   `holdingbranch_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2133   `holdingbranch_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the holdingbranch when item is on course reserve',
2134   `location` varchar(80) DEFAULT NULL COMMENT 'new shelving location for the item to have while on reseve (optional)',
2135   `location_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2136   `location_storage` varchar(80) DEFAULT NULL COMMENT 'a place to store the location when the item is on course reserve',
2137   `enabled` enum('yes','no') NOT NULL DEFAULT 'no' COMMENT 'if at least one enabled course has this item on reseve, this field will be ''yes'', otherwise it will be ''no''',
2138   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2139   PRIMARY KEY (`ci_id`),
2140   UNIQUE KEY `itemnumber` (`itemnumber`),
2141   KEY `holdingbranch` (`holdingbranch`),
2142   KEY `fk_course_items_homebranch` (`homebranch`),
2143   KEY `fk_course_items_homebranch_storage` (`homebranch_storage`),
2144   KEY `fk_course_items_biblionumber` (`biblionumber`),
2145   CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2146   CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2147   CONSTRAINT `fk_course_items_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2148   CONSTRAINT `fk_course_items_homebranch` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2149   CONSTRAINT `fk_course_items_homebranch_storage` FOREIGN KEY (`homebranch_storage`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2150 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2151 /*!40101 SET character_set_client = @saved_cs_client */;
2152
2153 --
2154 -- Table structure for table `course_reserves`
2155 --
2156
2157 DROP TABLE IF EXISTS `course_reserves`;
2158 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2159 /*!40101 SET character_set_client = utf8 */;
2160 CREATE TABLE `course_reserves` (
2161   `cr_id` int(11) NOT NULL AUTO_INCREMENT,
2162   `course_id` int(11) NOT NULL COMMENT 'foreign key to link to courses.course_id',
2163   `ci_id` int(11) NOT NULL COMMENT 'foreign key to link to courses_items.ci_id',
2164   `staff_note` longtext DEFAULT NULL COMMENT 'staff only note',
2165   `public_note` longtext DEFAULT NULL COMMENT 'public, OPAC visible note',
2166   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2167   PRIMARY KEY (`cr_id`),
2168   UNIQUE KEY `pseudo_key` (`course_id`,`ci_id`),
2169   KEY `course_id` (`course_id`),
2170   KEY `course_reserves_ibfk_2` (`ci_id`),
2171   CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`),
2172   CONSTRAINT `course_reserves_ibfk_2` FOREIGN KEY (`ci_id`) REFERENCES `course_items` (`ci_id`) ON DELETE CASCADE ON UPDATE CASCADE
2173 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2174 /*!40101 SET character_set_client = @saved_cs_client */;
2175
2176 --
2177 -- Table structure for table `courses`
2178 --
2179
2180 DROP TABLE IF EXISTS `courses`;
2181 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2182 /*!40101 SET character_set_client = utf8 */;
2183 CREATE TABLE `courses` (
2184   `course_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the course',
2185   `department` varchar(80) DEFAULT NULL COMMENT 'the authorised value for the DEPARTMENT',
2186   `course_number` varchar(255) DEFAULT NULL COMMENT 'the ''course number'' assigned to a course',
2187   `section` varchar(255) DEFAULT NULL COMMENT 'the ''section'' of a course',
2188   `course_name` varchar(255) DEFAULT NULL COMMENT 'the name of the course',
2189   `term` varchar(80) DEFAULT NULL COMMENT 'the authorised value for the TERM',
2190   `staff_note` longtext DEFAULT NULL COMMENT 'the text of the staff only note',
2191   `public_note` longtext DEFAULT NULL COMMENT 'the text of the public / opac note',
2192   `students_count` varchar(20) DEFAULT NULL COMMENT 'how many students will be taking this course/section',
2193   `enabled` enum('yes','no') NOT NULL DEFAULT 'yes' COMMENT 'determines whether the course is active',
2194   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2195   PRIMARY KEY (`course_id`)
2196 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2197 /*!40101 SET character_set_client = @saved_cs_client */;
2198
2199 --
2200 -- Table structure for table `cover_images`
2201 --
2202
2203 DROP TABLE IF EXISTS `cover_images`;
2204 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2205 /*!40101 SET character_set_client = utf8 */;
2206 CREATE TABLE `cover_images` (
2207   `imagenumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the image',
2208   `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from biblio table to link to biblionumber',
2209   `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from item table to link to itemnumber',
2210   `mimetype` varchar(15) NOT NULL COMMENT 'image type',
2211   `imagefile` mediumblob NOT NULL COMMENT 'image file contents',
2212   `thumbnail` mediumblob NOT NULL COMMENT 'thumbnail file contents',
2213   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'image creation/update time',
2214   PRIMARY KEY (`imagenumber`),
2215   KEY `bibliocoverimage_fk1` (`biblionumber`),
2216   KEY `bibliocoverimage_fk2` (`itemnumber`),
2217   CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2218   CONSTRAINT `bibliocoverimage_fk2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
2219 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2220 /*!40101 SET character_set_client = @saved_cs_client */;
2221
2222 --
2223 -- Table structure for table `creator_batches`
2224 --
2225
2226 DROP TABLE IF EXISTS `creator_batches`;
2227 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2228 /*!40101 SET character_set_client = utf8 */;
2229 CREATE TABLE `creator_batches` (
2230   `label_id` int(11) NOT NULL AUTO_INCREMENT,
2231   `batch_id` int(10) NOT NULL DEFAULT 1,
2232   `description` mediumtext DEFAULT NULL,
2233   `item_number` int(11) DEFAULT NULL,
2234   `borrower_number` int(11) DEFAULT NULL,
2235   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2236   `branch_code` varchar(10) NOT NULL DEFAULT 'NB',
2237   `creator` char(15) NOT NULL DEFAULT 'Labels',
2238   PRIMARY KEY (`label_id`),
2239   KEY `branch_fk_constraint` (`branch_code`),
2240   KEY `item_fk_constraint` (`item_number`),
2241   KEY `borrower_fk_constraint` (`borrower_number`),
2242   CONSTRAINT `creator_batches_ibfk_1` FOREIGN KEY (`borrower_number`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2243   CONSTRAINT `creator_batches_ibfk_2` FOREIGN KEY (`branch_code`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
2244   CONSTRAINT `creator_batches_ibfk_3` FOREIGN KEY (`item_number`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE
2245 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2246 /*!40101 SET character_set_client = @saved_cs_client */;
2247
2248 --
2249 -- Table structure for table `creator_images`
2250 --
2251
2252 DROP TABLE IF EXISTS `creator_images`;
2253 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2254 /*!40101 SET character_set_client = utf8 */;
2255 CREATE TABLE `creator_images` (
2256   `image_id` int(4) NOT NULL AUTO_INCREMENT,
2257   `imagefile` mediumblob DEFAULT NULL,
2258   `image_name` char(20) NOT NULL DEFAULT 'DEFAULT',
2259   PRIMARY KEY (`image_id`),
2260   UNIQUE KEY `image_name_index` (`image_name`)
2261 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2262 /*!40101 SET character_set_client = @saved_cs_client */;
2263
2264 --
2265 -- Table structure for table `creator_layouts`
2266 --
2267
2268 DROP TABLE IF EXISTS `creator_layouts`;
2269 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2270 /*!40101 SET character_set_client = utf8 */;
2271 CREATE TABLE `creator_layouts` (
2272   `layout_id` int(4) NOT NULL AUTO_INCREMENT,
2273   `barcode_type` char(100) NOT NULL DEFAULT 'CODE39',
2274   `start_label` int(2) NOT NULL DEFAULT 1,
2275   `printing_type` char(32) NOT NULL DEFAULT 'BAR',
2276   `layout_name` char(25) NOT NULL DEFAULT 'DEFAULT',
2277   `guidebox` int(1) DEFAULT 0,
2278   `oblique_title` int(1) DEFAULT 1,
2279   `font` char(10) NOT NULL DEFAULT 'TR',
2280   `font_size` int(4) NOT NULL DEFAULT 10,
2281   `units` char(20) NOT NULL DEFAULT 'POINT',
2282   `callnum_split` int(1) DEFAULT 0,
2283   `text_justify` char(1) NOT NULL DEFAULT 'L',
2284   `format_string` varchar(210) NOT NULL DEFAULT 'barcode',
2285   `layout_xml` mediumtext NOT NULL,
2286   `creator` char(15) NOT NULL DEFAULT 'Labels',
2287   PRIMARY KEY (`layout_id`)
2288 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2289 /*!40101 SET character_set_client = @saved_cs_client */;
2290
2291 --
2292 -- Table structure for table `creator_templates`
2293 --
2294
2295 DROP TABLE IF EXISTS `creator_templates`;
2296 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2297 /*!40101 SET character_set_client = utf8 */;
2298 CREATE TABLE `creator_templates` (
2299   `template_id` int(4) NOT NULL AUTO_INCREMENT,
2300   `profile_id` int(4) DEFAULT NULL,
2301   `template_code` char(100) NOT NULL DEFAULT 'DEFAULT TEMPLATE',
2302   `template_desc` char(100) NOT NULL DEFAULT 'Default description',
2303   `page_width` float NOT NULL DEFAULT 0,
2304   `page_height` float NOT NULL DEFAULT 0,
2305   `label_width` float NOT NULL DEFAULT 0,
2306   `label_height` float NOT NULL DEFAULT 0,
2307   `top_text_margin` float NOT NULL DEFAULT 0,
2308   `left_text_margin` float NOT NULL DEFAULT 0,
2309   `top_margin` float NOT NULL DEFAULT 0,
2310   `left_margin` float NOT NULL DEFAULT 0,
2311   `cols` int(2) NOT NULL DEFAULT 0,
2312   `rows` int(2) NOT NULL DEFAULT 0,
2313   `col_gap` float NOT NULL DEFAULT 0,
2314   `row_gap` float NOT NULL DEFAULT 0,
2315   `units` char(20) NOT NULL DEFAULT 'POINT',
2316   `creator` char(15) NOT NULL DEFAULT 'Labels',
2317   PRIMARY KEY (`template_id`),
2318   KEY `template_profile_fk_constraint` (`profile_id`)
2319 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2320 /*!40101 SET character_set_client = @saved_cs_client */;
2321
2322 --
2323 -- Table structure for table `curbside_pickup_issues`
2324 --
2325
2326 DROP TABLE IF EXISTS `curbside_pickup_issues`;
2327 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2328 /*!40101 SET character_set_client = utf8 */;
2329 CREATE TABLE `curbside_pickup_issues` (
2330   `id` int(11) NOT NULL AUTO_INCREMENT,
2331   `curbside_pickup_id` int(11) NOT NULL,
2332   `issue_id` int(11) NOT NULL,
2333   `reserve_id` int(11) NOT NULL,
2334   PRIMARY KEY (`id`),
2335   KEY `curbside_pickup_id` (`curbside_pickup_id`),
2336   CONSTRAINT `curbside_pickup_issues_ibfk_1` FOREIGN KEY (`curbside_pickup_id`) REFERENCES `curbside_pickups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2337 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2338 /*!40101 SET character_set_client = @saved_cs_client */;
2339
2340 --
2341 -- Table structure for table `curbside_pickup_opening_slots`
2342 --
2343
2344 DROP TABLE IF EXISTS `curbside_pickup_opening_slots`;
2345 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2346 /*!40101 SET character_set_client = utf8 */;
2347 CREATE TABLE `curbside_pickup_opening_slots` (
2348   `id` int(11) NOT NULL AUTO_INCREMENT,
2349   `curbside_pickup_policy_id` int(11) NOT NULL,
2350   `day` tinyint(1) NOT NULL,
2351   `start_hour` int(2) NOT NULL,
2352   `start_minute` int(2) NOT NULL,
2353   `end_hour` int(2) NOT NULL,
2354   `end_minute` int(2) NOT NULL,
2355   PRIMARY KEY (`id`),
2356   KEY `curbside_pickup_policy_id` (`curbside_pickup_policy_id`),
2357   CONSTRAINT `curbside_pickup_opening_slots_ibfk_1` FOREIGN KEY (`curbside_pickup_policy_id`) REFERENCES `curbside_pickup_policy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2358 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2359 /*!40101 SET character_set_client = @saved_cs_client */;
2360
2361 --
2362 -- Table structure for table `curbside_pickup_policy`
2363 --
2364
2365 DROP TABLE IF EXISTS `curbside_pickup_policy`;
2366 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2367 /*!40101 SET character_set_client = utf8 */;
2368 CREATE TABLE `curbside_pickup_policy` (
2369   `id` int(11) NOT NULL AUTO_INCREMENT,
2370   `branchcode` varchar(10) NOT NULL,
2371   `enabled` tinyint(1) NOT NULL DEFAULT 0,
2372   `enable_waiting_holds_only` tinyint(1) NOT NULL DEFAULT 0,
2373   `pickup_interval` int(2) NOT NULL DEFAULT 0,
2374   `patrons_per_interval` int(2) NOT NULL DEFAULT 0,
2375   `patron_scheduled_pickup` tinyint(1) NOT NULL DEFAULT 0,
2376   PRIMARY KEY (`id`),
2377   UNIQUE KEY `branchcode` (`branchcode`),
2378   CONSTRAINT `curbside_pickup_policy_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2379 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2380 /*!40101 SET character_set_client = @saved_cs_client */;
2381
2382 --
2383 -- Table structure for table `curbside_pickups`
2384 --
2385
2386 DROP TABLE IF EXISTS `curbside_pickups`;
2387 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2388 /*!40101 SET character_set_client = utf8 */;
2389 CREATE TABLE `curbside_pickups` (
2390   `id` int(11) NOT NULL AUTO_INCREMENT,
2391   `borrowernumber` int(11) NOT NULL,
2392   `branchcode` varchar(10) NOT NULL,
2393   `scheduled_pickup_datetime` datetime NOT NULL,
2394   `staged_datetime` datetime DEFAULT NULL,
2395   `staged_by` int(11) DEFAULT NULL,
2396   `arrival_datetime` datetime DEFAULT NULL,
2397   `delivered_datetime` datetime DEFAULT NULL,
2398   `delivered_by` int(11) DEFAULT NULL,
2399   `notes` text DEFAULT NULL,
2400   PRIMARY KEY (`id`),
2401   KEY `branchcode` (`branchcode`),
2402   KEY `borrowernumber` (`borrowernumber`),
2403   KEY `staged_by` (`staged_by`),
2404   CONSTRAINT `curbside_pickups_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2405   CONSTRAINT `curbside_pickups_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2406   CONSTRAINT `curbside_pickups_ibfk_3` FOREIGN KEY (`staged_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
2407 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2408 /*!40101 SET character_set_client = @saved_cs_client */;
2409
2410 --
2411 -- Table structure for table `currency`
2412 --
2413
2414 DROP TABLE IF EXISTS `currency`;
2415 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2416 /*!40101 SET character_set_client = utf8 */;
2417 CREATE TABLE `currency` (
2418   `currency` varchar(10) NOT NULL DEFAULT '',
2419   `symbol` varchar(5) DEFAULT NULL,
2420   `isocode` varchar(5) DEFAULT NULL,
2421   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2422   `rate` float(15,5) DEFAULT NULL,
2423   `active` tinyint(1) DEFAULT NULL,
2424   `archived` tinyint(1) DEFAULT 0,
2425   `p_sep_by_space` tinyint(1) DEFAULT 0,
2426   PRIMARY KEY (`currency`)
2427 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2428 /*!40101 SET character_set_client = @saved_cs_client */;
2429
2430 --
2431 -- Table structure for table `deletedbiblio`
2432 --
2433
2434 DROP TABLE IF EXISTS `deletedbiblio`;
2435 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2436 /*!40101 SET character_set_client = utf8 */;
2437 CREATE TABLE `deletedbiblio` (
2438   `biblionumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned to each bibliographic record',
2439   `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'foriegn key from the biblio_framework table to identify which framework was used in cataloging this record',
2440   `author` longtext DEFAULT NULL COMMENT 'statement of responsibility from MARC record (100$a in MARC21)',
2441   `title` longtext DEFAULT NULL COMMENT 'title (without the subtitle) from the MARC record (245$a in MARC21)',
2442   `medium` longtext DEFAULT NULL COMMENT 'medium from the MARC record (245$h in MARC21)',
2443   `subtitle` longtext DEFAULT NULL COMMENT 'remainder of the title from the MARC record (245$b in MARC21)',
2444   `part_number` longtext DEFAULT NULL COMMENT 'part number from the MARC record (245$n in MARC21)',
2445   `part_name` longtext DEFAULT NULL COMMENT 'part name from the MARC record (245$p in MARC21)',
2446   `unititle` longtext DEFAULT NULL COMMENT 'uniform title (without the subtitle) from the MARC record (240$a in MARC21)',
2447   `notes` longtext DEFAULT NULL COMMENT 'values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)',
2448   `serial` tinyint(1) DEFAULT NULL COMMENT 'Boolean indicating whether biblio is for a serial',
2449   `seriestitle` longtext DEFAULT NULL,
2450   `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'publication or copyright date from the MARC record',
2451   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
2452   `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
2453   `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
2454   PRIMARY KEY (`biblionumber`),
2455   KEY `blbnoidx` (`biblionumber`)
2456 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2457 /*!40101 SET character_set_client = @saved_cs_client */;
2458
2459 --
2460 -- Table structure for table `deletedbiblio_metadata`
2461 --
2462
2463 DROP TABLE IF EXISTS `deletedbiblio_metadata`;
2464 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2465 /*!40101 SET character_set_client = utf8 */;
2466 CREATE TABLE `deletedbiblio_metadata` (
2467   `id` int(11) NOT NULL AUTO_INCREMENT,
2468   `biblionumber` int(11) NOT NULL,
2469   `format` varchar(16) NOT NULL,
2470   `schema` varchar(16) NOT NULL,
2471   `metadata` longtext NOT NULL,
2472   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2473   PRIMARY KEY (`id`),
2474   UNIQUE KEY `deletedbiblio_metadata_uniq_key` (`biblionumber`,`format`,`schema`),
2475   KEY `timestamp` (`timestamp`),
2476   CONSTRAINT `deletedrecord_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `deletedbiblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2477 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2478 /*!40101 SET character_set_client = @saved_cs_client */;
2479
2480 --
2481 -- Table structure for table `deletedbiblioitems`
2482 --
2483
2484 DROP TABLE IF EXISTS `deletedbiblioitems`;
2485 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2486 /*!40101 SET character_set_client = utf8 */;
2487 CREATE TABLE `deletedbiblioitems` (
2488   `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key, unique identifier assigned by Koha',
2489   `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the biblio table',
2490   `volume` longtext DEFAULT NULL,
2491   `number` longtext DEFAULT NULL,
2492   `itemtype` varchar(10) DEFAULT NULL COMMENT 'biblio level item type (MARC21 942$c)',
2493   `isbn` longtext DEFAULT NULL COMMENT 'ISBN (MARC21 020$a)',
2494   `issn` longtext DEFAULT NULL COMMENT 'ISSN (MARC21 022$a)',
2495   `ean` longtext DEFAULT NULL,
2496   `publicationyear` mediumtext DEFAULT NULL,
2497   `publishercode` varchar(255) DEFAULT NULL COMMENT 'publisher (MARC21 260$b)',
2498   `volumedate` date DEFAULT NULL,
2499   `volumedesc` mediumtext DEFAULT NULL COMMENT 'volume information (MARC21 362$a)',
2500   `collectiontitle` longtext DEFAULT NULL,
2501   `collectionissn` mediumtext DEFAULT NULL,
2502   `collectionvolume` longtext DEFAULT NULL,
2503   `editionstatement` mediumtext DEFAULT NULL,
2504   `editionresponsibility` mediumtext DEFAULT NULL,
2505   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2506   `illus` varchar(255) DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)',
2507   `pages` varchar(255) DEFAULT NULL COMMENT 'number of pages (MARC21 300$c)',
2508   `notes` longtext DEFAULT NULL,
2509   `size` varchar(255) DEFAULT NULL COMMENT 'material size (MARC21 300$c)',
2510   `place` varchar(255) DEFAULT NULL COMMENT 'publication place (MARC21 260$a)',
2511   `lccn` varchar(25) DEFAULT NULL COMMENT 'library of congress control number (MARC21 010$a)',
2512   `url` mediumtext DEFAULT NULL COMMENT 'url (MARC21 856$u)',
2513   `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source (MARC21 942$2)',
2514   `cn_class` varchar(30) DEFAULT NULL,
2515   `cn_item` varchar(10) DEFAULT NULL,
2516   `cn_suffix` varchar(10) DEFAULT NULL,
2517   `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized version of the call number used for sorting',
2518   `agerestriction` varchar(255) DEFAULT NULL COMMENT 'target audience/age restriction from the bib record (MARC21 521$a)',
2519   `totalissues` int(10) DEFAULT NULL,
2520   PRIMARY KEY (`biblioitemnumber`),
2521   KEY `bibinoidx` (`biblioitemnumber`),
2522   KEY `bibnoidx` (`biblionumber`),
2523   KEY `itemtype_idx` (`itemtype`),
2524   KEY `isbn` (`isbn`(191)),
2525   KEY `ean` (`ean`(191)),
2526   KEY `publishercode` (`publishercode`(191)),
2527   KEY `timestamp` (`timestamp`)
2528 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2529 /*!40101 SET character_set_client = @saved_cs_client */;
2530
2531 --
2532 -- Table structure for table `deletedborrowers`
2533 --
2534
2535 DROP TABLE IF EXISTS `deletedborrowers`;
2536 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2537 /*!40101 SET character_set_client = utf8 */;
2538 CREATE TABLE `deletedborrowers` (
2539   `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key, Koha assigned ID number for patrons/borrowers',
2540   `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
2541   `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2542   `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
2543   `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
2544   `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2545   `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
2546   `initials` mediumtext DEFAULT NULL COMMENT 'initials for your patron/borrower',
2547   `pronouns` longtext DEFAULT NULL COMMENT 'patron/borrower pronouns',
2548   `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',
2549   `streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s primary address',
2550   `address` longtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s primary address',
2551   `address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s primary address',
2552   `city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s primary address',
2553   `state` mediumtext DEFAULT NULL COMMENT 'the state or province for your patron/borrower''s primary address',
2554   `zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s primary address',
2555   `country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s primary address',
2556   `email` longtext DEFAULT NULL COMMENT 'the primary email address for your patron/borrower''s primary address',
2557   `phone` mediumtext DEFAULT NULL COMMENT 'the primary phone number for your patron/borrower''s primary address',
2558   `mobile` tinytext DEFAULT NULL COMMENT 'the other phone number for your patron/borrower''s primary address',
2559   `fax` longtext DEFAULT NULL COMMENT 'the fax number for your patron/borrower''s primary address',
2560   `emailpro` mediumtext DEFAULT NULL COMMENT 'the secondary email addres for your patron/borrower''s primary address',
2561   `phonepro` mediumtext DEFAULT NULL COMMENT 'the secondary phone number for your patron/borrower''s primary address',
2562   `B_streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address',
2563   `B_streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s alternate address',
2564   `B_address` mediumtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s alternate address',
2565   `B_address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s alternate address',
2566   `B_city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s alternate address',
2567   `B_state` mediumtext DEFAULT NULL COMMENT 'the state for your patron/borrower''s alternate address',
2568   `B_zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s alternate address',
2569   `B_country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s alternate address',
2570   `B_email` mediumtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate email address',
2571   `B_phone` longtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate phone number',
2572   `dateofbirth` date DEFAULT NULL COMMENT 'the patron/borrower''s date of birth (YYYY-MM-DD)',
2573   `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table, includes the code of the patron/borrower''s home branch',
2574   `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category',
2575   `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)',
2576   `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)',
2577   `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)',
2578   `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed',
2579   `gonenoaddress` tinyint(1) DEFAULT NULL COMMENT 'set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having an unconfirmed address',
2580   `lost` tinyint(1) DEFAULT NULL COMMENT 'set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having lost their card',
2581   `debarred` date DEFAULT NULL COMMENT 'until this date the patron can only check-in (no loans, no holds, etc.), is a fine based on days instead of money (YYYY-MM-DD)',
2582   `debarredcomment` varchar(255) DEFAULT NULL COMMENT 'comment on the stop of patron',
2583   `contactname` longtext DEFAULT NULL COMMENT 'used for children and profesionals to include surname or last name of guarantor or organization name',
2584   `contactfirstname` mediumtext DEFAULT NULL COMMENT 'used for children to include first name of guarantor',
2585   `contacttitle` mediumtext DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor',
2586   `borrowernotes` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface',
2587   `relationship` varchar(100) DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor',
2588   `sex` varchar(1) DEFAULT NULL COMMENT 'patron/borrower''s gender',
2589   `password` varchar(60) DEFAULT NULL COMMENT 'patron/borrower''s encrypted password',
2590   `secret` mediumtext DEFAULT NULL COMMENT 'Secret for 2FA',
2591   `auth_method` enum('password','two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method',
2592   `flags` bigint(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions',
2593   `userid` varchar(75) DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in',
2594   `opacnote` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface',
2595   `contactnote` varchar(255) DEFAULT NULL COMMENT 'a note related to the patron/borrower''s alternate address',
2596   `sort1` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
2597   `sort2` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
2598   `altcontactfirstname` mediumtext DEFAULT NULL COMMENT 'first name of alternate contact for the patron/borrower',
2599   `altcontactsurname` mediumtext DEFAULT NULL COMMENT 'surname or last name of the alternate contact for the patron/borrower',
2600   `altcontactaddress1` mediumtext DEFAULT NULL COMMENT 'the first address line for the alternate contact for the patron/borrower',
2601   `altcontactaddress2` mediumtext DEFAULT NULL COMMENT 'the second address line for the alternate contact for the patron/borrower',
2602   `altcontactaddress3` mediumtext DEFAULT NULL COMMENT 'the city for the alternate contact for the patron/borrower',
2603   `altcontactstate` mediumtext DEFAULT NULL COMMENT 'the state for the alternate contact for the patron/borrower',
2604   `altcontactzipcode` mediumtext DEFAULT NULL COMMENT 'the zipcode for the alternate contact for the patron/borrower',
2605   `altcontactcountry` mediumtext DEFAULT NULL COMMENT 'the country for the alternate contact for the patron/borrower',
2606   `altcontactphone` mediumtext DEFAULT NULL COMMENT 'the phone number for the alternate contact for the patron/borrower',
2607   `smsalertnumber` varchar(50) DEFAULT NULL COMMENT 'the mobile phone number where the patron/borrower would like to receive notices (if SMS turned on)',
2608   `sms_provider_id` int(11) DEFAULT NULL COMMENT 'the provider of the mobile phone number defined in smsalertnumber',
2609   `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history  KEY `borrowernumber` (`borrowernumber`),',
2610   `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines',
2611   `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
2612   `checkprevcheckout` varchar(7) NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.',
2613   `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'time of last change could be useful for synchronization with external systems (among others)',
2614   `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
2615   `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
2616   `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
2617   `overdrive_auth_token` mediumtext DEFAULT NULL COMMENT 'persist OverDrive auth token',
2618   `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2619   `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2620   `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
2621   KEY `borrowernumber` (`borrowernumber`),
2622   KEY `cardnumber` (`cardnumber`),
2623   KEY `sms_provider_id` (`sms_provider_id`)
2624 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2625 /*!40101 SET character_set_client = @saved_cs_client */;
2626
2627 --
2628 -- Table structure for table `deleteditems`
2629 --
2630
2631 DROP TABLE IF EXISTS `deleteditems`;
2632 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2633 /*!40101 SET character_set_client = utf8 */;
2634 CREATE TABLE `deleteditems` (
2635   `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key and unique identifier added by Koha',
2636   `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
2637   `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
2638   `barcode` varchar(20) DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
2639   `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
2640   `booksellerid` longtext DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
2641   `homebranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
2642   `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
2643   `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
2644   `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
2645   `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out',
2646   `datelastseen` date DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
2647   `stack` tinyint(1) DEFAULT NULL,
2648   `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
2649   `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
2650   `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
2651   `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
2652   `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
2653   `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
2654   `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
2655   `itemcallnumber` varchar(255) DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
2656   `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
2657   `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out',
2658   `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
2659   `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
2660   `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
2661   `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
2662   `itemnotes_nonpublic` longtext DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
2663   `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
2664   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
2665   `deleted_on` datetime DEFAULT NULL COMMENT 'date/time of deletion',
2666   `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
2667   `permanent_location` varchar(80) DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
2668   `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
2669   `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
2670   `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
2671   `ccode` varchar(80) DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
2672   `materials` mediumtext DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
2673   `uri` mediumtext DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
2674   `itype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
2675   `more_subfields_xml` longtext DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
2676   `enumchron` mediumtext DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
2677   `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
2678   `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
2679   `new_status` varchar(32) DEFAULT NULL COMMENT '''new'' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob.',
2680   `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
2681   PRIMARY KEY (`itemnumber`),
2682   KEY `delitembarcodeidx` (`barcode`),
2683   KEY `delitemstocknumberidx` (`stocknumber`),
2684   KEY `delitembinoidx` (`biblioitemnumber`),
2685   KEY `delitembibnoidx` (`biblionumber`),
2686   KEY `delhomebranch` (`homebranch`),
2687   KEY `delholdingbranch` (`holdingbranch`),
2688   KEY `itype_idx` (`itype`),
2689   KEY `timestamp` (`timestamp`)
2690 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2691 /*!40101 SET character_set_client = @saved_cs_client */;
2692
2693 --
2694 -- Table structure for table `desks`
2695 --
2696
2697 DROP TABLE IF EXISTS `desks`;
2698 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2699 /*!40101 SET character_set_client = utf8 */;
2700 CREATE TABLE `desks` (
2701   `desk_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
2702   `desk_name` varchar(100) NOT NULL DEFAULT '' COMMENT 'name of the desk',
2703   `branchcode` varchar(10) NOT NULL COMMENT 'library the desk is located at',
2704   PRIMARY KEY (`desk_id`),
2705   KEY `fk_desks_branchcode` (`branchcode`),
2706   CONSTRAINT `fk_desks_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2707 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2708 /*!40101 SET character_set_client = @saved_cs_client */;
2709
2710 --
2711 -- Table structure for table `discharges`
2712 --
2713
2714 DROP TABLE IF EXISTS `discharges`;
2715 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2716 /*!40101 SET character_set_client = utf8 */;
2717 CREATE TABLE `discharges` (
2718   `discharge_id` int(11) NOT NULL AUTO_INCREMENT,
2719   `borrower` int(11) DEFAULT NULL,
2720   `needed` timestamp NULL DEFAULT NULL,
2721   `validated` timestamp NULL DEFAULT NULL,
2722   PRIMARY KEY (`discharge_id`),
2723   KEY `borrower_discharges_ibfk1` (`borrower`),
2724   CONSTRAINT `borrower_discharges_ibfk1` FOREIGN KEY (`borrower`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2725 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2726 /*!40101 SET character_set_client = @saved_cs_client */;
2727
2728 --
2729 -- Table structure for table `edifact_ean`
2730 --
2731
2732 DROP TABLE IF EXISTS `edifact_ean`;
2733 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2734 /*!40101 SET character_set_client = utf8 */;
2735 CREATE TABLE `edifact_ean` (
2736   `ee_id` int(11) NOT NULL AUTO_INCREMENT,
2737   `description` varchar(128) DEFAULT NULL,
2738   `branchcode` varchar(10) DEFAULT NULL,
2739   `ean` varchar(15) NOT NULL,
2740   `id_code_qualifier` varchar(3) NOT NULL DEFAULT '14',
2741   PRIMARY KEY (`ee_id`),
2742   KEY `efk_branchcode` (`branchcode`),
2743   CONSTRAINT `efk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
2744 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2745 /*!40101 SET character_set_client = @saved_cs_client */;
2746
2747 --
2748 -- Table structure for table `edifact_messages`
2749 --
2750
2751 DROP TABLE IF EXISTS `edifact_messages`;
2752 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2753 /*!40101 SET character_set_client = utf8 */;
2754 CREATE TABLE `edifact_messages` (
2755   `id` int(11) NOT NULL AUTO_INCREMENT,
2756   `message_type` varchar(10) NOT NULL,
2757   `transfer_date` date DEFAULT NULL,
2758   `vendor_id` int(11) DEFAULT NULL,
2759   `edi_acct` int(11) DEFAULT NULL,
2760   `status` mediumtext DEFAULT NULL,
2761   `basketno` int(11) DEFAULT NULL,
2762   `raw_msg` longtext DEFAULT NULL,
2763   `filename` mediumtext DEFAULT NULL,
2764   `deleted` tinyint(1) NOT NULL DEFAULT 0,
2765   PRIMARY KEY (`id`),
2766   KEY `vendorid` (`vendor_id`),
2767   KEY `ediacct` (`edi_acct`),
2768   KEY `basketno` (`basketno`),
2769   CONSTRAINT `emfk_basketno` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2770   CONSTRAINT `emfk_edi_acct` FOREIGN KEY (`edi_acct`) REFERENCES `vendor_edi_accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2771   CONSTRAINT `emfk_vendor` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2772 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2773 /*!40101 SET character_set_client = @saved_cs_client */;
2774
2775 --
2776 -- Table structure for table `erm_agreement_licenses`
2777 --
2778
2779 DROP TABLE IF EXISTS `erm_agreement_licenses`;
2780 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2781 /*!40101 SET character_set_client = utf8 */;
2782 CREATE TABLE `erm_agreement_licenses` (
2783   `agreement_license_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2784   `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2785   `license_id` int(11) NOT NULL COMMENT 'link to the license',
2786   `status` varchar(80) NOT NULL COMMENT 'current status of the license',
2787   `physical_location` varchar(80) DEFAULT NULL COMMENT 'physical location of the license',
2788   `notes` mediumtext DEFAULT NULL COMMENT 'notes about this license',
2789   `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the license',
2790   PRIMARY KEY (`agreement_license_id`),
2791   UNIQUE KEY `erm_agreement_licenses_uniq` (`agreement_id`,`license_id`),
2792   KEY `erm_agreement_licenses_ibfk_2` (`license_id`),
2793   CONSTRAINT `erm_agreement_licenses_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2794   CONSTRAINT `erm_agreement_licenses_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE
2795 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2796 /*!40101 SET character_set_client = @saved_cs_client */;
2797
2798 --
2799 -- Table structure for table `erm_agreement_periods`
2800 --
2801
2802 DROP TABLE IF EXISTS `erm_agreement_periods`;
2803 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2804 /*!40101 SET character_set_client = utf8 */;
2805 CREATE TABLE `erm_agreement_periods` (
2806   `agreement_period_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2807   `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2808   `started_on` date NOT NULL COMMENT 'start of the agreement period',
2809   `ended_on` date DEFAULT NULL COMMENT 'end of the agreement period',
2810   `cancellation_deadline` date DEFAULT NULL COMMENT 'Deadline for the cancellation',
2811   `notes` mediumtext DEFAULT NULL COMMENT 'notes about this period',
2812   PRIMARY KEY (`agreement_period_id`),
2813   KEY `erm_agreement_periods_ibfk_1` (`agreement_id`),
2814   CONSTRAINT `erm_agreement_periods_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2815 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2816 /*!40101 SET character_set_client = @saved_cs_client */;
2817
2818 --
2819 -- Table structure for table `erm_agreement_relationships`
2820 --
2821
2822 DROP TABLE IF EXISTS `erm_agreement_relationships`;
2823 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2824 /*!40101 SET character_set_client = utf8 */;
2825 CREATE TABLE `erm_agreement_relationships` (
2826   `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2827   `related_agreement_id` int(11) NOT NULL COMMENT 'link to the related agreement',
2828   `relationship` enum('supersedes','is-superseded-by','provides_post-cancellation_access_for','has-post-cancellation-access-in','tracks_demand-driven_acquisitions_for','has-demand-driven-acquisitions-in','has_backfile_in','has_frontfile_in','related_to') NOT NULL COMMENT 'relationship between the two agreements',
2829   `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
2830   PRIMARY KEY (`agreement_id`,`related_agreement_id`),
2831   KEY `erm_agreement_relationships_ibfk_2` (`related_agreement_id`),
2832   CONSTRAINT `erm_agreement_relationships_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2833   CONSTRAINT `erm_agreement_relationships_ibfk_2` FOREIGN KEY (`related_agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2834 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2835 /*!40101 SET character_set_client = @saved_cs_client */;
2836
2837 --
2838 -- Table structure for table `erm_agreements`
2839 --
2840
2841 DROP TABLE IF EXISTS `erm_agreements`;
2842 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2843 /*!40101 SET character_set_client = utf8 */;
2844 CREATE TABLE `erm_agreements` (
2845   `agreement_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2846   `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2847   `name` varchar(255) NOT NULL COMMENT 'name of the agreement',
2848   `description` longtext DEFAULT NULL COMMENT 'description of the agreement',
2849   `status` varchar(80) NOT NULL COMMENT 'current status of the agreement',
2850   `closure_reason` varchar(80) DEFAULT NULL COMMENT 'reason of the closure',
2851   `is_perpetual` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the agreement perpetual',
2852   `renewal_priority` varchar(80) DEFAULT NULL COMMENT 'priority of the renewal',
2853   `license_info` varchar(80) DEFAULT NULL COMMENT 'info about the license',
2854   PRIMARY KEY (`agreement_id`),
2855   KEY `erm_agreements_ibfk_1` (`vendor_id`),
2856   CONSTRAINT `erm_agreements_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2857 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2858 /*!40101 SET character_set_client = @saved_cs_client */;
2859
2860 --
2861 -- Table structure for table `erm_documents`
2862 --
2863
2864 DROP TABLE IF EXISTS `erm_documents`;
2865 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2866 /*!40101 SET character_set_client = utf8 */;
2867 CREATE TABLE `erm_documents` (
2868   `document_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2869   `agreement_id` int(11) DEFAULT NULL COMMENT 'link to the agreement',
2870   `license_id` int(11) DEFAULT NULL COMMENT 'link to the license',
2871   `file_name` varchar(255) DEFAULT NULL COMMENT 'name of the file',
2872   `file_type` varchar(255) DEFAULT NULL COMMENT 'type of the file',
2873   `file_description` varchar(255) DEFAULT NULL COMMENT 'description of the file',
2874   `file_content` longblob DEFAULT NULL COMMENT 'the content of the file',
2875   `uploaded_on` datetime DEFAULT NULL COMMENT 'datetime when the file as attached',
2876   `physical_location` varchar(255) DEFAULT NULL COMMENT 'physical location of the document',
2877   `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the document',
2878   `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
2879   PRIMARY KEY (`document_id`),
2880   KEY `erm_documents_ibfk_1` (`agreement_id`),
2881   KEY `erm_documents_ibfk_2` (`license_id`),
2882   CONSTRAINT `erm_documents_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2883   CONSTRAINT `erm_documents_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE
2884 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2885 /*!40101 SET character_set_client = @saved_cs_client */;
2886
2887 --
2888 -- Table structure for table `erm_eholdings_packages`
2889 --
2890
2891 DROP TABLE IF EXISTS `erm_eholdings_packages`;
2892 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2893 /*!40101 SET character_set_client = utf8 */;
2894 CREATE TABLE `erm_eholdings_packages` (
2895   `package_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2896   `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2897   `name` varchar(255) NOT NULL COMMENT 'name of the package',
2898   `external_id` varchar(255) DEFAULT NULL COMMENT 'External key',
2899   `provider` enum('ebsco') DEFAULT NULL COMMENT 'External provider',
2900   `package_type` varchar(80) DEFAULT NULL COMMENT 'type of the package',
2901   `content_type` varchar(80) DEFAULT NULL COMMENT 'type of the package',
2902   `notes` mediumtext DEFAULT NULL COMMENT 'notes about this package',
2903   `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date of creation of the package',
2904   PRIMARY KEY (`package_id`),
2905   KEY `erm_eholdings_packages_ibfk_1` (`vendor_id`),
2906   CONSTRAINT `erm_eholdings_packages_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2907 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2908 /*!40101 SET character_set_client = @saved_cs_client */;
2909
2910 --
2911 -- Table structure for table `erm_eholdings_packages_agreements`
2912 --
2913
2914 DROP TABLE IF EXISTS `erm_eholdings_packages_agreements`;
2915 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2916 /*!40101 SET character_set_client = utf8 */;
2917 CREATE TABLE `erm_eholdings_packages_agreements` (
2918   `package_id` int(11) NOT NULL COMMENT 'link to the package',
2919   `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2920   PRIMARY KEY (`package_id`,`agreement_id`),
2921   KEY `erm_eholdings_packages_agreements_ibfk_2` (`agreement_id`),
2922   CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2923   CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2924 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2925 /*!40101 SET character_set_client = @saved_cs_client */;
2926
2927 --
2928 -- Table structure for table `erm_eholdings_resources`
2929 --
2930
2931 DROP TABLE IF EXISTS `erm_eholdings_resources`;
2932 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2933 /*!40101 SET character_set_client = utf8 */;
2934 CREATE TABLE `erm_eholdings_resources` (
2935   `resource_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2936   `title_id` int(11) NOT NULL,
2937   `package_id` int(11) NOT NULL,
2938   `vendor_id` int(11) DEFAULT NULL,
2939   `started_on` date DEFAULT NULL,
2940   `ended_on` date DEFAULT NULL,
2941   `proxy` varchar(80) DEFAULT NULL,
2942   PRIMARY KEY (`resource_id`),
2943   UNIQUE KEY `erm_eholdings_resources_uniq` (`title_id`,`package_id`),
2944   KEY `erm_eholdings_resources_ibfk_2` (`package_id`),
2945   KEY `erm_eholdings_resources_ibfk_3` (`vendor_id`),
2946   CONSTRAINT `erm_eholdings_resources_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_eholdings_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2947   CONSTRAINT `erm_eholdings_resources_ibfk_2` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2948   CONSTRAINT `erm_eholdings_resources_ibfk_3` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2949 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2950 /*!40101 SET character_set_client = @saved_cs_client */;
2951
2952 --
2953 -- Table structure for table `erm_eholdings_titles`
2954 --
2955
2956 DROP TABLE IF EXISTS `erm_eholdings_titles`;
2957 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2958 /*!40101 SET character_set_client = utf8 */;
2959 CREATE TABLE `erm_eholdings_titles` (
2960   `title_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2961   `biblio_id` int(11) DEFAULT NULL,
2962   `publication_title` varchar(255) DEFAULT NULL,
2963   `external_id` varchar(255) DEFAULT NULL,
2964   `print_identifier` varchar(255) DEFAULT NULL,
2965   `online_identifier` varchar(255) DEFAULT NULL,
2966   `date_first_issue_online` varchar(255) DEFAULT NULL,
2967   `num_first_vol_online` varchar(255) DEFAULT NULL,
2968   `num_first_issue_online` varchar(255) DEFAULT NULL,
2969   `date_last_issue_online` varchar(255) DEFAULT NULL,
2970   `num_last_vol_online` varchar(255) DEFAULT NULL,
2971   `num_last_issue_online` varchar(255) DEFAULT NULL,
2972   `title_url` varchar(255) DEFAULT NULL,
2973   `first_author` varchar(255) DEFAULT NULL,
2974   `embargo_info` varchar(255) DEFAULT NULL,
2975   `coverage_depth` varchar(255) DEFAULT NULL,
2976   `notes` varchar(255) DEFAULT NULL,
2977   `publisher_name` varchar(255) DEFAULT NULL,
2978   `publication_type` varchar(80) DEFAULT NULL,
2979   `date_monograph_published_print` varchar(255) DEFAULT NULL,
2980   `date_monograph_published_online` varchar(255) DEFAULT NULL,
2981   `monograph_volume` varchar(255) DEFAULT NULL,
2982   `monograph_edition` varchar(255) DEFAULT NULL,
2983   `first_editor` varchar(255) DEFAULT NULL,
2984   `parent_publication_title_id` varchar(255) DEFAULT NULL,
2985   `preceeding_publication_title_id` varchar(255) DEFAULT NULL,
2986   `access_type` varchar(255) DEFAULT NULL,
2987   PRIMARY KEY (`title_id`),
2988   KEY `erm_eholdings_titles_ibfk_2` (`biblio_id`),
2989   CONSTRAINT `erm_eholdings_titles_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE
2990 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2991 /*!40101 SET character_set_client = @saved_cs_client */;
2992
2993 --
2994 -- Table structure for table `erm_licenses`
2995 --
2996
2997 DROP TABLE IF EXISTS `erm_licenses`;
2998 /*!40101 SET @saved_cs_client     = @@character_set_client */;
2999 /*!40101 SET character_set_client = utf8 */;
3000 CREATE TABLE `erm_licenses` (
3001   `license_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3002   `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
3003   `name` varchar(255) NOT NULL COMMENT 'name of the license',
3004   `description` longtext DEFAULT NULL COMMENT 'description of the license',
3005   `type` varchar(80) NOT NULL COMMENT 'type of the license',
3006   `status` varchar(80) NOT NULL COMMENT 'current status of the license',
3007   `started_on` date DEFAULT NULL COMMENT 'start of the license',
3008   `ended_on` date DEFAULT NULL COMMENT 'end of the license',
3009   PRIMARY KEY (`license_id`),
3010   KEY `erm_licenses_ibfk_1` (`vendor_id`),
3011   CONSTRAINT `erm_licenses_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
3012 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3013 /*!40101 SET character_set_client = @saved_cs_client */;
3014
3015 --
3016 -- Table structure for table `erm_user_roles`
3017 --
3018
3019 DROP TABLE IF EXISTS `erm_user_roles`;
3020 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3021 /*!40101 SET character_set_client = utf8 */;
3022 CREATE TABLE `erm_user_roles` (
3023   `user_role_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3024   `agreement_id` int(11) DEFAULT NULL COMMENT 'link to the agreement',
3025   `license_id` int(11) DEFAULT NULL COMMENT 'link to the license',
3026   `user_id` int(11) NOT NULL COMMENT 'link to the user',
3027   `role` varchar(80) NOT NULL COMMENT 'role of the user',
3028   PRIMARY KEY (`user_role_id`),
3029   KEY `erm_user_roles_ibfk_1` (`agreement_id`),
3030   KEY `erm_user_roles_ibfk_2` (`license_id`),
3031   KEY `erm_user_roles_ibfk_3` (`user_id`),
3032   CONSTRAINT `erm_user_roles_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3033   CONSTRAINT `erm_user_roles_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3034   CONSTRAINT `erm_user_roles_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3035 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3036 /*!40101 SET character_set_client = @saved_cs_client */;
3037
3038 --
3039 -- Table structure for table `export_format`
3040 --
3041
3042 DROP TABLE IF EXISTS `export_format`;
3043 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3044 /*!40101 SET character_set_client = utf8 */;
3045 CREATE TABLE `export_format` (
3046   `export_format_id` int(11) NOT NULL AUTO_INCREMENT,
3047   `profile` varchar(255) NOT NULL,
3048   `description` longtext NOT NULL,
3049   `content` longtext NOT NULL,
3050   `csv_separator` varchar(2) NOT NULL DEFAULT ',',
3051   `field_separator` varchar(2) DEFAULT NULL,
3052   `subfield_separator` varchar(2) DEFAULT NULL,
3053   `encoding` varchar(255) NOT NULL DEFAULT 'utf8',
3054   `type` varchar(255) DEFAULT 'marc',
3055   `used_for` varchar(255) DEFAULT 'export_records',
3056   `staff_only` tinyint(1) NOT NULL DEFAULT 0,
3057   PRIMARY KEY (`export_format_id`),
3058   KEY `used_for_idx` (`used_for`(191)),
3059   KEY `staff_only_idx` (`staff_only`)
3060 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Used for CSV export';
3061 /*!40101 SET character_set_client = @saved_cs_client */;
3062
3063 --
3064 -- Table structure for table `hold_cancellation_requests`
3065 --
3066
3067 DROP TABLE IF EXISTS `hold_cancellation_requests`;
3068 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3069 /*!40101 SET character_set_client = utf8 */;
3070 CREATE TABLE `hold_cancellation_requests` (
3071   `hold_cancellation_request_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the cancellation request',
3072   `hold_id` int(11) NOT NULL COMMENT 'ID of the hold',
3073   `creation_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Time and date the cancellation request was created',
3074   PRIMARY KEY (`hold_cancellation_request_id`)
3075 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3076 /*!40101 SET character_set_client = @saved_cs_client */;
3077
3078 --
3079 -- Table structure for table `hold_fill_targets`
3080 --
3081
3082 DROP TABLE IF EXISTS `hold_fill_targets`;
3083 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3084 /*!40101 SET character_set_client = utf8 */;
3085 CREATE TABLE `hold_fill_targets` (
3086   `borrowernumber` int(11) NOT NULL,
3087   `biblionumber` int(11) NOT NULL,
3088   `itemnumber` int(11) NOT NULL,
3089   `source_branchcode` varchar(10) DEFAULT NULL,
3090   `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
3091   `reserve_id` int(11) DEFAULT NULL,
3092   PRIMARY KEY (`itemnumber`),
3093   KEY `bib_branch` (`biblionumber`,`source_branchcode`),
3094   KEY `hold_fill_targets_ibfk_1` (`borrowernumber`),
3095   KEY `hold_fill_targets_ibfk_4` (`source_branchcode`),
3096   CONSTRAINT `hold_fill_targets_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3097   CONSTRAINT `hold_fill_targets_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3098   CONSTRAINT `hold_fill_targets_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3099   CONSTRAINT `hold_fill_targets_ibfk_4` FOREIGN KEY (`source_branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
3100 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3101 /*!40101 SET character_set_client = @saved_cs_client */;
3102
3103 --
3104 -- Table structure for table `housebound_profile`
3105 --
3106
3107 DROP TABLE IF EXISTS `housebound_profile`;
3108 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3109 /*!40101 SET character_set_client = utf8 */;
3110 CREATE TABLE `housebound_profile` (
3111   `borrowernumber` int(11) NOT NULL COMMENT 'Number of the borrower associated with this profile.',
3112   `day` mediumtext NOT NULL COMMENT 'The preferred day of the week for delivery.',
3113   `frequency` mediumtext NOT NULL COMMENT 'The Authorised_Value definining the pattern for delivery.',
3114   `fav_itemtypes` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred itemtypes.',
3115   `fav_subjects` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred subjects.',
3116   `fav_authors` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred authors.',
3117   `referral` mediumtext DEFAULT NULL COMMENT 'Free text indicating how the borrower was added to the service.',
3118   `notes` mediumtext DEFAULT NULL COMMENT 'Free text for additional notes.',
3119   PRIMARY KEY (`borrowernumber`),
3120   CONSTRAINT `housebound_profile_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3121 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3122 /*!40101 SET character_set_client = @saved_cs_client */;
3123
3124 --
3125 -- Table structure for table `housebound_role`
3126 --
3127
3128 DROP TABLE IF EXISTS `housebound_role`;
3129 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3130 /*!40101 SET character_set_client = utf8 */;
3131 CREATE TABLE `housebound_role` (
3132   `borrowernumber_id` int(11) NOT NULL COMMENT 'borrowernumber link',
3133   `housebound_chooser` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'set to 1 to indicate this patron is a housebound chooser volunteer',
3134   `housebound_deliverer` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'set to 1 to indicate this patron is a housebound deliverer volunteer',
3135   PRIMARY KEY (`borrowernumber_id`),
3136   CONSTRAINT `houseboundrole_bnfk` FOREIGN KEY (`borrowernumber_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3137 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3138 /*!40101 SET character_set_client = @saved_cs_client */;
3139
3140 --
3141 -- Table structure for table `housebound_visit`
3142 --
3143
3144 DROP TABLE IF EXISTS `housebound_visit`;
3145 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3146 /*!40101 SET character_set_client = utf8 */;
3147 CREATE TABLE `housebound_visit` (
3148   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the visit.',
3149   `borrowernumber` int(11) NOT NULL COMMENT 'Number of the borrower, & the profile, linked to this visit.',
3150   `appointment_date` date DEFAULT NULL COMMENT 'Date of visit.',
3151   `day_segment` varchar(10) DEFAULT NULL COMMENT 'Rough time frame: ''morning'', ''afternoon'' ''evening''',
3152   `chooser_brwnumber` int(11) DEFAULT NULL COMMENT 'Number of the borrower to choose items  for delivery.',
3153   `deliverer_brwnumber` int(11) DEFAULT NULL COMMENT 'Number of the borrower to deliver items.',
3154   PRIMARY KEY (`id`),
3155   KEY `houseboundvisit_bnfk` (`borrowernumber`),
3156   KEY `houseboundvisit_bnfk_1` (`chooser_brwnumber`),
3157   KEY `houseboundvisit_bnfk_2` (`deliverer_brwnumber`),
3158   CONSTRAINT `houseboundvisit_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `housebound_profile` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3159   CONSTRAINT `houseboundvisit_bnfk_1` FOREIGN KEY (`chooser_brwnumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3160   CONSTRAINT `houseboundvisit_bnfk_2` FOREIGN KEY (`deliverer_brwnumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3161 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3162 /*!40101 SET character_set_client = @saved_cs_client */;
3163
3164 --
3165 -- Table structure for table `identity_provider_domains`
3166 --
3167
3168 DROP TABLE IF EXISTS `identity_provider_domains`;
3169 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3170 /*!40101 SET character_set_client = utf8 */;
3171 CREATE TABLE `identity_provider_domains` (
3172   `identity_provider_domain_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify providers domain',
3173   `identity_provider_id` int(11) NOT NULL COMMENT 'Reference to provider',
3174   `domain` varchar(100) DEFAULT NULL COMMENT 'Domain name. If null means all domains',
3175   `auto_register` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Allow user auto register',
3176   `update_on_auth` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Update user data on auth login',
3177   `default_library_id` varchar(10) DEFAULT NULL COMMENT 'Default library to create user if auto register is enabled',
3178   `default_category_id` varchar(10) DEFAULT NULL COMMENT 'Default category to create user if auto register is enabled',
3179   `allow_opac` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Allow provider from opac interface',
3180   `allow_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Allow provider from staff interface',
3181   PRIMARY KEY (`identity_provider_domain_id`),
3182   UNIQUE KEY `identity_provider_id` (`identity_provider_id`,`domain`),
3183   KEY `domain` (`domain`),
3184   KEY `allow_opac` (`allow_opac`),
3185   KEY `allow_staff` (`allow_staff`),
3186   KEY `identity_provider_domain_ibfk_2` (`default_library_id`),
3187   KEY `identity_provider_domain_ibfk_3` (`default_category_id`),
3188   CONSTRAINT `identity_provider_domain_ibfk_1` FOREIGN KEY (`identity_provider_id`) REFERENCES `identity_providers` (`identity_provider_id`) ON DELETE CASCADE,
3189   CONSTRAINT `identity_provider_domain_ibfk_2` FOREIGN KEY (`default_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
3190   CONSTRAINT `identity_provider_domain_ibfk_3` FOREIGN KEY (`default_category_id`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE
3191 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3192 /*!40101 SET character_set_client = @saved_cs_client */;
3193
3194 --
3195 -- Table structure for table `identity_providers`
3196 --
3197
3198 DROP TABLE IF EXISTS `identity_providers`;
3199 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3200 /*!40101 SET character_set_client = utf8 */;
3201 CREATE TABLE `identity_providers` (
3202   `identity_provider_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify the provider',
3203   `code` varchar(20) NOT NULL COMMENT 'Provider code',
3204   `description` varchar(255) NOT NULL COMMENT 'Description for the provider',
3205   `protocol` enum('OAuth','OIDC','LDAP','CAS') NOT NULL COMMENT 'Protocol provider speaks',
3206   `config` longtext NOT NULL COMMENT 'Configuration of the provider in JSON format',
3207   `mapping` longtext NOT NULL COMMENT 'Configuration to map provider data to Koha user',
3208   `matchpoint` enum('email','userid','cardnumber') NOT NULL COMMENT 'The patron attribute to be used as matchpoint',
3209   `icon_url` varchar(255) DEFAULT NULL COMMENT 'Provider icon URL',
3210   PRIMARY KEY (`identity_provider_id`),
3211   UNIQUE KEY `code` (`code`),
3212   KEY `protocol` (`protocol`)
3213 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3214 /*!40101 SET character_set_client = @saved_cs_client */;
3215
3216 --
3217 -- Table structure for table `illcomments`
3218 --
3219
3220 DROP TABLE IF EXISTS `illcomments`;
3221 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3222 /*!40101 SET character_set_client = utf8 */;
3223 CREATE TABLE `illcomments` (
3224   `illcomment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the comment',
3225   `illrequest_id` bigint(20) unsigned NOT NULL COMMENT 'ILL request number',
3226   `borrowernumber` int(11) DEFAULT NULL COMMENT 'Link to the user who made the comment (could be librarian, patron or ILL partner library)',
3227   `comment` text DEFAULT NULL COMMENT 'The text of the comment',
3228   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date and time when the comment was made',
3229   PRIMARY KEY (`illcomment_id`),
3230   KEY `illcomments_bnfk` (`borrowernumber`),
3231   KEY `illcomments_ifk` (`illrequest_id`),
3232   CONSTRAINT `illcomments_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3233   CONSTRAINT `illcomments_ifk` FOREIGN KEY (`illrequest_id`) REFERENCES `illrequests` (`illrequest_id`) ON DELETE CASCADE ON UPDATE CASCADE
3234 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3235 /*!40101 SET character_set_client = @saved_cs_client */;
3236
3237 --
3238 -- Table structure for table `illrequestattributes`
3239 --
3240
3241 DROP TABLE IF EXISTS `illrequestattributes`;
3242 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3243 /*!40101 SET character_set_client = utf8 */;
3244 CREATE TABLE `illrequestattributes` (
3245   `illrequest_id` bigint(20) unsigned NOT NULL COMMENT 'ILL request number',
3246   `type` varchar(200) NOT NULL COMMENT 'API ILL property name',
3247   `value` mediumtext NOT NULL COMMENT 'API ILL property value',
3248   `readonly` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Is this attribute read only',
3249   PRIMARY KEY (`illrequest_id`,`type`(191)),
3250   CONSTRAINT `illrequestattributes_ifk` FOREIGN KEY (`illrequest_id`) REFERENCES `illrequests` (`illrequest_id`) ON DELETE CASCADE ON UPDATE CASCADE
3251 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3252 /*!40101 SET character_set_client = @saved_cs_client */;
3253
3254 --
3255 -- Table structure for table `illrequests`
3256 --
3257
3258 DROP TABLE IF EXISTS `illrequests`;
3259 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3260 /*!40101 SET character_set_client = utf8 */;
3261 CREATE TABLE `illrequests` (
3262   `illrequest_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ILL request number',
3263   `borrowernumber` int(11) DEFAULT NULL COMMENT 'Patron associated with request',
3264   `biblio_id` int(11) DEFAULT NULL COMMENT 'Potential bib linked to request',
3265   `due_date` datetime DEFAULT NULL COMMENT 'Custom date due specified by backend, leave NULL for default date_due calculation',
3266   `branchcode` varchar(50) NOT NULL COMMENT 'The branch associated with the request',
3267   `status` varchar(50) DEFAULT NULL COMMENT 'Current Koha status of request',
3268   `status_alias` varchar(80) DEFAULT NULL COMMENT 'Foreign key to relevant authorised_values.authorised_value',
3269   `placed` date DEFAULT NULL COMMENT 'Date the request was placed',
3270   `replied` date DEFAULT NULL COMMENT 'Last API response',
3271   `updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
3272   `completed` date DEFAULT NULL COMMENT 'Date the request was completed',
3273   `medium` varchar(30) DEFAULT NULL COMMENT 'The Koha request type',
3274   `accessurl` varchar(500) DEFAULT NULL COMMENT 'Potential URL for accessing item',
3275   `cost` varchar(20) DEFAULT NULL COMMENT 'Quotes cost of request',
3276   `price_paid` varchar(20) DEFAULT NULL COMMENT 'Final cost of request',
3277   `notesopac` mediumtext DEFAULT NULL COMMENT 'Patron notes attached to request',
3278   `notesstaff` mediumtext DEFAULT NULL COMMENT 'Staff notes attached to request',
3279   `orderid` varchar(50) DEFAULT NULL COMMENT 'Backend id attached to request',
3280   `backend` varchar(20) DEFAULT NULL COMMENT 'The backend used to create request',
3281   PRIMARY KEY (`illrequest_id`),
3282   KEY `illrequests_bnfk` (`borrowernumber`),
3283   KEY `illrequests_bcfk_2` (`branchcode`),
3284   KEY `illrequests_safk` (`status_alias`),
3285   CONSTRAINT `illrequests_bcfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3286   CONSTRAINT `illrequests_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3287   CONSTRAINT `illrequests_safk` FOREIGN KEY (`status_alias`) REFERENCES `authorised_values` (`authorised_value`) ON DELETE SET NULL ON UPDATE CASCADE
3288 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3289 /*!40101 SET character_set_client = @saved_cs_client */;
3290
3291 --
3292 -- Table structure for table `import_auths`
3293 --
3294
3295 DROP TABLE IF EXISTS `import_auths`;
3296 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3297 /*!40101 SET character_set_client = utf8 */;
3298 CREATE TABLE `import_auths` (
3299   `import_record_id` int(11) NOT NULL,
3300   `matched_authid` int(11) DEFAULT NULL,
3301   `control_number` varchar(25) DEFAULT NULL,
3302   `authorized_heading` varchar(128) DEFAULT NULL,
3303   `original_source` varchar(25) DEFAULT NULL,
3304   PRIMARY KEY (`import_record_id`),
3305   KEY `import_auths_ibfk_1` (`import_record_id`),
3306   KEY `matched_authid` (`matched_authid`),
3307   CONSTRAINT `import_auths_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3308 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3309 /*!40101 SET character_set_client = @saved_cs_client */;
3310
3311 --
3312 -- Table structure for table `import_batch_profiles`
3313 --
3314
3315 DROP TABLE IF EXISTS `import_batch_profiles`;
3316 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3317 /*!40101 SET character_set_client = utf8 */;
3318 CREATE TABLE `import_batch_profiles` (
3319   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3320   `name` varchar(100) NOT NULL COMMENT 'name of this profile',
3321   `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3322   `template_id` int(11) DEFAULT NULL COMMENT 'the id of the marc modification template',
3323   `overlay_action` varchar(50) DEFAULT NULL COMMENT 'how to handle duplicate records',
3324   `nomatch_action` varchar(50) DEFAULT NULL COMMENT 'how to handle records where no match is found',
3325   `item_action` varchar(50) DEFAULT NULL COMMENT 'what to do with item records',
3326   `parse_items` tinyint(1) DEFAULT NULL COMMENT 'should items be parsed',
3327   `record_type` varchar(50) DEFAULT NULL COMMENT 'type of record in the batch',
3328   `encoding` varchar(50) DEFAULT NULL COMMENT 'file encoding',
3329   `format` varchar(50) DEFAULT NULL COMMENT 'marc format',
3330   `comments` longtext DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3331   PRIMARY KEY (`id`),
3332   UNIQUE KEY `u_import_batch_profiles__name` (`name`)
3333 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3334 /*!40101 SET character_set_client = @saved_cs_client */;
3335
3336 --
3337 -- Table structure for table `import_batches`
3338 --
3339
3340 DROP TABLE IF EXISTS `import_batches`;
3341 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3342 /*!40101 SET character_set_client = utf8 */;
3343 CREATE TABLE `import_batches` (
3344   `import_batch_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3345   `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3346   `template_id` int(11) DEFAULT NULL,
3347   `branchcode` varchar(10) DEFAULT NULL,
3348   `num_records` int(11) NOT NULL DEFAULT 0 COMMENT 'number of records in the file',
3349   `num_items` int(11) NOT NULL DEFAULT 0 COMMENT 'number of items in the file',
3350   `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was uploaded',
3351   `overlay_action` enum('replace','create_new','use_template','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle duplicate records',
3352   `nomatch_action` enum('create_new','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle records where no match is found',
3353   `item_action` enum('always_add','add_only_for_matches','add_only_for_new','ignore','replace') NOT NULL DEFAULT 'always_add' COMMENT 'what to do with item records',
3354   `import_status` enum('staging','staged','importing','imported','reverting','reverted','cleaned') NOT NULL DEFAULT 'staging' COMMENT 'the status of the imported file',
3355   `batch_type` enum('batch','z3950','webservice') NOT NULL DEFAULT 'batch' COMMENT 'where this batch has come from',
3356   `record_type` enum('biblio','auth','holdings') NOT NULL DEFAULT 'biblio' COMMENT 'type of record in the batch',
3357   `file_name` varchar(100) DEFAULT NULL COMMENT 'the name of the file uploaded',
3358   `comments` longtext DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3359   `profile_id` int(11) DEFAULT NULL,
3360   PRIMARY KEY (`import_batch_id`),
3361   KEY `branchcode` (`branchcode`),
3362   KEY `import_batches_ibfk_1` (`profile_id`),
3363   CONSTRAINT `import_batches_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `import_batch_profiles` (`id`) ON DELETE SET NULL ON UPDATE SET NULL
3364 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3365 /*!40101 SET character_set_client = @saved_cs_client */;
3366
3367 --
3368 -- Table structure for table `import_biblios`
3369 --
3370
3371 DROP TABLE IF EXISTS `import_biblios`;
3372 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3373 /*!40101 SET character_set_client = utf8 */;
3374 CREATE TABLE `import_biblios` (
3375   `import_record_id` int(11) NOT NULL,
3376   `matched_biblionumber` int(11) DEFAULT NULL,
3377   `control_number` varchar(25) DEFAULT NULL,
3378   `original_source` varchar(25) DEFAULT NULL,
3379   `title` longtext DEFAULT NULL,
3380   `author` longtext DEFAULT NULL,
3381   `isbn` longtext DEFAULT NULL,
3382   `issn` longtext DEFAULT NULL,
3383   `has_items` tinyint(1) NOT NULL DEFAULT 0,
3384   PRIMARY KEY (`import_record_id`),
3385   KEY `import_biblios_ibfk_1` (`import_record_id`),
3386   KEY `matched_biblionumber` (`matched_biblionumber`),
3387   KEY `title` (`title`(191)),
3388   KEY `isbn` (`isbn`(191)),
3389   CONSTRAINT `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3390 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3391 /*!40101 SET character_set_client = @saved_cs_client */;
3392
3393 --
3394 -- Table structure for table `import_items`
3395 --
3396
3397 DROP TABLE IF EXISTS `import_items`;
3398 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3399 /*!40101 SET character_set_client = utf8 */;
3400 CREATE TABLE `import_items` (
3401   `import_items_id` int(11) NOT NULL AUTO_INCREMENT,
3402   `import_record_id` int(11) NOT NULL,
3403   `itemnumber` int(11) DEFAULT NULL,
3404   `branchcode` varchar(10) DEFAULT NULL,
3405   `status` enum('error','staged','imported','reverted','ignored') NOT NULL DEFAULT 'staged',
3406   `marcxml` longtext NOT NULL,
3407   `import_error` longtext DEFAULT NULL,
3408   PRIMARY KEY (`import_items_id`),
3409   KEY `import_items_ibfk_1` (`import_record_id`),
3410   KEY `itemnumber` (`itemnumber`),
3411   KEY `branchcode` (`branchcode`),
3412   CONSTRAINT `import_items_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3413 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3414 /*!40101 SET character_set_client = @saved_cs_client */;
3415
3416 --
3417 -- Table structure for table `import_record_matches`
3418 --
3419
3420 DROP TABLE IF EXISTS `import_record_matches`;
3421 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3422 /*!40101 SET character_set_client = utf8 */;
3423 CREATE TABLE `import_record_matches` (
3424   `import_record_id` int(11) NOT NULL COMMENT 'the id given to the imported bib record (import_records.import_record_id)',
3425   `candidate_match_id` int(11) NOT NULL COMMENT 'the biblio the imported record matches (biblio.biblionumber)',
3426   `score` int(11) NOT NULL DEFAULT 0 COMMENT 'the match score',
3427   `chosen` tinyint(1) DEFAULT NULL COMMENT 'whether this match has been allowed or denied',
3428   PRIMARY KEY (`import_record_id`,`candidate_match_id`),
3429   KEY `record_score` (`import_record_id`,`score`),
3430   CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3431 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3432 /*!40101 SET character_set_client = @saved_cs_client */;
3433
3434 --
3435 -- Table structure for table `import_records`
3436 --
3437
3438 DROP TABLE IF EXISTS `import_records`;
3439 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3440 /*!40101 SET character_set_client = utf8 */;
3441 CREATE TABLE `import_records` (
3442   `import_record_id` int(11) NOT NULL AUTO_INCREMENT,
3443   `import_batch_id` int(11) NOT NULL,
3444   `branchcode` varchar(10) DEFAULT NULL,
3445   `record_sequence` int(11) NOT NULL DEFAULT 0,
3446   `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
3447   `import_date` date DEFAULT NULL,
3448   `marc` longblob NOT NULL,
3449   `marcxml` longtext NOT NULL,
3450   `marcxml_old` longtext NOT NULL,
3451   `record_type` enum('biblio','auth','holdings') NOT NULL DEFAULT 'biblio',
3452   `overlay_status` enum('no_match','auto_match','manual_match','match_applied') NOT NULL DEFAULT 'no_match',
3453   `status` enum('error','staged','imported','reverted','items_reverted','ignored') NOT NULL DEFAULT 'staged',
3454   `import_error` longtext DEFAULT NULL,
3455   `encoding` varchar(40) NOT NULL DEFAULT '',
3456   PRIMARY KEY (`import_record_id`),
3457   KEY `branchcode` (`branchcode`),
3458   KEY `batch_sequence` (`import_batch_id`,`record_sequence`),
3459   KEY `batch_id_record_type` (`import_batch_id`,`record_type`),
3460   CONSTRAINT `import_records_ifbk_1` FOREIGN KEY (`import_batch_id`) REFERENCES `import_batches` (`import_batch_id`) ON DELETE CASCADE ON UPDATE CASCADE
3461 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3462 /*!40101 SET character_set_client = @saved_cs_client */;
3463
3464 --
3465 -- Table structure for table `issues`
3466 --
3467
3468 DROP TABLE IF EXISTS `issues`;
3469 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3470 /*!40101 SET character_set_client = utf8 */;
3471 CREATE TABLE `issues` (
3472   `issue_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key for issues table',
3473   `borrowernumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
3474   `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
3475   `itemnumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
3476   `date_due` datetime DEFAULT NULL COMMENT 'datetime the item is due (yyyy-mm-dd hh:mm::ss)',
3477   `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
3478   `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned, will be NULL until moved to old_issues',
3479   `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
3480   `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
3481   `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
3482   `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
3483   `auto_renew_error` varchar(32) DEFAULT NULL COMMENT 'automatic renewal error',
3484   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
3485   `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
3486   `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
3487   `note` longtext DEFAULT NULL COMMENT 'issue note text',
3488   `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
3489   `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
3490   PRIMARY KEY (`issue_id`),
3491   UNIQUE KEY `itemnumber` (`itemnumber`),
3492   KEY `issuesborridx` (`borrowernumber`),
3493   KEY `itemnumber_idx` (`itemnumber`),
3494   KEY `branchcode_idx` (`branchcode`),
3495   KEY `bordate` (`borrowernumber`,`timestamp`),
3496   KEY `issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
3497   CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE,
3498   CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE,
3499   CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3500 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3501 /*!40101 SET character_set_client = @saved_cs_client */;
3502
3503 --
3504 -- Table structure for table `item_bundles`
3505 --
3506
3507 DROP TABLE IF EXISTS `item_bundles`;
3508 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3509 /*!40101 SET character_set_client = utf8 */;
3510 CREATE TABLE `item_bundles` (
3511   `item` int(11) NOT NULL,
3512   `host` int(11) NOT NULL,
3513   PRIMARY KEY (`host`,`item`),
3514   UNIQUE KEY `item_bundles_uniq_1` (`item`),
3515   CONSTRAINT `item_bundles_ibfk_1` FOREIGN KEY (`item`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3516   CONSTRAINT `item_bundles_ibfk_2` FOREIGN KEY (`host`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3517 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3518 /*!40101 SET character_set_client = @saved_cs_client */;
3519
3520 --
3521 -- Table structure for table `item_circulation_alert_preferences`
3522 --
3523
3524 DROP TABLE IF EXISTS `item_circulation_alert_preferences`;
3525 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3526 /*!40101 SET character_set_client = utf8 */;
3527 CREATE TABLE `item_circulation_alert_preferences` (
3528   `id` int(11) NOT NULL AUTO_INCREMENT,
3529   `branchcode` varchar(10) NOT NULL,
3530   `categorycode` varchar(10) NOT NULL,
3531   `item_type` varchar(10) NOT NULL,
3532   `notification` varchar(16) NOT NULL,
3533   PRIMARY KEY (`id`),
3534   KEY `branchcode` (`branchcode`,`categorycode`,`item_type`,`notification`)
3535 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3536 /*!40101 SET character_set_client = @saved_cs_client */;
3537
3538 --
3539 -- Table structure for table `item_editor_templates`
3540 --
3541
3542 DROP TABLE IF EXISTS `item_editor_templates`;
3543 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3544 /*!40101 SET character_set_client = utf8 */;
3545 CREATE TABLE `item_editor_templates` (
3546   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the template',
3547   `patron_id` int(11) DEFAULT NULL COMMENT 'creator of this template',
3548   `name` mediumtext NOT NULL COMMENT 'template name',
3549   `is_shared` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if template is shared',
3550   `contents` longtext NOT NULL COMMENT 'json encoded template data',
3551   PRIMARY KEY (`id`),
3552   KEY `bn` (`patron_id`),
3553   CONSTRAINT `bn` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3554 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3555 /*!40101 SET character_set_client = @saved_cs_client */;
3556
3557 --
3558 -- Table structure for table `item_group_items`
3559 --
3560
3561 DROP TABLE IF EXISTS `item_group_items`;
3562 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3563 /*!40101 SET character_set_client = utf8 */;
3564 CREATE TABLE `item_group_items` (
3565   `item_group_items_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the group/item link',
3566   `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',
3567   `item_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the items table',
3568   PRIMARY KEY (`item_group_items_id`),
3569   UNIQUE KEY `item_id` (`item_id`),
3570   KEY `item_group_items_gifk_1` (`item_group_id`),
3571   CONSTRAINT `item_group_items_gifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3572   CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3573 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3574 /*!40101 SET character_set_client = @saved_cs_client */;
3575
3576 --
3577 -- Table structure for table `item_groups`
3578 --
3579
3580 DROP TABLE IF EXISTS `item_groups`;
3581 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3582 /*!40101 SET character_set_client = utf8 */;
3583 CREATE TABLE `item_groups` (
3584   `item_group_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the items group',
3585   `biblio_id` int(11) NOT NULL DEFAULT 0 COMMENT 'id for the bibliographic record the group belongs to',
3586   `display_order` int(4) NOT NULL DEFAULT 0 COMMENT 'The ''sort order'' for item_groups',
3587   `description` mediumtext DEFAULT NULL COMMENT 'A group description',
3588   `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the group was created',
3589   `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the group',
3590   PRIMARY KEY (`item_group_id`),
3591   KEY `item_groups_ibfk_1` (`biblio_id`),
3592   CONSTRAINT `item_groups_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
3593 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3594 /*!40101 SET character_set_client = @saved_cs_client */;
3595
3596 --
3597 -- Table structure for table `items`
3598 --
3599
3600 DROP TABLE IF EXISTS `items`;
3601 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3602 /*!40101 SET character_set_client = utf8 */;
3603 CREATE TABLE `items` (
3604   `itemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier added by Koha',
3605   `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
3606   `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
3607   `barcode` varchar(20) DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
3608   `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
3609   `booksellerid` longtext DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
3610   `homebranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
3611   `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
3612   `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
3613   `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
3614   `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out/issued',
3615   `datelastseen` date DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
3616   `stack` tinyint(1) DEFAULT NULL,
3617   `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
3618   `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
3619   `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
3620   `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
3621   `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
3622   `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
3623   `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
3624   `itemcallnumber` varchar(255) DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
3625   `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
3626   `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out/issued',
3627   `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
3628   `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
3629   `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
3630   `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
3631   `itemnotes_nonpublic` longtext DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
3632   `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
3633   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
3634   `deleted_on` datetime DEFAULT NULL COMMENT 'date/time of deletion',
3635   `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
3636   `permanent_location` varchar(80) DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
3637   `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
3638   `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
3639   `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
3640   `ccode` varchar(80) DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
3641   `materials` mediumtext DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
3642   `uri` mediumtext DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
3643   `itype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
3644   `more_subfields_xml` longtext DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
3645   `enumchron` mediumtext DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
3646   `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
3647   `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
3648   `new_status` varchar(32) DEFAULT NULL COMMENT '''new'' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob.',
3649   `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
3650   PRIMARY KEY (`itemnumber`),
3651   UNIQUE KEY `itembarcodeidx` (`barcode`),
3652   KEY `itemstocknumberidx` (`stocknumber`),
3653   KEY `itembinoidx` (`biblioitemnumber`),
3654   KEY `itembibnoidx` (`biblionumber`),
3655   KEY `homebranch` (`homebranch`),
3656   KEY `holdingbranch` (`holdingbranch`),
3657   KEY `itemcallnumber` (`itemcallnumber`(191)),
3658   KEY `items_location` (`location`),
3659   KEY `items_ccode` (`ccode`),
3660   KEY `itype_idx` (`itype`),
3661   KEY `timestamp` (`timestamp`),
3662   CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3663   CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
3664   CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
3665   CONSTRAINT `items_ibfk_4` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
3666 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3667 /*!40101 SET character_set_client = @saved_cs_client */;
3668
3669 --
3670 -- Table structure for table `items_last_borrower`
3671 --
3672
3673 DROP TABLE IF EXISTS `items_last_borrower`;
3674 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3675 /*!40101 SET character_set_client = utf8 */;
3676 CREATE TABLE `items_last_borrower` (
3677   `id` int(11) NOT NULL AUTO_INCREMENT,
3678   `itemnumber` int(11) NOT NULL,
3679   `borrowernumber` int(11) NOT NULL,
3680   `created_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
3681   PRIMARY KEY (`id`),
3682   UNIQUE KEY `itemnumber` (`itemnumber`),
3683   KEY `borrowernumber` (`borrowernumber`),
3684   CONSTRAINT `items_last_borrower_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3685   CONSTRAINT `items_last_borrower_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3686 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3687 /*!40101 SET character_set_client = @saved_cs_client */;
3688
3689 --
3690 -- Table structure for table `items_search_fields`
3691 --
3692
3693 DROP TABLE IF EXISTS `items_search_fields`;
3694 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3695 /*!40101 SET character_set_client = utf8 */;
3696 CREATE TABLE `items_search_fields` (
3697   `name` varchar(255) NOT NULL,
3698   `label` varchar(255) NOT NULL,
3699   `tagfield` char(3) NOT NULL,
3700   `tagsubfield` char(1) DEFAULT NULL,
3701   `authorised_values_category` varchar(32) DEFAULT NULL,
3702   PRIMARY KEY (`name`(191)),
3703   KEY `items_search_fields_authorised_values_category` (`authorised_values_category`),
3704   CONSTRAINT `items_search_fields_authorised_values_category` FOREIGN KEY (`authorised_values_category`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE SET NULL ON UPDATE CASCADE
3705 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3706 /*!40101 SET character_set_client = @saved_cs_client */;
3707
3708 --
3709 -- Table structure for table `itemtypes`
3710 --
3711
3712 DROP TABLE IF EXISTS `itemtypes`;
3713 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3714 /*!40101 SET character_set_client = utf8 */;
3715 CREATE TABLE `itemtypes` (
3716   `itemtype` varchar(10) NOT NULL DEFAULT '' COMMENT 'unique key, a code associated with the item type',
3717   `parent_type` varchar(10) DEFAULT NULL COMMENT 'unique key, a code associated with the item type',
3718   `description` longtext DEFAULT NULL COMMENT 'a plain text explanation of the item type',
3719   `rentalcharge` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged when this item is checked out/issued',
3720   `rentalcharge_daily` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each day between checkout date and due date',
3721   `rentalcharge_daily_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the daily rental fee is calculated directly or using finesCalendar',
3722   `rentalcharge_hourly` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each hour between checkout date and due date',
3723   `rentalcharge_hourly_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the hourly rental fee is calculated directly or using finesCalendar',
3724   `defaultreplacecost` decimal(28,6) DEFAULT NULL COMMENT 'default replacement cost',
3725   `processfee` decimal(28,6) DEFAULT NULL COMMENT 'default text be recorded in the column note when the processing fee is applied',
3726   `notforloan` smallint(6) DEFAULT NULL COMMENT '1 if the item is not for loan, 0 if the item is available for loan',
3727   `imageurl` varchar(200) DEFAULT NULL COMMENT 'URL for the item type icon',
3728   `summary` mediumtext DEFAULT NULL COMMENT 'information from the summary field, may include HTML',
3729   `checkinmsg` varchar(255) DEFAULT NULL COMMENT 'message that is displayed when an item with the given item type is checked in',
3730   `checkinmsgtype` char(16) NOT NULL DEFAULT 'message' COMMENT 'type (CSS class) for the checkinmsg, can be ''alert'' or ''message''',
3731   `sip_media_type` varchar(3) DEFAULT NULL COMMENT 'SIP2 protocol media type for this itemtype',
3732   `hideinopac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Hide the item type from the search options in OPAC',
3733   `searchcategory` varchar(80) DEFAULT NULL COMMENT 'Group this item type with others with the same value on OPAC search options',
3734   `automatic_checkin` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If automatic checkin is enabled for items of this type',
3735   PRIMARY KEY (`itemtype`),
3736   UNIQUE KEY `itemtype` (`itemtype`),
3737   KEY `itemtypes_ibfk_1` (`parent_type`),
3738   CONSTRAINT `itemtypes_ibfk_1` FOREIGN KEY (`parent_type`) REFERENCES `itemtypes` (`itemtype`)
3739 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3740 /*!40101 SET character_set_client = @saved_cs_client */;
3741
3742 --
3743 -- Table structure for table `itemtypes_branches`
3744 --
3745
3746 DROP TABLE IF EXISTS `itemtypes_branches`;
3747 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3748 /*!40101 SET character_set_client = utf8 */;
3749 CREATE TABLE `itemtypes_branches` (
3750   `itemtype` varchar(10) NOT NULL,
3751   `branchcode` varchar(10) NOT NULL,
3752   KEY `itemtype` (`itemtype`),
3753   KEY `branchcode` (`branchcode`),
3754   CONSTRAINT `itemtypes_branches_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE,
3755   CONSTRAINT `itemtypes_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
3756 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3757 /*!40101 SET character_set_client = @saved_cs_client */;
3758
3759 --
3760 -- Table structure for table `keyboard_shortcuts`
3761 --
3762
3763 DROP TABLE IF EXISTS `keyboard_shortcuts`;
3764 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3765 /*!40101 SET character_set_client = utf8 */;
3766 CREATE TABLE `keyboard_shortcuts` (
3767   `shortcut_name` varchar(80) NOT NULL,
3768   `shortcut_keys` varchar(80) NOT NULL,
3769   PRIMARY KEY (`shortcut_name`)
3770 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3771 /*!40101 SET character_set_client = @saved_cs_client */;
3772
3773 --
3774 -- Table structure for table `language_descriptions`
3775 --
3776
3777 DROP TABLE IF EXISTS `language_descriptions`;
3778 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3779 /*!40101 SET character_set_client = utf8 */;
3780 CREATE TABLE `language_descriptions` (
3781   `subtag` varchar(25) DEFAULT NULL,
3782   `type` varchar(25) DEFAULT NULL,
3783   `lang` varchar(25) DEFAULT NULL,
3784   `description` varchar(255) DEFAULT NULL,
3785   `id` int(11) NOT NULL AUTO_INCREMENT,
3786   PRIMARY KEY (`id`),
3787   UNIQUE KEY `uniq_desc` (`subtag`,`type`,`lang`),
3788   KEY `lang` (`lang`)
3789 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3790 /*!40101 SET character_set_client = @saved_cs_client */;
3791
3792 --
3793 -- Table structure for table `language_rfc4646_to_iso639`
3794 --
3795
3796 DROP TABLE IF EXISTS `language_rfc4646_to_iso639`;
3797 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3798 /*!40101 SET character_set_client = utf8 */;
3799 CREATE TABLE `language_rfc4646_to_iso639` (
3800   `rfc4646_subtag` varchar(25) DEFAULT NULL,
3801   `iso639_2_code` varchar(25) DEFAULT NULL,
3802   `id` int(11) NOT NULL AUTO_INCREMENT,
3803   PRIMARY KEY (`id`),
3804   UNIQUE KEY `uniq_code` (`rfc4646_subtag`,`iso639_2_code`),
3805   KEY `rfc4646_subtag` (`rfc4646_subtag`)
3806 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3807 /*!40101 SET character_set_client = @saved_cs_client */;
3808
3809 --
3810 -- Table structure for table `language_script_bidi`
3811 --
3812
3813 DROP TABLE IF EXISTS `language_script_bidi`;
3814 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3815 /*!40101 SET character_set_client = utf8 */;
3816 CREATE TABLE `language_script_bidi` (
3817   `rfc4646_subtag` varchar(25) DEFAULT NULL COMMENT 'script subtag, Arab, Hebr, etc.',
3818   `bidi` varchar(3) DEFAULT NULL COMMENT 'rtl ltr',
3819   KEY `rfc4646_subtag` (`rfc4646_subtag`)
3820 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3821 /*!40101 SET character_set_client = @saved_cs_client */;
3822
3823 --
3824 -- Table structure for table `language_script_mapping`
3825 --
3826
3827 DROP TABLE IF EXISTS `language_script_mapping`;
3828 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3829 /*!40101 SET character_set_client = utf8 */;
3830 CREATE TABLE `language_script_mapping` (
3831   `language_subtag` varchar(25) NOT NULL,
3832   `script_subtag` varchar(25) DEFAULT NULL,
3833   PRIMARY KEY (`language_subtag`)
3834 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3835 /*!40101 SET character_set_client = @saved_cs_client */;
3836
3837 --
3838 -- Table structure for table `language_subtag_registry`
3839 --
3840
3841 DROP TABLE IF EXISTS `language_subtag_registry`;
3842 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3843 /*!40101 SET character_set_client = utf8 */;
3844 CREATE TABLE `language_subtag_registry` (
3845   `subtag` varchar(25) DEFAULT NULL,
3846   `type` varchar(25) DEFAULT NULL COMMENT 'language-script-region-variant-extension-privateuse',
3847   `description` varchar(255) DEFAULT NULL COMMENT 'only one of the possible descriptions for ease of reference, see language_descriptions for the complete list',
3848   `added` date DEFAULT NULL,
3849   `id` int(11) NOT NULL AUTO_INCREMENT,
3850   PRIMARY KEY (`id`),
3851   UNIQUE KEY `uniq_lang` (`subtag`,`type`),
3852   KEY `subtag` (`subtag`)
3853 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3854 /*!40101 SET character_set_client = @saved_cs_client */;
3855
3856 --
3857 -- Table structure for table `letter`
3858 --
3859
3860 DROP TABLE IF EXISTS `letter`;
3861 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3862 /*!40101 SET character_set_client = utf8 */;
3863 CREATE TABLE `letter` (
3864   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
3865   `module` varchar(20) NOT NULL DEFAULT '' COMMENT 'Koha module that triggers this notice or slip',
3866   `code` varchar(20) NOT NULL DEFAULT '' COMMENT 'unique identifier for this notice or slip',
3867   `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch this notice or slip is used at (branches.branchcode)',
3868   `name` varchar(100) NOT NULL DEFAULT '' COMMENT 'plain text name for this notice or slip',
3869   `is_html` tinyint(1) DEFAULT 0 COMMENT 'does this notice or slip use HTML (1 for yes, 0 for no)',
3870   `title` varchar(200) NOT NULL DEFAULT '' COMMENT 'subject line of the notice',
3871   `content` mediumtext DEFAULT NULL COMMENT 'body text for the notice or slip',
3872   `message_transport_type` varchar(20) NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3873   `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3874   `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3875   PRIMARY KEY (`id`),
3876   UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3877   KEY `message_transport_type_fk` (`message_transport_type`),
3878   CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
3879 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3880 /*!40101 SET character_set_client = @saved_cs_client */;
3881
3882 --
3883 -- Table structure for table `library_groups`
3884 --
3885
3886 DROP TABLE IF EXISTS `library_groups`;
3887 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3888 /*!40101 SET character_set_client = utf8 */;
3889 CREATE TABLE `library_groups` (
3890   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for each group',
3891   `parent_id` int(11) DEFAULT NULL COMMENT 'if this is a child group, the id of the parent group',
3892   `branchcode` varchar(10) DEFAULT NULL COMMENT 'The branchcode of a branch belonging to the parent group',
3893   `title` varchar(100) DEFAULT NULL COMMENT 'Short description of the goup',
3894   `description` mediumtext DEFAULT NULL COMMENT 'Longer explanation of the group, if necessary',
3895   `ft_hide_patron_info` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Turn on the feature ''Hide patron''s info'' for this group',
3896   `ft_limit_item_editing` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Turn on the feature "Limit item editing by group" for this group',
3897   `ft_search_groups_opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for staff side search groups',
3898   `ft_search_groups_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for opac side search groups',
3899   `ft_local_hold_group` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group to identify libraries as pick up location for holds',
3900   `created_on` timestamp NULL DEFAULT NULL COMMENT 'Date and time of creation',
3901   `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time of last',
3902   PRIMARY KEY (`id`),
3903   UNIQUE KEY `title` (`title`),
3904   UNIQUE KEY `library_groups_uniq_2` (`parent_id`,`branchcode`),
3905   KEY `branchcode` (`branchcode`),
3906   CONSTRAINT `library_groups_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `library_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
3907   CONSTRAINT `library_groups_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
3908 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3909 /*!40101 SET character_set_client = @saved_cs_client */;
3910
3911 --
3912 -- Table structure for table `library_smtp_servers`
3913 --
3914
3915 DROP TABLE IF EXISTS `library_smtp_servers`;
3916 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3917 /*!40101 SET character_set_client = utf8 */;
3918 CREATE TABLE `library_smtp_servers` (
3919   `id` int(11) NOT NULL AUTO_INCREMENT,
3920   `library_id` varchar(10) NOT NULL,
3921   `smtp_server_id` int(11) NOT NULL,
3922   PRIMARY KEY (`id`),
3923   UNIQUE KEY `library_id_idx` (`library_id`),
3924   KEY `smtp_server_id_idx` (`smtp_server_id`),
3925   CONSTRAINT `library_smtp_servers_library_fk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3926   CONSTRAINT `library_smtp_servers_smtp_servers_fk` FOREIGN KEY (`smtp_server_id`) REFERENCES `smtp_servers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
3927 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3928 /*!40101 SET character_set_client = @saved_cs_client */;
3929
3930 --
3931 -- Table structure for table `linktracker`
3932 --
3933
3934 DROP TABLE IF EXISTS `linktracker`;
3935 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3936 /*!40101 SET character_set_client = utf8 */;
3937 CREATE TABLE `linktracker` (
3938   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
3939   `biblionumber` int(11) DEFAULT NULL COMMENT 'biblionumber of the record the link is from',
3940   `itemnumber` int(11) DEFAULT NULL COMMENT 'itemnumber if applicable that the link was from',
3941   `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrowernumber who clicked the link',
3942   `url` mediumtext DEFAULT NULL COMMENT 'the link itself',
3943   `timeclicked` datetime DEFAULT NULL COMMENT 'the date and time the link was clicked',
3944   PRIMARY KEY (`id`),
3945   KEY `bibidx` (`biblionumber`),
3946   KEY `itemidx` (`itemnumber`),
3947   KEY `borridx` (`borrowernumber`),
3948   KEY `dateidx` (`timeclicked`),
3949   CONSTRAINT `linktracker_biblio_ibfk` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3950   CONSTRAINT `linktracker_borrower_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3951   CONSTRAINT `linktracker_item_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL
3952 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3953 /*!40101 SET character_set_client = @saved_cs_client */;
3954
3955 --
3956 -- Table structure for table `localization`
3957 --
3958
3959 DROP TABLE IF EXISTS `localization`;
3960 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3961 /*!40101 SET character_set_client = utf8 */;
3962 CREATE TABLE `localization` (
3963   `localization_id` int(11) NOT NULL AUTO_INCREMENT,
3964   `entity` varchar(16) NOT NULL,
3965   `code` varchar(64) NOT NULL,
3966   `lang` varchar(25) NOT NULL COMMENT 'could be a foreign key',
3967   `translation` mediumtext DEFAULT NULL,
3968   PRIMARY KEY (`localization_id`),
3969   UNIQUE KEY `entity_code_lang` (`entity`,`code`,`lang`)
3970 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3971 /*!40101 SET character_set_client = @saved_cs_client */;
3972
3973 --
3974 -- Table structure for table `marc_matchers`
3975 --
3976
3977 DROP TABLE IF EXISTS `marc_matchers`;
3978 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3979 /*!40101 SET character_set_client = utf8 */;
3980 CREATE TABLE `marc_matchers` (
3981   `matcher_id` int(11) NOT NULL AUTO_INCREMENT,
3982   `code` varchar(10) NOT NULL DEFAULT '',
3983   `description` varchar(255) NOT NULL DEFAULT '',
3984   `record_type` varchar(10) NOT NULL DEFAULT 'biblio',
3985   `threshold` int(11) NOT NULL DEFAULT 0,
3986   PRIMARY KEY (`matcher_id`),
3987   KEY `code` (`code`),
3988   KEY `record_type` (`record_type`)
3989 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3990 /*!40101 SET character_set_client = @saved_cs_client */;
3991
3992 --
3993 -- Table structure for table `marc_modification_template_actions`
3994 --
3995
3996 DROP TABLE IF EXISTS `marc_modification_template_actions`;
3997 /*!40101 SET @saved_cs_client     = @@character_set_client */;
3998 /*!40101 SET character_set_client = utf8 */;
3999 CREATE TABLE `marc_modification_template_actions` (
4000   `mmta_id` int(11) NOT NULL AUTO_INCREMENT,
4001   `template_id` int(11) NOT NULL,
4002   `ordering` int(3) NOT NULL,
4003   `action` enum('delete_field','add_field','update_field','move_field','copy_field','copy_and_replace_field') NOT NULL,
4004   `field_number` smallint(6) NOT NULL DEFAULT 0,
4005   `from_field` varchar(3) NOT NULL,
4006   `from_subfield` varchar(1) DEFAULT NULL,
4007   `field_value`  text DEFAULT NULL,
4008   `to_field` varchar(3) DEFAULT NULL,
4009   `to_subfield` varchar(1) DEFAULT NULL,
4010   `to_regex_search` mediumtext DEFAULT NULL,
4011   `to_regex_replace` mediumtext DEFAULT NULL,
4012   `to_regex_modifiers` varchar(8) DEFAULT '',
4013   `conditional` enum('if','unless') DEFAULT NULL,
4014   `conditional_field` varchar(3) DEFAULT NULL,
4015   `conditional_subfield` varchar(1) DEFAULT NULL,
4016   `conditional_comparison` enum('exists','not_exists','equals','not_equals') DEFAULT NULL,
4017   `conditional_value` mediumtext DEFAULT NULL,
4018   `conditional_regex` tinyint(1) NOT NULL DEFAULT 0,
4019   `description` mediumtext DEFAULT NULL,
4020   PRIMARY KEY (`mmta_id`),
4021   KEY `mmta_ibfk_1` (`template_id`),
4022   CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
4023 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4024 /*!40101 SET character_set_client = @saved_cs_client */;
4025
4026 --
4027 -- Table structure for table `marc_modification_templates`
4028 --
4029
4030 DROP TABLE IF EXISTS `marc_modification_templates`;
4031 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4032 /*!40101 SET character_set_client = utf8 */;
4033 CREATE TABLE `marc_modification_templates` (
4034   `template_id` int(11) NOT NULL AUTO_INCREMENT,
4035   `name` mediumtext NOT NULL,
4036   PRIMARY KEY (`template_id`)
4037 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4038 /*!40101 SET character_set_client = @saved_cs_client */;
4039
4040 --
4041 -- Table structure for table `marc_overlay_rules`
4042 --
4043
4044 DROP TABLE IF EXISTS `marc_overlay_rules`;
4045 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4046 /*!40101 SET character_set_client = utf8 */;
4047 CREATE TABLE `marc_overlay_rules` (
4048   `id` int(11) NOT NULL AUTO_INCREMENT,
4049   `tag` varchar(255) NOT NULL,
4050   `module` varchar(127) NOT NULL,
4051   `filter` varchar(255) NOT NULL,
4052   `add` tinyint(1) NOT NULL DEFAULT 0,
4053   `append` tinyint(1) NOT NULL DEFAULT 0,
4054   `remove` tinyint(1) NOT NULL DEFAULT 0,
4055   `delete` tinyint(1) NOT NULL DEFAULT 0,
4056   PRIMARY KEY (`id`)
4057 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4058 /*!40101 SET character_set_client = @saved_cs_client */;
4059
4060 --
4061 -- Table structure for table `marc_subfield_structure`
4062 --
4063
4064 DROP TABLE IF EXISTS `marc_subfield_structure`;
4065 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4066 /*!40101 SET character_set_client = utf8 */;
4067 CREATE TABLE `marc_subfield_structure` (
4068   `tagfield` varchar(3) NOT NULL DEFAULT '',
4069   `tagsubfield` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
4070   `liblibrarian` varchar(255) NOT NULL DEFAULT '',
4071   `libopac` varchar(255) NOT NULL DEFAULT '',
4072   `repeatable` tinyint(4) NOT NULL DEFAULT 0,
4073   `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4074   `important` tinyint(4) NOT NULL DEFAULT 0,
4075   `kohafield` varchar(40) DEFAULT NULL,
4076   `tab` tinyint(1) DEFAULT NULL,
4077   `authorised_value` varchar(32) DEFAULT NULL,
4078   `authtypecode` varchar(20) DEFAULT NULL,
4079   `value_builder` varchar(80) DEFAULT NULL,
4080   `isurl` tinyint(1) DEFAULT NULL,
4081   `hidden` tinyint(1) NOT NULL DEFAULT 8,
4082   `frameworkcode` varchar(4) NOT NULL DEFAULT '',
4083   `seealso` varchar(1100) DEFAULT NULL,
4084   `link` varchar(80) DEFAULT NULL,
4085   `defaultvalue` mediumtext DEFAULT NULL,
4086   `maxlength` int(4) NOT NULL DEFAULT 9999,
4087   `display_order` int(2) NOT NULL DEFAULT 0,
4088   PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`),
4089   KEY `kohafield_2` (`kohafield`),
4090   KEY `tab` (`frameworkcode`,`tab`),
4091   KEY `kohafield` (`frameworkcode`,`kohafield`),
4092   KEY `marc_subfield_structure_ibfk_1` (`authorised_value`),
4093   CONSTRAINT `marc_subfield_structure_ibfk_1` FOREIGN KEY (`authorised_value`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE SET NULL ON UPDATE CASCADE
4094 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4095 /*!40101 SET character_set_client = @saved_cs_client */;
4096
4097 --
4098 -- Table structure for table `marc_tag_structure`
4099 --
4100
4101 DROP TABLE IF EXISTS `marc_tag_structure`;
4102 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4103 /*!40101 SET character_set_client = utf8 */;
4104 CREATE TABLE `marc_tag_structure` (
4105   `tagfield` varchar(3) NOT NULL DEFAULT '',
4106   `liblibrarian` varchar(255) NOT NULL DEFAULT '',
4107   `libopac` varchar(255) NOT NULL DEFAULT '',
4108   `repeatable` tinyint(4) NOT NULL DEFAULT 0,
4109   `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4110   `important` tinyint(4) NOT NULL DEFAULT 0,
4111   `authorised_value` varchar(32) DEFAULT NULL,
4112   `ind1_defaultvalue` varchar(1) NOT NULL DEFAULT '',
4113   `ind2_defaultvalue` varchar(1) NOT NULL DEFAULT '',
4114   `frameworkcode` varchar(4) NOT NULL DEFAULT '',
4115   PRIMARY KEY (`frameworkcode`,`tagfield`)
4116 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4117 /*!40101 SET character_set_client = @saved_cs_client */;
4118
4119 --
4120 -- Table structure for table `matchchecks`
4121 --
4122
4123 DROP TABLE IF EXISTS `matchchecks`;
4124 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4125 /*!40101 SET character_set_client = utf8 */;
4126 CREATE TABLE `matchchecks` (
4127   `matcher_id` int(11) NOT NULL,
4128   `matchcheck_id` int(11) NOT NULL AUTO_INCREMENT,
4129   `source_matchpoint_id` int(11) NOT NULL,
4130   `target_matchpoint_id` int(11) NOT NULL,
4131   PRIMARY KEY (`matchcheck_id`),
4132   KEY `matcher_matchchecks_ifbk_1` (`matcher_id`),
4133   KEY `matcher_matchchecks_ifbk_2` (`source_matchpoint_id`),
4134   KEY `matcher_matchchecks_ifbk_3` (`target_matchpoint_id`),
4135   CONSTRAINT `matcher_matchchecks_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4136   CONSTRAINT `matcher_matchchecks_ifbk_2` FOREIGN KEY (`source_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4137   CONSTRAINT `matcher_matchchecks_ifbk_3` FOREIGN KEY (`target_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4138 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4139 /*!40101 SET character_set_client = @saved_cs_client */;
4140
4141 --
4142 -- Table structure for table `matcher_matchpoints`
4143 --
4144
4145 DROP TABLE IF EXISTS `matcher_matchpoints`;
4146 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4147 /*!40101 SET character_set_client = utf8 */;
4148 CREATE TABLE `matcher_matchpoints` (
4149   `matcher_id` int(11) NOT NULL,
4150   `matchpoint_id` int(11) NOT NULL,
4151   KEY `matcher_matchpoints_ifbk_1` (`matcher_id`),
4152   KEY `matcher_matchpoints_ifbk_2` (`matchpoint_id`),
4153   CONSTRAINT `matcher_matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4154   CONSTRAINT `matcher_matchpoints_ifbk_2` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4155 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4156 /*!40101 SET character_set_client = @saved_cs_client */;
4157
4158 --
4159 -- Table structure for table `matchpoint_component_norms`
4160 --
4161
4162 DROP TABLE IF EXISTS `matchpoint_component_norms`;
4163 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4164 /*!40101 SET character_set_client = utf8 */;
4165 CREATE TABLE `matchpoint_component_norms` (
4166   `matchpoint_component_id` int(11) NOT NULL,
4167   `sequence` int(11) NOT NULL DEFAULT 0,
4168   `norm_routine` varchar(50) NOT NULL DEFAULT '',
4169   KEY `matchpoint_component_norms` (`matchpoint_component_id`,`sequence`),
4170   CONSTRAINT `matchpoint_component_norms_ifbk_1` FOREIGN KEY (`matchpoint_component_id`) REFERENCES `matchpoint_components` (`matchpoint_component_id`) ON DELETE CASCADE ON UPDATE CASCADE
4171 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4172 /*!40101 SET character_set_client = @saved_cs_client */;
4173
4174 --
4175 -- Table structure for table `matchpoint_components`
4176 --
4177
4178 DROP TABLE IF EXISTS `matchpoint_components`;
4179 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4180 /*!40101 SET character_set_client = utf8 */;
4181 CREATE TABLE `matchpoint_components` (
4182   `matchpoint_id` int(11) NOT NULL,
4183   `matchpoint_component_id` int(11) NOT NULL AUTO_INCREMENT,
4184   `sequence` int(11) NOT NULL DEFAULT 0,
4185   `tag` varchar(3) NOT NULL DEFAULT '',
4186   `subfields` varchar(40) NOT NULL DEFAULT '',
4187   `offset` int(4) NOT NULL DEFAULT 0,
4188   `length` int(4) NOT NULL DEFAULT 0,
4189   PRIMARY KEY (`matchpoint_component_id`),
4190   KEY `by_sequence` (`matchpoint_id`,`sequence`),
4191   CONSTRAINT `matchpoint_components_ifbk_1` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4192 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4193 /*!40101 SET character_set_client = @saved_cs_client */;
4194
4195 --
4196 -- Table structure for table `matchpoints`
4197 --
4198
4199 DROP TABLE IF EXISTS `matchpoints`;
4200 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4201 /*!40101 SET character_set_client = utf8 */;
4202 CREATE TABLE `matchpoints` (
4203   `matcher_id` int(11) NOT NULL,
4204   `matchpoint_id` int(11) NOT NULL AUTO_INCREMENT,
4205   `search_index` varchar(30) NOT NULL DEFAULT '',
4206   `score` int(11) NOT NULL DEFAULT 0,
4207   PRIMARY KEY (`matchpoint_id`),
4208   KEY `matchpoints_ifbk_1` (`matcher_id`),
4209   CONSTRAINT `matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE
4210 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4211 /*!40101 SET character_set_client = @saved_cs_client */;
4212
4213 --
4214 -- Table structure for table `message_attributes`
4215 --
4216
4217 DROP TABLE IF EXISTS `message_attributes`;
4218 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4219 /*!40101 SET character_set_client = utf8 */;
4220 CREATE TABLE `message_attributes` (
4221   `message_attribute_id` int(11) NOT NULL AUTO_INCREMENT,
4222   `message_name` varchar(40) NOT NULL DEFAULT '',
4223   `takes_days` tinyint(1) NOT NULL DEFAULT 0,
4224   PRIMARY KEY (`message_attribute_id`),
4225   UNIQUE KEY `message_name` (`message_name`)
4226 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4227 /*!40101 SET character_set_client = @saved_cs_client */;
4228
4229 --
4230 -- Table structure for table `message_queue`
4231 --
4232
4233 DROP TABLE IF EXISTS `message_queue`;
4234 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4235 /*!40101 SET character_set_client = utf8 */;
4236 CREATE TABLE `message_queue` (
4237   `message_id` int(11) NOT NULL AUTO_INCREMENT,
4238   `letter_id` int(11) DEFAULT NULL COMMENT 'Foreign key to the letters table',
4239   `borrowernumber` int(11) DEFAULT NULL,
4240   `subject` mediumtext DEFAULT NULL,
4241   `content` mediumtext DEFAULT NULL,
4242   `metadata` mediumtext DEFAULT NULL,
4243   `letter_code` varchar(64) DEFAULT NULL,
4244   `message_transport_type` varchar(20) NOT NULL,
4245   `status` enum('sent','pending','failed','deleted') NOT NULL DEFAULT 'pending',
4246   `time_queued` timestamp NULL DEFAULT NULL,
4247   `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
4248   `to_address` longtext DEFAULT NULL,
4249   `from_address` longtext DEFAULT NULL,
4250   `reply_address` longtext DEFAULT NULL,
4251   `content_type` mediumtext DEFAULT NULL,
4252   `failure_code` mediumtext DEFAULT NULL,
4253   PRIMARY KEY (`message_id`),
4254   KEY `borrowernumber` (`borrowernumber`),
4255   KEY `message_transport_type` (`message_transport_type`),
4256   KEY `letter_fk` (`letter_id`),
4257   CONSTRAINT `letter_fk` FOREIGN KEY (`letter_id`) REFERENCES `letter` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
4258   CONSTRAINT `messageq_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4259   CONSTRAINT `messageq_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON UPDATE CASCADE
4260 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4261 /*!40101 SET character_set_client = @saved_cs_client */;
4262
4263 --
4264 -- Table structure for table `message_transport_types`
4265 --
4266
4267 DROP TABLE IF EXISTS `message_transport_types`;
4268 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4269 /*!40101 SET character_set_client = utf8 */;
4270 CREATE TABLE `message_transport_types` (
4271   `message_transport_type` varchar(20) NOT NULL,
4272   PRIMARY KEY (`message_transport_type`)
4273 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4274 /*!40101 SET character_set_client = @saved_cs_client */;
4275
4276 --
4277 -- Table structure for table `message_transports`
4278 --
4279
4280 DROP TABLE IF EXISTS `message_transports`;
4281 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4282 /*!40101 SET character_set_client = utf8 */;
4283 CREATE TABLE `message_transports` (
4284   `message_attribute_id` int(11) NOT NULL,
4285   `message_transport_type` varchar(20) NOT NULL,
4286   `is_digest` tinyint(1) NOT NULL DEFAULT 0,
4287   `letter_module` varchar(20) NOT NULL DEFAULT '',
4288   `letter_code` varchar(20) NOT NULL DEFAULT '',
4289   `branchcode` varchar(10) NOT NULL DEFAULT '',
4290   PRIMARY KEY (`message_attribute_id`,`message_transport_type`,`is_digest`),
4291   KEY `message_transport_type` (`message_transport_type`),
4292   KEY `letter_module` (`letter_module`,`letter_code`),
4293   CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4294   CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
4295 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4296 /*!40101 SET character_set_client = @saved_cs_client */;
4297
4298 --
4299 -- Table structure for table `messages`
4300 --
4301
4302 DROP TABLE IF EXISTS `messages`;
4303 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4304 /*!40101 SET character_set_client = utf8 */;
4305 CREATE TABLE `messages` (
4306   `message_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4307   `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking this message to the borrowers table',
4308   `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key linking the message to the branches table',
4309   `message_type` varchar(1) NOT NULL COMMENT 'whether the message is for the librarians (L) or the patron (B)',
4310   `message` mediumtext NOT NULL COMMENT 'the text of the message',
4311   `message_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the message was written',
4312   `manager_id` int(11) DEFAULT NULL COMMENT 'creator of message',
4313   `patron_read_date` timestamp NULL DEFAULT NULL COMMENT 'the date and time the patron dismissed the message',
4314   PRIMARY KEY (`message_id`),
4315   KEY `messages_ibfk_1` (`manager_id`),
4316   KEY `messages_borrowernumber` (`borrowernumber`),
4317   CONSTRAINT `messages_borrowernumber` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4318   CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL
4319 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4320 /*!40101 SET character_set_client = @saved_cs_client */;
4321
4322 --
4323 -- Table structure for table `misc_files`
4324 --
4325
4326 DROP TABLE IF EXISTS `misc_files`;
4327 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4328 /*!40101 SET character_set_client = utf8 */;
4329 CREATE TABLE `misc_files` (
4330   `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the file record',
4331   `table_tag` varchar(255) NOT NULL COMMENT 'usually table name, or arbitrary unique tag',
4332   `record_id` int(11) NOT NULL COMMENT 'record id from the table this file is associated to',
4333   `file_name` varchar(255) NOT NULL COMMENT 'file name',
4334   `file_type` varchar(255) NOT NULL COMMENT 'MIME type of the file',
4335   `file_description` varchar(255) DEFAULT NULL COMMENT 'description given to the file',
4336   `file_content` longblob NOT NULL COMMENT 'file content',
4337   `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
4338   PRIMARY KEY (`file_id`),
4339   KEY `table_tag` (`table_tag`(191)),
4340   KEY `record_id` (`record_id`)
4341 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4342 /*!40101 SET character_set_client = @saved_cs_client */;
4343
4344 --
4345 -- Table structure for table `need_merge_authorities`
4346 --
4347
4348 DROP TABLE IF EXISTS `need_merge_authorities`;
4349 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4350 /*!40101 SET character_set_client = utf8 */;
4351 CREATE TABLE `need_merge_authorities` (
4352   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id',
4353   `authid` bigint(20) NOT NULL COMMENT 'reference to original authority record',
4354   `authid_new` bigint(20) DEFAULT NULL COMMENT 'reference to optional new authority record',
4355   `reportxml` mediumtext DEFAULT NULL COMMENT 'xml showing original reporting tag',
4356   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time last modified',
4357   `done` tinyint(4) DEFAULT 0,
4358   PRIMARY KEY (`id`)
4359 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4360 /*!40101 SET character_set_client = @saved_cs_client */;
4361
4362 --
4363 -- Table structure for table `oai_sets`
4364 --
4365
4366 DROP TABLE IF EXISTS `oai_sets`;
4367 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4368 /*!40101 SET character_set_client = utf8 */;
4369 CREATE TABLE `oai_sets` (
4370   `id` int(11) NOT NULL AUTO_INCREMENT,
4371   `spec` varchar(80) NOT NULL,
4372   `name` varchar(80) NOT NULL,
4373   PRIMARY KEY (`id`),
4374   UNIQUE KEY `spec` (`spec`)
4375 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4376 /*!40101 SET character_set_client = @saved_cs_client */;
4377
4378 --
4379 -- Table structure for table `oai_sets_biblios`
4380 --
4381
4382 DROP TABLE IF EXISTS `oai_sets_biblios`;
4383 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4384 /*!40101 SET character_set_client = utf8 */;
4385 CREATE TABLE `oai_sets_biblios` (
4386   `biblionumber` int(11) NOT NULL,
4387   `set_id` int(11) NOT NULL,
4388   PRIMARY KEY (`biblionumber`,`set_id`),
4389   KEY `oai_sets_biblios_ibfk_2` (`set_id`),
4390   CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4391 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4392 /*!40101 SET character_set_client = @saved_cs_client */;
4393
4394 --
4395 -- Table structure for table `oai_sets_descriptions`
4396 --
4397
4398 DROP TABLE IF EXISTS `oai_sets_descriptions`;
4399 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4400 /*!40101 SET character_set_client = utf8 */;
4401 CREATE TABLE `oai_sets_descriptions` (
4402   `set_id` int(11) NOT NULL,
4403   `description` varchar(255) NOT NULL,
4404   KEY `oai_sets_descriptions_ibfk_1` (`set_id`),
4405   CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4406 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4407 /*!40101 SET character_set_client = @saved_cs_client */;
4408
4409 --
4410 -- Table structure for table `oai_sets_mappings`
4411 --
4412
4413 DROP TABLE IF EXISTS `oai_sets_mappings`;
4414 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4415 /*!40101 SET character_set_client = utf8 */;
4416 CREATE TABLE `oai_sets_mappings` (
4417   `set_id` int(11) NOT NULL,
4418   `rule_order` int(11) DEFAULT NULL,
4419   `rule_operator` varchar(3) DEFAULT NULL,
4420   `marcfield` char(3) NOT NULL,
4421   `marcsubfield` char(1) NOT NULL,
4422   `operator` varchar(8) NOT NULL DEFAULT 'equal',
4423   `marcvalue` varchar(80) NOT NULL,
4424   KEY `oai_sets_mappings_ibfk_1` (`set_id`),
4425   CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4426 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4427 /*!40101 SET character_set_client = @saved_cs_client */;
4428
4429 --
4430 -- Table structure for table `oauth_access_tokens`
4431 --
4432
4433 DROP TABLE IF EXISTS `oauth_access_tokens`;
4434 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4435 /*!40101 SET character_set_client = utf8 */;
4436 CREATE TABLE `oauth_access_tokens` (
4437   `access_token` varchar(191) NOT NULL COMMENT 'generarated access token',
4438   `client_id` varchar(191) NOT NULL COMMENT 'the client id the access token belongs to',
4439   `expires` int(11) NOT NULL COMMENT 'expiration time in seconds',
4440   PRIMARY KEY (`access_token`)
4441 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4442 /*!40101 SET character_set_client = @saved_cs_client */;
4443
4444 --
4445 -- Table structure for table `old_issues`
4446 --
4447
4448 DROP TABLE IF EXISTS `old_issues`;
4449 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4450 /*!40101 SET character_set_client = utf8 */;
4451 CREATE TABLE `old_issues` (
4452   `issue_id` int(11) NOT NULL COMMENT 'primary key for issues table',
4453   `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
4454   `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
4455   `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
4456   `date_due` datetime DEFAULT NULL COMMENT 'date the item is due (yyyy-mm-dd)',
4457   `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
4458   `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned',
4459   `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
4460   `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
4461   `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
4462   `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
4463   `auto_renew_error` varchar(32) DEFAULT NULL COMMENT 'automatic renewal error',
4464   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
4465   `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
4466   `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
4467   `note` longtext DEFAULT NULL COMMENT 'issue note text',
4468   `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
4469   `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
4470   PRIMARY KEY (`issue_id`),
4471   KEY `old_issuesborridx` (`borrowernumber`),
4472   KEY `old_issuesitemidx` (`itemnumber`),
4473   KEY `branchcode_idx` (`branchcode`),
4474   KEY `old_bordate` (`borrowernumber`,`timestamp`),
4475   KEY `old_issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
4476   CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4477   CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4478   CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
4479 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4480 /*!40101 SET character_set_client = @saved_cs_client */;
4481
4482 --
4483 -- Table structure for table `old_reserves`
4484 --
4485
4486 DROP TABLE IF EXISTS `old_reserves`;
4487 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4488 /*!40101 SET character_set_client = utf8 */;
4489 CREATE TABLE `old_reserves` (
4490   `reserve_id` int(11) NOT NULL COMMENT 'primary key',
4491   `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4492   `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places',
4493   `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4494   `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
4495   `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
4496   `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4497   `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4498   `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4499   `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4500   `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4501   `reservenotes` longtext DEFAULT NULL COMMENT 'notes related to this hold',
4502   `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4503   `found` varchar(1) DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
4504   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4505   `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed on hold or the item this hold was filled with',
4506   `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4507   `expirationdate` date DEFAULT NULL COMMENT 'the date the hold expires (usually the date entered by the patron to say they don''t need the hold after a certain date)',
4508   `patron_expiration_date` date DEFAULT NULL COMMENT 'the date the hold expires - usually the date entered by the patron to say they don''t need the hold after a certain date',
4509   `lowestPriority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'has this hold been pinned to the lowest priority in the holds queue (1 for yes, 0 for no)',
4510   `suspend` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'in this hold suspended (1 for yes, 0 for no)',
4511   `suspend_until` datetime DEFAULT NULL COMMENT 'the date this hold is suspended until (NULL for infinitely)',
4512   `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4513   `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
4514   `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4515   PRIMARY KEY (`reserve_id`),
4516   KEY `old_reserves_borrowernumber` (`borrowernumber`),
4517   KEY `old_reserves_biblionumber` (`biblionumber`),
4518   KEY `old_reserves_itemnumber` (`itemnumber`),
4519   KEY `old_reserves_branchcode` (`branchcode`),
4520   KEY `old_reserves_itemtype` (`itemtype`),
4521   KEY `old_reserves_ibfk_ig` (`item_group_id`),
4522   CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4523   CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4524   CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4525   CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
4526   CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
4527 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4528 /*!40101 SET character_set_client = @saved_cs_client */;
4529
4530 --
4531 -- Table structure for table `overduerules`
4532 --
4533
4534 DROP TABLE IF EXISTS `overduerules`;
4535 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4536 /*!40101 SET character_set_client = utf8 */;
4537 CREATE TABLE `overduerules` (
4538   `overduerules_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the overduerules',
4539   `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table to define which branch this rule is for (if blank it''s all libraries)',
4540   `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table to define which patron category this rule is for',
4541   `delay1` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the first notice is sent',
4542   `letter1` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the first notice',
4543   `debarred1` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the first notice is sent (1 for yes, 0 for no)',
4544   `delay2` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the second notice is sent',
4545   `debarred2` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the second notice is sent (1 for yes, 0 for no)',
4546   `letter2` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the second notice',
4547   `delay3` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the third notice is sent',
4548   `letter3` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the third notice',
4549   `debarred3` int(1) DEFAULT 0 COMMENT 'is the patron restricted when the third notice is sent (1 for yes, 0 for no)',
4550   PRIMARY KEY (`overduerules_id`),
4551   UNIQUE KEY `overduerules_branch_cat` (`branchcode`,`categorycode`)
4552 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4553 /*!40101 SET character_set_client = @saved_cs_client */;
4554
4555 --
4556 -- Table structure for table `overduerules_transport_types`
4557 --
4558
4559 DROP TABLE IF EXISTS `overduerules_transport_types`;
4560 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4561 /*!40101 SET character_set_client = utf8 */;
4562 CREATE TABLE `overduerules_transport_types` (
4563   `id` int(11) NOT NULL AUTO_INCREMENT,
4564   `letternumber` int(1) NOT NULL DEFAULT 1,
4565   `message_transport_type` varchar(20) NOT NULL DEFAULT 'email',
4566   `overduerules_id` int(11) NOT NULL,
4567   PRIMARY KEY (`id`),
4568   KEY `overduerules_fk` (`overduerules_id`),
4569   KEY `mtt_fk` (`message_transport_type`),
4570   CONSTRAINT `mtt_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
4571   CONSTRAINT `overduerules_fk` FOREIGN KEY (`overduerules_id`) REFERENCES `overduerules` (`overduerules_id`) ON DELETE CASCADE ON UPDATE CASCADE
4572 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4573 /*!40101 SET character_set_client = @saved_cs_client */;
4574
4575 --
4576 -- Table structure for table `patron_consent`
4577 --
4578
4579 DROP TABLE IF EXISTS `patron_consent`;
4580 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4581 /*!40101 SET character_set_client = utf8 */;
4582 CREATE TABLE `patron_consent` (
4583   `id` int(11) NOT NULL AUTO_INCREMENT,
4584   `borrowernumber` int(11) NOT NULL,
4585   `type` enum('GDPR_PROCESSING') DEFAULT NULL COMMENT 'allows for future extension',
4586   `given_on` datetime DEFAULT NULL,
4587   `refused_on` datetime DEFAULT NULL,
4588   PRIMARY KEY (`id`),
4589   KEY `borrowernumber` (`borrowernumber`),
4590   CONSTRAINT `patron_consent_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4591 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4592 /*!40101 SET character_set_client = @saved_cs_client */;
4593
4594 --
4595 -- Table structure for table `patron_list_patrons`
4596 --
4597
4598 DROP TABLE IF EXISTS `patron_list_patrons`;
4599 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4600 /*!40101 SET character_set_client = utf8 */;
4601 CREATE TABLE `patron_list_patrons` (
4602   `patron_list_patron_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
4603   `patron_list_id` int(11) NOT NULL COMMENT 'the list this entry is part of',
4604   `borrowernumber` int(11) NOT NULL COMMENT 'the borrower that is part of this list',
4605   PRIMARY KEY (`patron_list_patron_id`),
4606   KEY `patron_list_id` (`patron_list_id`),
4607   KEY `borrowernumber` (`borrowernumber`),
4608   CONSTRAINT `patron_list_patrons_ibfk_1` FOREIGN KEY (`patron_list_id`) REFERENCES `patron_lists` (`patron_list_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4609   CONSTRAINT `patron_list_patrons_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4610 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4611 /*!40101 SET character_set_client = @saved_cs_client */;
4612
4613 --
4614 -- Table structure for table `patron_lists`
4615 --
4616
4617 DROP TABLE IF EXISTS `patron_lists`;
4618 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4619 /*!40101 SET character_set_client = utf8 */;
4620 CREATE TABLE `patron_lists` (
4621   `patron_list_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
4622   `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'the list''s name',
4623   `owner` int(11) NOT NULL COMMENT 'borrowernumber of the list creator',
4624   `shared` tinyint(1) DEFAULT 0,
4625   PRIMARY KEY (`patron_list_id`),
4626   KEY `owner` (`owner`),
4627   CONSTRAINT `patron_lists_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4628 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4629 /*!40101 SET character_set_client = @saved_cs_client */;
4630
4631 --
4632 -- Table structure for table `patronimage`
4633 --
4634
4635 DROP TABLE IF EXISTS `patronimage`;
4636 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4637 /*!40101 SET character_set_client = utf8 */;
4638 CREATE TABLE `patronimage` (
4639   `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron this image is attached to (borrowers.borrowernumber)',
4640   `mimetype` varchar(15) NOT NULL COMMENT 'the format of the image (png, jpg, etc)',
4641   `imagefile` mediumblob NOT NULL COMMENT 'the image',
4642   PRIMARY KEY (`borrowernumber`),
4643   CONSTRAINT `patronimage_fk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4644 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4645 /*!40101 SET character_set_client = @saved_cs_client */;
4646
4647 --
4648 -- Table structure for table `pending_offline_operations`
4649 --
4650
4651 DROP TABLE IF EXISTS `pending_offline_operations`;
4652 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4653 /*!40101 SET character_set_client = utf8 */;
4654 CREATE TABLE `pending_offline_operations` (
4655   `operationid` int(11) NOT NULL AUTO_INCREMENT,
4656   `userid` varchar(30) NOT NULL,
4657   `branchcode` varchar(10) NOT NULL,
4658   `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
4659   `action` varchar(10) NOT NULL,
4660   `barcode` varchar(20) DEFAULT NULL,
4661   `cardnumber` varchar(32) DEFAULT NULL,
4662   `amount` decimal(28,6) DEFAULT NULL,
4663   PRIMARY KEY (`operationid`)
4664 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4665 /*!40101 SET character_set_client = @saved_cs_client */;
4666
4667 --
4668 -- Table structure for table `permissions`
4669 --
4670
4671 DROP TABLE IF EXISTS `permissions`;
4672 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4673 /*!40101 SET character_set_client = utf8 */;
4674 CREATE TABLE `permissions` (
4675   `module_bit` int(11) NOT NULL DEFAULT 0,
4676   `code` varchar(64) NOT NULL DEFAULT '',
4677   `description` varchar(255) DEFAULT NULL,
4678   PRIMARY KEY (`module_bit`,`code`),
4679   CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`) ON DELETE CASCADE ON UPDATE CASCADE
4680 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4681 /*!40101 SET character_set_client = @saved_cs_client */;
4682
4683 --
4684 -- Table structure for table `plugin_data`
4685 --
4686
4687 DROP TABLE IF EXISTS `plugin_data`;
4688 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4689 /*!40101 SET character_set_client = utf8 */;
4690 CREATE TABLE `plugin_data` (
4691   `plugin_class` varchar(255) NOT NULL,
4692   `plugin_key` varchar(255) NOT NULL,
4693   `plugin_value` mediumtext DEFAULT NULL,
4694   PRIMARY KEY (`plugin_class`(191),`plugin_key`(191))
4695 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4696 /*!40101 SET character_set_client = @saved_cs_client */;
4697
4698 --
4699 -- Table structure for table `plugin_methods`
4700 --
4701
4702 DROP TABLE IF EXISTS `plugin_methods`;
4703 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4704 /*!40101 SET character_set_client = utf8 */;
4705 CREATE TABLE `plugin_methods` (
4706   `plugin_class` varchar(255) NOT NULL,
4707   `plugin_method` varchar(255) NOT NULL,
4708   PRIMARY KEY (`plugin_class`(191),`plugin_method`(191))
4709 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4710 /*!40101 SET character_set_client = @saved_cs_client */;
4711
4712 --
4713 -- Table structure for table `printers_profile`
4714 --
4715
4716 DROP TABLE IF EXISTS `printers_profile`;
4717 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4718 /*!40101 SET character_set_client = utf8 */;
4719 CREATE TABLE `printers_profile` (
4720   `profile_id` int(4) NOT NULL AUTO_INCREMENT,
4721   `printer_name` varchar(40) NOT NULL DEFAULT 'Default Printer',
4722   `template_id` int(4) NOT NULL DEFAULT 0,
4723   `paper_bin` varchar(20) NOT NULL DEFAULT 'Bypass',
4724   `offset_horz` float NOT NULL DEFAULT 0,
4725   `offset_vert` float NOT NULL DEFAULT 0,
4726   `creep_horz` float NOT NULL DEFAULT 0,
4727   `creep_vert` float NOT NULL DEFAULT 0,
4728   `units` char(20) NOT NULL DEFAULT 'POINT',
4729   `creator` char(15) NOT NULL DEFAULT 'Labels',
4730   PRIMARY KEY (`profile_id`),
4731   UNIQUE KEY `printername` (`printer_name`,`template_id`,`paper_bin`,`creator`)
4732 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4733 /*!40101 SET character_set_client = @saved_cs_client */;
4734
4735 --
4736 -- Table structure for table `problem_reports`
4737 --
4738
4739 DROP TABLE IF EXISTS `problem_reports`;
4740 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4741 /*!40101 SET character_set_client = utf8 */;
4742 CREATE TABLE `problem_reports` (
4743   `reportid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4744   `title` varchar(40) NOT NULL DEFAULT '' COMMENT 'report subject line',
4745   `content` text NOT NULL COMMENT 'report message content',
4746   `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the user who created the problem report',
4747   `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'borrower''s branch',
4748   `username` varchar(75) DEFAULT NULL COMMENT 'OPAC username',
4749   `problempage` text DEFAULT NULL COMMENT 'page the user triggered the problem report form from',
4750   `recipient` enum('admin','library') NOT NULL DEFAULT 'library' COMMENT 'the ''to-address'' of the problem report',
4751   `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'timestamp of report submission',
4752   `status` varchar(6) NOT NULL DEFAULT 'New' COMMENT 'status of the report. New, Viewed, Closed',
4753   PRIMARY KEY (`reportid`),
4754   KEY `problem_reports_ibfk1` (`borrowernumber`),
4755   KEY `problem_reports_ibfk2` (`branchcode`),
4756   CONSTRAINT `problem_reports_ibfk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4757   CONSTRAINT `problem_reports_ibfk2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4758 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4759 /*!40101 SET character_set_client = @saved_cs_client */;
4760
4761 --
4762 -- Table structure for table `pseudonymized_borrower_attributes`
4763 --
4764
4765 DROP TABLE IF EXISTS `pseudonymized_borrower_attributes`;
4766 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4767 /*!40101 SET character_set_client = utf8 */;
4768 CREATE TABLE `pseudonymized_borrower_attributes` (
4769   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
4770   `transaction_id` int(11) NOT NULL,
4771   `code` varchar(10) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
4772   `attribute` varchar(255) DEFAULT NULL COMMENT 'custom patron field value',
4773   PRIMARY KEY (`id`),
4774   KEY `pseudonymized_borrower_attributes_ibfk_1` (`transaction_id`),
4775   KEY `anonymized_borrower_attributes_ibfk_2` (`code`),
4776   CONSTRAINT `anonymized_borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
4777   CONSTRAINT `pseudonymized_borrower_attributes_ibfk_1` FOREIGN KEY (`transaction_id`) REFERENCES `pseudonymized_transactions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4778 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4779 /*!40101 SET character_set_client = @saved_cs_client */;
4780
4781 --
4782 -- Table structure for table `pseudonymized_transactions`
4783 --
4784
4785 DROP TABLE IF EXISTS `pseudonymized_transactions`;
4786 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4787 /*!40101 SET character_set_client = utf8 */;
4788 CREATE TABLE `pseudonymized_transactions` (
4789   `id` int(11) NOT NULL AUTO_INCREMENT,
4790   `hashed_borrowernumber` varchar(60) NOT NULL,
4791   `has_cardnumber` tinyint(1) NOT NULL DEFAULT 0,
4792   `title` longtext DEFAULT NULL,
4793   `city` longtext DEFAULT NULL,
4794   `state` mediumtext DEFAULT NULL,
4795   `zipcode` varchar(25) DEFAULT NULL,
4796   `country` mediumtext DEFAULT NULL,
4797   `branchcode` varchar(10) NOT NULL DEFAULT '',
4798   `categorycode` varchar(10) NOT NULL DEFAULT '',
4799   `dateenrolled` date DEFAULT NULL,
4800   `sex` varchar(1) DEFAULT NULL,
4801   `sort1` varchar(80) DEFAULT NULL,
4802   `sort2` varchar(80) DEFAULT NULL,
4803   `datetime` datetime DEFAULT NULL,
4804   `transaction_branchcode` varchar(10) DEFAULT NULL,
4805   `transaction_type` varchar(16) DEFAULT NULL,
4806   `itemnumber` int(11) DEFAULT NULL,
4807   `itemtype` varchar(10) DEFAULT NULL,
4808   `holdingbranch` varchar(10) DEFAULT NULL,
4809   `homebranch` varchar(10) DEFAULT NULL,
4810   `location` varchar(80) DEFAULT NULL,
4811   `itemcallnumber` varchar(255) DEFAULT NULL,
4812   `ccode` varchar(80) DEFAULT NULL,
4813   PRIMARY KEY (`id`),
4814   KEY `pseudonymized_transactions_ibfk_1` (`categorycode`),
4815   KEY `pseudonymized_transactions_borrowers_ibfk_2` (`branchcode`),
4816   KEY `pseudonymized_transactions_borrowers_ibfk_3` (`transaction_branchcode`)
4817 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4818 /*!40101 SET character_set_client = @saved_cs_client */;
4819
4820 --
4821 -- Table structure for table `quotes`
4822 --
4823
4824 DROP TABLE IF EXISTS `quotes`;
4825 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4826 /*!40101 SET character_set_client = utf8 */;
4827 CREATE TABLE `quotes` (
4828   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the quote',
4829   `source` mediumtext DEFAULT NULL COMMENT 'source/credit for the quote',
4830   `text` longtext NOT NULL COMMENT 'text of the quote',
4831   `timestamp` datetime DEFAULT NULL COMMENT 'date and time that the quote last appeared in the opac',
4832   PRIMARY KEY (`id`)
4833 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4834 /*!40101 SET character_set_client = @saved_cs_client */;
4835
4836 --
4837 -- Table structure for table `ratings`
4838 --
4839
4840 DROP TABLE IF EXISTS `ratings`;
4841 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4842 /*!40101 SET character_set_client = utf8 */;
4843 CREATE TABLE `ratings` (
4844   `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron who left this rating (borrowers.borrowernumber)',
4845   `biblionumber` int(11) NOT NULL COMMENT 'the biblio this rating is for (biblio.biblionumber)',
4846   `rating_value` tinyint(1) NOT NULL COMMENT 'the rating, from 1 to 5',
4847   `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
4848   PRIMARY KEY (`borrowernumber`,`biblionumber`),
4849   KEY `ratings_ibfk_2` (`biblionumber`),
4850   CONSTRAINT `ratings_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4851   CONSTRAINT `ratings_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
4852 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4853 /*!40101 SET character_set_client = @saved_cs_client */;
4854
4855 --
4856 -- Table structure for table `recalls`
4857 --
4858
4859 DROP TABLE IF EXISTS `recalls`;
4860 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4861 /*!40101 SET character_set_client = utf8 */;
4862 CREATE TABLE `recalls` (
4863   `recall_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier for this recall',
4864   `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Identifier for patron who requested recall',
4865   `created_date` datetime DEFAULT NULL COMMENT 'Date the recall was requested',
4866   `biblio_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Identifier for bibliographic record that has been recalled',
4867   `pickup_library_id` varchar(10) DEFAULT NULL COMMENT 'Identifier for recall pickup library',
4868   `completed_date` datetime DEFAULT NULL COMMENT 'Date the recall is completed (fulfilled, cancelled or expired)',
4869   `notes` mediumtext DEFAULT NULL COMMENT 'Notes related to the recall',
4870   `priority` smallint(6) DEFAULT NULL COMMENT 'Where in the queue the patron sits',
4871   `status` enum('requested','overdue','waiting','in_transit','cancelled','expired','fulfilled') DEFAULT 'requested' COMMENT 'Status of recall',
4872   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time the recall was last updated',
4873   `item_id` int(11) DEFAULT NULL COMMENT 'Identifier for item record that was recalled, if an item-level recall',
4874   `waiting_date` datetime DEFAULT NULL COMMENT 'Date an item was marked as waiting for the patron at the library',
4875   `expiration_date` datetime DEFAULT NULL COMMENT 'Date recall is no longer required, or date recall will expire after waiting on shelf for pickup',
4876   `completed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is old and no longer active, i.e. expired, cancelled or completed',
4877   `item_level` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is for a specific item',
4878   PRIMARY KEY (`recall_id`),
4879   KEY `recalls_ibfk_1` (`patron_id`),
4880   KEY `recalls_ibfk_2` (`biblio_id`),
4881   KEY `recalls_ibfk_3` (`item_id`),
4882   KEY `recalls_ibfk_4` (`pickup_library_id`),
4883   CONSTRAINT `recalls_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4884   CONSTRAINT `recalls_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4885   CONSTRAINT `recalls_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4886   CONSTRAINT `recalls_ibfk_4` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4887 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Information related to recalls in Koha';
4888 /*!40101 SET character_set_client = @saved_cs_client */;
4889
4890 --
4891 -- Table structure for table `repeatable_holidays`
4892 --
4893
4894 DROP TABLE IF EXISTS `repeatable_holidays`;
4895 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4896 /*!40101 SET character_set_client = utf8 */;
4897 CREATE TABLE `repeatable_holidays` (
4898   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4899   `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
4900   `weekday` smallint(6) DEFAULT NULL COMMENT 'day of the week (0=Sunday, 1=Monday, etc) this closing is repeated on',
4901   `day` smallint(6) DEFAULT NULL COMMENT 'day of the month this closing is on',
4902   `month` smallint(6) DEFAULT NULL COMMENT 'month this closing is in',
4903   `title` varchar(50) NOT NULL DEFAULT '' COMMENT 'title of this closing',
4904   `description` mediumtext NOT NULL COMMENT 'description for this closing',
4905   PRIMARY KEY (`id`),
4906   KEY `repeatable_holidays_ibfk_1` (`branchcode`),
4907   CONSTRAINT `repeatable_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4908 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4909 /*!40101 SET character_set_client = @saved_cs_client */;
4910
4911 --
4912 -- Table structure for table `reports_dictionary`
4913 --
4914
4915 DROP TABLE IF EXISTS `reports_dictionary`;
4916 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4917 /*!40101 SET character_set_client = utf8 */;
4918 CREATE TABLE `reports_dictionary` (
4919   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4920   `name` varchar(255) DEFAULT NULL COMMENT 'name for this definition',
4921   `description` mediumtext DEFAULT NULL COMMENT 'description for this definition',
4922   `date_created` datetime DEFAULT NULL COMMENT 'date and time this definition was created',
4923   `date_modified` datetime DEFAULT NULL COMMENT 'date and time this definition was last modified',
4924   `saved_sql` mediumtext DEFAULT NULL COMMENT 'SQL snippet for us in reports',
4925   `report_area` varchar(6) DEFAULT NULL COMMENT 'Koha module this definition is for Circulation, Catalog, Patrons, Acquistions, Accounts)',
4926   PRIMARY KEY (`id`),
4927   KEY `dictionary_area_idx` (`report_area`)
4928 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4929 /*!40101 SET character_set_client = @saved_cs_client */;
4930
4931 --
4932 -- Table structure for table `reserves`
4933 --
4934
4935 DROP TABLE IF EXISTS `reserves`;
4936 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4937 /*!40101 SET character_set_client = utf8 */;
4938 CREATE TABLE `reserves` (
4939   `reserve_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4940   `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4941   `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
4942   `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4943   `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
4944   `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
4945   `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4946   `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4947   `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4948   `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4949   `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4950   `reservenotes` longtext DEFAULT NULL COMMENT 'notes related to this hold',
4951   `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4952   `found` varchar(1) DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
4953   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4954   `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed on hold or the item this hold was filled with',
4955   `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4956   `expirationdate` date DEFAULT NULL COMMENT 'the date the hold expires (calculated value)',
4957   `patron_expiration_date` date DEFAULT NULL COMMENT 'the date the hold expires - usually the date entered by the patron to say they don''t need the hold after a certain date',
4958   `lowestPriority` tinyint(1) NOT NULL DEFAULT 0,
4959   `suspend` tinyint(1) NOT NULL DEFAULT 0,
4960   `suspend_until` datetime DEFAULT NULL,
4961   `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4962   `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
4963   `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4964   PRIMARY KEY (`reserve_id`),
4965   KEY `priorityfoundidx` (`priority`,`found`),
4966   KEY `borrowernumber` (`borrowernumber`),
4967   KEY `biblionumber` (`biblionumber`),
4968   KEY `itemnumber` (`itemnumber`),
4969   KEY `branchcode` (`branchcode`),
4970   KEY `desk_id` (`desk_id`),
4971   KEY `itemtype` (`itemtype`),
4972   KEY `reserves_ibfk_ig` (`item_group_id`),
4973   CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4974   CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4975   CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4976   CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4977   CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4978   CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE,
4979   CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE
4980 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4981 /*!40101 SET character_set_client = @saved_cs_client */;
4982
4983 --
4984 -- Table structure for table `restriction_types`
4985 --
4986
4987 DROP TABLE IF EXISTS `restriction_types`;
4988 /*!40101 SET @saved_cs_client     = @@character_set_client */;
4989 /*!40101 SET character_set_client = utf8 */;
4990 CREATE TABLE `restriction_types` (
4991   `code` varchar(50) NOT NULL,
4992   `display_text` text NOT NULL,
4993   `is_system` tinyint(1) NOT NULL DEFAULT 0,
4994   `is_default` tinyint(1) NOT NULL DEFAULT 0,
4995   PRIMARY KEY (`code`)
4996 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4997 /*!40101 SET character_set_client = @saved_cs_client */;
4998
4999 --
5000 -- Table structure for table `return_claims`
5001 --
5002
5003 DROP TABLE IF EXISTS `return_claims`;
5004 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5005 /*!40101 SET character_set_client = utf8 */;
5006 CREATE TABLE `return_claims` (
5007   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the return claim',
5008   `itemnumber` int(11) NOT NULL COMMENT 'ID of the item',
5009   `issue_id` int(11) DEFAULT NULL COMMENT 'ID of the checkout that triggered the claim',
5010   `borrowernumber` int(11) NOT NULL COMMENT 'ID of the patron',
5011   `notes` mediumtext DEFAULT NULL COMMENT 'Notes about the claim',
5012   `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was created',
5013   `created_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that registered the claim',
5014   `updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the claim (notes)',
5015   `updated_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that updated the claim',
5016   `resolution` varchar(80) DEFAULT NULL COMMENT 'Resolution code (RETURN_CLAIM_RESOLUTION AVs)',
5017   `resolved_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was resolved',
5018   `resolved_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that resolved the claim',
5019   PRIMARY KEY (`id`),
5020   UNIQUE KEY `item_issue` (`itemnumber`,`issue_id`),
5021   KEY `itemnumber` (`itemnumber`),
5022   KEY `rc_borrowers_ibfk` (`borrowernumber`),
5023   KEY `rc_created_by_ibfk` (`created_by`),
5024   KEY `rc_updated_by_ibfk` (`updated_by`),
5025   KEY `rc_resolved_by_ibfk` (`resolved_by`),
5026   CONSTRAINT `rc_borrowers_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5027   CONSTRAINT `rc_created_by_ibfk` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5028   CONSTRAINT `rc_items_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5029   CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5030   CONSTRAINT `rc_updated_by_ibfk` FOREIGN KEY (`updated_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5031 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5032 /*!40101 SET character_set_client = @saved_cs_client */;
5033
5034 --
5035 -- Table structure for table `reviews`
5036 --
5037
5038 DROP TABLE IF EXISTS `reviews`;
5039 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5040 /*!40101 SET character_set_client = utf8 */;
5041 CREATE TABLE `reviews` (
5042   `reviewid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for this comment',
5043   `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron left this comment',
5044   `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bibliographic record this comment is for',
5045   `review` mediumtext DEFAULT NULL COMMENT 'the body of the comment',
5046   `approved` tinyint(4) DEFAULT 0 COMMENT 'whether this comment has been approved by a librarian (1 for yes, 0 for no)',
5047   `datereviewed` datetime DEFAULT NULL COMMENT 'the date the comment was left',
5048   PRIMARY KEY (`reviewid`),
5049   KEY `reviews_ibfk_1` (`borrowernumber`),
5050   KEY `reviews_ibfk_2` (`biblionumber`),
5051   CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5052   CONSTRAINT `reviews_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5053 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5054 /*!40101 SET character_set_client = @saved_cs_client */;
5055
5056 --
5057 -- Table structure for table `saved_reports`
5058 --
5059
5060 DROP TABLE IF EXISTS `saved_reports`;
5061 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5062 /*!40101 SET character_set_client = utf8 */;
5063 CREATE TABLE `saved_reports` (
5064   `id` int(11) NOT NULL AUTO_INCREMENT,
5065   `report_id` int(11) DEFAULT NULL,
5066   `report` longtext DEFAULT NULL,
5067   `date_run` datetime DEFAULT NULL,
5068   PRIMARY KEY (`id`)
5069 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5070 /*!40101 SET character_set_client = @saved_cs_client */;
5071
5072 --
5073 -- Table structure for table `saved_sql`
5074 --
5075
5076 DROP TABLE IF EXISTS `saved_sql`;
5077 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5078 /*!40101 SET character_set_client = utf8 */;
5079 CREATE TABLE `saved_sql` (
5080   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key assigned by Koha',
5081   `borrowernumber` int(11) DEFAULT NULL COMMENT 'the staff member who created this report (borrowers.borrowernumber)',
5082   `date_created` datetime DEFAULT NULL COMMENT 'the date this report was created',
5083   `last_modified` datetime DEFAULT NULL COMMENT 'the date this report was last edited',
5084   `savedsql` mediumtext DEFAULT NULL COMMENT 'the SQL for this report',
5085   `last_run` datetime DEFAULT NULL,
5086   `report_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'the name of this report',
5087   `type` varchar(255) DEFAULT NULL COMMENT 'always 1 for tabular',
5088   `notes` mediumtext DEFAULT NULL COMMENT 'the notes or description given to this report',
5089   `cache_expiry` int(11) NOT NULL DEFAULT 300,
5090   `public` tinyint(1) NOT NULL DEFAULT 0,
5091   `report_area` varchar(6) DEFAULT NULL,
5092   `report_group` varchar(80) DEFAULT NULL,
5093   `report_subgroup` varchar(80) DEFAULT NULL,
5094   `mana_id` int(11) DEFAULT NULL,
5095   PRIMARY KEY (`id`),
5096   KEY `sql_area_group_idx` (`report_group`,`report_subgroup`),
5097   KEY `boridx` (`borrowernumber`)
5098 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5099 /*!40101 SET character_set_client = @saved_cs_client */;
5100
5101 --
5102 -- Table structure for table `search_field`
5103 --
5104
5105 DROP TABLE IF EXISTS `search_field`;
5106 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5107 /*!40101 SET character_set_client = utf8 */;
5108 CREATE TABLE `search_field` (
5109   `id` int(11) NOT NULL AUTO_INCREMENT,
5110   `name` varchar(255) NOT NULL COMMENT 'the name of the field as it will be stored in the search engine',
5111   `label` varchar(255) NOT NULL COMMENT 'the human readable name of the field, for display',
5112   `type` enum('','string','date','number','boolean','sum','isbn','stdno','year','callnumber') NOT NULL COMMENT 'what type of data this holds, relevant when storing it in the search engine',
5113   `weight` decimal(5,2) DEFAULT NULL,
5114   `facet_order` tinyint(4) DEFAULT NULL COMMENT 'the order place of the field in facet list if faceted',
5115   `staff_client` tinyint(1) NOT NULL DEFAULT 1,
5116   `opac` tinyint(1) NOT NULL DEFAULT 1,
5117   `mandatory` tinyint(1) DEFAULT NULL COMMENT 'if marked this field is not editable or removable',
5118   PRIMARY KEY (`id`),
5119   UNIQUE KEY `name` (`name`(191))
5120 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5121 /*!40101 SET character_set_client = @saved_cs_client */;
5122
5123 --
5124 -- Table structure for table `search_filters`
5125 --
5126
5127 DROP TABLE IF EXISTS `search_filters`;
5128 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5129 /*!40101 SET character_set_client = utf8 */;
5130 CREATE TABLE `search_filters` (
5131   `search_filter_id` int(11) NOT NULL AUTO_INCREMENT,
5132   `name` varchar(255) NOT NULL COMMENT 'filter name',
5133   `query` mediumtext DEFAULT NULL COMMENT 'filter query part',
5134   `limits` mediumtext DEFAULT NULL COMMENT 'filter limits part',
5135   `opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown on OPAC',
5136   `staff_client` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown in staff client',
5137   PRIMARY KEY (`search_filter_id`)
5138 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5139 /*!40101 SET character_set_client = @saved_cs_client */;
5140
5141 --
5142 -- Table structure for table `search_history`
5143 --
5144
5145 DROP TABLE IF EXISTS `search_history`;
5146 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5147 /*!40101 SET character_set_client = utf8 */;
5148 CREATE TABLE `search_history` (
5149   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'search history id',
5150   `userid` int(11) NOT NULL COMMENT 'the patron who performed the search (borrowers.borrowernumber)',
5151   `sessionid` varchar(32) NOT NULL COMMENT 'a system generated session id',
5152   `query_desc` varchar(255) NOT NULL COMMENT 'the search that was performed',
5153   `query_cgi` mediumtext NOT NULL COMMENT 'the string to append to the search url to rerun the search',
5154   `type` varchar(16) NOT NULL DEFAULT 'biblio' COMMENT 'search type, must be ''biblio'' or ''authority''',
5155   `total` int(11) NOT NULL COMMENT 'the total of results found',
5156   `time` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the search was run',
5157   PRIMARY KEY (`id`),
5158   KEY `userid` (`userid`),
5159   KEY `sessionid` (`sessionid`)
5160 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Opac search history results';
5161 /*!40101 SET character_set_client = @saved_cs_client */;
5162
5163 --
5164 -- Table structure for table `search_marc_map`
5165 --
5166
5167 DROP TABLE IF EXISTS `search_marc_map`;
5168 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5169 /*!40101 SET character_set_client = utf8 */;
5170 CREATE TABLE `search_marc_map` (
5171   `id` int(11) NOT NULL AUTO_INCREMENT,
5172   `index_name` enum('biblios','authorities') NOT NULL COMMENT 'what storage index this map is for',
5173   `marc_type` enum('marc21','unimarc') NOT NULL COMMENT 'what MARC type this map is for',
5174   `marc_field` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the MARC specifier for this field',
5175   PRIMARY KEY (`id`),
5176   UNIQUE KEY `index_name` (`index_name`,`marc_field`(191),`marc_type`),
5177   KEY `index_name_2` (`index_name`)
5178 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5179 /*!40101 SET character_set_client = @saved_cs_client */;
5180
5181 --
5182 -- Table structure for table `search_marc_to_field`
5183 --
5184
5185 DROP TABLE IF EXISTS `search_marc_to_field`;
5186 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5187 /*!40101 SET character_set_client = utf8 */;
5188 CREATE TABLE `search_marc_to_field` (
5189   `search` tinyint(1) NOT NULL DEFAULT 1,
5190   `search_marc_map_id` int(11) NOT NULL,
5191   `search_field_id` int(11) NOT NULL,
5192   `facet` tinyint(1) DEFAULT 0 COMMENT 'true if a facet field should be generated for this',
5193   `suggestible` tinyint(1) DEFAULT 0 COMMENT 'true if this field can be used to generate suggestions for browse',
5194   `sort` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Sort defaults to 1 (Yes) and creates sort fields in the index, 0 (no) will prevent this',
5195   PRIMARY KEY (`search_marc_map_id`,`search_field_id`),
5196   KEY `search_field_id` (`search_field_id`),
5197   CONSTRAINT `search_marc_to_field_ibfk_1` FOREIGN KEY (`search_marc_map_id`) REFERENCES `search_marc_map` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
5198   CONSTRAINT `search_marc_to_field_ibfk_2` FOREIGN KEY (`search_field_id`) REFERENCES `search_field` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
5199 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5200 /*!40101 SET character_set_client = @saved_cs_client */;
5201
5202 --
5203 -- Table structure for table `serial`
5204 --
5205
5206 DROP TABLE IF EXISTS `serial`;
5207 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5208 /*!40101 SET character_set_client = utf8 */;
5209 CREATE TABLE `serial` (
5210   `serialid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the issue',
5211   `biblionumber` int(11) NOT NULL COMMENT 'foreign key for the biblio.biblionumber that this issue is attached to',
5212   `subscriptionid` int(11) NOT NULL COMMENT 'foreign key to the subscription.subscriptionid that this issue is part of',
5213   `serialseq` varchar(100) NOT NULL DEFAULT '' COMMENT 'issue information (volume, number, etc)',
5214   `serialseq_x` varchar(100) DEFAULT NULL COMMENT 'first part of issue information',
5215   `serialseq_y` varchar(100) DEFAULT NULL COMMENT 'second part of issue information',
5216   `serialseq_z` varchar(100) DEFAULT NULL COMMENT 'third part of issue information',
5217   `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'status code for this issue (see manual for full descriptions)',
5218   `planneddate` date DEFAULT NULL COMMENT 'date expected',
5219   `notes` mediumtext DEFAULT NULL COMMENT 'notes',
5220   `publisheddate` date DEFAULT NULL COMMENT 'date published',
5221   `publisheddatetext` varchar(100) DEFAULT NULL COMMENT 'date published (descriptive)',
5222   `claimdate` date DEFAULT NULL COMMENT 'date claimed',
5223   `claims_count` int(11) DEFAULT 0 COMMENT 'number of claims made related to this issue',
5224   `routingnotes` mediumtext DEFAULT NULL COMMENT 'notes from the routing list',
5225   PRIMARY KEY (`serialid`),
5226   KEY `serial_ibfk_1` (`biblionumber`),
5227   KEY `serial_ibfk_2` (`subscriptionid`),
5228   CONSTRAINT `serial_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5229   CONSTRAINT `serial_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5230 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5231 /*!40101 SET character_set_client = @saved_cs_client */;
5232
5233 --
5234 -- Table structure for table `serialitems`
5235 --
5236
5237 DROP TABLE IF EXISTS `serialitems`;
5238 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5239 /*!40101 SET character_set_client = utf8 */;
5240 CREATE TABLE `serialitems` (
5241   `itemnumber` int(11) NOT NULL,
5242   `serialid` int(11) NOT NULL,
5243   PRIMARY KEY (`itemnumber`),
5244   KEY `serialitems_sfk_1` (`serialid`),
5245   CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE,
5246   CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
5247 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5248 /*!40101 SET character_set_client = @saved_cs_client */;
5249
5250 --
5251 -- Table structure for table `sessions`
5252 --
5253
5254 DROP TABLE IF EXISTS `sessions`;
5255 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5256 /*!40101 SET character_set_client = utf8 */;
5257 CREATE TABLE `sessions` (
5258   `id` varchar(32) NOT NULL,
5259   `a_session` longblob NOT NULL,
5260   PRIMARY KEY (`id`)
5261 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5262 /*!40101 SET character_set_client = @saved_cs_client */;
5263
5264 --
5265 -- Table structure for table `sms_providers`
5266 --
5267
5268 DROP TABLE IF EXISTS `sms_providers`;
5269 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5270 /*!40101 SET character_set_client = utf8 */;
5271 CREATE TABLE `sms_providers` (
5272   `id` int(11) NOT NULL AUTO_INCREMENT,
5273   `name` varchar(255) NOT NULL,
5274   `domain` varchar(255) NOT NULL,
5275   PRIMARY KEY (`id`),
5276   UNIQUE KEY `name` (`name`(191))
5277 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5278 /*!40101 SET character_set_client = @saved_cs_client */;
5279
5280 --
5281 -- Table structure for table `smtp_servers`
5282 --
5283
5284 DROP TABLE IF EXISTS `smtp_servers`;
5285 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5286 /*!40101 SET character_set_client = utf8 */;
5287 CREATE TABLE `smtp_servers` (
5288   `id` int(11) NOT NULL AUTO_INCREMENT,
5289   `name` varchar(80) NOT NULL,
5290   `host` varchar(80) NOT NULL DEFAULT 'localhost',
5291   `port` int(11) NOT NULL DEFAULT 25,
5292   `timeout` int(11) NOT NULL DEFAULT 120,
5293   `ssl_mode` enum('disabled','ssl','starttls') NOT NULL,
5294   `user_name` varchar(80) DEFAULT NULL,
5295   `password` varchar(80) DEFAULT NULL,
5296   `debug` tinyint(1) NOT NULL DEFAULT 0,
5297   `is_default` tinyint(1) NOT NULL DEFAULT 0,
5298   PRIMARY KEY (`id`),
5299   KEY `host_idx` (`host`)
5300 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5301 /*!40101 SET character_set_client = @saved_cs_client */;
5302
5303 --
5304 -- Table structure for table `social_data`
5305 --
5306
5307 DROP TABLE IF EXISTS `social_data`;
5308 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5309 /*!40101 SET character_set_client = utf8 */;
5310 CREATE TABLE `social_data` (
5311   `isbn` varchar(30) NOT NULL DEFAULT '',
5312   `num_critics` int(11) DEFAULT NULL,
5313   `num_critics_pro` int(11) DEFAULT NULL,
5314   `num_quotations` int(11) DEFAULT NULL,
5315   `num_videos` int(11) DEFAULT NULL,
5316   `score_avg` decimal(5,2) DEFAULT NULL,
5317   `num_scores` int(11) DEFAULT NULL,
5318   PRIMARY KEY (`isbn`)
5319 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5320 /*!40101 SET character_set_client = @saved_cs_client */;
5321
5322 --
5323 -- Table structure for table `special_holidays`
5324 --
5325
5326 DROP TABLE IF EXISTS `special_holidays`;
5327 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5328 /*!40101 SET character_set_client = utf8 */;
5329 CREATE TABLE `special_holidays` (
5330   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5331   `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
5332   `day` smallint(6) NOT NULL DEFAULT 0 COMMENT 'day of the month this closing is on',
5333   `month` smallint(6) NOT NULL DEFAULT 0 COMMENT 'month this closing is in',
5334   `year` smallint(6) NOT NULL DEFAULT 0 COMMENT 'year this closing is in',
5335   `isexception` smallint(1) NOT NULL DEFAULT 1 COMMENT 'is this a holiday exception to a repeatable holiday (1 for yes, 0 for no)',
5336   `title` varchar(50) NOT NULL DEFAULT '' COMMENT 'title for this closing',
5337   `description` mediumtext NOT NULL COMMENT 'description of this closing',
5338   PRIMARY KEY (`id`),
5339   KEY `special_holidays_ibfk_1` (`branchcode`),
5340   CONSTRAINT `special_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5341 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5342 /*!40101 SET character_set_client = @saved_cs_client */;
5343
5344 --
5345 -- Table structure for table `statistics`
5346 --
5347
5348 DROP TABLE IF EXISTS `statistics`;
5349 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5350 /*!40101 SET character_set_client = utf8 */;
5351 CREATE TABLE `statistics` (
5352   `datetime` datetime DEFAULT NULL COMMENT 'date and time of the transaction',
5353   `branch` varchar(10) DEFAULT NULL COMMENT 'foreign key, branch where the transaction occurred',
5354   `value` double(16,4) DEFAULT NULL COMMENT 'monetary value associated with the transaction',
5355   `type` varchar(16) DEFAULT NULL COMMENT 'transaction type (localuse, issue, return, renew, writeoff, payment)',
5356   `other` longtext DEFAULT NULL COMMENT 'used by SIP',
5357   `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific item',
5358   `itemtype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table, links transaction to a specific item type',
5359   `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
5360   `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower',
5361   `ccode` varchar(80) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific collection code',
5362   `categorycode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower category',
5363   KEY `timeidx` (`datetime`),
5364   KEY `branch_idx` (`branch`),
5365   KEY `type_idx` (`type`),
5366   KEY `itemnumber_idx` (`itemnumber`),
5367   KEY `itemtype_idx` (`itemtype`),
5368   KEY `borrowernumber_idx` (`borrowernumber`),
5369   KEY `ccode_idx` (`ccode`)
5370 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5371 /*!40101 SET character_set_client = @saved_cs_client */;
5372
5373 --
5374 -- Table structure for table `stockrotationitems`
5375 --
5376
5377 DROP TABLE IF EXISTS `stockrotationitems`;
5378 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5379 /*!40101 SET character_set_client = utf8 */;
5380 CREATE TABLE `stockrotationitems` (
5381   `itemnumber_id` int(11) NOT NULL COMMENT 'Itemnumber to link to a stage & rota',
5382   `stage_id` int(11) NOT NULL COMMENT 'stage ID to link the item to',
5383   `indemand` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should this item be skipped for rotation?',
5384   `fresh` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag showing item is only just added to rota',
5385   PRIMARY KEY (`itemnumber_id`),
5386   KEY `stockrotationitems_sifk` (`stage_id`),
5387   CONSTRAINT `stockrotationitems_iifk` FOREIGN KEY (`itemnumber_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5388   CONSTRAINT `stockrotationitems_sifk` FOREIGN KEY (`stage_id`) REFERENCES `stockrotationstages` (`stage_id`) ON DELETE CASCADE ON UPDATE CASCADE
5389 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5390 /*!40101 SET character_set_client = @saved_cs_client */;
5391
5392 --
5393 -- Table structure for table `stockrotationrotas`
5394 --
5395
5396 DROP TABLE IF EXISTS `stockrotationrotas`;
5397 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5398 /*!40101 SET character_set_client = utf8 */;
5399 CREATE TABLE `stockrotationrotas` (
5400   `rota_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Stockrotation rota ID',
5401   `title` varchar(100) NOT NULL COMMENT 'Title for this rota',
5402   `description` text NOT NULL COMMENT 'Description for this rota',
5403   `cyclical` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should items on this rota keep cycling?',
5404   `active` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this rota currently active?',
5405   PRIMARY KEY (`rota_id`),
5406   UNIQUE KEY `stockrotationrotas_title` (`title`)
5407 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5408 /*!40101 SET character_set_client = @saved_cs_client */;
5409
5410 --
5411 -- Table structure for table `stockrotationstages`
5412 --
5413
5414 DROP TABLE IF EXISTS `stockrotationstages`;
5415 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5416 /*!40101 SET character_set_client = utf8 */;
5417 CREATE TABLE `stockrotationstages` (
5418   `stage_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique stage ID',
5419   `position` int(11) NOT NULL COMMENT 'The position of this stage within its rota',
5420   `rota_id` int(11) NOT NULL COMMENT 'The rota this stage belongs to',
5421   `branchcode_id` varchar(10) NOT NULL COMMENT 'Branch this stage relates to',
5422   `duration` int(11) NOT NULL DEFAULT 4 COMMENT 'The number of days items shoud occupy this stage',
5423   PRIMARY KEY (`stage_id`),
5424   KEY `stockrotationstages_rifk` (`rota_id`),
5425   KEY `stockrotationstages_bifk` (`branchcode_id`),
5426   CONSTRAINT `stockrotationstages_bifk` FOREIGN KEY (`branchcode_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5427   CONSTRAINT `stockrotationstages_rifk` FOREIGN KEY (`rota_id`) REFERENCES `stockrotationrotas` (`rota_id`) ON DELETE CASCADE ON UPDATE CASCADE
5428 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5429 /*!40101 SET character_set_client = @saved_cs_client */;
5430
5431 --
5432 -- Table structure for table `subscription`
5433 --
5434
5435 DROP TABLE IF EXISTS `subscription`;
5436 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5437 /*!40101 SET character_set_client = utf8 */;
5438 CREATE TABLE `subscription` (
5439   `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
5440   `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
5441   `librarian` varchar(100) DEFAULT '' COMMENT 'the librarian''s username from borrowers.userid',
5442   `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
5443   `aqbooksellerid` int(11) DEFAULT 0 COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
5444   `cost` int(11) DEFAULT 0,
5445   `aqbudgetid` int(11) DEFAULT 0,
5446   `weeklength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or numberlength is set)',
5447   `monthlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if weeklength or numberlength is set)',
5448   `numberlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or weeklength is set)',
5449   `periodicity` int(11) DEFAULT NULL COMMENT 'frequency type links to subscription_frequencies.id',
5450   `countissuesperunit` int(11) NOT NULL DEFAULT 1,
5451   `notes` longtext DEFAULT NULL COMMENT 'notes',
5452   `status` varchar(100) NOT NULL DEFAULT '' COMMENT 'status of this subscription',
5453   `lastvalue1` int(11) DEFAULT NULL,
5454   `innerloop1` int(11) DEFAULT 0,
5455   `lastvalue2` int(11) DEFAULT NULL,
5456   `innerloop2` int(11) DEFAULT 0,
5457   `lastvalue3` int(11) DEFAULT NULL,
5458   `innerloop3` int(11) DEFAULT 0,
5459   `firstacquidate` date DEFAULT NULL COMMENT 'first issue received date',
5460   `manualhistory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes or no to managing the history manually',
5461   `irregularity` mediumtext DEFAULT NULL COMMENT 'any irregularities in the subscription',
5462   `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
5463   `letter` varchar(20) DEFAULT NULL,
5464   `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
5465   `locale` varchar(80) DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
5466   `distributedto` mediumtext DEFAULT NULL,
5467   `internalnotes` longtext DEFAULT NULL,
5468   `callnumber` mediumtext DEFAULT NULL COMMENT 'default call number',
5469   `location` varchar(80) DEFAULT '' COMMENT 'default shelving location (items.location)',
5470   `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'default branches (items.homebranch)',
5471   `lastbranch` varchar(10) DEFAULT NULL,
5472   `serialsadditems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'does receiving this serial create an item record',
5473   `staffdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the staff',
5474   `opacdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the public',
5475   `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
5476   `enddate` date DEFAULT NULL COMMENT 'subscription end date',
5477   `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
5478   `reneweddate` date DEFAULT NULL COMMENT 'date of last renewal for the subscription',
5479   `itemtype` varchar(10) DEFAULT NULL,
5480   `previousitemtype` varchar(10) DEFAULT NULL,
5481   `mana_id` int(11) DEFAULT NULL,
5482   `ccode` varchar(80) DEFAULT NULL COMMENT 'collection code to assign to serial items',
5483   PRIMARY KEY (`subscriptionid`),
5484   KEY `subscription_ibfk_1` (`periodicity`),
5485   KEY `subscription_ibfk_2` (`numberpattern`),
5486   KEY `subscription_ibfk_3` (`biblionumber`),
5487   CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5488   CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5489   CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5490 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5491 /*!40101 SET character_set_client = @saved_cs_client */;
5492
5493 --
5494 -- Table structure for table `subscription_frequencies`
5495 --
5496
5497 DROP TABLE IF EXISTS `subscription_frequencies`;
5498 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5499 /*!40101 SET character_set_client = utf8 */;
5500 CREATE TABLE `subscription_frequencies` (
5501   `id` int(11) NOT NULL AUTO_INCREMENT,
5502   `description` mediumtext NOT NULL,
5503   `displayorder` int(11) DEFAULT NULL,
5504   `unit` enum('day','week','month','year') DEFAULT NULL,
5505   `unitsperissue` int(11) NOT NULL DEFAULT 1,
5506   `issuesperunit` int(11) NOT NULL DEFAULT 1,
5507   PRIMARY KEY (`id`)
5508 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5509 /*!40101 SET character_set_client = @saved_cs_client */;
5510
5511 --
5512 -- Table structure for table `subscription_numberpatterns`
5513 --
5514
5515 DROP TABLE IF EXISTS `subscription_numberpatterns`;
5516 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5517 /*!40101 SET character_set_client = utf8 */;
5518 CREATE TABLE `subscription_numberpatterns` (
5519   `id` int(11) NOT NULL AUTO_INCREMENT,
5520   `label` varchar(255) NOT NULL,
5521   `displayorder` int(11) DEFAULT NULL,
5522   `description` mediumtext NOT NULL,
5523   `numberingmethod` varchar(255) NOT NULL,
5524   `label1` varchar(255) DEFAULT NULL,
5525   `add1` int(11) DEFAULT NULL,
5526   `every1` int(11) DEFAULT NULL,
5527   `whenmorethan1` int(11) DEFAULT NULL,
5528   `setto1` int(11) DEFAULT NULL,
5529   `numbering1` varchar(255) DEFAULT NULL,
5530   `label2` varchar(255) DEFAULT NULL,
5531   `add2` int(11) DEFAULT NULL,
5532   `every2` int(11) DEFAULT NULL,
5533   `whenmorethan2` int(11) DEFAULT NULL,
5534   `setto2` int(11) DEFAULT NULL,
5535   `numbering2` varchar(255) DEFAULT NULL,
5536   `label3` varchar(255) DEFAULT NULL,
5537   `add3` int(11) DEFAULT NULL,
5538   `every3` int(11) DEFAULT NULL,
5539   `whenmorethan3` int(11) DEFAULT NULL,
5540   `setto3` int(11) DEFAULT NULL,
5541   `numbering3` varchar(255) DEFAULT NULL,
5542   PRIMARY KEY (`id`)
5543 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5544 /*!40101 SET character_set_client = @saved_cs_client */;
5545
5546 --
5547 -- Table structure for table `subscriptionhistory`
5548 --
5549
5550 DROP TABLE IF EXISTS `subscriptionhistory`;
5551 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5552 /*!40101 SET character_set_client = utf8 */;
5553 CREATE TABLE `subscriptionhistory` (
5554   `biblionumber` int(11) NOT NULL,
5555   `subscriptionid` int(11) NOT NULL,
5556   `histstartdate` date DEFAULT NULL,
5557   `histenddate` date DEFAULT NULL,
5558   `missinglist` longtext NOT NULL,
5559   `recievedlist` longtext NOT NULL,
5560   `opacnote` longtext DEFAULT NULL,
5561   `librariannote` longtext DEFAULT NULL,
5562   PRIMARY KEY (`subscriptionid`),
5563   KEY `subscription_history_ibfk_1` (`biblionumber`),
5564   CONSTRAINT `subscription_history_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5565   CONSTRAINT `subscription_history_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5566 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5567 /*!40101 SET character_set_client = @saved_cs_client */;
5568
5569 --
5570 -- Table structure for table `subscriptionroutinglist`
5571 --
5572
5573 DROP TABLE IF EXISTS `subscriptionroutinglist`;
5574 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5575 /*!40101 SET character_set_client = utf8 */;
5576 CREATE TABLE `subscriptionroutinglist` (
5577   `routingid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5578   `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines with patron is on the routing list',
5579   `ranking` int(11) DEFAULT NULL COMMENT 'where the patron stands in line to receive the serial',
5580   `subscriptionid` int(11) NOT NULL COMMENT 'foreign key from the subscription table, defines which subscription this routing list is for',
5581   PRIMARY KEY (`routingid`),
5582   UNIQUE KEY `subscriptionid` (`subscriptionid`,`borrowernumber`),
5583   KEY `subscriptionroutinglist_ibfk_1` (`borrowernumber`),
5584   CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5585   CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5586 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5587 /*!40101 SET character_set_client = @saved_cs_client */;
5588
5589 --
5590 -- Table structure for table `suggestions`
5591 --
5592
5593 DROP TABLE IF EXISTS `suggestions`;
5594 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5595 /*!40101 SET character_set_client = utf8 */;
5596 CREATE TABLE `suggestions` (
5597   `suggestionid` int(8) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned automatically by Koha',
5598   `suggestedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the person making the suggestion, foreign key linking to the borrowers table',
5599   `suggesteddate` date NOT NULL COMMENT 'date the suggestion was submitted',
5600   `managedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian managing the suggestion, foreign key linking to the borrowers table',
5601   `manageddate` date DEFAULT NULL COMMENT 'date the suggestion was updated',
5602   `acceptedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who accepted the suggestion, foreign key linking to the borrowers table',
5603   `accepteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as accepted',
5604   `rejectedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table',
5605   `rejecteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as rejected',
5606   `lastmodificationby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who edit the suggestion for the last time',
5607   `lastmodificationdate` date DEFAULT NULL COMMENT 'date of the last modification',
5608   `STATUS` varchar(10) NOT NULL DEFAULT '' COMMENT 'suggestion status (ASKED, CHECKED, ACCEPTED, REJECTED, ORDERED, AVAILABLE or a value from the SUGGEST_STATUS authorised value category)',
5609   `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the suggestion archived?',
5610   `note` longtext DEFAULT NULL COMMENT 'note entered on the suggestion',
5611   `staff_note` longtext DEFAULT NULL COMMENT 'non-public note entered on the suggestion',
5612   `author` varchar(80) DEFAULT NULL COMMENT 'author of the suggested item',
5613   `title` varchar(255) DEFAULT NULL COMMENT 'title of the suggested item',
5614   `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'copyright date of the suggested item',
5615   `publishercode` varchar(255) DEFAULT NULL COMMENT 'publisher of the suggested item',
5616   `date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the suggestion was updated',
5617   `volumedesc` varchar(255) DEFAULT NULL,
5618   `publicationyear` smallint(6) DEFAULT 0,
5619   `place` varchar(255) DEFAULT NULL COMMENT 'publication place of the suggested item',
5620   `isbn` varchar(30) DEFAULT NULL COMMENT 'isbn of the suggested item',
5621   `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggestion to the biblio table after the suggestion has been ordered',
5622   `reason` mediumtext DEFAULT NULL COMMENT 'reason for accepting or rejecting the suggestion',
5623   `patronreason` mediumtext DEFAULT NULL COMMENT 'reason for making the suggestion',
5624   `budgetid` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggested budget to the aqbudgets table',
5625   `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key linking the suggested branch to the branches table',
5626   `collectiontitle` mediumtext DEFAULT NULL COMMENT 'collection name for the suggested item',
5627   `itemtype` varchar(30) DEFAULT NULL COMMENT 'suggested item type',
5628   `quantity` smallint(6) DEFAULT NULL COMMENT 'suggested quantity to be purchased',
5629   `currency` varchar(10) DEFAULT NULL COMMENT 'suggested currency for the suggested price',
5630   `price` decimal(28,6) DEFAULT NULL COMMENT 'suggested price',
5631   `total` decimal(28,6) DEFAULT NULL COMMENT 'suggested total cost (price*quantity updated for currency)',
5632   PRIMARY KEY (`suggestionid`),
5633   KEY `suggestedby` (`suggestedby`),
5634   KEY `managedby` (`managedby`),
5635   KEY `acceptedby` (`acceptedby`),
5636   KEY `rejectedby` (`rejectedby`),
5637   KEY `biblionumber` (`biblionumber`),
5638   KEY `budgetid` (`budgetid`),
5639   KEY `branchcode` (`branchcode`),
5640   KEY `status` (`STATUS`),
5641   KEY `suggestions_ibfk_lastmodificationby` (`lastmodificationby`),
5642   CONSTRAINT `suggestions_budget_id_fk` FOREIGN KEY (`budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5643   CONSTRAINT `suggestions_ibfk_acceptedby` FOREIGN KEY (`acceptedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5644   CONSTRAINT `suggestions_ibfk_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5645   CONSTRAINT `suggestions_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
5646   CONSTRAINT `suggestions_ibfk_lastmodificationby` FOREIGN KEY (`lastmodificationby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5647   CONSTRAINT `suggestions_ibfk_managedby` FOREIGN KEY (`managedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5648   CONSTRAINT `suggestions_ibfk_rejectedby` FOREIGN KEY (`rejectedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5649   CONSTRAINT `suggestions_ibfk_suggestedby` FOREIGN KEY (`suggestedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5650 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5651 /*!40101 SET character_set_client = @saved_cs_client */;
5652
5653 --
5654 -- Table structure for table `systempreferences`
5655 --
5656
5657 DROP TABLE IF EXISTS `systempreferences`;
5658 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5659 /*!40101 SET character_set_client = utf8 */;
5660 CREATE TABLE `systempreferences` (
5661   `variable` varchar(50) NOT NULL DEFAULT '' COMMENT 'system preference name',
5662   `value` mediumtext DEFAULT NULL COMMENT 'system preference values',
5663   `options` longtext DEFAULT NULL COMMENT 'options for multiple choice system preferences',
5664   `explanation` mediumtext DEFAULT NULL COMMENT 'descriptive text for the system preference',
5665   `type` varchar(20) DEFAULT NULL COMMENT 'type of question this preference asks (multiple choice, plain text, yes or no, etc)',
5666   PRIMARY KEY (`variable`)
5667 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5668 /*!40101 SET character_set_client = @saved_cs_client */;
5669
5670 --
5671 -- Table structure for table `tables_settings`
5672 --
5673
5674 DROP TABLE IF EXISTS `tables_settings`;
5675 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5676 /*!40101 SET character_set_client = utf8 */;
5677 CREATE TABLE `tables_settings` (
5678   `module` varchar(255) NOT NULL,
5679   `page` varchar(255) NOT NULL,
5680   `tablename` varchar(255) NOT NULL,
5681   `default_display_length` smallint(6) DEFAULT NULL,
5682   `default_sort_order` varchar(255) DEFAULT NULL,
5683   PRIMARY KEY (`module`(191),`page`(191),`tablename`(191))
5684 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5685 /*!40101 SET character_set_client = @saved_cs_client */;
5686
5687 --
5688 -- Table structure for table `tags`
5689 --
5690
5691 DROP TABLE IF EXISTS `tags`;
5692 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5693 /*!40101 SET character_set_client = utf8 */;
5694 CREATE TABLE `tags` (
5695   `entry` varchar(255) NOT NULL DEFAULT '',
5696   `weight` bigint(20) NOT NULL DEFAULT 0,
5697   PRIMARY KEY (`entry`(191))
5698 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5699 /*!40101 SET character_set_client = @saved_cs_client */;
5700
5701 --
5702 -- Table structure for table `tags_all`
5703 --
5704
5705 DROP TABLE IF EXISTS `tags_all`;
5706 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5707 /*!40101 SET character_set_client = utf8 */;
5708 CREATE TABLE `tags_all` (
5709   `tag_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key',
5710   `borrowernumber` int(11) DEFAULT NULL COMMENT 'the patron who added the tag (borrowers.borrowernumber)',
5711   `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was left on (biblio.biblionumber)',
5712   `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5713   `language` int(4) DEFAULT NULL COMMENT 'the language the tag was left in',
5714   `date_created` datetime NOT NULL COMMENT 'the date the tag was added',
5715   PRIMARY KEY (`tag_id`),
5716   KEY `tags_borrowers_fk_1` (`borrowernumber`),
5717   KEY `tags_biblionumber_fk_1` (`biblionumber`),
5718   CONSTRAINT `tags_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5719   CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5720 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5721 /*!40101 SET character_set_client = @saved_cs_client */;
5722
5723 --
5724 -- Table structure for table `tags_approval`
5725 --
5726
5727 DROP TABLE IF EXISTS `tags_approval`;
5728 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5729 /*!40101 SET character_set_client = utf8 */;
5730 CREATE TABLE `tags_approval` (
5731   `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5732   `approved` int(1) NOT NULL DEFAULT 0 COMMENT 'whether the tag is approved or not (1=yes, 0=pending, -1=rejected)',
5733   `date_approved` datetime DEFAULT NULL COMMENT 'the date this tag was approved',
5734   `approved_by` int(11) DEFAULT NULL COMMENT 'the librarian who approved the tag (borrowers.borrowernumber)',
5735   `weight_total` int(9) NOT NULL DEFAULT 1 COMMENT 'the total number of times this tag was used',
5736   PRIMARY KEY (`term`),
5737   KEY `tags_approval_borrowers_fk_1` (`approved_by`),
5738   CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5739 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5740 /*!40101 SET character_set_client = @saved_cs_client */;
5741
5742 --
5743 -- Table structure for table `tags_index`
5744 --
5745
5746 DROP TABLE IF EXISTS `tags_index`;
5747 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5748 /*!40101 SET character_set_client = utf8 */;
5749 CREATE TABLE `tags_index` (
5750   `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5751   `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was used on (biblio.biblionumber)',
5752   `weight` int(9) NOT NULL DEFAULT 1 COMMENT 'the number of times this term was used on this bib record',
5753   PRIMARY KEY (`term`,`biblionumber`),
5754   KEY `tags_index_biblionumber_fk_1` (`biblionumber`),
5755   CONSTRAINT `tags_index_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5756   CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`) REFERENCES `tags_approval` (`term`) ON DELETE CASCADE ON UPDATE CASCADE
5757 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5758 /*!40101 SET character_set_client = @saved_cs_client */;
5759
5760 --
5761 -- Table structure for table `tickets`
5762 --
5763
5764 DROP TABLE IF EXISTS `tickets`;
5765 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5766 /*!40101 SET character_set_client = utf8 */;
5767 CREATE TABLE IF NOT EXISTS `tickets` (
5768   `id` int(11) NOT NULL auto_increment COMMENT 'primary key',
5769   `reporter_id` int(11) NOT NULL DEFAULT 0 COMMENT 'id of the patron who reported the ticket',
5770   `reported_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time this ticket was reported',
5771   `title` text NOT NULL COMMENT 'ticket title',
5772   `body` text NOT NULL COMMENT 'ticket details',
5773   `resolver_id` int(11) DEFAULT NULL COMMENT 'id of the user who resolved the ticket',
5774   `resolved_date` datetime DEFAULT NULL COMMENT 'date and time this ticket was resolved',
5775   `biblio_id` int(11) DEFAULT NULL COMMENT 'id of biblio linked',
5776   PRIMARY KEY(`id`),
5777   CONSTRAINT `tickets_ibfk_1` FOREIGN KEY (`reporter_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5778   CONSTRAINT `tickets_ibfk_2` FOREIGN KEY (`resolver_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5779   CONSTRAINT `tickets_ibfk_3` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5780 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5781 /*!40101 SET character_set_client = @saved_cs_client */;
5782
5783 --
5784 -- Table structure for table `ticket_updates`
5785 --
5786
5787 DROP TABLE IF EXISTS `ticket_updates`;
5788 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5789 /*!40101 SET character_set_client = utf8 */;
5790 CREATE TABLE IF NOT EXISTS `ticket_updates` (
5791   `id` int(11) NOT NULL auto_increment COMMENT 'primary key',
5792   `ticket_id` int(11) NOT NULL COMMENT 'id of catalog ticket the update relates to',
5793   `user_id` int(11) NOT NULL DEFAULT 0 COMMENT 'id of the user who logged the update',
5794   `public` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote whether this update is public',
5795   `date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time this update was logged',
5796   `message` text NOT NULL COMMENT 'update message content',
5797   PRIMARY KEY(`id`),
5798   CONSTRAINT `ticket_updates_ibfk_1` FOREIGN KEY (`ticket_id`) REFERENCES `tickets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
5799   CONSTRAINT `ticket_updates_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
5800 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5801 /*!40101 SET character_set_client = @saved_cs_client */;
5802
5803 --
5804 -- Table structure for table `tmp_holdsqueue`
5805 --
5806
5807 DROP TABLE IF EXISTS `tmp_holdsqueue`;
5808 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5809 /*!40101 SET character_set_client = utf8 */;
5810 CREATE TABLE `tmp_holdsqueue` (
5811   `biblionumber` int(11) DEFAULT NULL,
5812   `itemnumber` int(11) DEFAULT NULL,
5813   `barcode` varchar(20) DEFAULT NULL,
5814   `surname` longtext NOT NULL,
5815   `firstname` mediumtext DEFAULT NULL,
5816   `phone` mediumtext DEFAULT NULL,
5817   `borrowernumber` int(11) NOT NULL,
5818   `cardnumber` varchar(32) DEFAULT NULL,
5819   `reservedate` date DEFAULT NULL,
5820   `title` longtext DEFAULT NULL,
5821   `itemcallnumber` varchar(255) DEFAULT NULL,
5822   `holdingbranch` varchar(10) DEFAULT NULL,
5823   `pickbranch` varchar(10) DEFAULT NULL,
5824   `notes` mediumtext DEFAULT NULL,
5825   `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
5826   `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this entry as added/last updated',
5827   KEY `tmp_holdsqueue_ibfk_1` (`itemnumber`),
5828   KEY `tmp_holdsqueue_ibfk_2` (`biblionumber`),
5829   KEY `tmp_holdsqueue_ibfk_3` (`borrowernumber`),
5830   CONSTRAINT `tmp_holdsqueue_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5831   CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5832   CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
5833 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5834 /*!40101 SET character_set_client = @saved_cs_client */;
5835
5836 --
5837 -- Table structure for table `transport_cost`
5838 --
5839
5840 DROP TABLE IF EXISTS `transport_cost`;
5841 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5842 /*!40101 SET character_set_client = utf8 */;
5843 CREATE TABLE `transport_cost` (
5844   `frombranch` varchar(10) NOT NULL,
5845   `tobranch` varchar(10) NOT NULL,
5846   `cost` decimal(6,2) NOT NULL,
5847   `disable_transfer` tinyint(1) NOT NULL DEFAULT 0,
5848   PRIMARY KEY (`frombranch`,`tobranch`),
5849   KEY `transport_cost_ibfk_2` (`tobranch`),
5850   CONSTRAINT `transport_cost_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5851   CONSTRAINT `transport_cost_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5852 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5853 /*!40101 SET character_set_client = @saved_cs_client */;
5854
5855 --
5856 -- Table structure for table `uploaded_files`
5857 --
5858
5859 DROP TABLE IF EXISTS `uploaded_files`;
5860 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5861 /*!40101 SET character_set_client = utf8 */;
5862 CREATE TABLE `uploaded_files` (
5863   `id` int(11) NOT NULL AUTO_INCREMENT,
5864   `hashvalue` char(40) NOT NULL,
5865   `filename` mediumtext NOT NULL,
5866   `dir` mediumtext NOT NULL,
5867   `filesize` int(11) DEFAULT NULL,
5868   `dtcreated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
5869   `uploadcategorycode` text DEFAULT NULL,
5870   `owner` int(11) DEFAULT NULL,
5871   `public` tinyint(4) DEFAULT NULL,
5872   `permanent` tinyint(4) DEFAULT NULL,
5873   PRIMARY KEY (`id`)
5874 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5875 /*!40101 SET character_set_client = @saved_cs_client */;
5876
5877 --
5878 -- Table structure for table `user_permissions`
5879 --
5880
5881 DROP TABLE IF EXISTS `user_permissions`;
5882 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5883 /*!40101 SET character_set_client = utf8 */;
5884 CREATE TABLE `user_permissions` (
5885   `borrowernumber` int(11) NOT NULL DEFAULT 0,
5886   `module_bit` int(11) NOT NULL DEFAULT 0,
5887   `code` varchar(64) NOT NULL,
5888   PRIMARY KEY (`borrowernumber`,`module_bit`,`code`),
5889   KEY `user_permissions_ibfk_1` (`borrowernumber`),
5890   KEY `user_permissions_ibfk_2` (`module_bit`,`code`),
5891   CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5892   CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`) ON DELETE CASCADE ON UPDATE CASCADE
5893 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5894 /*!40101 SET character_set_client = @saved_cs_client */;
5895
5896 --
5897 -- Table structure for table `userflags`
5898 --
5899
5900 DROP TABLE IF EXISTS `userflags`;
5901 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5902 /*!40101 SET character_set_client = utf8 */;
5903 CREATE TABLE `userflags` (
5904   `bit` int(11) NOT NULL DEFAULT 0,
5905   `flag` varchar(30) DEFAULT NULL,
5906   `flagdesc` varchar(255) DEFAULT NULL,
5907   `defaulton` int(11) DEFAULT NULL,
5908   PRIMARY KEY (`bit`)
5909 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5910 /*!40101 SET character_set_client = @saved_cs_client */;
5911
5912 --
5913 -- Table structure for table `vendor_edi_accounts`
5914 --
5915
5916 DROP TABLE IF EXISTS `vendor_edi_accounts`;
5917 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5918 /*!40101 SET character_set_client = utf8 */;
5919 CREATE TABLE `vendor_edi_accounts` (
5920   `id` int(11) NOT NULL AUTO_INCREMENT,
5921   `description` mediumtext NOT NULL,
5922   `host` varchar(40) DEFAULT NULL,
5923   `username` varchar(40) DEFAULT NULL,
5924   `password` varchar(40) DEFAULT NULL,
5925   `last_activity` date DEFAULT NULL,
5926   `vendor_id` int(11) DEFAULT NULL,
5927   `download_directory` mediumtext DEFAULT NULL,
5928   `upload_directory` mediumtext DEFAULT NULL,
5929   `san` varchar(20) DEFAULT NULL,
5930   `standard` varchar(3) DEFAULT 'EUR',
5931   `id_code_qualifier` varchar(3) DEFAULT '14',
5932   `transport` varchar(6) DEFAULT 'FTP',
5933   `quotes_enabled` tinyint(1) NOT NULL DEFAULT 0,
5934   `invoices_enabled` tinyint(1) NOT NULL DEFAULT 0,
5935   `orders_enabled` tinyint(1) NOT NULL DEFAULT 0,
5936   `responses_enabled` tinyint(1) NOT NULL DEFAULT 0,
5937   `auto_orders` tinyint(1) NOT NULL DEFAULT 0,
5938   `shipment_budget` int(11) DEFAULT NULL,
5939   `plugin` varchar(256) NOT NULL DEFAULT '',
5940   PRIMARY KEY (`id`),
5941   KEY `vendorid` (`vendor_id`),
5942   KEY `shipmentbudget` (`shipment_budget`),
5943   CONSTRAINT `vfk_shipment_budget` FOREIGN KEY (`shipment_budget`) REFERENCES `aqbudgets` (`budget_id`),
5944   CONSTRAINT `vfk_vendor_id` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`)
5945 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5946 /*!40101 SET character_set_client = @saved_cs_client */;
5947
5948 --
5949 -- Table structure for table `virtualshelfcontents`
5950 --
5951
5952 DROP TABLE IF EXISTS `virtualshelfcontents`;
5953 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5954 /*!40101 SET character_set_client = utf8 */;
5955 CREATE TABLE `virtualshelfcontents` (
5956   `shelfnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking to the virtualshelves table, defines the list that this record has been added to',
5957   `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking to the biblio table, defines the bib record that has been added to the list',
5958   `flags` int(11) DEFAULT NULL,
5959   `dateadded` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this bib record was added to the list',
5960   `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrower number that created this list entry (only the first one is saved: no need for use in/as key)',
5961   KEY `shelfnumber` (`shelfnumber`),
5962   KEY `biblionumber` (`biblionumber`),
5963   KEY `shelfcontents_ibfk_3` (`borrowernumber`),
5964   CONSTRAINT `shelfcontents_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5965   CONSTRAINT `shelfcontents_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
5966   CONSTRAINT `virtualshelfcontents_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE
5967 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5968 /*!40101 SET character_set_client = @saved_cs_client */;
5969
5970 --
5971 -- Table structure for table `virtualshelfshares`
5972 --
5973
5974 DROP TABLE IF EXISTS `virtualshelfshares`;
5975 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5976 /*!40101 SET character_set_client = utf8 */;
5977 CREATE TABLE `virtualshelfshares` (
5978   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
5979   `shelfnumber` int(11) NOT NULL COMMENT 'foreign key for virtualshelves',
5980   `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrower that accepted access to this list',
5981   `invitekey` varchar(10) DEFAULT NULL COMMENT 'temporary string used in accepting the invitation to access thist list; not-empty means that the invitation has not been accepted yet',
5982   `sharedate` datetime DEFAULT NULL COMMENT 'date of invitation or acceptance of invitation',
5983   PRIMARY KEY (`id`),
5984   KEY `virtualshelfshares_ibfk_1` (`shelfnumber`),
5985   KEY `virtualshelfshares_ibfk_2` (`borrowernumber`),
5986   CONSTRAINT `virtualshelfshares_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5987   CONSTRAINT `virtualshelfshares_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
5988 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5989 /*!40101 SET character_set_client = @saved_cs_client */;
5990
5991 --
5992 -- Table structure for table `virtualshelves`
5993 --
5994
5995 DROP TABLE IF EXISTS `virtualshelves`;
5996 /*!40101 SET @saved_cs_client     = @@character_set_client */;
5997 /*!40101 SET character_set_client = utf8 */;
5998 CREATE TABLE `virtualshelves` (
5999   `shelfnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
6000   `shelfname` varchar(255) DEFAULT NULL COMMENT 'name of the list',
6001   `owner` int(11) DEFAULT NULL COMMENT 'foreign key linking to the borrowers table (using borrowernumber) for the creator of this list (changed from varchar(80) to int)',
6002   `public` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If the list is public',
6003   `sortfield` varchar(16) DEFAULT 'title' COMMENT 'the field this list is sorted on',
6004   `lastmodified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the list was last modified',
6005   `created_on` datetime NOT NULL COMMENT 'creation time',
6006   `allow_change_from_owner` tinyint(1) DEFAULT 1 COMMENT 'can owner change contents?',
6007   `allow_change_from_others` tinyint(1) DEFAULT 0 COMMENT 'can others change contents?',
6008   `allow_change_from_staff` tinyint(1) DEFAULT 0 COMMENT 'can staff change contents?',
6009   PRIMARY KEY (`shelfnumber`),
6010   KEY `virtualshelves_ibfk_1` (`owner`),
6011   CONSTRAINT `virtualshelves_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
6012 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6013 /*!40101 SET character_set_client = @saved_cs_client */;
6014
6015 --
6016 -- Table structure for table `z3950servers`
6017 --
6018
6019 DROP TABLE IF EXISTS `z3950servers`;
6020 /*!40101 SET @saved_cs_client     = @@character_set_client */;
6021 /*!40101 SET character_set_client = utf8 */;
6022 CREATE TABLE `z3950servers` (
6023   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
6024   `host` varchar(255) NOT NULL COMMENT 'target''s host name',
6025   `port` int(11) DEFAULT NULL COMMENT 'port number used to connect to target',
6026   `db` varchar(255) DEFAULT NULL COMMENT 'target''s database name',
6027   `userid` varchar(255) DEFAULT NULL COMMENT 'username needed to log in to target',
6028   `password` varchar(255) DEFAULT NULL COMMENT 'password needed to log in to target',
6029   `servername` longtext NOT NULL COMMENT 'name given to the target by the library',
6030   `checked` smallint(6) DEFAULT NULL COMMENT 'whether this target is checked by default  (1 for yes, 0 for no)',
6031   `rank` int(11) DEFAULT NULL COMMENT 'where this target appears in the list of targets',
6032   `syntax` varchar(80) NOT NULL COMMENT 'MARC format provided by this target',
6033   `timeout` int(11) NOT NULL DEFAULT 0 COMMENT 'number of seconds before Koha stops trying to access this server',
6034   `servertype` enum('zed','sru') NOT NULL DEFAULT 'zed' COMMENT 'zed means z39.50 server',
6035   `encoding` mediumtext NOT NULL COMMENT 'characters encoding provided by this target',
6036   `recordtype` enum('authority','biblio') NOT NULL DEFAULT 'biblio' COMMENT 'server contains bibliographic or authority records',
6037   `sru_options` varchar(255) DEFAULT NULL COMMENT 'options like sru=get, sru_version=1.1; will be passed to the server via ZOOM',
6038   `sru_fields` longtext DEFAULT NULL COMMENT 'contains the mapping between the Z3950 search fields and the specific SRU server indexes',
6039   `add_xslt` longtext DEFAULT NULL COMMENT 'zero or more paths to XSLT files to be processed on the search results',
6040   `attributes` varchar(255) DEFAULT NULL COMMENT 'additional attributes passed to PQF queries',
6041   PRIMARY KEY (`id`)
6042 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6043 /*!40101 SET character_set_client = @saved_cs_client */;
6044
6045 --
6046 -- Table structure for table `zebraqueue`
6047 --
6048
6049 DROP TABLE IF EXISTS `zebraqueue`;
6050 /*!40101 SET @saved_cs_client     = @@character_set_client */;
6051 /*!40101 SET character_set_client = utf8 */;
6052 CREATE TABLE `zebraqueue` (
6053   `id` int(11) NOT NULL AUTO_INCREMENT,
6054   `biblio_auth_number` bigint(20) unsigned NOT NULL DEFAULT 0,
6055   `operation` char(20) NOT NULL DEFAULT '',
6056   `server` char(20) NOT NULL DEFAULT '',
6057   `done` int(11) NOT NULL DEFAULT 0,
6058   `time` timestamp NOT NULL DEFAULT current_timestamp(),
6059   PRIMARY KEY (`id`),
6060   KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
6061 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6062 /*!40101 SET character_set_client = @saved_cs_client */;
6063 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
6064
6065 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
6066 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
6067 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
6068 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
6069 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
6070 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
6071 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
6072
6073 -- Dump completed on 2022-11-25 14:12:24