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