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