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