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