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