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