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