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