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