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