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 PRIMARY KEY (`action_id`),
175 KEY `timestamp_idx` (`timestamp`),
176 KEY `user_idx` (`user`),
177 KEY `module_idx` (`module`(191)),
178 KEY `action_idx` (`action`(191)),
179 KEY `object_idx` (`object`),
180 KEY `info_idx` (`info`(191)),
181 KEY `interface` (`interface`)
182 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
183 /*!40101 SET character_set_client = @saved_cs_client */;
186 -- Table structure for table `additional_contents`
189 DROP TABLE IF EXISTS `additional_contents`;
190 /*!40101 SET @saved_cs_client = @@character_set_client */;
191 /*!40101 SET character_set_client = utf8 */;
192 CREATE TABLE `additional_contents` (
193 `idnew` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the additional content',
194 `category` varchar(20) NOT NULL COMMENT 'category for the additional content',
195 `code` varchar(100) NOT NULL COMMENT 'code to group content per lang',
196 `location` varchar(255) NOT NULL COMMENT 'location of the additional content',
197 `branchcode` varchar(10) DEFAULT NULL COMMENT 'branch code users to create branch specific additional content, NULL is every branch.',
198 `title` varchar(250) NOT NULL DEFAULT '' COMMENT 'title of the additional content',
199 `content` mediumtext NOT NULL COMMENT 'the body of your additional content',
200 `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)',
201 `published_on` date DEFAULT NULL COMMENT 'publication date',
202 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
203 `expirationdate` date DEFAULT NULL COMMENT 'date the additional content is set to expire or no longer be visible',
204 `number` int(11) DEFAULT NULL COMMENT 'the order in which this additional content appears in that specific location',
205 `borrowernumber` int(11) DEFAULT NULL COMMENT 'The user who created the additional content',
206 PRIMARY KEY (`idnew`),
207 UNIQUE KEY `additional_contents_uniq` (`category`,`code`,`branchcode`,`lang`),
208 KEY `additional_contents_borrowernumber_fk` (`borrowernumber`),
209 KEY `additional_contents_branchcode_ibfk` (`branchcode`),
210 CONSTRAINT `additional_contents_branchcode_ibfk` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
211 CONSTRAINT `borrowernumber_fk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
212 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
213 /*!40101 SET character_set_client = @saved_cs_client */;
216 -- Table structure for table `additional_field_values`
219 DROP TABLE IF EXISTS `additional_field_values`;
220 /*!40101 SET @saved_cs_client = @@character_set_client */;
221 /*!40101 SET character_set_client = utf8 */;
222 CREATE TABLE `additional_field_values` (
223 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
224 `field_id` int(11) NOT NULL COMMENT 'foreign key references additional_fields(id)',
225 `record_id` int(11) NOT NULL COMMENT 'record_id',
226 `value` varchar(255) NOT NULL DEFAULT '' COMMENT 'value for this field',
228 UNIQUE KEY `field_record` (`field_id`,`record_id`),
229 CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
230 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
231 /*!40101 SET character_set_client = @saved_cs_client */;
234 -- Table structure for table `additional_fields`
237 DROP TABLE IF EXISTS `additional_fields`;
238 /*!40101 SET @saved_cs_client = @@character_set_client */;
239 /*!40101 SET character_set_client = utf8 */;
240 CREATE TABLE `additional_fields` (
241 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
242 `tablename` varchar(255) NOT NULL DEFAULT '' COMMENT 'tablename of the new field',
243 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the field',
244 `authorised_value_category` varchar(32) NOT NULL DEFAULT '' COMMENT 'is an authorised value category',
245 `marcfield` varchar(16) NOT NULL DEFAULT '' COMMENT 'contains the marc field to copied into the record',
246 `searchable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the field searchable?',
248 UNIQUE KEY `fields_uniq` (`tablename`(191),`name`(191))
249 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
250 /*!40101 SET character_set_client = @saved_cs_client */;
253 -- Table structure for table `advanced_editor_macros`
256 DROP TABLE IF EXISTS `advanced_editor_macros`;
257 /*!40101 SET @saved_cs_client = @@character_set_client */;
258 /*!40101 SET character_set_client = utf8 */;
259 CREATE TABLE `advanced_editor_macros` (
260 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the macro',
261 `name` varchar(80) NOT NULL COMMENT 'Name of the macro',
262 `macro` longtext DEFAULT NULL COMMENT 'The macro code itself',
263 `borrowernumber` int(11) DEFAULT NULL COMMENT 'ID of the borrower who created this macro',
264 `shared` tinyint(1) DEFAULT 0 COMMENT 'Bit to define if shared or private macro',
266 KEY `borrower_macro_fk` (`borrowernumber`),
267 CONSTRAINT `borrower_macro_fk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
268 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
269 /*!40101 SET character_set_client = @saved_cs_client */;
272 -- Table structure for table `alert`
275 DROP TABLE IF EXISTS `alert`;
276 /*!40101 SET @saved_cs_client = @@character_set_client */;
277 /*!40101 SET character_set_client = utf8 */;
278 CREATE TABLE `alert` (
279 `alertid` int(11) NOT NULL AUTO_INCREMENT,
280 `borrowernumber` int(11) NOT NULL DEFAULT 0,
281 `type` varchar(10) NOT NULL DEFAULT '',
282 `externalid` varchar(20) NOT NULL DEFAULT '',
283 PRIMARY KEY (`alertid`),
284 KEY `borrowernumber` (`borrowernumber`),
285 KEY `type` (`type`,`externalid`),
286 CONSTRAINT `alert_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
287 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
288 /*!40101 SET character_set_client = @saved_cs_client */;
291 -- Table structure for table `api_keys`
294 DROP TABLE IF EXISTS `api_keys`;
295 /*!40101 SET @saved_cs_client = @@character_set_client */;
296 /*!40101 SET character_set_client = utf8 */;
297 CREATE TABLE `api_keys` (
298 `client_id` varchar(191) NOT NULL COMMENT 'API client ID',
299 `secret` varchar(191) NOT NULL COMMENT 'API client secret used for API authentication',
300 `description` varchar(255) NOT NULL COMMENT 'API client description',
301 `patron_id` int(11) NOT NULL COMMENT 'Foreign key to the borrowers table',
302 `active` tinyint(1) NOT NULL DEFAULT 1 COMMENT '0 means this API key is revoked',
303 PRIMARY KEY (`client_id`),
304 UNIQUE KEY `secret` (`secret`),
305 KEY `patron_id` (`patron_id`),
306 CONSTRAINT `api_keys_fk_patron_id` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
307 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
308 /*!40101 SET character_set_client = @saved_cs_client */;
311 -- Table structure for table `aqbasket`
314 DROP TABLE IF EXISTS `aqbasket`;
315 /*!40101 SET @saved_cs_client = @@character_set_client */;
316 /*!40101 SET character_set_client = utf8 */;
317 CREATE TABLE `aqbasket` (
318 `basketno` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, Koha defined number',
319 `basketname` varchar(50) DEFAULT NULL COMMENT 'name given to the basket at creation',
320 `note` longtext DEFAULT NULL COMMENT 'the internal note added at basket creation',
321 `booksellernote` longtext DEFAULT NULL COMMENT 'the vendor note added at basket creation',
322 `contractnumber` int(11) DEFAULT NULL COMMENT 'links this basket to the aqcontract table (aqcontract.contractnumber)',
323 `creationdate` date DEFAULT NULL COMMENT 'the date the basket was created',
324 `closedate` date DEFAULT NULL COMMENT 'the date the basket was closed',
325 `booksellerid` int(11) NOT NULL DEFAULT 1 COMMENT 'the Koha assigned ID for the vendor (aqbooksellers.id)',
326 `authorisedby` varchar(10) DEFAULT NULL COMMENT 'the borrowernumber of the person who created the basket',
327 `booksellerinvoicenumber` longtext DEFAULT NULL COMMENT 'appears to always be NULL',
328 `basketgroupid` int(11) DEFAULT NULL COMMENT 'links this basket to its group (aqbasketgroups.id)',
329 `deliveryplace` varchar(10) DEFAULT NULL COMMENT 'basket delivery place',
330 `billingplace` varchar(10) DEFAULT NULL COMMENT 'basket billing place',
331 `branch` varchar(10) DEFAULT NULL COMMENT 'basket branch',
332 `is_standing` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'orders in this basket are standing',
333 `create_items` enum('ordering','receiving','cataloguing') DEFAULT NULL COMMENT 'when items should be created for orders in this basket',
334 PRIMARY KEY (`basketno`),
335 KEY `booksellerid` (`booksellerid`),
336 KEY `basketgroupid` (`basketgroupid`),
337 KEY `contractnumber` (`contractnumber`),
338 KEY `authorisedby` (`authorisedby`),
339 KEY `aqbasket_ibfk_4` (`branch`),
340 CONSTRAINT `aqbasket_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE,
341 CONSTRAINT `aqbasket_ibfk_2` FOREIGN KEY (`contractnumber`) REFERENCES `aqcontract` (`contractnumber`),
342 CONSTRAINT `aqbasket_ibfk_3` FOREIGN KEY (`basketgroupid`) REFERENCES `aqbasketgroups` (`id`) ON UPDATE CASCADE,
343 CONSTRAINT `aqbasket_ibfk_4` FOREIGN KEY (`branch`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
344 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
345 /*!40101 SET character_set_client = @saved_cs_client */;
348 -- Table structure for table `aqbasketgroups`
351 DROP TABLE IF EXISTS `aqbasketgroups`;
352 /*!40101 SET @saved_cs_client = @@character_set_client */;
353 /*!40101 SET character_set_client = utf8 */;
354 CREATE TABLE `aqbasketgroups` (
355 `id` int(11) NOT NULL AUTO_INCREMENT,
356 `name` varchar(50) DEFAULT NULL,
357 `closed` tinyint(1) DEFAULT NULL,
358 `booksellerid` int(11) NOT NULL,
359 `deliveryplace` varchar(10) DEFAULT NULL,
360 `freedeliveryplace` mediumtext DEFAULT NULL,
361 `deliverycomment` varchar(255) DEFAULT NULL,
362 `billingplace` varchar(10) DEFAULT NULL,
364 KEY `booksellerid` (`booksellerid`),
365 CONSTRAINT `aqbasketgroups_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
366 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
367 /*!40101 SET character_set_client = @saved_cs_client */;
370 -- Table structure for table `aqbasketusers`
373 DROP TABLE IF EXISTS `aqbasketusers`;
374 /*!40101 SET @saved_cs_client = @@character_set_client */;
375 /*!40101 SET character_set_client = utf8 */;
376 CREATE TABLE `aqbasketusers` (
377 `basketno` int(11) NOT NULL,
378 `borrowernumber` int(11) NOT NULL,
379 PRIMARY KEY (`basketno`,`borrowernumber`),
380 KEY `aqbasketusers_ibfk_2` (`borrowernumber`),
381 CONSTRAINT `aqbasketusers_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
382 CONSTRAINT `aqbasketusers_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
383 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
384 /*!40101 SET character_set_client = @saved_cs_client */;
387 -- Table structure for table `aqbooksellers`
390 DROP TABLE IF EXISTS `aqbooksellers`;
391 /*!40101 SET @saved_cs_client = @@character_set_client */;
392 /*!40101 SET character_set_client = utf8 */;
393 CREATE TABLE `aqbooksellers` (
394 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha',
395 `name` longtext NOT NULL COMMENT 'vendor name',
396 `address1` longtext DEFAULT NULL COMMENT 'first line of vendor physical address',
397 `address2` longtext DEFAULT NULL COMMENT 'second line of vendor physical address',
398 `address3` longtext DEFAULT NULL COMMENT 'third line of vendor physical address',
399 `address4` longtext DEFAULT NULL COMMENT 'fourth line of vendor physical address',
400 `phone` varchar(30) DEFAULT NULL COMMENT 'vendor phone number',
401 `accountnumber` longtext DEFAULT NULL COMMENT 'vendor account number',
402 `type` varchar(255) DEFAULT NULL,
403 `notes` longtext DEFAULT NULL COMMENT 'order notes',
404 `postal` longtext DEFAULT NULL COMMENT 'vendor postal address (all lines)',
405 `url` varchar(255) DEFAULT NULL COMMENT 'vendor web address',
406 `active` tinyint(4) DEFAULT NULL COMMENT 'is this vendor active (1 for yes, 0 for no)',
407 `listprice` varchar(10) DEFAULT NULL COMMENT 'currency code for list prices',
408 `invoiceprice` varchar(10) DEFAULT NULL COMMENT 'currency code for invoice prices',
409 `gstreg` tinyint(4) DEFAULT NULL COMMENT 'is your library charged tax (1 for yes, 0 for no)',
410 `listincgst` tinyint(4) DEFAULT NULL COMMENT 'is tax included in list prices (1 for yes, 0 for no)',
411 `invoiceincgst` tinyint(4) DEFAULT NULL COMMENT 'is tax included in invoice prices (1 for yes, 0 for no)',
412 `tax_rate` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate the library is charged',
413 `discount` float(6,4) DEFAULT NULL COMMENT 'discount offered on all items ordered from this vendor',
414 `fax` varchar(50) DEFAULT NULL COMMENT 'vendor fax number',
415 `deliverytime` int(11) DEFAULT NULL COMMENT 'vendor delivery time',
416 `external_id` varchar(255) DEFAULT NULL COMMENT 'external id of the vendor',
418 KEY `listprice` (`listprice`),
419 KEY `invoiceprice` (`invoiceprice`),
420 KEY `name` (`name`(191)),
421 CONSTRAINT `aqbooksellers_ibfk_1` FOREIGN KEY (`listprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE,
422 CONSTRAINT `aqbooksellers_ibfk_2` FOREIGN KEY (`invoiceprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE
423 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
424 /*!40101 SET character_set_client = @saved_cs_client */;
427 -- Table structure for table `aqbudgetborrowers`
430 DROP TABLE IF EXISTS `aqbudgetborrowers`;
431 /*!40101 SET @saved_cs_client = @@character_set_client */;
432 /*!40101 SET character_set_client = utf8 */;
433 CREATE TABLE `aqbudgetborrowers` (
434 `budget_id` int(11) NOT NULL,
435 `borrowernumber` int(11) NOT NULL,
436 PRIMARY KEY (`budget_id`,`borrowernumber`),
437 KEY `aqbudgetborrowers_ibfk_2` (`borrowernumber`),
438 CONSTRAINT `aqbudgetborrowers_ibfk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
439 CONSTRAINT `aqbudgetborrowers_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) 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 `aqbudgetperiods`
447 DROP TABLE IF EXISTS `aqbudgetperiods`;
448 /*!40101 SET @saved_cs_client = @@character_set_client */;
449 /*!40101 SET character_set_client = utf8 */;
450 CREATE TABLE `aqbudgetperiods` (
451 `budget_period_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned by Koha',
452 `budget_period_startdate` date NOT NULL COMMENT 'date when the budget starts',
453 `budget_period_enddate` date NOT NULL COMMENT 'date when the budget ends',
454 `budget_period_active` tinyint(1) DEFAULT 0 COMMENT 'whether this budget is active or not (1 for yes, 0 for no)',
455 `budget_period_description` longtext DEFAULT NULL COMMENT 'description assigned to this budget',
456 `budget_period_total` decimal(28,6) DEFAULT NULL COMMENT 'total amount available in this budget',
457 `budget_period_locked` tinyint(1) DEFAULT NULL COMMENT 'whether this budget is locked or not (1 for yes, 0 for no)',
458 `sort1_authcat` varchar(10) DEFAULT NULL COMMENT 'statistical category for this budget',
459 `sort2_authcat` varchar(10) DEFAULT NULL COMMENT 'second statistical category for this budget',
460 PRIMARY KEY (`budget_period_id`)
461 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
462 /*!40101 SET character_set_client = @saved_cs_client */;
465 -- Table structure for table `aqbudgets`
468 DROP TABLE IF EXISTS `aqbudgets`;
469 /*!40101 SET @saved_cs_client = @@character_set_client */;
470 /*!40101 SET character_set_client = utf8 */;
471 CREATE TABLE `aqbudgets` (
472 `budget_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned to each fund by Koha',
473 `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)',
474 `budget_code` varchar(30) DEFAULT NULL COMMENT 'code assigned to the fund by the user',
475 `budget_name` varchar(80) DEFAULT NULL COMMENT 'name assigned to the fund by the user',
476 `budget_branchcode` varchar(10) DEFAULT NULL COMMENT 'branch that this fund belongs to (branches.branchcode)',
477 `budget_amount` decimal(28,6) DEFAULT 0.000000 COMMENT 'total amount for this fund',
478 `budget_encumb` decimal(28,6) DEFAULT 0.000000 COMMENT 'budget warning at percentage',
479 `budget_expend` decimal(28,6) DEFAULT 0.000000 COMMENT 'budget warning at amount',
480 `budget_notes` longtext DEFAULT NULL COMMENT 'notes related to this fund',
481 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this fund was last touched (created or modified)',
482 `budget_period_id` int(11) DEFAULT NULL COMMENT 'id of the budget that this fund belongs to (aqbudgetperiods.budget_period_id)',
483 `sort1_authcat` varchar(80) DEFAULT NULL COMMENT 'statistical category for this fund',
484 `sort2_authcat` varchar(80) DEFAULT NULL COMMENT 'second statistical category for this fund',
485 `budget_owner_id` int(11) DEFAULT NULL COMMENT 'borrowernumber of the person who owns this fund (borrowers.borrowernumber)',
486 `budget_permission` int(1) DEFAULT 0 COMMENT 'level of permission for this fund (used only by the owner, only by the library, or anyone)',
487 PRIMARY KEY (`budget_id`),
488 KEY `budget_parent_id` (`budget_parent_id`),
489 KEY `budget_code` (`budget_code`),
490 KEY `budget_branchcode` (`budget_branchcode`),
491 KEY `budget_period_id` (`budget_period_id`),
492 KEY `budget_owner_id` (`budget_owner_id`),
493 CONSTRAINT `aqbudgetperiods_ibfk_1` FOREIGN KEY (`budget_period_id`) REFERENCES `aqbudgetperiods` (`budget_period_id`) ON DELETE CASCADE ON UPDATE CASCADE
494 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
495 /*!40101 SET character_set_client = @saved_cs_client */;
498 -- Table structure for table `aqbudgets_planning`
501 DROP TABLE IF EXISTS `aqbudgets_planning`;
502 /*!40101 SET @saved_cs_client = @@character_set_client */;
503 /*!40101 SET character_set_client = utf8 */;
504 CREATE TABLE `aqbudgets_planning` (
505 `plan_id` int(11) NOT NULL AUTO_INCREMENT,
506 `budget_id` int(11) NOT NULL,
507 `budget_period_id` int(11) NOT NULL,
508 `estimated_amount` decimal(28,6) DEFAULT NULL,
509 `authcat` varchar(30) NOT NULL,
510 `authvalue` varchar(30) NOT NULL,
511 `display` tinyint(1) DEFAULT 1,
512 PRIMARY KEY (`plan_id`),
513 KEY `budget_period_id` (`budget_period_id`),
514 KEY `aqbudgets_planning_ifbk_1` (`budget_id`),
515 CONSTRAINT `aqbudgets_planning_ifbk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE
516 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
517 /*!40101 SET character_set_client = @saved_cs_client */;
520 -- Table structure for table `aqcontacts`
523 DROP TABLE IF EXISTS `aqcontacts`;
524 /*!40101 SET @saved_cs_client = @@character_set_client */;
525 /*!40101 SET character_set_client = utf8 */;
526 CREATE TABLE `aqcontacts` (
527 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned by Koha',
528 `name` varchar(100) DEFAULT NULL COMMENT 'name of contact at vendor',
529 `position` varchar(100) DEFAULT NULL COMMENT 'contact person''s position',
530 `phone` varchar(100) DEFAULT NULL COMMENT 'contact''s phone number',
531 `altphone` varchar(100) DEFAULT NULL COMMENT 'contact''s alternate phone number',
532 `fax` varchar(100) DEFAULT NULL COMMENT 'contact''s fax number',
533 `email` varchar(100) DEFAULT NULL COMMENT 'contact''s email address',
534 `notes` longtext DEFAULT NULL COMMENT 'notes related to the contact',
535 `orderacquisition` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive acquisition orders',
536 `claimacquisition` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive acquisitions claims',
537 `claimissues` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive serial claims',
538 `acqprimary` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is this the primary contact for acquisitions messages',
539 `serialsprimary` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is this the primary contact for serials messages',
540 `booksellerid` int(11) NOT NULL,
542 KEY `booksellerid_aqcontacts_fk` (`booksellerid`),
543 CONSTRAINT `booksellerid_aqcontacts_fk` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
544 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
545 /*!40101 SET character_set_client = @saved_cs_client */;
548 -- Table structure for table `aqcontract`
551 DROP TABLE IF EXISTS `aqcontract`;
552 /*!40101 SET @saved_cs_client = @@character_set_client */;
553 /*!40101 SET character_set_client = utf8 */;
554 CREATE TABLE `aqcontract` (
555 `contractnumber` int(11) NOT NULL AUTO_INCREMENT,
556 `contractstartdate` date DEFAULT NULL,
557 `contractenddate` date DEFAULT NULL,
558 `contractname` varchar(50) DEFAULT NULL,
559 `contractdescription` longtext DEFAULT NULL,
560 `booksellerid` int(11) NOT NULL,
561 PRIMARY KEY (`contractnumber`),
562 KEY `booksellerid_fk1` (`booksellerid`),
563 CONSTRAINT `booksellerid_fk1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
564 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
565 /*!40101 SET character_set_client = @saved_cs_client */;
568 -- Table structure for table `aqinvoice_adjustments`
571 DROP TABLE IF EXISTS `aqinvoice_adjustments`;
572 /*!40101 SET @saved_cs_client = @@character_set_client */;
573 /*!40101 SET character_set_client = utf8 */;
574 CREATE TABLE `aqinvoice_adjustments` (
575 `adjustment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key for adjustments',
576 `invoiceid` int(11) NOT NULL COMMENT 'foreign key to link an adjustment to an invoice',
577 `adjustment` decimal(28,6) DEFAULT NULL COMMENT 'amount of adjustment',
578 `reason` varchar(80) DEFAULT NULL COMMENT 'reason for adjustment defined by authorised values in ADJ_REASON category',
579 `note` mediumtext DEFAULT NULL COMMENT 'text to explain adjustment',
580 `budget_id` int(11) DEFAULT NULL COMMENT 'optional link to budget to apply adjustment to',
581 `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',
582 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'timestamp of last adjustment to adjustment',
583 PRIMARY KEY (`adjustment_id`),
584 KEY `aqinvoice_adjustments_fk_invoiceid` (`invoiceid`),
585 KEY `aqinvoice_adjustments_fk_budget_id` (`budget_id`),
586 CONSTRAINT `aqinvoice_adjustments_fk_budget_id` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
587 CONSTRAINT `aqinvoice_adjustments_fk_invoiceid` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE CASCADE ON UPDATE CASCADE
588 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
589 /*!40101 SET character_set_client = @saved_cs_client */;
592 -- Table structure for table `aqinvoices`
595 DROP TABLE IF EXISTS `aqinvoices`;
596 /*!40101 SET @saved_cs_client = @@character_set_client */;
597 /*!40101 SET character_set_client = utf8 */;
598 CREATE TABLE `aqinvoices` (
599 `invoiceid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the invoice, primary key',
600 `invoicenumber` longtext NOT NULL COMMENT 'Name of invoice',
601 `booksellerid` int(11) NOT NULL COMMENT 'foreign key to aqbooksellers',
602 `shipmentdate` date DEFAULT NULL COMMENT 'date of shipment',
603 `billingdate` date DEFAULT NULL COMMENT 'date of billing',
604 `closedate` date DEFAULT NULL COMMENT 'invoice close date, NULL means the invoice is open',
605 `shipmentcost` decimal(28,6) DEFAULT NULL COMMENT 'shipment cost',
606 `shipmentcost_budgetid` int(11) DEFAULT NULL COMMENT 'foreign key to aqbudgets, link the shipment cost to a budget',
607 `message_id` int(11) DEFAULT NULL COMMENT 'foreign key to edifact invoice message',
608 PRIMARY KEY (`invoiceid`),
609 KEY `aqinvoices_fk_aqbooksellerid` (`booksellerid`),
610 KEY `edifact_msg_fk` (`message_id`),
611 KEY `aqinvoices_fk_shipmentcost_budgetid` (`shipmentcost_budgetid`),
612 CONSTRAINT `aqinvoices_fk_aqbooksellerid` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
613 CONSTRAINT `aqinvoices_fk_shipmentcost_budgetid` FOREIGN KEY (`shipmentcost_budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
614 CONSTRAINT `edifact_msg_fk` FOREIGN KEY (`message_id`) REFERENCES `edifact_messages` (`id`) ON DELETE SET NULL
615 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
616 /*!40101 SET character_set_client = @saved_cs_client */;
619 -- Table structure for table `aqorder_users`
622 DROP TABLE IF EXISTS `aqorder_users`;
623 /*!40101 SET @saved_cs_client = @@character_set_client */;
624 /*!40101 SET character_set_client = utf8 */;
625 CREATE TABLE `aqorder_users` (
626 `ordernumber` int(11) NOT NULL COMMENT 'the order this patrons receive notifications from (aqorders.ordernumber)',
627 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber for the patron receiving notifications for this order (borrowers.borrowernumber)',
628 PRIMARY KEY (`ordernumber`,`borrowernumber`),
629 KEY `aqorder_users_ibfk_2` (`borrowernumber`),
630 CONSTRAINT `aqorder_users_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
631 CONSTRAINT `aqorder_users_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
632 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
633 /*!40101 SET character_set_client = @saved_cs_client */;
636 -- Table structure for table `aqorders`
639 DROP TABLE IF EXISTS `aqorders`;
640 /*!40101 SET @saved_cs_client = @@character_set_client */;
641 /*!40101 SET character_set_client = utf8 */;
642 CREATE TABLE `aqorders` (
643 `ordernumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha to each line',
644 `biblionumber` int(11) DEFAULT NULL COMMENT 'links the order to the biblio being ordered (biblio.biblionumber)',
645 `entrydate` date DEFAULT NULL COMMENT 'the date the bib was added to the basket',
646 `quantity` smallint(6) DEFAULT NULL COMMENT 'the quantity ordered',
647 `currency` varchar(10) DEFAULT NULL COMMENT 'the currency used for the purchase',
648 `listprice` decimal(28,6) DEFAULT NULL COMMENT 'the vendor price for this line item',
649 `datereceived` date DEFAULT NULL COMMENT 'the date this order was received',
650 `invoiceid` int(11) DEFAULT NULL COMMENT 'id of invoice',
651 `freight` decimal(28,6) DEFAULT NULL COMMENT 'shipping costs (not used)',
652 `unitprice` decimal(28,6) DEFAULT NULL COMMENT 'the actual cost entered when receiving this line item',
653 `unitprice_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the unit price excluding tax (on receiving)',
654 `unitprice_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the unit price including tax (on receiving)',
655 `quantityreceived` smallint(6) NOT NULL DEFAULT 0 COMMENT 'the quantity that have been received so far',
656 `created_by` int(11) DEFAULT NULL COMMENT 'the borrowernumber of order line''s creator',
657 `datecancellationprinted` date DEFAULT NULL COMMENT 'the date the line item was deleted',
658 `cancellationreason` mediumtext DEFAULT NULL COMMENT 'reason of cancellation',
659 `order_internalnote` longtext DEFAULT NULL COMMENT 'notes related to this order line, made for staff',
660 `order_vendornote` longtext DEFAULT NULL COMMENT 'notes related to this order line, made for vendor',
661 `purchaseordernumber` longtext DEFAULT NULL COMMENT 'not used? always NULL',
662 `basketno` int(11) DEFAULT NULL COMMENT 'links this order line to a specific basket (aqbasket.basketno)',
663 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this order line was last modified',
664 `rrp` decimal(13,2) DEFAULT NULL COMMENT 'the retail cost for this line item',
665 `replacementprice` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost for this line item',
666 `rrp_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost excluding tax',
667 `rrp_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost including tax',
668 `ecost` decimal(13,2) DEFAULT NULL COMMENT 'the replacement cost for this line item',
669 `ecost_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the estimated cost excluding tax',
670 `ecost_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the estimated cost including tax',
671 `tax_rate_bak` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate for this line item (%)',
672 `tax_rate_on_ordering` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate on ordering for this line item (%)',
673 `tax_rate_on_receiving` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate on receiving for this line item (%)',
674 `tax_value_bak` decimal(28,6) DEFAULT NULL COMMENT 'the tax value for this line item',
675 `tax_value_on_ordering` decimal(28,6) DEFAULT NULL COMMENT 'the tax value on ordering for this line item',
676 `tax_value_on_receiving` decimal(28,6) DEFAULT NULL COMMENT 'the tax value on receiving for this line item',
677 `discount` float(6,4) DEFAULT NULL COMMENT 'the discount for this line item (%)',
678 `budget_id` int(11) NOT NULL COMMENT 'the fund this order goes against (aqbudgets.budget_id)',
679 `budgetdate` date DEFAULT NULL COMMENT 'not used? always NULL',
680 `sort1` varchar(80) DEFAULT NULL COMMENT 'statistical field',
681 `sort2` varchar(80) DEFAULT NULL COMMENT 'second statistical field',
682 `sort1_authcat` varchar(10) DEFAULT NULL,
683 `sort2_authcat` varchar(10) DEFAULT NULL,
684 `uncertainprice` tinyint(1) DEFAULT NULL COMMENT 'was this price uncertain (1 for yes, 0 for no)',
685 `subscriptionid` int(11) DEFAULT NULL COMMENT 'links this order line to a subscription (subscription.subscriptionid)',
686 `parent_ordernumber` int(11) DEFAULT NULL COMMENT 'ordernumber of parent order line, or same as ordernumber if no parent',
687 `orderstatus` varchar(16) DEFAULT 'new' COMMENT 'the current status for this line item. Can be ''new'', ''ordered'', ''partial'', ''complete'' or ''cancelled''',
688 `line_item_id` varchar(35) DEFAULT NULL COMMENT 'Supplier''s article id for Edifact orderline',
689 `suppliers_reference_number` varchar(35) DEFAULT NULL COMMENT 'Suppliers unique edifact quote ref',
690 `suppliers_reference_qualifier` varchar(3) DEFAULT NULL COMMENT 'Type of number above usually ''QLI''',
691 `suppliers_report` mediumtext DEFAULT NULL COMMENT 'reports received from suppliers',
692 `estimated_delivery_date` date DEFAULT NULL COMMENT 'Estimated delivery date',
693 PRIMARY KEY (`ordernumber`),
694 KEY `basketno` (`basketno`),
695 KEY `biblionumber` (`biblionumber`),
696 KEY `budget_id` (`budget_id`),
697 KEY `parent_ordernumber` (`parent_ordernumber`),
698 KEY `orderstatus` (`orderstatus`),
699 KEY `aqorders_created_by` (`created_by`),
700 KEY `aqorders_ibfk_3` (`invoiceid`),
701 KEY `aqorders_subscriptionid` (`subscriptionid`),
702 KEY `aqorders_currency` (`currency`),
703 CONSTRAINT `aqorders_budget_id_fk` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
704 CONSTRAINT `aqorders_created_by` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
705 CONSTRAINT `aqorders_currency` FOREIGN KEY (`currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
706 CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
707 CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
708 CONSTRAINT `aqorders_ibfk_3` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE SET NULL ON UPDATE CASCADE,
709 CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
710 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
711 /*!40101 SET character_set_client = @saved_cs_client */;
714 -- Table structure for table `aqorders_claims`
717 DROP TABLE IF EXISTS `aqorders_claims`;
718 /*!40101 SET @saved_cs_client = @@character_set_client */;
719 /*!40101 SET character_set_client = utf8 */;
720 CREATE TABLE `aqorders_claims` (
721 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the claims',
722 `ordernumber` int(11) NOT NULL COMMENT 'order linked to this claim',
723 `claimed_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date of the claims',
725 KEY `aqorders_claims_ibfk_1` (`ordernumber`),
726 CONSTRAINT `aqorders_claims_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE
727 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
728 /*!40101 SET character_set_client = @saved_cs_client */;
731 -- Table structure for table `aqorders_items`
734 DROP TABLE IF EXISTS `aqorders_items`;
735 /*!40101 SET @saved_cs_client = @@character_set_client */;
736 /*!40101 SET character_set_client = utf8 */;
737 CREATE TABLE `aqorders_items` (
738 `ordernumber` int(11) NOT NULL COMMENT 'the order this item is attached to (aqorders.ordernumber)',
739 `itemnumber` int(11) NOT NULL COMMENT 'the item number for this item (items.itemnumber)',
740 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this order item was last touched',
741 PRIMARY KEY (`itemnumber`),
742 KEY `ordernumber` (`ordernumber`),
743 CONSTRAINT `aqorders_items_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE
744 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
745 /*!40101 SET character_set_client = @saved_cs_client */;
748 -- Table structure for table `aqorders_transfers`
751 DROP TABLE IF EXISTS `aqorders_transfers`;
752 /*!40101 SET @saved_cs_client = @@character_set_client */;
753 /*!40101 SET character_set_client = utf8 */;
754 CREATE TABLE `aqorders_transfers` (
755 `ordernumber_from` int(11) DEFAULT NULL,
756 `ordernumber_to` int(11) DEFAULT NULL,
757 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
758 UNIQUE KEY `ordernumber_from` (`ordernumber_from`),
759 UNIQUE KEY `ordernumber_to` (`ordernumber_to`),
760 CONSTRAINT `aqorders_transfers_ordernumber_from` FOREIGN KEY (`ordernumber_from`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
761 CONSTRAINT `aqorders_transfers_ordernumber_to` FOREIGN KEY (`ordernumber_to`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE
762 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
763 /*!40101 SET character_set_client = @saved_cs_client */;
766 -- Table structure for table `article_requests`
769 DROP TABLE IF EXISTS `article_requests`;
770 /*!40101 SET @saved_cs_client = @@character_set_client */;
771 /*!40101 SET character_set_client = utf8 */;
772 CREATE TABLE `article_requests` (
773 `id` int(11) NOT NULL AUTO_INCREMENT,
774 `borrowernumber` int(11) NOT NULL,
775 `biblionumber` int(11) NOT NULL,
776 `itemnumber` int(11) DEFAULT NULL,
777 `branchcode` varchar(10) DEFAULT NULL,
778 `title` mediumtext DEFAULT NULL,
779 `author` mediumtext DEFAULT NULL,
780 `volume` mediumtext DEFAULT NULL,
781 `issue` mediumtext DEFAULT NULL,
782 `date` mediumtext DEFAULT NULL,
783 `pages` mediumtext DEFAULT NULL,
784 `chapters` mediumtext DEFAULT NULL,
785 `patron_notes` mediumtext DEFAULT NULL,
786 `status` enum('REQUESTED','PENDING','PROCESSING','COMPLETED','CANCELED') NOT NULL DEFAULT 'REQUESTED',
787 `notes` mediumtext DEFAULT NULL,
788 `format` enum('PHOTOCOPY','SCAN') NOT NULL DEFAULT 'PHOTOCOPY',
789 `urls` mediumtext DEFAULT NULL,
790 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value AR_CANCELLATION',
791 `debit_id` int(11) DEFAULT NULL COMMENT 'Debit line with cost for article scan request',
792 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Be careful with two timestamps in one table not allowing NULL',
793 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
794 `toc_request` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'borrower requested table of contents',
796 KEY `borrowernumber` (`borrowernumber`),
797 KEY `biblionumber` (`biblionumber`),
798 KEY `itemnumber` (`itemnumber`),
799 KEY `branchcode` (`branchcode`),
800 KEY `debit_id` (`debit_id`),
801 CONSTRAINT `article_requests_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
802 CONSTRAINT `article_requests_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
803 CONSTRAINT `article_requests_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
804 CONSTRAINT `article_requests_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
805 CONSTRAINT `article_requests_ibfk_5` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE SET NULL ON UPDATE CASCADE
806 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
807 /*!40101 SET character_set_client = @saved_cs_client */;
810 -- Table structure for table `audio_alerts`
813 DROP TABLE IF EXISTS `audio_alerts`;
814 /*!40101 SET @saved_cs_client = @@character_set_client */;
815 /*!40101 SET character_set_client = utf8 */;
816 CREATE TABLE `audio_alerts` (
817 `id` int(11) NOT NULL AUTO_INCREMENT,
818 `precedence` smallint(5) unsigned NOT NULL,
819 `selector` varchar(255) NOT NULL,
820 `sound` varchar(255) NOT NULL,
822 KEY `precedence` (`precedence`)
823 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
824 /*!40101 SET character_set_client = @saved_cs_client */;
827 -- Table structure for table `auth_header`
830 DROP TABLE IF EXISTS `auth_header`;
831 /*!40101 SET @saved_cs_client = @@character_set_client */;
832 /*!40101 SET character_set_client = utf8 */;
833 CREATE TABLE `auth_header` (
834 `authid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
835 `authtypecode` varchar(10) NOT NULL DEFAULT '',
836 `datecreated` date DEFAULT NULL,
837 `modification_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
838 `origincode` varchar(20) DEFAULT NULL,
839 `authtrees` longtext DEFAULT NULL,
840 `marc` blob DEFAULT NULL,
841 `linkid` bigint(20) DEFAULT NULL,
842 `marcxml` longtext NOT NULL,
843 PRIMARY KEY (`authid`),
844 KEY `origincode` (`origincode`)
845 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
846 /*!40101 SET character_set_client = @saved_cs_client */;
849 -- Table structure for table `auth_subfield_structure`
852 DROP TABLE IF EXISTS `auth_subfield_structure`;
853 /*!40101 SET @saved_cs_client = @@character_set_client */;
854 /*!40101 SET character_set_client = utf8 */;
855 CREATE TABLE `auth_subfield_structure` (
856 `authtypecode` varchar(10) NOT NULL DEFAULT '',
857 `tagfield` varchar(3) NOT NULL DEFAULT '',
858 `tagsubfield` varchar(1) NOT NULL DEFAULT '',
859 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
860 `libopac` varchar(255) NOT NULL DEFAULT '',
861 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
862 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
863 `tab` tinyint(1) DEFAULT NULL,
864 `authorised_value` varchar(32) DEFAULT NULL,
865 `value_builder` varchar(80) DEFAULT NULL,
866 `seealso` varchar(255) DEFAULT NULL,
867 `isurl` tinyint(1) DEFAULT NULL,
868 `hidden` tinyint(3) NOT NULL DEFAULT 0,
869 `linkid` tinyint(1) NOT NULL DEFAULT 0,
870 `kohafield` varchar(45) DEFAULT '',
871 `frameworkcode` varchar(10) NOT NULL DEFAULT '',
872 `defaultvalue` mediumtext DEFAULT NULL,
873 `display_order` int(2) NOT NULL DEFAULT 0,
874 PRIMARY KEY (`authtypecode`,`tagfield`,`tagsubfield`),
875 KEY `tab` (`authtypecode`,`tab`),
876 CONSTRAINT `auth_subfield_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
877 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
878 /*!40101 SET character_set_client = @saved_cs_client */;
881 -- Table structure for table `auth_tag_structure`
884 DROP TABLE IF EXISTS `auth_tag_structure`;
885 /*!40101 SET @saved_cs_client = @@character_set_client */;
886 /*!40101 SET character_set_client = utf8 */;
887 CREATE TABLE `auth_tag_structure` (
888 `authtypecode` varchar(10) NOT NULL DEFAULT '',
889 `tagfield` varchar(3) NOT NULL DEFAULT '',
890 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
891 `libopac` varchar(255) NOT NULL DEFAULT '',
892 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
893 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
894 `authorised_value` varchar(32) DEFAULT NULL,
895 PRIMARY KEY (`authtypecode`,`tagfield`),
896 CONSTRAINT `auth_tag_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
897 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
898 /*!40101 SET character_set_client = @saved_cs_client */;
901 -- Table structure for table `auth_types`
904 DROP TABLE IF EXISTS `auth_types`;
905 /*!40101 SET @saved_cs_client = @@character_set_client */;
906 /*!40101 SET character_set_client = utf8 */;
907 CREATE TABLE `auth_types` (
908 `authtypecode` varchar(10) NOT NULL DEFAULT '',
909 `authtypetext` varchar(255) NOT NULL DEFAULT '',
910 `auth_tag_to_report` varchar(3) NOT NULL DEFAULT '',
911 `summary` longtext NOT NULL,
912 PRIMARY KEY (`authtypecode`)
913 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
914 /*!40101 SET character_set_client = @saved_cs_client */;
917 -- Table structure for table `authorised_value_categories`
920 DROP TABLE IF EXISTS `authorised_value_categories`;
921 /*!40101 SET @saved_cs_client = @@character_set_client */;
922 /*!40101 SET character_set_client = utf8 */;
923 CREATE TABLE `authorised_value_categories` (
924 `category_name` varchar(32) NOT NULL DEFAULT '',
925 `is_system` tinyint(1) DEFAULT 0,
926 PRIMARY KEY (`category_name`)
927 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
928 /*!40101 SET character_set_client = @saved_cs_client */;
931 -- Table structure for table `authorised_values`
934 DROP TABLE IF EXISTS `authorised_values`;
935 /*!40101 SET @saved_cs_client = @@character_set_client */;
936 /*!40101 SET character_set_client = utf8 */;
937 CREATE TABLE `authorised_values` (
938 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify the authorized value',
939 `category` varchar(32) NOT NULL DEFAULT '' COMMENT 'key used to identify the authorized value category',
940 `authorised_value` varchar(80) NOT NULL DEFAULT '' COMMENT 'code use to identify the authorized value',
941 `lib` varchar(200) DEFAULT NULL COMMENT 'authorized value description as printed in the staff interface',
942 `lib_opac` varchar(200) DEFAULT NULL COMMENT 'authorized value description as printed in the OPAC',
943 `imageurl` varchar(200) DEFAULT NULL COMMENT 'authorized value URL',
945 UNIQUE KEY `av_uniq` (`category`,`authorised_value`),
946 KEY `name` (`category`),
947 KEY `lib` (`lib`(191)),
948 KEY `auth_value_idx` (`authorised_value`),
949 CONSTRAINT `authorised_values_authorised_values_category` FOREIGN KEY (`category`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE CASCADE ON UPDATE CASCADE
950 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
951 /*!40101 SET character_set_client = @saved_cs_client */;
954 -- Table structure for table `authorised_values_branches`
957 DROP TABLE IF EXISTS `authorised_values_branches`;
958 /*!40101 SET @saved_cs_client = @@character_set_client */;
959 /*!40101 SET character_set_client = utf8 */;
960 CREATE TABLE `authorised_values_branches` (
961 `av_id` int(11) NOT NULL,
962 `branchcode` varchar(10) NOT NULL,
963 KEY `av_id` (`av_id`),
964 KEY `branchcode` (`branchcode`),
965 CONSTRAINT `authorised_values_branches_ibfk_1` FOREIGN KEY (`av_id`) REFERENCES `authorised_values` (`id`) ON DELETE CASCADE,
966 CONSTRAINT `authorised_values_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
967 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
968 /*!40101 SET character_set_client = @saved_cs_client */;
971 -- Table structure for table `background_jobs`
974 DROP TABLE IF EXISTS `background_jobs`;
975 /*!40101 SET @saved_cs_client = @@character_set_client */;
976 /*!40101 SET character_set_client = utf8 */;
977 CREATE TABLE `background_jobs` (
978 `id` int(11) NOT NULL AUTO_INCREMENT,
979 `status` varchar(32) DEFAULT NULL,
980 `progress` int(11) DEFAULT NULL,
981 `size` int(11) DEFAULT NULL,
982 `borrowernumber` int(11) DEFAULT NULL,
983 `type` varchar(64) DEFAULT NULL,
984 `queue` varchar(191) NOT NULL DEFAULT 'default' COMMENT 'Name of the queue the job is sent to',
985 `data` longtext DEFAULT NULL,
986 `context` longtext DEFAULT NULL COMMENT 'JSON-serialized context information for the job',
987 `enqueued_on` datetime DEFAULT NULL,
988 `started_on` datetime DEFAULT NULL,
989 `ended_on` datetime DEFAULT NULL,
991 KEY `borrowernumber` (`borrowernumber`),
992 KEY `queue` (`queue`),
993 KEY `status` (`status`)
994 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
995 /*!40101 SET character_set_client = @saved_cs_client */;
998 -- Table structure for table `biblio`
1001 DROP TABLE IF EXISTS `biblio`;
1002 /*!40101 SET @saved_cs_client = @@character_set_client */;
1003 /*!40101 SET character_set_client = utf8 */;
1004 CREATE TABLE `biblio` (
1005 `biblionumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned to each bibliographic record',
1006 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'foreign key from the biblio_framework table to identify which framework was used in cataloging this record',
1007 `author` longtext DEFAULT NULL COMMENT 'statement of responsibility from MARC record (100$a in MARC21)',
1008 `title` longtext DEFAULT NULL COMMENT 'title (without the subtitle) from the MARC record (245$a in MARC21)',
1009 `medium` longtext DEFAULT NULL COMMENT 'medium from the MARC record (245$h in MARC21)',
1010 `subtitle` longtext DEFAULT NULL COMMENT 'remainder of the title from the MARC record (245$b in MARC21)',
1011 `part_number` longtext DEFAULT NULL COMMENT 'part number from the MARC record (245$n in MARC21)',
1012 `part_name` longtext DEFAULT NULL COMMENT 'part name from the MARC record (245$p in MARC21)',
1013 `unititle` longtext DEFAULT NULL COMMENT 'uniform title (without the subtitle) from the MARC record (240$a in MARC21)',
1014 `notes` longtext DEFAULT NULL COMMENT 'values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)',
1015 `serial` tinyint(1) DEFAULT NULL COMMENT 'Boolean indicating whether biblio is for a serial',
1016 `seriestitle` longtext DEFAULT NULL,
1017 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'publication or copyright date from the MARC record',
1018 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
1019 `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
1020 `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
1021 PRIMARY KEY (`biblionumber`),
1022 KEY `blbnoidx` (`biblionumber`)
1023 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1024 /*!40101 SET character_set_client = @saved_cs_client */;
1027 -- Table structure for table `biblio_framework`
1030 DROP TABLE IF EXISTS `biblio_framework`;
1031 /*!40101 SET @saved_cs_client = @@character_set_client */;
1032 /*!40101 SET character_set_client = utf8 */;
1033 CREATE TABLE `biblio_framework` (
1034 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'the unique code assigned to the framework',
1035 `frameworktext` varchar(255) NOT NULL DEFAULT '' COMMENT 'the description/name given to the framework',
1036 PRIMARY KEY (`frameworkcode`)
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_metadata`
1044 DROP TABLE IF EXISTS `biblio_metadata`;
1045 /*!40101 SET @saved_cs_client = @@character_set_client */;
1046 /*!40101 SET character_set_client = utf8 */;
1047 CREATE TABLE `biblio_metadata` (
1048 `id` int(11) NOT NULL AUTO_INCREMENT,
1049 `biblionumber` int(11) NOT NULL,
1050 `format` varchar(16) NOT NULL,
1051 `schema` varchar(16) NOT NULL,
1052 `metadata` longtext NOT NULL,
1053 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1055 UNIQUE KEY `biblio_metadata_uniq_key` (`biblionumber`,`format`,`schema`),
1056 KEY `timestamp` (`timestamp`),
1057 CONSTRAINT `record_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1058 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1059 /*!40101 SET character_set_client = @saved_cs_client */;
1062 -- Table structure for table `biblioitems`
1065 DROP TABLE IF EXISTS `biblioitems`;
1066 /*!40101 SET @saved_cs_client = @@character_set_client */;
1067 /*!40101 SET character_set_client = utf8 */;
1068 CREATE TABLE `biblioitems` (
1069 `biblioitemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, unique identifier assigned by Koha',
1070 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the biblio table',
1071 `volume` longtext DEFAULT NULL,
1072 `number` longtext DEFAULT NULL,
1073 `itemtype` varchar(10) DEFAULT NULL COMMENT 'biblio level item type (MARC21 942$c)',
1074 `isbn` longtext DEFAULT NULL COMMENT 'ISBN (MARC21 020$a)',
1075 `issn` longtext DEFAULT NULL COMMENT 'ISSN (MARC21 022$a)',
1076 `ean` longtext DEFAULT NULL,
1077 `publicationyear` mediumtext DEFAULT NULL,
1078 `publishercode` varchar(255) DEFAULT NULL COMMENT 'publisher (MARC21 260$b)',
1079 `volumedate` date DEFAULT NULL,
1080 `volumedesc` mediumtext DEFAULT NULL COMMENT 'volume information (MARC21 362$a)',
1081 `collectiontitle` longtext DEFAULT NULL,
1082 `collectionissn` mediumtext DEFAULT NULL,
1083 `collectionvolume` longtext DEFAULT NULL,
1084 `editionstatement` mediumtext DEFAULT NULL,
1085 `editionresponsibility` mediumtext DEFAULT NULL,
1086 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1087 `illus` varchar(255) DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)',
1088 `pages` varchar(255) DEFAULT NULL COMMENT 'number of pages (MARC21 300$c)',
1089 `notes` longtext DEFAULT NULL,
1090 `size` varchar(255) DEFAULT NULL COMMENT 'material size (MARC21 300$c)',
1091 `place` varchar(255) DEFAULT NULL COMMENT 'publication place (MARC21 260$a)',
1092 `lccn` varchar(25) DEFAULT NULL COMMENT 'library of congress control number (MARC21 010$a)',
1093 `url` mediumtext DEFAULT NULL COMMENT 'url (MARC21 856$u)',
1094 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source (MARC21 942$2)',
1095 `cn_class` varchar(30) DEFAULT NULL,
1096 `cn_item` varchar(10) DEFAULT NULL,
1097 `cn_suffix` varchar(10) DEFAULT NULL,
1098 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized version of the call number used for sorting',
1099 `agerestriction` varchar(255) DEFAULT NULL COMMENT 'target audience/age restriction from the bib record (MARC21 521$a)',
1100 `totalissues` int(10) DEFAULT NULL,
1101 PRIMARY KEY (`biblioitemnumber`),
1102 KEY `bibinoidx` (`biblioitemnumber`),
1103 KEY `bibnoidx` (`biblionumber`),
1104 KEY `itemtype_idx` (`itemtype`),
1105 KEY `isbn` (`isbn`(191)),
1106 KEY `issn` (`issn`(191)),
1107 KEY `ean` (`ean`(191)),
1108 KEY `publishercode` (`publishercode`(191)),
1109 KEY `timestamp` (`timestamp`),
1110 CONSTRAINT `biblioitems_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1111 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1112 /*!40101 SET character_set_client = @saved_cs_client */;
1115 -- Table structure for table `borrower_attribute_types`
1118 DROP TABLE IF EXISTS `borrower_attribute_types`;
1119 /*!40101 SET @saved_cs_client = @@character_set_client */;
1120 /*!40101 SET character_set_client = utf8 */;
1121 CREATE TABLE `borrower_attribute_types` (
1122 `code` varchar(10) NOT NULL COMMENT 'unique key used to identify each custom field',
1123 `description` varchar(255) NOT NULL COMMENT 'description for each custom field',
1124 `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)',
1125 `unique_id` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this value needs to be unique (1 for yes, 0 for no)',
1126 `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)',
1127 `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)',
1128 `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)',
1129 `authorised_value_category` varchar(32) DEFAULT NULL COMMENT 'foreign key from authorised_values that links this custom field to an authorized value category',
1130 `display_checkout` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field displays in checkout screens',
1131 `category_code` varchar(10) DEFAULT NULL COMMENT 'defines a category for an attribute_type',
1132 `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1133 `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)',
1134 `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1135 PRIMARY KEY (`code`),
1136 KEY `auth_val_cat_idx` (`authorised_value_category`),
1137 KEY `category_code` (`category_code`),
1138 CONSTRAINT `borrower_attribute_types_ibfk_1` FOREIGN KEY (`category_code`) REFERENCES `categories` (`categorycode`)
1139 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1140 /*!40101 SET character_set_client = @saved_cs_client */;
1143 -- Table structure for table `borrower_attribute_types_branches`
1146 DROP TABLE IF EXISTS `borrower_attribute_types_branches`;
1147 /*!40101 SET @saved_cs_client = @@character_set_client */;
1148 /*!40101 SET character_set_client = utf8 */;
1149 CREATE TABLE `borrower_attribute_types_branches` (
1150 `bat_code` varchar(10) DEFAULT NULL,
1151 `b_branchcode` varchar(10) DEFAULT NULL,
1152 KEY `bat_code` (`bat_code`),
1153 KEY `b_branchcode` (`b_branchcode`),
1154 CONSTRAINT `borrower_attribute_types_branches_ibfk_1` FOREIGN KEY (`bat_code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE,
1155 CONSTRAINT `borrower_attribute_types_branches_ibfk_2` FOREIGN KEY (`b_branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1156 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1157 /*!40101 SET character_set_client = @saved_cs_client */;
1160 -- Table structure for table `borrower_attributes`
1163 DROP TABLE IF EXISTS `borrower_attributes`;
1164 /*!40101 SET @saved_cs_client = @@character_set_client */;
1165 /*!40101 SET character_set_client = utf8 */;
1166 CREATE TABLE `borrower_attributes` (
1167 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
1168 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines which patron/borrower has this attribute',
1169 `code` varchar(10) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
1170 `attribute` varchar(255) DEFAULT NULL COMMENT 'custom patron field value',
1172 KEY `borrowernumber` (`borrowernumber`),
1173 KEY `code_attribute` (`code`,`attribute`(191)),
1174 CONSTRAINT `borrower_attributes_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1175 CONSTRAINT `borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE
1176 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1177 /*!40101 SET character_set_client = @saved_cs_client */;
1180 -- Table structure for table `borrower_debarments`
1183 DROP TABLE IF EXISTS `borrower_debarments`;
1184 /*!40101 SET @saved_cs_client = @@character_set_client */;
1185 /*!40101 SET character_set_client = utf8 */;
1186 CREATE TABLE `borrower_debarments` (
1187 `borrower_debarment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the restriction',
1188 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key for borrowers.borrowernumber for patron who is restricted',
1189 `expiration` date DEFAULT NULL COMMENT 'expiration date of the restriction',
1190 `type` varchar(50) NOT NULL COMMENT 'type of restriction, FK to restriction_types.code',
1191 `comment` mediumtext DEFAULT NULL COMMENT 'comments about the restriction',
1192 `manager_id` int(11) DEFAULT NULL COMMENT 'foreign key for borrowers.borrowernumber for the librarian managing the restriction',
1193 `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date the restriction was added',
1194 `updated` timestamp NULL DEFAULT NULL COMMENT 'date the restriction was updated',
1195 PRIMARY KEY (`borrower_debarment_id`),
1196 KEY `borrowernumber` (`borrowernumber`),
1197 KEY `borrower_debarments_ibfk_2` (`type`),
1198 CONSTRAINT `borrower_debarments_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1199 CONSTRAINT `borrower_debarments_ibfk_2` FOREIGN KEY (`type`) REFERENCES `restriction_types` (`code`) ON DELETE NO ACTION ON UPDATE CASCADE
1200 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1201 /*!40101 SET character_set_client = @saved_cs_client */;
1204 -- Table structure for table `borrower_files`
1207 DROP TABLE IF EXISTS `borrower_files`;
1208 /*!40101 SET @saved_cs_client = @@character_set_client */;
1209 /*!40101 SET character_set_client = utf8 */;
1210 CREATE TABLE `borrower_files` (
1211 `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
1212 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking to the patron via the borrowernumber',
1213 `file_name` varchar(255) NOT NULL COMMENT 'file name',
1214 `file_type` varchar(255) NOT NULL COMMENT 'type of file',
1215 `file_description` varchar(255) DEFAULT NULL COMMENT 'description given to the file',
1216 `file_content` longblob NOT NULL COMMENT 'the file',
1217 `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
1218 PRIMARY KEY (`file_id`),
1219 KEY `borrowernumber` (`borrowernumber`),
1220 CONSTRAINT `borrower_files_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1221 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1222 /*!40101 SET character_set_client = @saved_cs_client */;
1225 -- Table structure for table `borrower_message_preferences`
1228 DROP TABLE IF EXISTS `borrower_message_preferences`;
1229 /*!40101 SET @saved_cs_client = @@character_set_client */;
1230 /*!40101 SET character_set_client = utf8 */;
1231 CREATE TABLE `borrower_message_preferences` (
1232 `borrower_message_preference_id` int(11) NOT NULL AUTO_INCREMENT,
1233 `borrowernumber` int(11) DEFAULT NULL,
1234 `categorycode` varchar(10) DEFAULT NULL,
1235 `message_attribute_id` int(11) DEFAULT 0,
1236 `days_in_advance` int(11) DEFAULT 0,
1237 `wants_digest` tinyint(1) NOT NULL DEFAULT 0,
1238 PRIMARY KEY (`borrower_message_preference_id`),
1239 KEY `borrowernumber` (`borrowernumber`),
1240 KEY `categorycode` (`categorycode`),
1241 KEY `message_attribute_id` (`message_attribute_id`),
1242 CONSTRAINT `borrower_message_preferences_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1243 CONSTRAINT `borrower_message_preferences_ibfk_2` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1244 CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
1245 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1246 /*!40101 SET character_set_client = @saved_cs_client */;
1249 -- Table structure for table `borrower_message_transport_preferences`
1252 DROP TABLE IF EXISTS `borrower_message_transport_preferences`;
1253 /*!40101 SET @saved_cs_client = @@character_set_client */;
1254 /*!40101 SET character_set_client = utf8 */;
1255 CREATE TABLE `borrower_message_transport_preferences` (
1256 `borrower_message_preference_id` int(11) NOT NULL DEFAULT 0,
1257 `message_transport_type` varchar(20) NOT NULL DEFAULT '0',
1258 PRIMARY KEY (`borrower_message_preference_id`,`message_transport_type`),
1259 KEY `message_transport_type` (`message_transport_type`),
1260 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,
1261 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
1262 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1263 /*!40101 SET character_set_client = @saved_cs_client */;
1266 -- Table structure for table `borrower_modifications`
1269 DROP TABLE IF EXISTS `borrower_modifications`;
1270 /*!40101 SET @saved_cs_client = @@character_set_client */;
1271 /*!40101 SET character_set_client = utf8 */;
1272 CREATE TABLE `borrower_modifications` (
1273 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1274 `verification_token` varchar(255) NOT NULL DEFAULT '',
1275 `changed_fields` mediumtext DEFAULT NULL,
1276 `borrowernumber` int(11) NOT NULL DEFAULT 0,
1277 `cardnumber` varchar(32) DEFAULT NULL,
1278 `surname` longtext DEFAULT NULL,
1279 `firstname` mediumtext DEFAULT NULL,
1280 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1281 `title` longtext DEFAULT NULL,
1282 `othernames` longtext DEFAULT NULL,
1283 `initials` mediumtext DEFAULT NULL,
1284 `pronouns` longtext DEFAULT NULL,
1285 `streetnumber` varchar(10) DEFAULT NULL,
1286 `streettype` varchar(50) DEFAULT NULL,
1287 `address` longtext DEFAULT NULL,
1288 `address2` mediumtext DEFAULT NULL,
1289 `city` longtext DEFAULT NULL,
1290 `state` mediumtext DEFAULT NULL,
1291 `zipcode` varchar(25) DEFAULT NULL,
1292 `country` mediumtext DEFAULT NULL,
1293 `email` longtext DEFAULT NULL,
1294 `phone` mediumtext DEFAULT NULL,
1295 `mobile` varchar(50) DEFAULT NULL,
1296 `fax` longtext DEFAULT NULL,
1297 `emailpro` mediumtext DEFAULT NULL,
1298 `phonepro` mediumtext DEFAULT NULL,
1299 `B_streetnumber` varchar(10) DEFAULT NULL,
1300 `B_streettype` varchar(50) DEFAULT NULL,
1301 `B_address` varchar(100) DEFAULT NULL,
1302 `B_address2` mediumtext DEFAULT NULL,
1303 `B_city` longtext DEFAULT NULL,
1304 `B_state` mediumtext DEFAULT NULL,
1305 `B_zipcode` varchar(25) DEFAULT NULL,
1306 `B_country` mediumtext DEFAULT NULL,
1307 `B_email` mediumtext DEFAULT NULL,
1308 `B_phone` longtext DEFAULT NULL,
1309 `dateofbirth` date DEFAULT NULL,
1310 `branchcode` varchar(10) DEFAULT NULL,
1311 `categorycode` varchar(10) DEFAULT NULL,
1312 `dateenrolled` date DEFAULT NULL,
1313 `dateexpiry` date DEFAULT NULL,
1314 `date_renewed` date DEFAULT NULL,
1315 `gonenoaddress` tinyint(1) DEFAULT NULL,
1316 `lost` tinyint(1) DEFAULT NULL,
1317 `debarred` date DEFAULT NULL,
1318 `debarredcomment` varchar(255) DEFAULT NULL,
1319 `contactname` longtext DEFAULT NULL,
1320 `contactfirstname` mediumtext DEFAULT NULL,
1321 `contacttitle` mediumtext DEFAULT NULL,
1322 `borrowernotes` longtext DEFAULT NULL,
1323 `relationship` varchar(100) DEFAULT NULL,
1324 `sex` varchar(1) DEFAULT NULL,
1325 `password` varchar(30) DEFAULT NULL,
1326 `flags` int(11) DEFAULT NULL,
1327 `userid` varchar(75) DEFAULT NULL,
1328 `opacnote` longtext DEFAULT NULL,
1329 `contactnote` varchar(255) DEFAULT NULL,
1330 `sort1` varchar(80) DEFAULT NULL,
1331 `sort2` varchar(80) DEFAULT NULL,
1332 `altcontactfirstname` varchar(255) DEFAULT NULL,
1333 `altcontactsurname` varchar(255) DEFAULT NULL,
1334 `altcontactaddress1` varchar(255) DEFAULT NULL,
1335 `altcontactaddress2` varchar(255) DEFAULT NULL,
1336 `altcontactaddress3` varchar(255) DEFAULT NULL,
1337 `altcontactstate` mediumtext DEFAULT NULL,
1338 `altcontactzipcode` varchar(50) DEFAULT NULL,
1339 `altcontactcountry` mediumtext DEFAULT NULL,
1340 `altcontactphone` varchar(50) DEFAULT NULL,
1341 `smsalertnumber` varchar(50) DEFAULT NULL,
1342 `privacy` int(11) DEFAULT NULL,
1343 `extended_attributes` mediumtext DEFAULT NULL,
1344 `gdpr_proc_consent` datetime DEFAULT NULL COMMENT 'data processing consent',
1345 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1346 PRIMARY KEY (`verification_token`(191),`borrowernumber`),
1347 KEY `verification_token` (`verification_token`(191)),
1348 KEY `borrowernumber` (`borrowernumber`)
1349 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1350 /*!40101 SET character_set_client = @saved_cs_client */;
1353 -- Table structure for table `borrower_password_recovery`
1356 DROP TABLE IF EXISTS `borrower_password_recovery`;
1357 /*!40101 SET @saved_cs_client = @@character_set_client */;
1358 /*!40101 SET character_set_client = utf8 */;
1359 CREATE TABLE `borrower_password_recovery` (
1360 `borrowernumber` int(11) NOT NULL COMMENT 'the user asking a password recovery',
1361 `uuid` varchar(128) NOT NULL COMMENT 'a unique string to identify a password recovery attempt',
1362 `valid_until` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'a time limit on the password recovery attempt',
1363 PRIMARY KEY (`borrowernumber`),
1364 KEY `borrowernumber` (`borrowernumber`)
1365 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1366 /*!40101 SET character_set_client = @saved_cs_client */;
1369 -- Table structure for table `borrower_relationships`
1372 DROP TABLE IF EXISTS `borrower_relationships`;
1373 /*!40101 SET @saved_cs_client = @@character_set_client */;
1374 /*!40101 SET character_set_client = utf8 */;
1375 CREATE TABLE `borrower_relationships` (
1376 `id` int(11) NOT NULL AUTO_INCREMENT,
1377 `guarantor_id` int(11) NOT NULL,
1378 `guarantee_id` int(11) NOT NULL,
1379 `relationship` varchar(100) NOT NULL,
1381 UNIQUE KEY `guarantor_guarantee_idx` (`guarantor_id`,`guarantee_id`),
1382 KEY `r_guarantee` (`guarantee_id`),
1383 CONSTRAINT `r_guarantee` FOREIGN KEY (`guarantee_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1384 CONSTRAINT `r_guarantor` FOREIGN KEY (`guarantor_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1385 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1386 /*!40101 SET character_set_client = @saved_cs_client */;
1389 -- Table structure for table `borrowers`
1392 DROP TABLE IF EXISTS `borrowers`;
1393 /*!40101 SET @saved_cs_client = @@character_set_client */;
1394 /*!40101 SET character_set_client = utf8 */;
1395 CREATE TABLE `borrowers` (
1396 `borrowernumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, Koha assigned ID number for patrons/borrowers',
1397 `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
1398 `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1399 `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
1400 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1401 `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1402 `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
1403 `initials` mediumtext DEFAULT NULL COMMENT 'initials for your patron/borrower',
1404 `pronouns` longtext DEFAULT NULL COMMENT 'patron/borrower pronouns',
1405 `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',
1406 `streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s primary address',
1407 `address` longtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s primary address',
1408 `address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s primary address',
1409 `city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s primary address',
1410 `state` mediumtext DEFAULT NULL COMMENT 'the state or province for your patron/borrower''s primary address',
1411 `zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s primary address',
1412 `country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s primary address',
1413 `email` longtext DEFAULT NULL COMMENT 'the primary email address for your patron/borrower''s primary address',
1414 `phone` mediumtext DEFAULT NULL COMMENT 'the primary phone number for your patron/borrower''s primary address',
1415 `mobile` tinytext DEFAULT NULL COMMENT 'the other phone number for your patron/borrower''s primary address',
1416 `fax` longtext DEFAULT NULL COMMENT 'the fax number for your patron/borrower''s primary address',
1417 `emailpro` mediumtext DEFAULT NULL COMMENT 'the secondary email addres for your patron/borrower''s primary address',
1418 `phonepro` mediumtext DEFAULT NULL COMMENT 'the secondary phone number for your patron/borrower''s primary address',
1419 `B_streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address',
1420 `B_streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s alternate address',
1421 `B_address` mediumtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s alternate address',
1422 `B_address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s alternate address',
1423 `B_city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s alternate address',
1424 `B_state` mediumtext DEFAULT NULL COMMENT 'the state for your patron/borrower''s alternate address',
1425 `B_zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s alternate address',
1426 `B_country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s alternate address',
1427 `B_email` mediumtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate email address',
1428 `B_phone` longtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate phone number',
1429 `dateofbirth` date DEFAULT NULL COMMENT 'the patron/borrower''s date of birth (YYYY-MM-DD)',
1430 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table, includes the code of the patron/borrower''s home branch',
1431 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category',
1432 `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)',
1433 `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)',
1434 `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)',
1435 `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed',
1436 `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',
1437 `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',
1438 `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)',
1439 `debarredcomment` varchar(255) DEFAULT NULL COMMENT 'comment on the stop of the patron',
1440 `contactname` longtext DEFAULT NULL COMMENT 'used for children and profesionals to include surname or last name of guarantor or organization name',
1441 `contactfirstname` mediumtext DEFAULT NULL COMMENT 'used for children to include first name of guarantor',
1442 `contacttitle` mediumtext DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor',
1443 `borrowernotes` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface',
1444 `relationship` varchar(100) DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor',
1445 `sex` varchar(1) DEFAULT NULL COMMENT 'patron/borrower''s gender',
1446 `password` varchar(60) DEFAULT NULL COMMENT 'patron/borrower''s Bcrypt encrypted password',
1447 `secret` mediumtext DEFAULT NULL COMMENT 'Secret for 2FA',
1448 `auth_method` enum('password','two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method',
1449 `flags` int(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions',
1450 `userid` varchar(75) DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in',
1451 `opacnote` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface',
1452 `contactnote` varchar(255) DEFAULT NULL COMMENT 'a note related to the patron/borrower''s alternate address',
1453 `sort1` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
1454 `sort2` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
1455 `altcontactfirstname` mediumtext DEFAULT NULL COMMENT 'first name of alternate contact for the patron/borrower',
1456 `altcontactsurname` mediumtext DEFAULT NULL COMMENT 'surname or last name of the alternate contact for the patron/borrower',
1457 `altcontactaddress1` mediumtext DEFAULT NULL COMMENT 'the first address line for the alternate contact for the patron/borrower',
1458 `altcontactaddress2` mediumtext DEFAULT NULL COMMENT 'the second address line for the alternate contact for the patron/borrower',
1459 `altcontactaddress3` mediumtext DEFAULT NULL COMMENT 'the city for the alternate contact for the patron/borrower',
1460 `altcontactstate` mediumtext DEFAULT NULL COMMENT 'the state for the alternate contact for the patron/borrower',
1461 `altcontactzipcode` mediumtext DEFAULT NULL COMMENT 'the zipcode for the alternate contact for the patron/borrower',
1462 `altcontactcountry` mediumtext DEFAULT NULL COMMENT 'the country for the alternate contact for the patron/borrower',
1463 `altcontactphone` mediumtext DEFAULT NULL COMMENT 'the phone number for the alternate contact for the patron/borrower',
1464 `smsalertnumber` varchar(50) DEFAULT NULL COMMENT 'the mobile phone number where the patron/borrower would like to receive notices (if SMS turned on)',
1465 `sms_provider_id` int(11) DEFAULT NULL COMMENT 'the provider of the mobile phone number defined in smsalertnumber',
1466 `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history',
1467 `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines',
1468 `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
1469 `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''.',
1470 `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)',
1471 `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
1472 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
1473 `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
1474 `overdrive_auth_token` mediumtext DEFAULT NULL COMMENT 'persist OverDrive auth token',
1475 `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1476 `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1477 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1478 PRIMARY KEY (`borrowernumber`),
1479 UNIQUE KEY `cardnumber` (`cardnumber`),
1480 UNIQUE KEY `userid` (`userid`),
1481 KEY `categorycode` (`categorycode`),
1482 KEY `branchcode` (`branchcode`),
1483 KEY `surname_idx` (`surname`(191)),
1484 KEY `firstname_idx` (`firstname`(191)),
1485 KEY `othernames_idx` (`othernames`(191)),
1486 KEY `sms_provider_id` (`sms_provider_id`),
1487 CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
1488 CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`),
1489 CONSTRAINT `borrowers_ibfk_3` FOREIGN KEY (`sms_provider_id`) REFERENCES `sms_providers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
1490 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1491 /*!40101 SET character_set_client = @saved_cs_client */;
1494 -- Table structure for table `branch_transfer_limits`
1497 DROP TABLE IF EXISTS `branch_transfer_limits`;
1498 /*!40101 SET @saved_cs_client = @@character_set_client */;
1499 /*!40101 SET character_set_client = utf8 */;
1500 CREATE TABLE `branch_transfer_limits` (
1501 `limitId` int(8) NOT NULL AUTO_INCREMENT,
1502 `toBranch` varchar(10) NOT NULL,
1503 `fromBranch` varchar(10) NOT NULL,
1504 `itemtype` varchar(10) DEFAULT NULL,
1505 `ccode` varchar(80) DEFAULT NULL,
1506 PRIMARY KEY (`limitId`)
1507 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1508 /*!40101 SET character_set_client = @saved_cs_client */;
1511 -- Table structure for table `branches`
1514 DROP TABLE IF EXISTS `branches`;
1515 /*!40101 SET @saved_cs_client = @@character_set_client */;
1516 /*!40101 SET character_set_client = utf8 */;
1517 CREATE TABLE `branches` (
1518 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'a unique key assigned to each branch',
1519 `branchname` longtext NOT NULL COMMENT 'the name of your library or branch',
1520 `branchaddress1` longtext DEFAULT NULL COMMENT 'the first address line of for your library or branch',
1521 `branchaddress2` longtext DEFAULT NULL COMMENT 'the second address line of for your library or branch',
1522 `branchaddress3` longtext DEFAULT NULL COMMENT 'the third address line of for your library or branch',
1523 `branchzip` varchar(25) DEFAULT NULL COMMENT 'the zip or postal code for your library or branch',
1524 `branchcity` longtext DEFAULT NULL COMMENT 'the city or province for your library or branch',
1525 `branchstate` longtext DEFAULT NULL COMMENT 'the state for your library or branch',
1526 `branchcountry` mediumtext DEFAULT NULL COMMENT 'the county for your library or branch',
1527 `branchphone` longtext DEFAULT NULL COMMENT 'the primary phone for your library or branch',
1528 `branchfax` longtext DEFAULT NULL COMMENT 'the fax number for your library or branch',
1529 `branchemail` longtext DEFAULT NULL COMMENT 'the primary email address for your library or branch',
1530 `branchillemail` longtext DEFAULT NULL COMMENT 'the ILL staff email address for your library or branch',
1531 `branchreplyto` longtext DEFAULT NULL COMMENT 'the email to be used as a Reply-To',
1532 `branchreturnpath` longtext DEFAULT NULL COMMENT 'the email to be used as Return-Path',
1533 `branchurl` longtext DEFAULT NULL COMMENT 'the URL for your library or branch''s website',
1534 `issuing` tinyint(4) DEFAULT NULL COMMENT 'unused in Koha',
1535 `branchip` varchar(15) DEFAULT NULL COMMENT 'the IP address for your library or branch',
1536 `branchnotes` longtext DEFAULT NULL COMMENT 'notes related to your library or branch',
1537 `geolocation` varchar(255) DEFAULT NULL COMMENT 'geolocation of your library',
1538 `marcorgcode` varchar(16) DEFAULT NULL COMMENT 'MARC Organization Code, see http://www.loc.gov/marc/organizations/orgshome.html, when empty defaults to syspref MARCOrgCode',
1539 `pickup_location` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'the ability to act as a pickup location',
1540 `public` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'whether this library should show in the opac',
1541 PRIMARY KEY (`branchcode`)
1542 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1543 /*!40101 SET character_set_client = @saved_cs_client */;
1546 -- Table structure for table `branches_overdrive`
1549 DROP TABLE IF EXISTS `branches_overdrive`;
1550 /*!40101 SET @saved_cs_client = @@character_set_client */;
1551 /*!40101 SET character_set_client = utf8 */;
1552 CREATE TABLE `branches_overdrive` (
1553 `branchcode` varchar(10) NOT NULL,
1554 `authname` varchar(255) NOT NULL,
1555 PRIMARY KEY (`branchcode`),
1556 CONSTRAINT `branches_overdrive_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1557 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1558 /*!40101 SET character_set_client = @saved_cs_client */;
1561 -- Table structure for table `branchtransfers`
1564 DROP TABLE IF EXISTS `branchtransfers`;
1565 /*!40101 SET @saved_cs_client = @@character_set_client */;
1566 /*!40101 SET character_set_client = utf8 */;
1567 CREATE TABLE `branchtransfers` (
1568 `branchtransfer_id` int(12) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
1569 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the itemnumber that it is in transit (items.itemnumber)',
1570 `daterequested` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date the transfer was requested',
1571 `datesent` datetime DEFAULT NULL COMMENT 'the date the transfer was initialized',
1572 `frombranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer is coming from',
1573 `datearrived` datetime DEFAULT NULL COMMENT 'the date the transfer arrived at its destination',
1574 `datecancelled` datetime DEFAULT NULL COMMENT 'the date the transfer was cancelled',
1575 `tobranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer was going to',
1576 `comments` longtext DEFAULT NULL COMMENT 'any comments related to the transfer',
1577 `reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation','Recall','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer',
1578 `cancellation_reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','ItemLost','WrongTransfer','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer cancellation',
1579 PRIMARY KEY (`branchtransfer_id`),
1580 KEY `frombranch` (`frombranch`),
1581 KEY `tobranch` (`tobranch`),
1582 KEY `itemnumber` (`itemnumber`),
1583 CONSTRAINT `branchtransfers_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1584 CONSTRAINT `branchtransfers_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1585 CONSTRAINT `branchtransfers_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1586 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1587 /*!40101 SET character_set_client = @saved_cs_client */;
1590 -- Table structure for table `browser`
1593 DROP TABLE IF EXISTS `browser`;
1594 /*!40101 SET @saved_cs_client = @@character_set_client */;
1595 /*!40101 SET character_set_client = utf8 */;
1596 CREATE TABLE `browser` (
1597 `level` int(11) NOT NULL,
1598 `classification` varchar(20) NOT NULL,
1599 `description` varchar(255) NOT NULL,
1600 `number` bigint(20) NOT NULL,
1601 `endnode` tinyint(4) NOT NULL
1602 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1603 /*!40101 SET character_set_client = @saved_cs_client */;
1606 -- Table structure for table `cash_register_actions`
1609 DROP TABLE IF EXISTS `cash_register_actions`;
1610 /*!40101 SET @saved_cs_client = @@character_set_client */;
1611 /*!40101 SET character_set_client = utf8 */;
1612 CREATE TABLE `cash_register_actions` (
1613 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each account register action',
1614 `code` varchar(24) NOT NULL COMMENT 'action code denoting the type of action recorded (enum),',
1615 `register_id` int(11) NOT NULL COMMENT 'id of cash_register this action belongs to,',
1616 `manager_id` int(11) NOT NULL COMMENT 'staff member performing the action',
1617 `amount` decimal(28,6) DEFAULT NULL COMMENT 'amount recorded in action (signed)',
1618 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1620 KEY `cash_register_actions_manager` (`manager_id`),
1621 KEY `cash_register_actions_register` (`register_id`),
1622 CONSTRAINT `cash_register_actions_manager` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1623 CONSTRAINT `cash_register_actions_register` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1624 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1625 /*!40101 SET character_set_client = @saved_cs_client */;
1628 -- Table structure for table `cash_registers`
1631 DROP TABLE IF EXISTS `cash_registers`;
1632 /*!40101 SET @saved_cs_client = @@character_set_client */;
1633 /*!40101 SET character_set_client = utf8 */;
1634 CREATE TABLE `cash_registers` (
1635 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each account register',
1636 `name` varchar(24) NOT NULL COMMENT 'the user friendly identifier for each account register',
1637 `description` longtext NOT NULL COMMENT 'the user friendly description for each account register',
1638 `branch` varchar(10) NOT NULL COMMENT 'the foreign key the library this account register belongs',
1639 `branch_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote that this till is the branch default',
1640 `starting_float` decimal(28,6) DEFAULT NULL COMMENT 'the starting float this account register should be assigned',
1641 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote if this till is archived or not',
1643 UNIQUE KEY `name` (`name`,`branch`),
1644 KEY `cash_registers_branch` (`branch`),
1645 CONSTRAINT `cash_registers_branch` FOREIGN KEY (`branch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1646 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1647 /*!40101 SET character_set_client = @saved_cs_client */;
1650 -- Table structure for table `categories`
1653 DROP TABLE IF EXISTS `categories`;
1654 /*!40101 SET @saved_cs_client = @@character_set_client */;
1655 /*!40101 SET character_set_client = utf8 */;
1656 CREATE TABLE `categories` (
1657 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'unique primary key used to idenfity the patron category',
1658 `description` longtext DEFAULT NULL COMMENT 'description of the patron category',
1659 `enrolmentperiod` smallint(6) DEFAULT NULL COMMENT 'number of months the patron is enrolled for (will be NULL if enrolmentperioddate is set)',
1660 `enrolmentperioddate` date DEFAULT NULL COMMENT 'date the patron is enrolled until (will be NULL if enrolmentperiod is set)',
1661 `password_expiry_days` smallint(6) DEFAULT NULL COMMENT 'number of days after which the patron must reset their password',
1662 `upperagelimit` smallint(6) DEFAULT NULL COMMENT 'age limit for the patron',
1663 `dateofbirthrequired` tinyint(1) DEFAULT NULL COMMENT 'the minimum age required for the patron category',
1664 `finetype` varchar(30) DEFAULT NULL COMMENT 'unused in Koha',
1665 `bulk` tinyint(1) DEFAULT NULL,
1666 `enrolmentfee` decimal(28,6) DEFAULT NULL COMMENT 'enrollment fee for the patron',
1667 `overduenoticerequired` tinyint(1) DEFAULT NULL COMMENT 'are overdue notices sent to this patron category (1 for yes, 0 for no)',
1668 `issuelimit` smallint(6) DEFAULT NULL COMMENT 'unused in Koha',
1669 `reservefee` decimal(28,6) DEFAULT NULL COMMENT 'cost to place holds',
1670 `hidelostitems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'are lost items shown to this category (1 for yes, 0 for no)',
1671 `category_type` varchar(1) NOT NULL DEFAULT 'A' COMMENT 'type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)',
1672 `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',
1673 `default_privacy` enum('default','never','forever') NOT NULL DEFAULT 'default' COMMENT 'Default privacy setting for this patron category',
1674 `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''.',
1675 `can_be_guarantee` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if patrons of this category can be guarantees',
1676 `reset_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can do the password reset flow,',
1677 `change_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can change their passwords in the OAPC',
1678 `min_password_length` smallint(6) DEFAULT NULL COMMENT 'set minimum password length for patrons in this category',
1679 `require_strong_password` tinyint(1) DEFAULT NULL COMMENT 'set required password strength for patrons in this category',
1680 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude patrons of this category from local holds priority',
1681 PRIMARY KEY (`categorycode`),
1682 UNIQUE KEY `categorycode` (`categorycode`)
1683 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1684 /*!40101 SET character_set_client = @saved_cs_client */;
1687 -- Table structure for table `categories_branches`
1690 DROP TABLE IF EXISTS `categories_branches`;
1691 /*!40101 SET @saved_cs_client = @@character_set_client */;
1692 /*!40101 SET character_set_client = utf8 */;
1693 CREATE TABLE `categories_branches` (
1694 `categorycode` varchar(10) DEFAULT NULL,
1695 `branchcode` varchar(10) DEFAULT NULL,
1696 KEY `categorycode` (`categorycode`),
1697 KEY `branchcode` (`branchcode`),
1698 CONSTRAINT `categories_branches_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE,
1699 CONSTRAINT `categories_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1700 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1701 /*!40101 SET character_set_client = @saved_cs_client */;
1704 -- Table structure for table `checkout_renewals`
1707 DROP TABLE IF EXISTS `checkout_renewals`;
1708 /*!40101 SET @saved_cs_client = @@character_set_client */;
1709 /*!40101 SET character_set_client = utf8 */;
1710 CREATE TABLE `checkout_renewals` (
1711 `renewal_id` int(11) NOT NULL AUTO_INCREMENT,
1712 `checkout_id` int(11) DEFAULT NULL COMMENT 'the id of the checkout this renewal pertains to',
1713 `renewer_id` int(11) DEFAULT NULL COMMENT 'the id of the user who processed the renewal',
1714 `seen` tinyint(1) DEFAULT 0 COMMENT 'boolean denoting whether the item was present or not',
1715 `interface` varchar(16) NOT NULL COMMENT 'the interface this renewal took place on',
1716 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the renewal took place',
1717 `renewal_type` enum('Automatic', 'Manual') NOT NULL DEFAULT 'Manual' COMMENT 'whether the renewal was an automatic or manual renewal',
1718 PRIMARY KEY (`renewal_id`),
1719 KEY `renewer_id` (`renewer_id`),
1720 CONSTRAINT `renewals_renewer_id` FOREIGN KEY (`renewer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
1721 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1722 /*!40101 SET character_set_client = @saved_cs_client */;
1725 -- Table structure for table `circulation_rules`
1728 DROP TABLE IF EXISTS `circulation_rules`;
1729 /*!40101 SET @saved_cs_client = @@character_set_client */;
1730 /*!40101 SET character_set_client = utf8 */;
1731 CREATE TABLE `circulation_rules` (
1732 `id` int(11) NOT NULL AUTO_INCREMENT,
1733 `branchcode` varchar(10) DEFAULT NULL,
1734 `categorycode` varchar(10) DEFAULT NULL,
1735 `itemtype` varchar(10) DEFAULT NULL,
1736 `rule_name` varchar(32) NOT NULL,
1737 `rule_value` varchar(32) NOT NULL,
1739 UNIQUE KEY `branchcode` (`branchcode`,`categorycode`,`itemtype`,`rule_name`),
1740 KEY `circ_rules_ibfk_2` (`categorycode`),
1741 KEY `circ_rules_ibfk_3` (`itemtype`),
1742 KEY `rule_name` (`rule_name`),
1743 CONSTRAINT `circ_rules_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1744 CONSTRAINT `circ_rules_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
1745 CONSTRAINT `circ_rules_ibfk_3` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
1746 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1747 /*!40101 SET character_set_client = @saved_cs_client */;
1750 -- Table structure for table `cities`
1753 DROP TABLE IF EXISTS `cities`;
1754 /*!40101 SET @saved_cs_client = @@character_set_client */;
1755 /*!40101 SET character_set_client = utf8 */;
1756 CREATE TABLE `cities` (
1757 `cityid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier added by Koha',
1758 `city_name` varchar(100) NOT NULL DEFAULT '' COMMENT 'name of the city',
1759 `city_state` varchar(100) DEFAULT NULL COMMENT 'name of the state/province',
1760 `city_country` varchar(100) DEFAULT NULL COMMENT 'name of the country',
1761 `city_zipcode` varchar(20) DEFAULT NULL COMMENT 'zip or postal code',
1762 PRIMARY KEY (`cityid`)
1763 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1764 /*!40101 SET character_set_client = @saved_cs_client */;
1767 -- Table structure for table `class_sort_rules`
1770 DROP TABLE IF EXISTS `class_sort_rules`;
1771 /*!40101 SET @saved_cs_client = @@character_set_client */;
1772 /*!40101 SET character_set_client = utf8 */;
1773 CREATE TABLE `class_sort_rules` (
1774 `class_sort_rule` varchar(10) NOT NULL DEFAULT '',
1775 `description` longtext DEFAULT NULL,
1776 `sort_routine` varchar(30) NOT NULL DEFAULT '',
1777 PRIMARY KEY (`class_sort_rule`),
1778 UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
1779 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1780 /*!40101 SET character_set_client = @saved_cs_client */;
1783 -- Table structure for table `class_sources`
1786 DROP TABLE IF EXISTS `class_sources`;
1787 /*!40101 SET @saved_cs_client = @@character_set_client */;
1788 /*!40101 SET character_set_client = utf8 */;
1789 CREATE TABLE `class_sources` (
1790 `cn_source` varchar(10) NOT NULL DEFAULT '',
1791 `description` longtext DEFAULT NULL,
1792 `used` tinyint(4) NOT NULL DEFAULT 0,
1793 `class_sort_rule` varchar(10) NOT NULL DEFAULT '',
1794 `class_split_rule` varchar(10) NOT NULL DEFAULT '',
1795 PRIMARY KEY (`cn_source`),
1796 UNIQUE KEY `cn_source_idx` (`cn_source`),
1797 KEY `used_idx` (`used`),
1798 KEY `class_source_ibfk_1` (`class_sort_rule`),
1799 KEY `class_source_ibfk_2` (`class_split_rule`),
1800 CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`),
1801 CONSTRAINT `class_source_ibfk_2` FOREIGN KEY (`class_split_rule`) REFERENCES `class_split_rules` (`class_split_rule`)
1802 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1803 /*!40101 SET character_set_client = @saved_cs_client */;
1806 -- Table structure for table `class_split_rules`
1809 DROP TABLE IF EXISTS `class_split_rules`;
1810 /*!40101 SET @saved_cs_client = @@character_set_client */;
1811 /*!40101 SET character_set_client = utf8 */;
1812 CREATE TABLE `class_split_rules` (
1813 `class_split_rule` varchar(10) NOT NULL DEFAULT '',
1814 `description` longtext DEFAULT NULL,
1815 `split_routine` varchar(30) NOT NULL DEFAULT '',
1816 `split_regex` varchar(255) NOT NULL DEFAULT '',
1817 PRIMARY KEY (`class_split_rule`),
1818 UNIQUE KEY `class_split_rule_idx` (`class_split_rule`)
1819 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1820 /*!40101 SET character_set_client = @saved_cs_client */;
1823 -- Table structure for table `club_enrollment_fields`
1826 DROP TABLE IF EXISTS `club_enrollment_fields`;
1827 /*!40101 SET @saved_cs_client = @@character_set_client */;
1828 /*!40101 SET character_set_client = utf8 */;
1829 CREATE TABLE `club_enrollment_fields` (
1830 `id` int(11) NOT NULL AUTO_INCREMENT,
1831 `club_enrollment_id` int(11) NOT NULL,
1832 `club_template_enrollment_field_id` int(11) NOT NULL,
1833 `value` mediumtext NOT NULL,
1835 KEY `club_enrollment_id` (`club_enrollment_id`),
1836 KEY `club_template_enrollment_field_id` (`club_template_enrollment_field_id`),
1837 CONSTRAINT `club_enrollment_fields_ibfk_1` FOREIGN KEY (`club_enrollment_id`) REFERENCES `club_enrollments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1838 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
1839 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1840 /*!40101 SET character_set_client = @saved_cs_client */;
1843 -- Table structure for table `club_enrollments`
1846 DROP TABLE IF EXISTS `club_enrollments`;
1847 /*!40101 SET @saved_cs_client = @@character_set_client */;
1848 /*!40101 SET character_set_client = utf8 */;
1849 CREATE TABLE `club_enrollments` (
1850 `id` int(11) NOT NULL AUTO_INCREMENT,
1851 `club_id` int(11) NOT NULL,
1852 `borrowernumber` int(11) NOT NULL,
1853 `date_enrolled` timestamp NOT NULL DEFAULT current_timestamp(),
1854 `date_canceled` timestamp NULL DEFAULT NULL,
1855 `date_created` timestamp NULL DEFAULT NULL,
1856 `date_updated` timestamp NULL DEFAULT NULL,
1857 `branchcode` varchar(10) DEFAULT NULL,
1859 KEY `club_id` (`club_id`),
1860 KEY `borrowernumber` (`borrowernumber`),
1861 KEY `branchcode` (`branchcode`),
1862 CONSTRAINT `club_enrollments_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1863 CONSTRAINT `club_enrollments_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1864 CONSTRAINT `club_enrollments_ibfk_3` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
1865 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1866 /*!40101 SET character_set_client = @saved_cs_client */;
1869 -- Table structure for table `club_fields`
1872 DROP TABLE IF EXISTS `club_fields`;
1873 /*!40101 SET @saved_cs_client = @@character_set_client */;
1874 /*!40101 SET character_set_client = utf8 */;
1875 CREATE TABLE `club_fields` (
1876 `id` int(11) NOT NULL AUTO_INCREMENT,
1877 `club_template_field_id` int(11) NOT NULL,
1878 `club_id` int(11) NOT NULL,
1879 `value` mediumtext DEFAULT NULL,
1881 KEY `club_template_field_id` (`club_template_field_id`),
1882 KEY `club_id` (`club_id`),
1883 CONSTRAINT `club_fields_ibfk_3` FOREIGN KEY (`club_template_field_id`) REFERENCES `club_template_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1884 CONSTRAINT `club_fields_ibfk_4` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1885 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1886 /*!40101 SET character_set_client = @saved_cs_client */;
1889 -- Table structure for table `club_holds`
1892 DROP TABLE IF EXISTS `club_holds`;
1893 /*!40101 SET @saved_cs_client = @@character_set_client */;
1894 /*!40101 SET character_set_client = utf8 */;
1895 CREATE TABLE `club_holds` (
1896 `id` int(11) NOT NULL AUTO_INCREMENT,
1897 `club_id` int(11) NOT NULL COMMENT 'id for the club the hold was generated for',
1898 `biblio_id` int(11) NOT NULL COMMENT 'id for the bibliographic record the hold has been placed against',
1899 `item_id` int(11) DEFAULT NULL COMMENT 'If item-level, the id for the item the hold has been placed agains',
1900 `date_created` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Timestamp for the placed hold',
1902 KEY `clubs_holds_ibfk_1` (`club_id`),
1903 KEY `clubs_holds_ibfk_2` (`biblio_id`),
1904 KEY `clubs_holds_ibfk_3` (`item_id`),
1905 CONSTRAINT `clubs_holds_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1906 CONSTRAINT `clubs_holds_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1907 CONSTRAINT `clubs_holds_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1908 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1909 /*!40101 SET character_set_client = @saved_cs_client */;
1912 -- Table structure for table `club_holds_to_patron_holds`
1915 DROP TABLE IF EXISTS `club_holds_to_patron_holds`;
1916 /*!40101 SET @saved_cs_client = @@character_set_client */;
1917 /*!40101 SET character_set_client = utf8 */;
1918 CREATE TABLE `club_holds_to_patron_holds` (
1919 `id` int(11) NOT NULL AUTO_INCREMENT,
1920 `club_hold_id` int(11) NOT NULL,
1921 `patron_id` int(11) NOT NULL,
1922 `hold_id` int(11) DEFAULT NULL,
1923 `error_code` enum('damaged','ageRestricted','itemAlreadyOnHold','tooManyHoldsForThisRecord','tooManyReservesToday','tooManyReserves','notReservable','cannotReserveFromOtherBranches','libraryNotFound','libraryNotPickupLocation','cannotBeTransferred','noReservesAllowed') DEFAULT NULL,
1924 `error_message` varchar(100) DEFAULT NULL,
1926 KEY `clubs_holds_paton_holds_ibfk_1` (`club_hold_id`),
1927 KEY `clubs_holds_paton_holds_ibfk_2` (`patron_id`),
1928 KEY `clubs_holds_paton_holds_ibfk_3` (`hold_id`),
1929 CONSTRAINT `clubs_holds_paton_holds_ibfk_1` FOREIGN KEY (`club_hold_id`) REFERENCES `club_holds` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1930 CONSTRAINT `clubs_holds_paton_holds_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1931 CONSTRAINT `clubs_holds_paton_holds_ibfk_3` FOREIGN KEY (`hold_id`) REFERENCES `reserves` (`reserve_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_template_enrollment_fields`
1939 DROP TABLE IF EXISTS `club_template_enrollment_fields`;
1940 /*!40101 SET @saved_cs_client = @@character_set_client */;
1941 /*!40101 SET character_set_client = utf8 */;
1942 CREATE TABLE `club_template_enrollment_fields` (
1943 `id` int(11) NOT NULL AUTO_INCREMENT,
1944 `club_template_id` int(11) NOT NULL,
1945 `name` text NOT NULL,
1946 `description` mediumtext DEFAULT NULL,
1947 `authorised_value_category` varchar(32) DEFAULT NULL,
1949 KEY `club_template_id` (`club_template_id`),
1950 CONSTRAINT `club_template_enrollment_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1951 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1952 /*!40101 SET character_set_client = @saved_cs_client */;
1955 -- Table structure for table `club_template_fields`
1958 DROP TABLE IF EXISTS `club_template_fields`;
1959 /*!40101 SET @saved_cs_client = @@character_set_client */;
1960 /*!40101 SET character_set_client = utf8 */;
1961 CREATE TABLE `club_template_fields` (
1962 `id` int(11) NOT NULL AUTO_INCREMENT,
1963 `club_template_id` int(11) NOT NULL,
1964 `name` text NOT NULL,
1965 `description` mediumtext DEFAULT NULL,
1966 `authorised_value_category` varchar(32) DEFAULT NULL,
1968 KEY `club_template_id` (`club_template_id`),
1969 CONSTRAINT `club_template_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1970 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1971 /*!40101 SET character_set_client = @saved_cs_client */;
1974 -- Table structure for table `club_templates`
1977 DROP TABLE IF EXISTS `club_templates`;
1978 /*!40101 SET @saved_cs_client = @@character_set_client */;
1979 /*!40101 SET character_set_client = utf8 */;
1980 CREATE TABLE `club_templates` (
1981 `id` int(11) NOT NULL AUTO_INCREMENT,
1982 `name` text NOT NULL,
1983 `description` mediumtext DEFAULT NULL,
1984 `is_enrollable_from_opac` tinyint(1) NOT NULL DEFAULT 0,
1985 `is_email_required` tinyint(1) NOT NULL DEFAULT 0,
1986 `branchcode` varchar(10) DEFAULT NULL,
1987 `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
1988 `date_updated` timestamp NULL DEFAULT NULL,
1989 `is_deletable` tinyint(1) NOT NULL DEFAULT 1,
1991 KEY `ct_branchcode` (`branchcode`),
1992 CONSTRAINT `club_templates_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1993 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1994 /*!40101 SET character_set_client = @saved_cs_client */;
1997 -- Table structure for table `clubs`
2000 DROP TABLE IF EXISTS `clubs`;
2001 /*!40101 SET @saved_cs_client = @@character_set_client */;
2002 /*!40101 SET character_set_client = utf8 */;
2003 CREATE TABLE `clubs` (
2004 `id` int(11) NOT NULL AUTO_INCREMENT,
2005 `club_template_id` int(11) NOT NULL,
2006 `name` text NOT NULL,
2007 `description` mediumtext DEFAULT NULL,
2008 `date_start` date DEFAULT NULL,
2009 `date_end` date DEFAULT NULL,
2010 `branchcode` varchar(10) DEFAULT NULL,
2011 `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
2012 `date_updated` timestamp NULL DEFAULT NULL,
2014 KEY `club_template_id` (`club_template_id`),
2015 KEY `branchcode` (`branchcode`),
2016 CONSTRAINT `clubs_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2017 CONSTRAINT `clubs_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
2018 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2019 /*!40101 SET character_set_client = @saved_cs_client */;
2022 -- Table structure for table `collections`
2025 DROP TABLE IF EXISTS `collections`;
2026 /*!40101 SET @saved_cs_client = @@character_set_client */;
2027 /*!40101 SET character_set_client = utf8 */;
2028 CREATE TABLE `collections` (
2029 `colId` int(11) NOT NULL AUTO_INCREMENT,
2030 `colTitle` varchar(100) NOT NULL DEFAULT '',
2031 `colDesc` mediumtext NOT NULL,
2032 `colBranchcode` varchar(10) DEFAULT NULL COMMENT '''branchcode for branch where item should be held.''',
2033 PRIMARY KEY (`colId`),
2034 KEY `collections_ibfk_1` (`colBranchcode`),
2035 CONSTRAINT `collections_ibfk_1` FOREIGN KEY (`colBranchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2036 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2037 /*!40101 SET character_set_client = @saved_cs_client */;
2040 -- Table structure for table `collections_tracking`
2043 DROP TABLE IF EXISTS `collections_tracking`;
2044 /*!40101 SET @saved_cs_client = @@character_set_client */;
2045 /*!40101 SET character_set_client = utf8 */;
2046 CREATE TABLE `collections_tracking` (
2047 `collections_tracking_id` int(11) NOT NULL AUTO_INCREMENT,
2048 `colId` int(11) NOT NULL DEFAULT 0 COMMENT 'collections.colId',
2049 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'items.itemnumber',
2050 PRIMARY KEY (`collections_tracking_id`),
2051 KEY `collectionst_ibfk_1` (`colId`),
2052 CONSTRAINT `collectionst_ibfk_1` FOREIGN KEY (`colId`) REFERENCES `collections` (`colId`) ON DELETE CASCADE ON UPDATE CASCADE
2053 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2054 /*!40101 SET character_set_client = @saved_cs_client */;
2057 -- Table structure for table `columns_settings`
2060 DROP TABLE IF EXISTS `columns_settings`;
2061 /*!40101 SET @saved_cs_client = @@character_set_client */;
2062 /*!40101 SET character_set_client = utf8 */;
2063 CREATE TABLE `columns_settings` (
2064 `module` varchar(255) NOT NULL,
2065 `page` varchar(255) NOT NULL,
2066 `tablename` varchar(255) NOT NULL,
2067 `columnname` varchar(255) NOT NULL,
2068 `cannot_be_toggled` int(1) NOT NULL DEFAULT 0,
2069 `is_hidden` int(1) NOT NULL DEFAULT 0,
2070 PRIMARY KEY (`module`(191),`page`(191),`tablename`(191),`columnname`(191))
2071 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2072 /*!40101 SET character_set_client = @saved_cs_client */;
2075 -- Table structure for table `course_instructors`
2078 DROP TABLE IF EXISTS `course_instructors`;
2079 /*!40101 SET @saved_cs_client = @@character_set_client */;
2080 /*!40101 SET character_set_client = utf8 */;
2081 CREATE TABLE `course_instructors` (
2082 `course_id` int(11) NOT NULL COMMENT 'foreign key to link to courses.course_id',
2083 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key to link to borrowers.borrowernumber for instructor information',
2084 PRIMARY KEY (`course_id`,`borrowernumber`),
2085 KEY `borrowernumber` (`borrowernumber`),
2086 CONSTRAINT `course_instructors_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2087 CONSTRAINT `course_instructors_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`)
2088 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2089 /*!40101 SET character_set_client = @saved_cs_client */;
2092 -- Table structure for table `course_items`
2095 DROP TABLE IF EXISTS `course_items`;
2096 /*!40101 SET @saved_cs_client = @@character_set_client */;
2097 /*!40101 SET character_set_client = utf8 */;
2098 CREATE TABLE `course_items` (
2099 `ci_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'course item id',
2100 `itemnumber` int(11) DEFAULT NULL COMMENT 'items.itemnumber for the item on reserve',
2101 `biblionumber` int(11) NOT NULL COMMENT 'biblio.biblionumber for the bibliographic record on reserve',
2102 `itype` varchar(10) DEFAULT NULL COMMENT 'new itemtype for the item to have while on reserve (optional)',
2103 `itype_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2104 `itype_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the itype when item is on course reserve',
2105 `ccode` varchar(80) DEFAULT NULL COMMENT 'new category code for the item to have while on reserve (optional)',
2106 `ccode_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if ccode should be changed while on course reserve',
2107 `ccode_storage` varchar(80) DEFAULT NULL COMMENT 'a place to store the ccode when item is on course reserve',
2108 `homebranch` varchar(10) DEFAULT NULL COMMENT 'new home branch for the item to have while on reserve (optional)',
2109 `homebranch_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if homebranch should be changed while on course reserve',
2110 `homebranch_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the homebranch when item is on course reserve',
2111 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'new holding branch for the item to have while on reserve (optional)',
2112 `holdingbranch_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2113 `holdingbranch_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the holdingbranch when item is on course reserve',
2114 `location` varchar(80) DEFAULT NULL COMMENT 'new shelving location for the item to have while on reseve (optional)',
2115 `location_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2116 `location_storage` varchar(80) DEFAULT NULL COMMENT 'a place to store the location when the item is on course reserve',
2117 `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''',
2118 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2119 PRIMARY KEY (`ci_id`),
2120 UNIQUE KEY `itemnumber` (`itemnumber`),
2121 KEY `holdingbranch` (`holdingbranch`),
2122 KEY `fk_course_items_homebranch` (`homebranch`),
2123 KEY `fk_course_items_homebranch_storage` (`homebranch_storage`),
2124 KEY `fk_course_items_biblionumber` (`biblionumber`),
2125 CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2126 CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2127 CONSTRAINT `fk_course_items_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2128 CONSTRAINT `fk_course_items_homebranch` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2129 CONSTRAINT `fk_course_items_homebranch_storage` FOREIGN KEY (`homebranch_storage`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2130 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2131 /*!40101 SET character_set_client = @saved_cs_client */;
2134 -- Table structure for table `course_reserves`
2137 DROP TABLE IF EXISTS `course_reserves`;
2138 /*!40101 SET @saved_cs_client = @@character_set_client */;
2139 /*!40101 SET character_set_client = utf8 */;
2140 CREATE TABLE `course_reserves` (
2141 `cr_id` int(11) NOT NULL AUTO_INCREMENT,
2142 `course_id` int(11) NOT NULL COMMENT 'foreign key to link to courses.course_id',
2143 `ci_id` int(11) NOT NULL COMMENT 'foreign key to link to courses_items.ci_id',
2144 `staff_note` longtext DEFAULT NULL COMMENT 'staff only note',
2145 `public_note` longtext DEFAULT NULL COMMENT 'public, OPAC visible note',
2146 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2147 PRIMARY KEY (`cr_id`),
2148 UNIQUE KEY `pseudo_key` (`course_id`,`ci_id`),
2149 KEY `course_id` (`course_id`),
2150 KEY `course_reserves_ibfk_2` (`ci_id`),
2151 CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`),
2152 CONSTRAINT `course_reserves_ibfk_2` FOREIGN KEY (`ci_id`) REFERENCES `course_items` (`ci_id`) ON DELETE CASCADE ON UPDATE CASCADE
2153 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2154 /*!40101 SET character_set_client = @saved_cs_client */;
2157 -- Table structure for table `courses`
2160 DROP TABLE IF EXISTS `courses`;
2161 /*!40101 SET @saved_cs_client = @@character_set_client */;
2162 /*!40101 SET character_set_client = utf8 */;
2163 CREATE TABLE `courses` (
2164 `course_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the course',
2165 `department` varchar(80) DEFAULT NULL COMMENT 'the authorised value for the DEPARTMENT',
2166 `course_number` varchar(255) DEFAULT NULL COMMENT 'the ''course number'' assigned to a course',
2167 `section` varchar(255) DEFAULT NULL COMMENT 'the ''section'' of a course',
2168 `course_name` varchar(255) DEFAULT NULL COMMENT 'the name of the course',
2169 `term` varchar(80) DEFAULT NULL COMMENT 'the authorised value for the TERM',
2170 `staff_note` longtext DEFAULT NULL COMMENT 'the text of the staff only note',
2171 `public_note` longtext DEFAULT NULL COMMENT 'the text of the public / opac note',
2172 `students_count` varchar(20) DEFAULT NULL COMMENT 'how many students will be taking this course/section',
2173 `enabled` enum('yes','no') NOT NULL DEFAULT 'yes' COMMENT 'determines whether the course is active',
2174 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2175 PRIMARY KEY (`course_id`)
2176 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2177 /*!40101 SET character_set_client = @saved_cs_client */;
2180 -- Table structure for table `cover_images`
2183 DROP TABLE IF EXISTS `cover_images`;
2184 /*!40101 SET @saved_cs_client = @@character_set_client */;
2185 /*!40101 SET character_set_client = utf8 */;
2186 CREATE TABLE `cover_images` (
2187 `imagenumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the image',
2188 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from biblio table to link to biblionumber',
2189 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from item table to link to itemnumber',
2190 `mimetype` varchar(15) NOT NULL COMMENT 'image type',
2191 `imagefile` mediumblob NOT NULL COMMENT 'image file contents',
2192 `thumbnail` mediumblob NOT NULL COMMENT 'thumbnail file contents',
2193 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'image creation/update time',
2194 PRIMARY KEY (`imagenumber`),
2195 KEY `bibliocoverimage_fk1` (`biblionumber`),
2196 KEY `bibliocoverimage_fk2` (`itemnumber`),
2197 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2198 CONSTRAINT `bibliocoverimage_fk2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
2199 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2200 /*!40101 SET character_set_client = @saved_cs_client */;
2203 -- Table structure for table `creator_batches`
2206 DROP TABLE IF EXISTS `creator_batches`;
2207 /*!40101 SET @saved_cs_client = @@character_set_client */;
2208 /*!40101 SET character_set_client = utf8 */;
2209 CREATE TABLE `creator_batches` (
2210 `label_id` int(11) NOT NULL AUTO_INCREMENT,
2211 `batch_id` int(10) NOT NULL DEFAULT 1,
2212 `description` mediumtext DEFAULT NULL,
2213 `item_number` int(11) DEFAULT NULL,
2214 `borrower_number` int(11) DEFAULT NULL,
2215 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2216 `branch_code` varchar(10) NOT NULL DEFAULT 'NB',
2217 `creator` char(15) NOT NULL DEFAULT 'Labels',
2218 PRIMARY KEY (`label_id`),
2219 KEY `branch_fk_constraint` (`branch_code`),
2220 KEY `item_fk_constraint` (`item_number`),
2221 KEY `borrower_fk_constraint` (`borrower_number`),
2222 CONSTRAINT `creator_batches_ibfk_1` FOREIGN KEY (`borrower_number`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2223 CONSTRAINT `creator_batches_ibfk_2` FOREIGN KEY (`branch_code`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
2224 CONSTRAINT `creator_batches_ibfk_3` FOREIGN KEY (`item_number`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE
2225 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2226 /*!40101 SET character_set_client = @saved_cs_client */;
2229 -- Table structure for table `creator_images`
2232 DROP TABLE IF EXISTS `creator_images`;
2233 /*!40101 SET @saved_cs_client = @@character_set_client */;
2234 /*!40101 SET character_set_client = utf8 */;
2235 CREATE TABLE `creator_images` (
2236 `image_id` int(4) NOT NULL AUTO_INCREMENT,
2237 `imagefile` mediumblob DEFAULT NULL,
2238 `image_name` char(20) NOT NULL DEFAULT 'DEFAULT',
2239 PRIMARY KEY (`image_id`),
2240 UNIQUE KEY `image_name_index` (`image_name`)
2241 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2242 /*!40101 SET character_set_client = @saved_cs_client */;
2245 -- Table structure for table `creator_layouts`
2248 DROP TABLE IF EXISTS `creator_layouts`;
2249 /*!40101 SET @saved_cs_client = @@character_set_client */;
2250 /*!40101 SET character_set_client = utf8 */;
2251 CREATE TABLE `creator_layouts` (
2252 `layout_id` int(4) NOT NULL AUTO_INCREMENT,
2253 `barcode_type` char(100) NOT NULL DEFAULT 'CODE39',
2254 `start_label` int(2) NOT NULL DEFAULT 1,
2255 `printing_type` char(32) NOT NULL DEFAULT 'BAR',
2256 `layout_name` char(25) NOT NULL DEFAULT 'DEFAULT',
2257 `guidebox` int(1) DEFAULT 0,
2258 `oblique_title` int(1) DEFAULT 1,
2259 `font` char(10) NOT NULL DEFAULT 'TR',
2260 `font_size` int(4) NOT NULL DEFAULT 10,
2261 `units` char(20) NOT NULL DEFAULT 'POINT',
2262 `callnum_split` int(1) DEFAULT 0,
2263 `text_justify` char(1) NOT NULL DEFAULT 'L',
2264 `format_string` varchar(210) NOT NULL DEFAULT 'barcode',
2265 `layout_xml` mediumtext NOT NULL,
2266 `creator` char(15) NOT NULL DEFAULT 'Labels',
2267 PRIMARY KEY (`layout_id`)
2268 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2269 /*!40101 SET character_set_client = @saved_cs_client */;
2272 -- Table structure for table `creator_templates`
2275 DROP TABLE IF EXISTS `creator_templates`;
2276 /*!40101 SET @saved_cs_client = @@character_set_client */;
2277 /*!40101 SET character_set_client = utf8 */;
2278 CREATE TABLE `creator_templates` (
2279 `template_id` int(4) NOT NULL AUTO_INCREMENT,
2280 `profile_id` int(4) DEFAULT NULL,
2281 `template_code` char(100) NOT NULL DEFAULT 'DEFAULT TEMPLATE',
2282 `template_desc` char(100) NOT NULL DEFAULT 'Default description',
2283 `page_width` float NOT NULL DEFAULT 0,
2284 `page_height` float NOT NULL DEFAULT 0,
2285 `label_width` float NOT NULL DEFAULT 0,
2286 `label_height` float NOT NULL DEFAULT 0,
2287 `top_text_margin` float NOT NULL DEFAULT 0,
2288 `left_text_margin` float NOT NULL DEFAULT 0,
2289 `top_margin` float NOT NULL DEFAULT 0,
2290 `left_margin` float NOT NULL DEFAULT 0,
2291 `cols` int(2) NOT NULL DEFAULT 0,
2292 `rows` int(2) NOT NULL DEFAULT 0,
2293 `col_gap` float NOT NULL DEFAULT 0,
2294 `row_gap` float NOT NULL DEFAULT 0,
2295 `units` char(20) NOT NULL DEFAULT 'POINT',
2296 `creator` char(15) NOT NULL DEFAULT 'Labels',
2297 PRIMARY KEY (`template_id`),
2298 KEY `template_profile_fk_constraint` (`profile_id`)
2299 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2300 /*!40101 SET character_set_client = @saved_cs_client */;
2303 -- Table structure for table `curbside_pickup_issues`
2306 DROP TABLE IF EXISTS `curbside_pickup_issues`;
2307 /*!40101 SET @saved_cs_client = @@character_set_client */;
2308 /*!40101 SET character_set_client = utf8 */;
2309 CREATE TABLE `curbside_pickup_issues` (
2310 `id` int(11) NOT NULL AUTO_INCREMENT,
2311 `curbside_pickup_id` int(11) NOT NULL,
2312 `issue_id` int(11) NOT NULL,
2313 `reserve_id` int(11) NOT NULL,
2315 KEY `curbside_pickup_id` (`curbside_pickup_id`),
2316 CONSTRAINT `curbside_pickup_issues_ibfk_1` FOREIGN KEY (`curbside_pickup_id`) REFERENCES `curbside_pickups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2317 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2318 /*!40101 SET character_set_client = @saved_cs_client */;
2321 -- Table structure for table `curbside_pickup_opening_slots`
2324 DROP TABLE IF EXISTS `curbside_pickup_opening_slots`;
2325 /*!40101 SET @saved_cs_client = @@character_set_client */;
2326 /*!40101 SET character_set_client = utf8 */;
2327 CREATE TABLE `curbside_pickup_opening_slots` (
2328 `id` int(11) NOT NULL AUTO_INCREMENT,
2329 `curbside_pickup_policy_id` int(11) NOT NULL,
2330 `day` tinyint(1) NOT NULL,
2331 `start_hour` int(2) NOT NULL,
2332 `start_minute` int(2) NOT NULL,
2333 `end_hour` int(2) NOT NULL,
2334 `end_minute` int(2) NOT NULL,
2336 KEY `curbside_pickup_policy_id` (`curbside_pickup_policy_id`),
2337 CONSTRAINT `curbside_pickup_opening_slots_ibfk_1` FOREIGN KEY (`curbside_pickup_policy_id`) REFERENCES `curbside_pickup_policy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2338 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2339 /*!40101 SET character_set_client = @saved_cs_client */;
2342 -- Table structure for table `curbside_pickup_policy`
2345 DROP TABLE IF EXISTS `curbside_pickup_policy`;
2346 /*!40101 SET @saved_cs_client = @@character_set_client */;
2347 /*!40101 SET character_set_client = utf8 */;
2348 CREATE TABLE `curbside_pickup_policy` (
2349 `id` int(11) NOT NULL AUTO_INCREMENT,
2350 `branchcode` varchar(10) NOT NULL,
2351 `enabled` tinyint(1) NOT NULL DEFAULT 0,
2352 `enable_waiting_holds_only` tinyint(1) NOT NULL DEFAULT 0,
2353 `pickup_interval` int(2) NOT NULL DEFAULT 0,
2354 `patrons_per_interval` int(2) NOT NULL DEFAULT 0,
2355 `patron_scheduled_pickup` tinyint(1) NOT NULL DEFAULT 0,
2357 UNIQUE KEY `branchcode` (`branchcode`),
2358 CONSTRAINT `curbside_pickup_policy_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2359 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2360 /*!40101 SET character_set_client = @saved_cs_client */;
2363 -- Table structure for table `curbside_pickups`
2366 DROP TABLE IF EXISTS `curbside_pickups`;
2367 /*!40101 SET @saved_cs_client = @@character_set_client */;
2368 /*!40101 SET character_set_client = utf8 */;
2369 CREATE TABLE `curbside_pickups` (
2370 `id` int(11) NOT NULL AUTO_INCREMENT,
2371 `borrowernumber` int(11) NOT NULL,
2372 `branchcode` varchar(10) NOT NULL,
2373 `scheduled_pickup_datetime` datetime NOT NULL,
2374 `staged_datetime` datetime DEFAULT NULL,
2375 `staged_by` int(11) DEFAULT NULL,
2376 `arrival_datetime` datetime DEFAULT NULL,
2377 `delivered_datetime` datetime DEFAULT NULL,
2378 `delivered_by` int(11) DEFAULT NULL,
2379 `notes` text DEFAULT NULL,
2381 KEY `branchcode` (`branchcode`),
2382 KEY `borrowernumber` (`borrowernumber`),
2383 KEY `staged_by` (`staged_by`),
2384 CONSTRAINT `curbside_pickups_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2385 CONSTRAINT `curbside_pickups_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2386 CONSTRAINT `curbside_pickups_ibfk_3` FOREIGN KEY (`staged_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
2387 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2388 /*!40101 SET character_set_client = @saved_cs_client */;
2391 -- Table structure for table `currency`
2394 DROP TABLE IF EXISTS `currency`;
2395 /*!40101 SET @saved_cs_client = @@character_set_client */;
2396 /*!40101 SET character_set_client = utf8 */;
2397 CREATE TABLE `currency` (
2398 `currency` varchar(10) NOT NULL DEFAULT '',
2399 `symbol` varchar(5) DEFAULT NULL,
2400 `isocode` varchar(5) DEFAULT NULL,
2401 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2402 `rate` float(15,5) DEFAULT NULL,
2403 `active` tinyint(1) DEFAULT NULL,
2404 `archived` tinyint(1) DEFAULT 0,
2405 `p_sep_by_space` tinyint(1) DEFAULT 0,
2406 PRIMARY KEY (`currency`)
2407 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2408 /*!40101 SET character_set_client = @saved_cs_client */;
2411 -- Table structure for table `deletedbiblio`
2414 DROP TABLE IF EXISTS `deletedbiblio`;
2415 /*!40101 SET @saved_cs_client = @@character_set_client */;
2416 /*!40101 SET character_set_client = utf8 */;
2417 CREATE TABLE `deletedbiblio` (
2418 `biblionumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned to each bibliographic record',
2419 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'foriegn key from the biblio_framework table to identify which framework was used in cataloging this record',
2420 `author` longtext DEFAULT NULL COMMENT 'statement of responsibility from MARC record (100$a in MARC21)',
2421 `title` longtext DEFAULT NULL COMMENT 'title (without the subtitle) from the MARC record (245$a in MARC21)',
2422 `medium` longtext DEFAULT NULL COMMENT 'medium from the MARC record (245$h in MARC21)',
2423 `subtitle` longtext DEFAULT NULL COMMENT 'remainder of the title from the MARC record (245$b in MARC21)',
2424 `part_number` longtext DEFAULT NULL COMMENT 'part number from the MARC record (245$n in MARC21)',
2425 `part_name` longtext DEFAULT NULL COMMENT 'part name from the MARC record (245$p in MARC21)',
2426 `unititle` longtext DEFAULT NULL COMMENT 'uniform title (without the subtitle) from the MARC record (240$a in MARC21)',
2427 `notes` longtext DEFAULT NULL COMMENT 'values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)',
2428 `serial` tinyint(1) DEFAULT NULL COMMENT 'Boolean indicating whether biblio is for a serial',
2429 `seriestitle` longtext DEFAULT NULL,
2430 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'publication or copyright date from the MARC record',
2431 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
2432 `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
2433 `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
2434 PRIMARY KEY (`biblionumber`),
2435 KEY `blbnoidx` (`biblionumber`)
2436 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2437 /*!40101 SET character_set_client = @saved_cs_client */;
2440 -- Table structure for table `deletedbiblio_metadata`
2443 DROP TABLE IF EXISTS `deletedbiblio_metadata`;
2444 /*!40101 SET @saved_cs_client = @@character_set_client */;
2445 /*!40101 SET character_set_client = utf8 */;
2446 CREATE TABLE `deletedbiblio_metadata` (
2447 `id` int(11) NOT NULL AUTO_INCREMENT,
2448 `biblionumber` int(11) NOT NULL,
2449 `format` varchar(16) NOT NULL,
2450 `schema` varchar(16) NOT NULL,
2451 `metadata` longtext NOT NULL,
2452 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2454 UNIQUE KEY `deletedbiblio_metadata_uniq_key` (`biblionumber`,`format`,`schema`),
2455 KEY `timestamp` (`timestamp`),
2456 CONSTRAINT `deletedrecord_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `deletedbiblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2457 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2458 /*!40101 SET character_set_client = @saved_cs_client */;
2461 -- Table structure for table `deletedbiblioitems`
2464 DROP TABLE IF EXISTS `deletedbiblioitems`;
2465 /*!40101 SET @saved_cs_client = @@character_set_client */;
2466 /*!40101 SET character_set_client = utf8 */;
2467 CREATE TABLE `deletedbiblioitems` (
2468 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key, unique identifier assigned by Koha',
2469 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the biblio table',
2470 `volume` longtext DEFAULT NULL,
2471 `number` longtext DEFAULT NULL,
2472 `itemtype` varchar(10) DEFAULT NULL COMMENT 'biblio level item type (MARC21 942$c)',
2473 `isbn` longtext DEFAULT NULL COMMENT 'ISBN (MARC21 020$a)',
2474 `issn` longtext DEFAULT NULL COMMENT 'ISSN (MARC21 022$a)',
2475 `ean` longtext DEFAULT NULL,
2476 `publicationyear` mediumtext DEFAULT NULL,
2477 `publishercode` varchar(255) DEFAULT NULL COMMENT 'publisher (MARC21 260$b)',
2478 `volumedate` date DEFAULT NULL,
2479 `volumedesc` mediumtext DEFAULT NULL COMMENT 'volume information (MARC21 362$a)',
2480 `collectiontitle` longtext DEFAULT NULL,
2481 `collectionissn` mediumtext DEFAULT NULL,
2482 `collectionvolume` longtext DEFAULT NULL,
2483 `editionstatement` mediumtext DEFAULT NULL,
2484 `editionresponsibility` mediumtext DEFAULT NULL,
2485 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2486 `illus` varchar(255) DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)',
2487 `pages` varchar(255) DEFAULT NULL COMMENT 'number of pages (MARC21 300$c)',
2488 `notes` longtext DEFAULT NULL,
2489 `size` varchar(255) DEFAULT NULL COMMENT 'material size (MARC21 300$c)',
2490 `place` varchar(255) DEFAULT NULL COMMENT 'publication place (MARC21 260$a)',
2491 `lccn` varchar(25) DEFAULT NULL COMMENT 'library of congress control number (MARC21 010$a)',
2492 `url` mediumtext DEFAULT NULL COMMENT 'url (MARC21 856$u)',
2493 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source (MARC21 942$2)',
2494 `cn_class` varchar(30) DEFAULT NULL,
2495 `cn_item` varchar(10) DEFAULT NULL,
2496 `cn_suffix` varchar(10) DEFAULT NULL,
2497 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized version of the call number used for sorting',
2498 `agerestriction` varchar(255) DEFAULT NULL COMMENT 'target audience/age restriction from the bib record (MARC21 521$a)',
2499 `totalissues` int(10) DEFAULT NULL,
2500 PRIMARY KEY (`biblioitemnumber`),
2501 KEY `bibinoidx` (`biblioitemnumber`),
2502 KEY `bibnoidx` (`biblionumber`),
2503 KEY `itemtype_idx` (`itemtype`),
2504 KEY `isbn` (`isbn`(191)),
2505 KEY `ean` (`ean`(191)),
2506 KEY `publishercode` (`publishercode`(191)),
2507 KEY `timestamp` (`timestamp`)
2508 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2509 /*!40101 SET character_set_client = @saved_cs_client */;
2512 -- Table structure for table `deletedborrowers`
2515 DROP TABLE IF EXISTS `deletedborrowers`;
2516 /*!40101 SET @saved_cs_client = @@character_set_client */;
2517 /*!40101 SET character_set_client = utf8 */;
2518 CREATE TABLE `deletedborrowers` (
2519 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key, Koha assigned ID number for patrons/borrowers',
2520 `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
2521 `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2522 `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
2523 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
2524 `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2525 `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
2526 `initials` mediumtext DEFAULT NULL COMMENT 'initials for your patron/borrower',
2527 `pronouns` longtext DEFAULT NULL COMMENT 'patron/borrower pronouns',
2528 `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',
2529 `streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s primary address',
2530 `address` longtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s primary address',
2531 `address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s primary address',
2532 `city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s primary address',
2533 `state` mediumtext DEFAULT NULL COMMENT 'the state or province for your patron/borrower''s primary address',
2534 `zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s primary address',
2535 `country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s primary address',
2536 `email` longtext DEFAULT NULL COMMENT 'the primary email address for your patron/borrower''s primary address',
2537 `phone` mediumtext DEFAULT NULL COMMENT 'the primary phone number for your patron/borrower''s primary address',
2538 `mobile` tinytext DEFAULT NULL COMMENT 'the other phone number for your patron/borrower''s primary address',
2539 `fax` longtext DEFAULT NULL COMMENT 'the fax number for your patron/borrower''s primary address',
2540 `emailpro` mediumtext DEFAULT NULL COMMENT 'the secondary email addres for your patron/borrower''s primary address',
2541 `phonepro` mediumtext DEFAULT NULL COMMENT 'the secondary phone number for your patron/borrower''s primary address',
2542 `B_streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address',
2543 `B_streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s alternate address',
2544 `B_address` mediumtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s alternate address',
2545 `B_address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s alternate address',
2546 `B_city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s alternate address',
2547 `B_state` mediumtext DEFAULT NULL COMMENT 'the state for your patron/borrower''s alternate address',
2548 `B_zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s alternate address',
2549 `B_country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s alternate address',
2550 `B_email` mediumtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate email address',
2551 `B_phone` longtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate phone number',
2552 `dateofbirth` date DEFAULT NULL COMMENT 'the patron/borrower''s date of birth (YYYY-MM-DD)',
2553 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table, includes the code of the patron/borrower''s home branch',
2554 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category',
2555 `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)',
2556 `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)',
2557 `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)',
2558 `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed',
2559 `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',
2560 `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',
2561 `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)',
2562 `debarredcomment` varchar(255) DEFAULT NULL COMMENT 'comment on the stop of patron',
2563 `contactname` longtext DEFAULT NULL COMMENT 'used for children and profesionals to include surname or last name of guarantor or organization name',
2564 `contactfirstname` mediumtext DEFAULT NULL COMMENT 'used for children to include first name of guarantor',
2565 `contacttitle` mediumtext DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor',
2566 `borrowernotes` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface',
2567 `relationship` varchar(100) DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor',
2568 `sex` varchar(1) DEFAULT NULL COMMENT 'patron/borrower''s gender',
2569 `password` varchar(60) DEFAULT NULL COMMENT 'patron/borrower''s encrypted password',
2570 `secret` mediumtext DEFAULT NULL COMMENT 'Secret for 2FA',
2571 `auth_method` enum('password','two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method',
2572 `flags` int(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions',
2573 `userid` varchar(75) DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in',
2574 `opacnote` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface',
2575 `contactnote` varchar(255) DEFAULT NULL COMMENT 'a note related to the patron/borrower''s alternate address',
2576 `sort1` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
2577 `sort2` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
2578 `altcontactfirstname` mediumtext DEFAULT NULL COMMENT 'first name of alternate contact for the patron/borrower',
2579 `altcontactsurname` mediumtext DEFAULT NULL COMMENT 'surname or last name of the alternate contact for the patron/borrower',
2580 `altcontactaddress1` mediumtext DEFAULT NULL COMMENT 'the first address line for the alternate contact for the patron/borrower',
2581 `altcontactaddress2` mediumtext DEFAULT NULL COMMENT 'the second address line for the alternate contact for the patron/borrower',
2582 `altcontactaddress3` mediumtext DEFAULT NULL COMMENT 'the city for the alternate contact for the patron/borrower',
2583 `altcontactstate` mediumtext DEFAULT NULL COMMENT 'the state for the alternate contact for the patron/borrower',
2584 `altcontactzipcode` mediumtext DEFAULT NULL COMMENT 'the zipcode for the alternate contact for the patron/borrower',
2585 `altcontactcountry` mediumtext DEFAULT NULL COMMENT 'the country for the alternate contact for the patron/borrower',
2586 `altcontactphone` mediumtext DEFAULT NULL COMMENT 'the phone number for the alternate contact for the patron/borrower',
2587 `smsalertnumber` varchar(50) DEFAULT NULL COMMENT 'the mobile phone number where the patron/borrower would like to receive notices (if SMS turned on)',
2588 `sms_provider_id` int(11) DEFAULT NULL COMMENT 'the provider of the mobile phone number defined in smsalertnumber',
2589 `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history KEY `borrowernumber` (`borrowernumber`),',
2590 `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines',
2591 `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
2592 `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''.',
2593 `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)',
2594 `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
2595 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
2596 `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
2597 `overdrive_auth_token` mediumtext DEFAULT NULL COMMENT 'persist OverDrive auth token',
2598 `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2599 `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2600 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
2601 KEY `borrowernumber` (`borrowernumber`),
2602 KEY `cardnumber` (`cardnumber`),
2603 KEY `sms_provider_id` (`sms_provider_id`)
2604 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2605 /*!40101 SET character_set_client = @saved_cs_client */;
2608 -- Table structure for table `deleteditems`
2611 DROP TABLE IF EXISTS `deleteditems`;
2612 /*!40101 SET @saved_cs_client = @@character_set_client */;
2613 /*!40101 SET character_set_client = utf8 */;
2614 CREATE TABLE `deleteditems` (
2615 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key and unique identifier added by Koha',
2616 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
2617 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
2618 `barcode` varchar(20) DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
2619 `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
2620 `booksellerid` longtext DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
2621 `homebranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
2622 `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
2623 `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
2624 `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
2625 `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out',
2626 `datelastseen` date DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
2627 `stack` tinyint(1) DEFAULT NULL,
2628 `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
2629 `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
2630 `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
2631 `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
2632 `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
2633 `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
2634 `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
2635 `itemcallnumber` varchar(255) DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
2636 `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
2637 `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out',
2638 `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
2639 `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
2640 `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
2641 `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
2642 `itemnotes_nonpublic` longtext DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
2643 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
2644 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
2645 `deleted_on` datetime DEFAULT NULL COMMENT 'date/time of deletion',
2646 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
2647 `permanent_location` varchar(80) DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
2648 `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
2649 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
2650 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
2651 `ccode` varchar(80) DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
2652 `materials` mediumtext DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
2653 `uri` mediumtext DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
2654 `itype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
2655 `more_subfields_xml` longtext DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
2656 `enumchron` mediumtext DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
2657 `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
2658 `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
2659 `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.',
2660 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
2661 PRIMARY KEY (`itemnumber`),
2662 KEY `delitembarcodeidx` (`barcode`),
2663 KEY `delitemstocknumberidx` (`stocknumber`),
2664 KEY `delitembinoidx` (`biblioitemnumber`),
2665 KEY `delitembibnoidx` (`biblionumber`),
2666 KEY `delhomebranch` (`homebranch`),
2667 KEY `delholdingbranch` (`holdingbranch`),
2668 KEY `itype_idx` (`itype`),
2669 KEY `timestamp` (`timestamp`)
2670 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2671 /*!40101 SET character_set_client = @saved_cs_client */;
2674 -- Table structure for table `desks`
2677 DROP TABLE IF EXISTS `desks`;
2678 /*!40101 SET @saved_cs_client = @@character_set_client */;
2679 /*!40101 SET character_set_client = utf8 */;
2680 CREATE TABLE `desks` (
2681 `desk_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
2682 `desk_name` varchar(100) NOT NULL DEFAULT '' COMMENT 'name of the desk',
2683 `branchcode` varchar(10) NOT NULL COMMENT 'library the desk is located at',
2684 PRIMARY KEY (`desk_id`),
2685 KEY `fk_desks_branchcode` (`branchcode`),
2686 CONSTRAINT `fk_desks_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2687 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2688 /*!40101 SET character_set_client = @saved_cs_client */;
2691 -- Table structure for table `discharges`
2694 DROP TABLE IF EXISTS `discharges`;
2695 /*!40101 SET @saved_cs_client = @@character_set_client */;
2696 /*!40101 SET character_set_client = utf8 */;
2697 CREATE TABLE `discharges` (
2698 `discharge_id` int(11) NOT NULL AUTO_INCREMENT,
2699 `borrower` int(11) DEFAULT NULL,
2700 `needed` timestamp NULL DEFAULT NULL,
2701 `validated` timestamp NULL DEFAULT NULL,
2702 PRIMARY KEY (`discharge_id`),
2703 KEY `borrower_discharges_ibfk1` (`borrower`),
2704 CONSTRAINT `borrower_discharges_ibfk1` FOREIGN KEY (`borrower`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2705 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2706 /*!40101 SET character_set_client = @saved_cs_client */;
2709 -- Table structure for table `edifact_ean`
2712 DROP TABLE IF EXISTS `edifact_ean`;
2713 /*!40101 SET @saved_cs_client = @@character_set_client */;
2714 /*!40101 SET character_set_client = utf8 */;
2715 CREATE TABLE `edifact_ean` (
2716 `ee_id` int(11) NOT NULL AUTO_INCREMENT,
2717 `description` varchar(128) DEFAULT NULL,
2718 `branchcode` varchar(10) DEFAULT NULL,
2719 `ean` varchar(15) NOT NULL,
2720 `id_code_qualifier` varchar(3) NOT NULL DEFAULT '14',
2721 PRIMARY KEY (`ee_id`),
2722 KEY `efk_branchcode` (`branchcode`),
2723 CONSTRAINT `efk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
2724 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2725 /*!40101 SET character_set_client = @saved_cs_client */;
2728 -- Table structure for table `edifact_messages`
2731 DROP TABLE IF EXISTS `edifact_messages`;
2732 /*!40101 SET @saved_cs_client = @@character_set_client */;
2733 /*!40101 SET character_set_client = utf8 */;
2734 CREATE TABLE `edifact_messages` (
2735 `id` int(11) NOT NULL AUTO_INCREMENT,
2736 `message_type` varchar(10) NOT NULL,
2737 `transfer_date` date DEFAULT NULL,
2738 `vendor_id` int(11) DEFAULT NULL,
2739 `edi_acct` int(11) DEFAULT NULL,
2740 `status` mediumtext DEFAULT NULL,
2741 `basketno` int(11) DEFAULT NULL,
2742 `raw_msg` longtext DEFAULT NULL,
2743 `filename` mediumtext DEFAULT NULL,
2744 `deleted` tinyint(1) NOT NULL DEFAULT 0,
2746 KEY `vendorid` (`vendor_id`),
2747 KEY `ediacct` (`edi_acct`),
2748 KEY `basketno` (`basketno`),
2749 CONSTRAINT `emfk_basketno` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2750 CONSTRAINT `emfk_edi_acct` FOREIGN KEY (`edi_acct`) REFERENCES `vendor_edi_accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2751 CONSTRAINT `emfk_vendor` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2752 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2753 /*!40101 SET character_set_client = @saved_cs_client */;
2756 -- Table structure for table `erm_agreement_licenses`
2759 DROP TABLE IF EXISTS `erm_agreement_licenses`;
2760 /*!40101 SET @saved_cs_client = @@character_set_client */;
2761 /*!40101 SET character_set_client = utf8 */;
2762 CREATE TABLE `erm_agreement_licenses` (
2763 `agreement_license_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2764 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2765 `license_id` int(11) NOT NULL COMMENT 'link to the license',
2766 `status` varchar(80) NOT NULL COMMENT 'current status of the license',
2767 `physical_location` varchar(80) DEFAULT NULL COMMENT 'physical location of the license',
2768 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this license',
2769 `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the license',
2770 PRIMARY KEY (`agreement_license_id`),
2771 UNIQUE KEY `erm_agreement_licenses_uniq` (`agreement_id`,`license_id`),
2772 KEY `erm_agreement_licenses_ibfk_2` (`license_id`),
2773 CONSTRAINT `erm_agreement_licenses_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2774 CONSTRAINT `erm_agreement_licenses_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE
2775 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2776 /*!40101 SET character_set_client = @saved_cs_client */;
2779 -- Table structure for table `erm_agreement_periods`
2782 DROP TABLE IF EXISTS `erm_agreement_periods`;
2783 /*!40101 SET @saved_cs_client = @@character_set_client */;
2784 /*!40101 SET character_set_client = utf8 */;
2785 CREATE TABLE `erm_agreement_periods` (
2786 `agreement_period_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2787 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2788 `started_on` date NOT NULL COMMENT 'start of the agreement period',
2789 `ended_on` date DEFAULT NULL COMMENT 'end of the agreement period',
2790 `cancellation_deadline` date DEFAULT NULL COMMENT 'Deadline for the cancellation',
2791 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this period',
2792 PRIMARY KEY (`agreement_period_id`),
2793 KEY `erm_agreement_periods_ibfk_1` (`agreement_id`),
2794 CONSTRAINT `erm_agreement_periods_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2795 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2796 /*!40101 SET character_set_client = @saved_cs_client */;
2799 -- Table structure for table `erm_agreement_relationships`
2802 DROP TABLE IF EXISTS `erm_agreement_relationships`;
2803 /*!40101 SET @saved_cs_client = @@character_set_client */;
2804 /*!40101 SET character_set_client = utf8 */;
2805 CREATE TABLE `erm_agreement_relationships` (
2806 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2807 `related_agreement_id` int(11) NOT NULL COMMENT 'link to the related agreement',
2808 `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',
2809 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
2810 PRIMARY KEY (`agreement_id`,`related_agreement_id`),
2811 KEY `erm_agreement_relationships_ibfk_2` (`related_agreement_id`),
2812 CONSTRAINT `erm_agreement_relationships_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2813 CONSTRAINT `erm_agreement_relationships_ibfk_2` FOREIGN KEY (`related_agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2814 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2815 /*!40101 SET character_set_client = @saved_cs_client */;
2818 -- Table structure for table `erm_agreements`
2821 DROP TABLE IF EXISTS `erm_agreements`;
2822 /*!40101 SET @saved_cs_client = @@character_set_client */;
2823 /*!40101 SET character_set_client = utf8 */;
2824 CREATE TABLE `erm_agreements` (
2825 `agreement_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2826 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2827 `name` varchar(255) NOT NULL COMMENT 'name of the agreement',
2828 `description` longtext DEFAULT NULL COMMENT 'description of the agreement',
2829 `status` varchar(80) NOT NULL COMMENT 'current status of the agreement',
2830 `closure_reason` varchar(80) DEFAULT NULL COMMENT 'reason of the closure',
2831 `is_perpetual` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the agreement perpetual',
2832 `renewal_priority` varchar(80) DEFAULT NULL COMMENT 'priority of the renewal',
2833 `license_info` varchar(80) DEFAULT NULL COMMENT 'info about the license',
2834 PRIMARY KEY (`agreement_id`),
2835 KEY `erm_agreements_ibfk_1` (`vendor_id`),
2836 CONSTRAINT `erm_agreements_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2837 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2838 /*!40101 SET character_set_client = @saved_cs_client */;
2841 -- Table structure for table `erm_documents`
2844 DROP TABLE IF EXISTS `erm_documents`;
2845 /*!40101 SET @saved_cs_client = @@character_set_client */;
2846 /*!40101 SET character_set_client = utf8 */;
2847 CREATE TABLE `erm_documents` (
2848 `document_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2849 `agreement_id` int(11) DEFAULT NULL COMMENT 'link to the agreement',
2850 `license_id` int(11) DEFAULT NULL COMMENT 'link to the license',
2851 `file_name` varchar(255) DEFAULT NULL COMMENT 'name of the file',
2852 `file_type` varchar(255) DEFAULT NULL COMMENT 'type of the file',
2853 `file_description` varchar(255) DEFAULT NULL COMMENT 'description of the file',
2854 `file_content` longblob DEFAULT NULL COMMENT 'the content of the file',
2855 `uploaded_on` datetime DEFAULT NULL COMMENT 'datetime when the file as attached',
2856 `physical_location` varchar(255) DEFAULT NULL COMMENT 'physical location of the document',
2857 `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the document',
2858 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
2859 PRIMARY KEY (`document_id`),
2860 KEY `erm_documents_ibfk_1` (`agreement_id`),
2861 KEY `erm_documents_ibfk_2` (`license_id`),
2862 CONSTRAINT `erm_documents_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2863 CONSTRAINT `erm_documents_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE
2864 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2865 /*!40101 SET character_set_client = @saved_cs_client */;
2868 -- Table structure for table `erm_eholdings_packages`
2871 DROP TABLE IF EXISTS `erm_eholdings_packages`;
2872 /*!40101 SET @saved_cs_client = @@character_set_client */;
2873 /*!40101 SET character_set_client = utf8 */;
2874 CREATE TABLE `erm_eholdings_packages` (
2875 `package_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2876 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2877 `name` varchar(255) NOT NULL COMMENT 'name of the package',
2878 `external_id` varchar(255) DEFAULT NULL COMMENT 'External key',
2879 `provider` enum('ebsco') DEFAULT NULL COMMENT 'External provider',
2880 `package_type` varchar(80) DEFAULT NULL COMMENT 'type of the package',
2881 `content_type` varchar(80) DEFAULT NULL COMMENT 'type of the package',
2882 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this package',
2883 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date of creation of the package',
2884 PRIMARY KEY (`package_id`),
2885 KEY `erm_eholdings_packages_ibfk_1` (`vendor_id`),
2886 CONSTRAINT `erm_eholdings_packages_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2887 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2888 /*!40101 SET character_set_client = @saved_cs_client */;
2891 -- Table structure for table `erm_eholdings_packages_agreements`
2894 DROP TABLE IF EXISTS `erm_eholdings_packages_agreements`;
2895 /*!40101 SET @saved_cs_client = @@character_set_client */;
2896 /*!40101 SET character_set_client = utf8 */;
2897 CREATE TABLE `erm_eholdings_packages_agreements` (
2898 `package_id` int(11) NOT NULL COMMENT 'link to the package',
2899 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2900 PRIMARY KEY (`package_id`,`agreement_id`),
2901 KEY `erm_eholdings_packages_agreements_ibfk_2` (`agreement_id`),
2902 CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2903 CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2904 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2905 /*!40101 SET character_set_client = @saved_cs_client */;
2908 -- Table structure for table `erm_eholdings_resources`
2911 DROP TABLE IF EXISTS `erm_eholdings_resources`;
2912 /*!40101 SET @saved_cs_client = @@character_set_client */;
2913 /*!40101 SET character_set_client = utf8 */;
2914 CREATE TABLE `erm_eholdings_resources` (
2915 `resource_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2916 `title_id` int(11) NOT NULL,
2917 `package_id` int(11) NOT NULL,
2918 `vendor_id` int(11) DEFAULT NULL,
2919 `started_on` date DEFAULT NULL,
2920 `ended_on` date DEFAULT NULL,
2921 `proxy` varchar(80) DEFAULT NULL,
2922 PRIMARY KEY (`resource_id`),
2923 UNIQUE KEY `erm_eholdings_resources_uniq` (`title_id`,`package_id`),
2924 KEY `erm_eholdings_resources_ibfk_2` (`package_id`),
2925 KEY `erm_eholdings_resources_ibfk_3` (`vendor_id`),
2926 CONSTRAINT `erm_eholdings_resources_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_eholdings_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2927 CONSTRAINT `erm_eholdings_resources_ibfk_2` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2928 CONSTRAINT `erm_eholdings_resources_ibfk_3` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2929 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2930 /*!40101 SET character_set_client = @saved_cs_client */;
2933 -- Table structure for table `erm_eholdings_titles`
2936 DROP TABLE IF EXISTS `erm_eholdings_titles`;
2937 /*!40101 SET @saved_cs_client = @@character_set_client */;
2938 /*!40101 SET character_set_client = utf8 */;
2939 CREATE TABLE `erm_eholdings_titles` (
2940 `title_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2941 `biblio_id` int(11) DEFAULT NULL,
2942 `publication_title` varchar(255) DEFAULT NULL,
2943 `external_id` varchar(255) DEFAULT NULL,
2944 `print_identifier` varchar(255) DEFAULT NULL,
2945 `online_identifier` varchar(255) DEFAULT NULL,
2946 `date_first_issue_online` varchar(255) DEFAULT NULL,
2947 `num_first_vol_online` varchar(255) DEFAULT NULL,
2948 `num_first_issue_online` varchar(255) DEFAULT NULL,
2949 `date_last_issue_online` varchar(255) DEFAULT NULL,
2950 `num_last_vol_online` varchar(255) DEFAULT NULL,
2951 `num_last_issue_online` varchar(255) DEFAULT NULL,
2952 `title_url` varchar(255) DEFAULT NULL,
2953 `first_author` varchar(255) DEFAULT NULL,
2954 `embargo_info` varchar(255) DEFAULT NULL,
2955 `coverage_depth` varchar(255) DEFAULT NULL,
2956 `notes` varchar(255) DEFAULT NULL,
2957 `publisher_name` varchar(255) DEFAULT NULL,
2958 `publication_type` varchar(80) DEFAULT NULL,
2959 `date_monograph_published_print` varchar(255) DEFAULT NULL,
2960 `date_monograph_published_online` varchar(255) DEFAULT NULL,
2961 `monograph_volume` varchar(255) DEFAULT NULL,
2962 `monograph_edition` varchar(255) DEFAULT NULL,
2963 `first_editor` varchar(255) DEFAULT NULL,
2964 `parent_publication_title_id` varchar(255) DEFAULT NULL,
2965 `preceeding_publication_title_id` varchar(255) DEFAULT NULL,
2966 `access_type` varchar(255) DEFAULT NULL,
2967 PRIMARY KEY (`title_id`),
2968 KEY `erm_eholdings_titles_ibfk_2` (`biblio_id`),
2969 CONSTRAINT `erm_eholdings_titles_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE
2970 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2971 /*!40101 SET character_set_client = @saved_cs_client */;
2974 -- Table structure for table `erm_licenses`
2977 DROP TABLE IF EXISTS `erm_licenses`;
2978 /*!40101 SET @saved_cs_client = @@character_set_client */;
2979 /*!40101 SET character_set_client = utf8 */;
2980 CREATE TABLE `erm_licenses` (
2981 `license_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2982 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2983 `name` varchar(255) NOT NULL COMMENT 'name of the license',
2984 `description` longtext DEFAULT NULL COMMENT 'description of the license',
2985 `type` varchar(80) NOT NULL COMMENT 'type of the license',
2986 `status` varchar(80) NOT NULL COMMENT 'current status of the license',
2987 `started_on` date DEFAULT NULL COMMENT 'start of the license',
2988 `ended_on` date DEFAULT NULL COMMENT 'end of the license',
2989 PRIMARY KEY (`license_id`),
2990 KEY `erm_licenses_ibfk_1` (`vendor_id`),
2991 CONSTRAINT `erm_licenses_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2992 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2993 /*!40101 SET character_set_client = @saved_cs_client */;
2996 -- Table structure for table `erm_user_roles`
2999 DROP TABLE IF EXISTS `erm_user_roles`;
3000 /*!40101 SET @saved_cs_client = @@character_set_client */;
3001 /*!40101 SET character_set_client = utf8 */;
3002 CREATE TABLE `erm_user_roles` (
3003 `user_role_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3004 `agreement_id` int(11) DEFAULT NULL COMMENT 'link to the agreement',
3005 `license_id` int(11) DEFAULT NULL COMMENT 'link to the license',
3006 `user_id` int(11) NOT NULL COMMENT 'link to the user',
3007 `role` varchar(80) NOT NULL COMMENT 'role of the user',
3008 PRIMARY KEY (`user_role_id`),
3009 KEY `erm_user_roles_ibfk_1` (`agreement_id`),
3010 KEY `erm_user_roles_ibfk_2` (`license_id`),
3011 KEY `erm_user_roles_ibfk_3` (`user_id`),
3012 CONSTRAINT `erm_user_roles_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3013 CONSTRAINT `erm_user_roles_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3014 CONSTRAINT `erm_user_roles_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3015 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3016 /*!40101 SET character_set_client = @saved_cs_client */;
3019 -- Table structure for table `export_format`
3022 DROP TABLE IF EXISTS `export_format`;
3023 /*!40101 SET @saved_cs_client = @@character_set_client */;
3024 /*!40101 SET character_set_client = utf8 */;
3025 CREATE TABLE `export_format` (
3026 `export_format_id` int(11) NOT NULL AUTO_INCREMENT,
3027 `profile` varchar(255) NOT NULL,
3028 `description` longtext NOT NULL,
3029 `content` longtext NOT NULL,
3030 `csv_separator` varchar(2) NOT NULL DEFAULT ',',
3031 `field_separator` varchar(2) DEFAULT NULL,
3032 `subfield_separator` varchar(2) DEFAULT NULL,
3033 `encoding` varchar(255) NOT NULL DEFAULT 'utf8',
3034 `type` varchar(255) DEFAULT 'marc',
3035 `used_for` varchar(255) DEFAULT 'export_records',
3036 `staff_only` tinyint(1) NOT NULL DEFAULT 0,
3037 PRIMARY KEY (`export_format_id`),
3038 KEY `used_for_idx` (`used_for`(191)),
3039 KEY `staff_only_idx` (`staff_only`)
3040 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Used for CSV export';
3041 /*!40101 SET character_set_client = @saved_cs_client */;
3044 -- Table structure for table `hold_cancellation_requests`
3047 DROP TABLE IF EXISTS `hold_cancellation_requests`;
3048 /*!40101 SET @saved_cs_client = @@character_set_client */;
3049 /*!40101 SET character_set_client = utf8 */;
3050 CREATE TABLE `hold_cancellation_requests` (
3051 `hold_cancellation_request_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the cancellation request',
3052 `hold_id` int(11) NOT NULL COMMENT 'ID of the hold',
3053 `creation_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Time and date the cancellation request was created',
3054 PRIMARY KEY (`hold_cancellation_request_id`)
3055 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3056 /*!40101 SET character_set_client = @saved_cs_client */;
3059 -- Table structure for table `hold_fill_targets`
3062 DROP TABLE IF EXISTS `hold_fill_targets`;
3063 /*!40101 SET @saved_cs_client = @@character_set_client */;
3064 /*!40101 SET character_set_client = utf8 */;
3065 CREATE TABLE `hold_fill_targets` (
3066 `borrowernumber` int(11) NOT NULL,
3067 `biblionumber` int(11) NOT NULL,
3068 `itemnumber` int(11) NOT NULL,
3069 `source_branchcode` varchar(10) DEFAULT NULL,
3070 `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
3071 `reserve_id` int(11) DEFAULT NULL,
3072 PRIMARY KEY (`itemnumber`),
3073 KEY `bib_branch` (`biblionumber`,`source_branchcode`),
3074 KEY `hold_fill_targets_ibfk_1` (`borrowernumber`),
3075 KEY `hold_fill_targets_ibfk_4` (`source_branchcode`),
3076 CONSTRAINT `hold_fill_targets_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3077 CONSTRAINT `hold_fill_targets_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3078 CONSTRAINT `hold_fill_targets_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3079 CONSTRAINT `hold_fill_targets_ibfk_4` FOREIGN KEY (`source_branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
3080 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3081 /*!40101 SET character_set_client = @saved_cs_client */;
3084 -- Table structure for table `housebound_profile`
3087 DROP TABLE IF EXISTS `housebound_profile`;
3088 /*!40101 SET @saved_cs_client = @@character_set_client */;
3089 /*!40101 SET character_set_client = utf8 */;
3090 CREATE TABLE `housebound_profile` (
3091 `borrowernumber` int(11) NOT NULL COMMENT 'Number of the borrower associated with this profile.',
3092 `day` mediumtext NOT NULL COMMENT 'The preferred day of the week for delivery.',
3093 `frequency` mediumtext NOT NULL COMMENT 'The Authorised_Value definining the pattern for delivery.',
3094 `fav_itemtypes` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred itemtypes.',
3095 `fav_subjects` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred subjects.',
3096 `fav_authors` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred authors.',
3097 `referral` mediumtext DEFAULT NULL COMMENT 'Free text indicating how the borrower was added to the service.',
3098 `notes` mediumtext DEFAULT NULL COMMENT 'Free text for additional notes.',
3099 PRIMARY KEY (`borrowernumber`),
3100 CONSTRAINT `housebound_profile_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3101 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3102 /*!40101 SET character_set_client = @saved_cs_client */;
3105 -- Table structure for table `housebound_role`
3108 DROP TABLE IF EXISTS `housebound_role`;
3109 /*!40101 SET @saved_cs_client = @@character_set_client */;
3110 /*!40101 SET character_set_client = utf8 */;
3111 CREATE TABLE `housebound_role` (
3112 `borrowernumber_id` int(11) NOT NULL COMMENT 'borrowernumber link',
3113 `housebound_chooser` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'set to 1 to indicate this patron is a housebound chooser volunteer',
3114 `housebound_deliverer` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'set to 1 to indicate this patron is a housebound deliverer volunteer',
3115 PRIMARY KEY (`borrowernumber_id`),
3116 CONSTRAINT `houseboundrole_bnfk` FOREIGN KEY (`borrowernumber_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3117 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3118 /*!40101 SET character_set_client = @saved_cs_client */;
3121 -- Table structure for table `housebound_visit`
3124 DROP TABLE IF EXISTS `housebound_visit`;
3125 /*!40101 SET @saved_cs_client = @@character_set_client */;
3126 /*!40101 SET character_set_client = utf8 */;
3127 CREATE TABLE `housebound_visit` (
3128 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the visit.',
3129 `borrowernumber` int(11) NOT NULL COMMENT 'Number of the borrower, & the profile, linked to this visit.',
3130 `appointment_date` date DEFAULT NULL COMMENT 'Date of visit.',
3131 `day_segment` varchar(10) DEFAULT NULL COMMENT 'Rough time frame: ''morning'', ''afternoon'' ''evening''',
3132 `chooser_brwnumber` int(11) DEFAULT NULL COMMENT 'Number of the borrower to choose items for delivery.',
3133 `deliverer_brwnumber` int(11) DEFAULT NULL COMMENT 'Number of the borrower to deliver items.',
3135 KEY `houseboundvisit_bnfk` (`borrowernumber`),
3136 KEY `houseboundvisit_bnfk_1` (`chooser_brwnumber`),
3137 KEY `houseboundvisit_bnfk_2` (`deliverer_brwnumber`),
3138 CONSTRAINT `houseboundvisit_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `housebound_profile` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3139 CONSTRAINT `houseboundvisit_bnfk_1` FOREIGN KEY (`chooser_brwnumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3140 CONSTRAINT `houseboundvisit_bnfk_2` FOREIGN KEY (`deliverer_brwnumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3141 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3142 /*!40101 SET character_set_client = @saved_cs_client */;
3145 -- Table structure for table `identity_provider_domains`
3148 DROP TABLE IF EXISTS `identity_provider_domains`;
3149 /*!40101 SET @saved_cs_client = @@character_set_client */;
3150 /*!40101 SET character_set_client = utf8 */;
3151 CREATE TABLE `identity_provider_domains` (
3152 `identity_provider_domain_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify providers domain',
3153 `identity_provider_id` int(11) NOT NULL COMMENT 'Reference to provider',
3154 `domain` varchar(100) DEFAULT NULL COMMENT 'Domain name. If null means all domains',
3155 `auto_register` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Allow user auto register',
3156 `update_on_auth` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Update user data on auth login',
3157 `default_library_id` varchar(10) DEFAULT NULL COMMENT 'Default library to create user if auto register is enabled',
3158 `default_category_id` varchar(10) DEFAULT NULL COMMENT 'Default category to create user if auto register is enabled',
3159 `allow_opac` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Allow provider from opac interface',
3160 `allow_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Allow provider from staff interface',
3161 PRIMARY KEY (`identity_provider_domain_id`),
3162 UNIQUE KEY `identity_provider_id` (`identity_provider_id`,`domain`),
3163 KEY `domain` (`domain`),
3164 KEY `allow_opac` (`allow_opac`),
3165 KEY `allow_staff` (`allow_staff`),
3166 KEY `identity_provider_domain_ibfk_2` (`default_library_id`),
3167 KEY `identity_provider_domain_ibfk_3` (`default_category_id`),
3168 CONSTRAINT `identity_provider_domain_ibfk_1` FOREIGN KEY (`identity_provider_id`) REFERENCES `identity_providers` (`identity_provider_id`) ON DELETE CASCADE,
3169 CONSTRAINT `identity_provider_domain_ibfk_2` FOREIGN KEY (`default_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
3170 CONSTRAINT `identity_provider_domain_ibfk_3` FOREIGN KEY (`default_category_id`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE
3171 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3172 /*!40101 SET character_set_client = @saved_cs_client */;
3175 -- Table structure for table `identity_providers`
3178 DROP TABLE IF EXISTS `identity_providers`;
3179 /*!40101 SET @saved_cs_client = @@character_set_client */;
3180 /*!40101 SET character_set_client = utf8 */;
3181 CREATE TABLE `identity_providers` (
3182 `identity_provider_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify the provider',
3183 `code` varchar(20) NOT NULL COMMENT 'Provider code',
3184 `description` varchar(255) NOT NULL COMMENT 'Description for the provider',
3185 `protocol` enum('OAuth','OIDC','LDAP','CAS') NOT NULL COMMENT 'Protocol provider speaks',
3186 `config` longtext NOT NULL COMMENT 'Configuration of the provider in JSON format',
3187 `mapping` longtext NOT NULL COMMENT 'Configuration to map provider data to Koha user',
3188 `matchpoint` enum('email','userid','cardnumber') NOT NULL COMMENT 'The patron attribute to be used as matchpoint',
3189 `icon_url` varchar(255) DEFAULT NULL COMMENT 'Provider icon URL',
3190 PRIMARY KEY (`identity_provider_id`),
3191 UNIQUE KEY `code` (`code`),
3192 KEY `protocol` (`protocol`)
3193 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3194 /*!40101 SET character_set_client = @saved_cs_client */;
3197 -- Table structure for table `illcomments`
3200 DROP TABLE IF EXISTS `illcomments`;
3201 /*!40101 SET @saved_cs_client = @@character_set_client */;
3202 /*!40101 SET character_set_client = utf8 */;
3203 CREATE TABLE `illcomments` (
3204 `illcomment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the comment',
3205 `illrequest_id` bigint(20) unsigned NOT NULL COMMENT 'ILL request number',
3206 `borrowernumber` int(11) DEFAULT NULL COMMENT 'Link to the user who made the comment (could be librarian, patron or ILL partner library)',
3207 `comment` text DEFAULT NULL COMMENT 'The text of the comment',
3208 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date and time when the comment was made',
3209 PRIMARY KEY (`illcomment_id`),
3210 KEY `illcomments_bnfk` (`borrowernumber`),
3211 KEY `illcomments_ifk` (`illrequest_id`),
3212 CONSTRAINT `illcomments_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3213 CONSTRAINT `illcomments_ifk` FOREIGN KEY (`illrequest_id`) REFERENCES `illrequests` (`illrequest_id`) ON DELETE CASCADE ON UPDATE CASCADE
3214 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3215 /*!40101 SET character_set_client = @saved_cs_client */;
3218 -- Table structure for table `illrequestattributes`
3221 DROP TABLE IF EXISTS `illrequestattributes`;
3222 /*!40101 SET @saved_cs_client = @@character_set_client */;
3223 /*!40101 SET character_set_client = utf8 */;
3224 CREATE TABLE `illrequestattributes` (
3225 `illrequest_id` bigint(20) unsigned NOT NULL COMMENT 'ILL request number',
3226 `type` varchar(200) NOT NULL COMMENT 'API ILL property name',
3227 `value` mediumtext NOT NULL COMMENT 'API ILL property value',
3228 `readonly` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Is this attribute read only',
3229 PRIMARY KEY (`illrequest_id`,`type`(191)),
3230 CONSTRAINT `illrequestattributes_ifk` FOREIGN KEY (`illrequest_id`) REFERENCES `illrequests` (`illrequest_id`) ON DELETE CASCADE ON UPDATE CASCADE
3231 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3232 /*!40101 SET character_set_client = @saved_cs_client */;
3235 -- Table structure for table `illrequests`
3238 DROP TABLE IF EXISTS `illrequests`;
3239 /*!40101 SET @saved_cs_client = @@character_set_client */;
3240 /*!40101 SET character_set_client = utf8 */;
3241 CREATE TABLE `illrequests` (
3242 `illrequest_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ILL request number',
3243 `borrowernumber` int(11) DEFAULT NULL COMMENT 'Patron associated with request',
3244 `biblio_id` int(11) DEFAULT NULL COMMENT 'Potential bib linked to request',
3245 `due_date` datetime DEFAULT NULL COMMENT 'Custom date due specified by backend, leave NULL for default date_due calculation',
3246 `branchcode` varchar(50) NOT NULL COMMENT 'The branch associated with the request',
3247 `status` varchar(50) DEFAULT NULL COMMENT 'Current Koha status of request',
3248 `status_alias` varchar(80) DEFAULT NULL COMMENT 'Foreign key to relevant authorised_values.authorised_value',
3249 `placed` date DEFAULT NULL COMMENT 'Date the request was placed',
3250 `replied` date DEFAULT NULL COMMENT 'Last API response',
3251 `updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
3252 `completed` date DEFAULT NULL COMMENT 'Date the request was completed',
3253 `medium` varchar(30) DEFAULT NULL COMMENT 'The Koha request type',
3254 `accessurl` varchar(500) DEFAULT NULL COMMENT 'Potential URL for accessing item',
3255 `cost` varchar(20) DEFAULT NULL COMMENT 'Quotes cost of request',
3256 `price_paid` varchar(20) DEFAULT NULL COMMENT 'Final cost of request',
3257 `notesopac` mediumtext DEFAULT NULL COMMENT 'Patron notes attached to request',
3258 `notesstaff` mediumtext DEFAULT NULL COMMENT 'Staff notes attached to request',
3259 `orderid` varchar(50) DEFAULT NULL COMMENT 'Backend id attached to request',
3260 `backend` varchar(20) DEFAULT NULL COMMENT 'The backend used to create request',
3261 PRIMARY KEY (`illrequest_id`),
3262 KEY `illrequests_bnfk` (`borrowernumber`),
3263 KEY `illrequests_bcfk_2` (`branchcode`),
3264 KEY `illrequests_safk` (`status_alias`),
3265 CONSTRAINT `illrequests_bcfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3266 CONSTRAINT `illrequests_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3267 CONSTRAINT `illrequests_safk` FOREIGN KEY (`status_alias`) REFERENCES `authorised_values` (`authorised_value`) ON DELETE SET NULL ON UPDATE CASCADE
3268 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3269 /*!40101 SET character_set_client = @saved_cs_client */;
3272 -- Table structure for table `import_auths`
3275 DROP TABLE IF EXISTS `import_auths`;
3276 /*!40101 SET @saved_cs_client = @@character_set_client */;
3277 /*!40101 SET character_set_client = utf8 */;
3278 CREATE TABLE `import_auths` (
3279 `import_record_id` int(11) NOT NULL,
3280 `matched_authid` int(11) DEFAULT NULL,
3281 `control_number` varchar(25) DEFAULT NULL,
3282 `authorized_heading` varchar(128) DEFAULT NULL,
3283 `original_source` varchar(25) DEFAULT NULL,
3284 KEY `import_auths_ibfk_1` (`import_record_id`),
3285 KEY `matched_authid` (`matched_authid`),
3286 CONSTRAINT `import_auths_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3287 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3288 /*!40101 SET character_set_client = @saved_cs_client */;
3291 -- Table structure for table `import_batch_profiles`
3294 DROP TABLE IF EXISTS `import_batch_profiles`;
3295 /*!40101 SET @saved_cs_client = @@character_set_client */;
3296 /*!40101 SET character_set_client = utf8 */;
3297 CREATE TABLE `import_batch_profiles` (
3298 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3299 `name` varchar(100) NOT NULL COMMENT 'name of this profile',
3300 `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3301 `template_id` int(11) DEFAULT NULL COMMENT 'the id of the marc modification template',
3302 `overlay_action` varchar(50) DEFAULT NULL COMMENT 'how to handle duplicate records',
3303 `nomatch_action` varchar(50) DEFAULT NULL COMMENT 'how to handle records where no match is found',
3304 `item_action` varchar(50) DEFAULT NULL COMMENT 'what to do with item records',
3305 `parse_items` tinyint(1) DEFAULT NULL COMMENT 'should items be parsed',
3306 `record_type` varchar(50) DEFAULT NULL COMMENT 'type of record in the batch',
3307 `encoding` varchar(50) DEFAULT NULL COMMENT 'file encoding',
3308 `format` varchar(50) DEFAULT NULL COMMENT 'marc format',
3309 `comments` longtext DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3311 UNIQUE KEY `u_import_batch_profiles__name` (`name`)
3312 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3313 /*!40101 SET character_set_client = @saved_cs_client */;
3316 -- Table structure for table `import_batches`
3319 DROP TABLE IF EXISTS `import_batches`;
3320 /*!40101 SET @saved_cs_client = @@character_set_client */;
3321 /*!40101 SET character_set_client = utf8 */;
3322 CREATE TABLE `import_batches` (
3323 `import_batch_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3324 `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3325 `template_id` int(11) DEFAULT NULL,
3326 `branchcode` varchar(10) DEFAULT NULL,
3327 `num_records` int(11) NOT NULL DEFAULT 0 COMMENT 'number of records in the file',
3328 `num_items` int(11) NOT NULL DEFAULT 0 COMMENT 'number of items in the file',
3329 `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was uploaded',
3330 `overlay_action` enum('replace','create_new','use_template','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle duplicate records',
3331 `nomatch_action` enum('create_new','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle records where no match is found',
3332 `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',
3333 `import_status` enum('staging','staged','importing','imported','reverting','reverted','cleaned') NOT NULL DEFAULT 'staging' COMMENT 'the status of the imported file',
3334 `batch_type` enum('batch','z3950','webservice') NOT NULL DEFAULT 'batch' COMMENT 'where this batch has come from',
3335 `record_type` enum('biblio','auth','holdings') NOT NULL DEFAULT 'biblio' COMMENT 'type of record in the batch',
3336 `file_name` varchar(100) DEFAULT NULL COMMENT 'the name of the file uploaded',
3337 `comments` longtext DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3338 `profile_id` int(11) DEFAULT NULL,
3339 PRIMARY KEY (`import_batch_id`),
3340 KEY `branchcode` (`branchcode`),
3341 KEY `import_batches_ibfk_1` (`profile_id`),
3342 CONSTRAINT `import_batches_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `import_batch_profiles` (`id`) ON DELETE SET NULL ON UPDATE SET NULL
3343 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3344 /*!40101 SET character_set_client = @saved_cs_client */;
3347 -- Table structure for table `import_biblios`
3350 DROP TABLE IF EXISTS `import_biblios`;
3351 /*!40101 SET @saved_cs_client = @@character_set_client */;
3352 /*!40101 SET character_set_client = utf8 */;
3353 CREATE TABLE `import_biblios` (
3354 `import_record_id` int(11) NOT NULL,
3355 `matched_biblionumber` int(11) DEFAULT NULL,
3356 `control_number` varchar(25) DEFAULT NULL,
3357 `original_source` varchar(25) DEFAULT NULL,
3358 `title` longtext DEFAULT NULL,
3359 `author` longtext DEFAULT NULL,
3360 `isbn` longtext DEFAULT NULL,
3361 `issn` longtext DEFAULT NULL,
3362 `has_items` tinyint(1) NOT NULL DEFAULT 0,
3363 PRIMARY KEY (`import_record_id`),
3364 KEY `import_biblios_ibfk_1` (`import_record_id`),
3365 KEY `matched_biblionumber` (`matched_biblionumber`),
3366 KEY `title` (`title`(191)),
3367 KEY `isbn` (`isbn`(191)),
3368 CONSTRAINT `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3369 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3370 /*!40101 SET character_set_client = @saved_cs_client */;
3373 -- Table structure for table `import_items`
3376 DROP TABLE IF EXISTS `import_items`;
3377 /*!40101 SET @saved_cs_client = @@character_set_client */;
3378 /*!40101 SET character_set_client = utf8 */;
3379 CREATE TABLE `import_items` (
3380 `import_items_id` int(11) NOT NULL AUTO_INCREMENT,
3381 `import_record_id` int(11) NOT NULL,
3382 `itemnumber` int(11) DEFAULT NULL,
3383 `branchcode` varchar(10) DEFAULT NULL,
3384 `status` enum('error','staged','imported','reverted','ignored') NOT NULL DEFAULT 'staged',
3385 `marcxml` longtext NOT NULL,
3386 `import_error` longtext DEFAULT NULL,
3387 PRIMARY KEY (`import_items_id`),
3388 KEY `import_items_ibfk_1` (`import_record_id`),
3389 KEY `itemnumber` (`itemnumber`),
3390 KEY `branchcode` (`branchcode`),
3391 CONSTRAINT `import_items_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
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_record_matches`
3399 DROP TABLE IF EXISTS `import_record_matches`;
3400 /*!40101 SET @saved_cs_client = @@character_set_client */;
3401 /*!40101 SET character_set_client = utf8 */;
3402 CREATE TABLE `import_record_matches` (
3403 `import_record_id` int(11) NOT NULL COMMENT 'the id given to the imported bib record (import_records.import_record_id)',
3404 `candidate_match_id` int(11) NOT NULL COMMENT 'the biblio the imported record matches (biblio.biblionumber)',
3405 `score` int(11) NOT NULL DEFAULT 0 COMMENT 'the match score',
3406 `chosen` tinyint(1) DEFAULT NULL COMMENT 'whether this match has been allowed or denied',
3407 PRIMARY KEY (`import_record_id`,`candidate_match_id`),
3408 KEY `record_score` (`import_record_id`,`score`),
3409 CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3410 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3411 /*!40101 SET character_set_client = @saved_cs_client */;
3414 -- Table structure for table `import_records`
3417 DROP TABLE IF EXISTS `import_records`;
3418 /*!40101 SET @saved_cs_client = @@character_set_client */;
3419 /*!40101 SET character_set_client = utf8 */;
3420 CREATE TABLE `import_records` (
3421 `import_record_id` int(11) NOT NULL AUTO_INCREMENT,
3422 `import_batch_id` int(11) NOT NULL,
3423 `branchcode` varchar(10) DEFAULT NULL,
3424 `record_sequence` int(11) NOT NULL DEFAULT 0,
3425 `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
3426 `import_date` date DEFAULT NULL,
3427 `marc` longblob NOT NULL,
3428 `marcxml` longtext NOT NULL,
3429 `marcxml_old` longtext NOT NULL,
3430 `record_type` enum('biblio','auth','holdings') NOT NULL DEFAULT 'biblio',
3431 `overlay_status` enum('no_match','auto_match','manual_match','match_applied') NOT NULL DEFAULT 'no_match',
3432 `status` enum('error','staged','imported','reverted','items_reverted','ignored') NOT NULL DEFAULT 'staged',
3433 `import_error` longtext DEFAULT NULL,
3434 `encoding` varchar(40) NOT NULL DEFAULT '',
3435 PRIMARY KEY (`import_record_id`),
3436 KEY `branchcode` (`branchcode`),
3437 KEY `batch_sequence` (`import_batch_id`,`record_sequence`),
3438 KEY `batch_id_record_type` (`import_batch_id`,`record_type`),
3439 CONSTRAINT `import_records_ifbk_1` FOREIGN KEY (`import_batch_id`) REFERENCES `import_batches` (`import_batch_id`) ON DELETE CASCADE ON UPDATE CASCADE
3440 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3441 /*!40101 SET character_set_client = @saved_cs_client */;
3444 -- Table structure for table `issues`
3447 DROP TABLE IF EXISTS `issues`;
3448 /*!40101 SET @saved_cs_client = @@character_set_client */;
3449 /*!40101 SET character_set_client = utf8 */;
3450 CREATE TABLE `issues` (
3451 `issue_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key for issues table',
3452 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
3453 `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
3454 `itemnumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
3455 `date_due` datetime DEFAULT NULL COMMENT 'datetime the item is due (yyyy-mm-dd hh:mm::ss)',
3456 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
3457 `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned, will be NULL until moved to old_issues',
3458 `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
3459 `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
3460 `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
3461 `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
3462 `auto_renew_error` varchar(32) DEFAULT NULL COMMENT 'automatic renewal error',
3463 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
3464 `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
3465 `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
3466 `note` longtext DEFAULT NULL COMMENT 'issue note text',
3467 `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
3468 `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
3469 PRIMARY KEY (`issue_id`),
3470 UNIQUE KEY `itemnumber` (`itemnumber`),
3471 KEY `issuesborridx` (`borrowernumber`),
3472 KEY `itemnumber_idx` (`itemnumber`),
3473 KEY `branchcode_idx` (`branchcode`),
3474 KEY `bordate` (`borrowernumber`,`timestamp`),
3475 KEY `issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
3476 CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE,
3477 CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE,
3478 CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3479 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3480 /*!40101 SET character_set_client = @saved_cs_client */;
3483 -- Table structure for table `item_bundles`
3486 DROP TABLE IF EXISTS `item_bundles`;
3487 /*!40101 SET @saved_cs_client = @@character_set_client */;
3488 /*!40101 SET character_set_client = utf8 */;
3489 CREATE TABLE `item_bundles` (
3490 `item` int(11) NOT NULL,
3491 `host` int(11) NOT NULL,
3492 PRIMARY KEY (`host`,`item`),
3493 UNIQUE KEY `item_bundles_uniq_1` (`item`),
3494 CONSTRAINT `item_bundles_ibfk_1` FOREIGN KEY (`item`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3495 CONSTRAINT `item_bundles_ibfk_2` FOREIGN KEY (`host`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3496 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3497 /*!40101 SET character_set_client = @saved_cs_client */;
3500 -- Table structure for table `item_circulation_alert_preferences`
3503 DROP TABLE IF EXISTS `item_circulation_alert_preferences`;
3504 /*!40101 SET @saved_cs_client = @@character_set_client */;
3505 /*!40101 SET character_set_client = utf8 */;
3506 CREATE TABLE `item_circulation_alert_preferences` (
3507 `id` int(11) NOT NULL AUTO_INCREMENT,
3508 `branchcode` varchar(10) NOT NULL,
3509 `categorycode` varchar(10) NOT NULL,
3510 `item_type` varchar(10) NOT NULL,
3511 `notification` varchar(16) NOT NULL,
3513 KEY `branchcode` (`branchcode`,`categorycode`,`item_type`,`notification`)
3514 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3515 /*!40101 SET character_set_client = @saved_cs_client */;
3518 -- Table structure for table `item_editor_templates`
3521 DROP TABLE IF EXISTS `item_editor_templates`;
3522 /*!40101 SET @saved_cs_client = @@character_set_client */;
3523 /*!40101 SET character_set_client = utf8 */;
3524 CREATE TABLE `item_editor_templates` (
3525 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the template',
3526 `patron_id` int(11) DEFAULT NULL COMMENT 'creator of this template',
3527 `name` mediumtext NOT NULL COMMENT 'template name',
3528 `is_shared` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if template is shared',
3529 `contents` longtext NOT NULL COMMENT 'json encoded template data',
3531 KEY `bn` (`patron_id`),
3532 CONSTRAINT `bn` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3533 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3534 /*!40101 SET character_set_client = @saved_cs_client */;
3537 -- Table structure for table `item_group_items`
3540 DROP TABLE IF EXISTS `item_group_items`;
3541 /*!40101 SET @saved_cs_client = @@character_set_client */;
3542 /*!40101 SET character_set_client = utf8 */;
3543 CREATE TABLE `item_group_items` (
3544 `item_group_items_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the group/item link',
3545 `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',
3546 `item_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the items table',
3547 PRIMARY KEY (`item_group_items_id`),
3548 UNIQUE KEY `item_id` (`item_id`),
3549 KEY `item_group_items_gifk_1` (`item_group_id`),
3550 CONSTRAINT `item_group_items_gifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3551 CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3552 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3553 /*!40101 SET character_set_client = @saved_cs_client */;
3556 -- Table structure for table `item_groups`
3559 DROP TABLE IF EXISTS `item_groups`;
3560 /*!40101 SET @saved_cs_client = @@character_set_client */;
3561 /*!40101 SET character_set_client = utf8 */;
3562 CREATE TABLE `item_groups` (
3563 `item_group_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the items group',
3564 `biblio_id` int(11) NOT NULL DEFAULT 0 COMMENT 'id for the bibliographic record the group belongs to',
3565 `display_order` int(4) NOT NULL DEFAULT 0 COMMENT 'The ''sort order'' for item_groups',
3566 `description` mediumtext DEFAULT NULL COMMENT 'A group description',
3567 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the group was created',
3568 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the group',
3569 PRIMARY KEY (`item_group_id`),
3570 KEY `item_groups_ibfk_1` (`biblio_id`),
3571 CONSTRAINT `item_groups_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
3572 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3573 /*!40101 SET character_set_client = @saved_cs_client */;
3576 -- Table structure for table `items`
3579 DROP TABLE IF EXISTS `items`;
3580 /*!40101 SET @saved_cs_client = @@character_set_client */;
3581 /*!40101 SET character_set_client = utf8 */;
3582 CREATE TABLE `items` (
3583 `itemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier added by Koha',
3584 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
3585 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
3586 `barcode` varchar(20) DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
3587 `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
3588 `booksellerid` longtext DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
3589 `homebranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
3590 `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
3591 `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
3592 `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
3593 `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out/issued',
3594 `datelastseen` date DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
3595 `stack` tinyint(1) DEFAULT NULL,
3596 `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
3597 `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
3598 `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
3599 `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
3600 `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
3601 `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
3602 `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
3603 `itemcallnumber` varchar(255) DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
3604 `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
3605 `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out/issued',
3606 `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
3607 `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
3608 `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
3609 `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
3610 `itemnotes_nonpublic` longtext DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
3611 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
3612 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
3613 `deleted_on` datetime DEFAULT NULL COMMENT 'date/time of deletion',
3614 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
3615 `permanent_location` varchar(80) DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
3616 `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
3617 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
3618 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
3619 `ccode` varchar(80) DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
3620 `materials` mediumtext DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
3621 `uri` mediumtext DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
3622 `itype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
3623 `more_subfields_xml` longtext DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
3624 `enumchron` mediumtext DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
3625 `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
3626 `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
3627 `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.',
3628 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
3629 PRIMARY KEY (`itemnumber`),
3630 UNIQUE KEY `itembarcodeidx` (`barcode`),
3631 KEY `itemstocknumberidx` (`stocknumber`),
3632 KEY `itembinoidx` (`biblioitemnumber`),
3633 KEY `itembibnoidx` (`biblionumber`),
3634 KEY `homebranch` (`homebranch`),
3635 KEY `holdingbranch` (`holdingbranch`),
3636 KEY `itemcallnumber` (`itemcallnumber`(191)),
3637 KEY `items_location` (`location`),
3638 KEY `items_ccode` (`ccode`),
3639 KEY `itype_idx` (`itype`),
3640 KEY `timestamp` (`timestamp`),
3641 CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3642 CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
3643 CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
3644 CONSTRAINT `items_ibfk_4` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
3645 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3646 /*!40101 SET character_set_client = @saved_cs_client */;
3649 -- Table structure for table `items_last_borrower`
3652 DROP TABLE IF EXISTS `items_last_borrower`;
3653 /*!40101 SET @saved_cs_client = @@character_set_client */;
3654 /*!40101 SET character_set_client = utf8 */;
3655 CREATE TABLE `items_last_borrower` (
3656 `id` int(11) NOT NULL AUTO_INCREMENT,
3657 `itemnumber` int(11) NOT NULL,
3658 `borrowernumber` int(11) NOT NULL,
3659 `created_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
3661 UNIQUE KEY `itemnumber` (`itemnumber`),
3662 KEY `borrowernumber` (`borrowernumber`),
3663 CONSTRAINT `items_last_borrower_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3664 CONSTRAINT `items_last_borrower_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3665 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3666 /*!40101 SET character_set_client = @saved_cs_client */;
3669 -- Table structure for table `items_search_fields`
3672 DROP TABLE IF EXISTS `items_search_fields`;
3673 /*!40101 SET @saved_cs_client = @@character_set_client */;
3674 /*!40101 SET character_set_client = utf8 */;
3675 CREATE TABLE `items_search_fields` (
3676 `name` varchar(255) NOT NULL,
3677 `label` varchar(255) NOT NULL,
3678 `tagfield` char(3) NOT NULL,
3679 `tagsubfield` char(1) DEFAULT NULL,
3680 `authorised_values_category` varchar(32) DEFAULT NULL,
3681 PRIMARY KEY (`name`(191)),
3682 KEY `items_search_fields_authorised_values_category` (`authorised_values_category`),
3683 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
3684 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3685 /*!40101 SET character_set_client = @saved_cs_client */;
3688 -- Table structure for table `itemtypes`
3691 DROP TABLE IF EXISTS `itemtypes`;
3692 /*!40101 SET @saved_cs_client = @@character_set_client */;
3693 /*!40101 SET character_set_client = utf8 */;
3694 CREATE TABLE `itemtypes` (
3695 `itemtype` varchar(10) NOT NULL DEFAULT '' COMMENT 'unique key, a code associated with the item type',
3696 `parent_type` varchar(10) DEFAULT NULL COMMENT 'unique key, a code associated with the item type',
3697 `description` longtext DEFAULT NULL COMMENT 'a plain text explanation of the item type',
3698 `rentalcharge` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged when this item is checked out/issued',
3699 `rentalcharge_daily` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each day between checkout date and due date',
3700 `rentalcharge_daily_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the daily rental fee is calculated directly or using finesCalendar',
3701 `rentalcharge_hourly` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each hour between checkout date and due date',
3702 `rentalcharge_hourly_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the hourly rental fee is calculated directly or using finesCalendar',
3703 `defaultreplacecost` decimal(28,6) DEFAULT NULL COMMENT 'default replacement cost',
3704 `processfee` decimal(28,6) DEFAULT NULL COMMENT 'default text be recorded in the column note when the processing fee is applied',
3705 `notforloan` smallint(6) DEFAULT NULL COMMENT '1 if the item is not for loan, 0 if the item is available for loan',
3706 `imageurl` varchar(200) DEFAULT NULL COMMENT 'URL for the item type icon',
3707 `summary` mediumtext DEFAULT NULL COMMENT 'information from the summary field, may include HTML',
3708 `checkinmsg` varchar(255) DEFAULT NULL COMMENT 'message that is displayed when an item with the given item type is checked in',
3709 `checkinmsgtype` char(16) NOT NULL DEFAULT 'message' COMMENT 'type (CSS class) for the checkinmsg, can be ''alert'' or ''message''',
3710 `sip_media_type` varchar(3) DEFAULT NULL COMMENT 'SIP2 protocol media type for this itemtype',
3711 `hideinopac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Hide the item type from the search options in OPAC',
3712 `searchcategory` varchar(80) DEFAULT NULL COMMENT 'Group this item type with others with the same value on OPAC search options',
3713 `automatic_checkin` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If automatic checkin is enabled for items of this type',
3714 PRIMARY KEY (`itemtype`),
3715 UNIQUE KEY `itemtype` (`itemtype`),
3716 KEY `itemtypes_ibfk_1` (`parent_type`),
3717 CONSTRAINT `itemtypes_ibfk_1` FOREIGN KEY (`parent_type`) REFERENCES `itemtypes` (`itemtype`)
3718 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3719 /*!40101 SET character_set_client = @saved_cs_client */;
3722 -- Table structure for table `itemtypes_branches`
3725 DROP TABLE IF EXISTS `itemtypes_branches`;
3726 /*!40101 SET @saved_cs_client = @@character_set_client */;
3727 /*!40101 SET character_set_client = utf8 */;
3728 CREATE TABLE `itemtypes_branches` (
3729 `itemtype` varchar(10) NOT NULL,
3730 `branchcode` varchar(10) NOT NULL,
3731 KEY `itemtype` (`itemtype`),
3732 KEY `branchcode` (`branchcode`),
3733 CONSTRAINT `itemtypes_branches_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE,
3734 CONSTRAINT `itemtypes_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
3735 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3736 /*!40101 SET character_set_client = @saved_cs_client */;
3739 -- Table structure for table `keyboard_shortcuts`
3742 DROP TABLE IF EXISTS `keyboard_shortcuts`;
3743 /*!40101 SET @saved_cs_client = @@character_set_client */;
3744 /*!40101 SET character_set_client = utf8 */;
3745 CREATE TABLE `keyboard_shortcuts` (
3746 `shortcut_name` varchar(80) NOT NULL,
3747 `shortcut_keys` varchar(80) NOT NULL,
3748 PRIMARY KEY (`shortcut_name`)
3749 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3750 /*!40101 SET character_set_client = @saved_cs_client */;
3753 -- Table structure for table `language_descriptions`
3756 DROP TABLE IF EXISTS `language_descriptions`;
3757 /*!40101 SET @saved_cs_client = @@character_set_client */;
3758 /*!40101 SET character_set_client = utf8 */;
3759 CREATE TABLE `language_descriptions` (
3760 `subtag` varchar(25) DEFAULT NULL,
3761 `type` varchar(25) DEFAULT NULL,
3762 `lang` varchar(25) DEFAULT NULL,
3763 `description` varchar(255) DEFAULT NULL,
3764 `id` int(11) NOT NULL AUTO_INCREMENT,
3766 UNIQUE KEY `uniq_desc` (`subtag`,`type`,`lang`),
3768 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3769 /*!40101 SET character_set_client = @saved_cs_client */;
3772 -- Table structure for table `language_rfc4646_to_iso639`
3775 DROP TABLE IF EXISTS `language_rfc4646_to_iso639`;
3776 /*!40101 SET @saved_cs_client = @@character_set_client */;
3777 /*!40101 SET character_set_client = utf8 */;
3778 CREATE TABLE `language_rfc4646_to_iso639` (
3779 `rfc4646_subtag` varchar(25) DEFAULT NULL,
3780 `iso639_2_code` varchar(25) DEFAULT NULL,
3781 `id` int(11) NOT NULL AUTO_INCREMENT,
3783 UNIQUE KEY `uniq_code` (`rfc4646_subtag`,`iso639_2_code`),
3784 KEY `rfc4646_subtag` (`rfc4646_subtag`)
3785 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3786 /*!40101 SET character_set_client = @saved_cs_client */;
3789 -- Table structure for table `language_script_bidi`
3792 DROP TABLE IF EXISTS `language_script_bidi`;
3793 /*!40101 SET @saved_cs_client = @@character_set_client */;
3794 /*!40101 SET character_set_client = utf8 */;
3795 CREATE TABLE `language_script_bidi` (
3796 `rfc4646_subtag` varchar(25) DEFAULT NULL COMMENT 'script subtag, Arab, Hebr, etc.',
3797 `bidi` varchar(3) DEFAULT NULL COMMENT 'rtl ltr',
3798 KEY `rfc4646_subtag` (`rfc4646_subtag`)
3799 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3800 /*!40101 SET character_set_client = @saved_cs_client */;
3803 -- Table structure for table `language_script_mapping`
3806 DROP TABLE IF EXISTS `language_script_mapping`;
3807 /*!40101 SET @saved_cs_client = @@character_set_client */;
3808 /*!40101 SET character_set_client = utf8 */;
3809 CREATE TABLE `language_script_mapping` (
3810 `language_subtag` varchar(25) NOT NULL,
3811 `script_subtag` varchar(25) DEFAULT NULL,
3812 PRIMARY KEY (`language_subtag`)
3813 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3814 /*!40101 SET character_set_client = @saved_cs_client */;
3817 -- Table structure for table `language_subtag_registry`
3820 DROP TABLE IF EXISTS `language_subtag_registry`;
3821 /*!40101 SET @saved_cs_client = @@character_set_client */;
3822 /*!40101 SET character_set_client = utf8 */;
3823 CREATE TABLE `language_subtag_registry` (
3824 `subtag` varchar(25) DEFAULT NULL,
3825 `type` varchar(25) DEFAULT NULL COMMENT 'language-script-region-variant-extension-privateuse',
3826 `description` varchar(255) DEFAULT NULL COMMENT 'only one of the possible descriptions for ease of reference, see language_descriptions for the complete list',
3827 `added` date DEFAULT NULL,
3828 `id` int(11) NOT NULL AUTO_INCREMENT,
3830 UNIQUE KEY `uniq_lang` (`subtag`,`type`),
3831 KEY `subtag` (`subtag`)
3832 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3833 /*!40101 SET character_set_client = @saved_cs_client */;
3836 -- Table structure for table `letter`
3839 DROP TABLE IF EXISTS `letter`;
3840 /*!40101 SET @saved_cs_client = @@character_set_client */;
3841 /*!40101 SET character_set_client = utf8 */;
3842 CREATE TABLE `letter` (
3843 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
3844 `module` varchar(20) NOT NULL DEFAULT '' COMMENT 'Koha module that triggers this notice or slip',
3845 `code` varchar(20) NOT NULL DEFAULT '' COMMENT 'unique identifier for this notice or slip',
3846 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch this notice or slip is used at (branches.branchcode)',
3847 `name` varchar(100) NOT NULL DEFAULT '' COMMENT 'plain text name for this notice or slip',
3848 `is_html` tinyint(1) DEFAULT 0 COMMENT 'does this notice or slip use HTML (1 for yes, 0 for no)',
3849 `title` varchar(200) NOT NULL DEFAULT '' COMMENT 'subject line of the notice',
3850 `content` mediumtext DEFAULT NULL COMMENT 'body text for the notice or slip',
3851 `message_transport_type` varchar(20) NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3852 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3853 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3855 UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3856 KEY `message_transport_type_fk` (`message_transport_type`),
3857 CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
3858 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3859 /*!40101 SET character_set_client = @saved_cs_client */;
3862 -- Table structure for table `library_groups`
3865 DROP TABLE IF EXISTS `library_groups`;
3866 /*!40101 SET @saved_cs_client = @@character_set_client */;
3867 /*!40101 SET character_set_client = utf8 */;
3868 CREATE TABLE `library_groups` (
3869 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for each group',
3870 `parent_id` int(11) DEFAULT NULL COMMENT 'if this is a child group, the id of the parent group',
3871 `branchcode` varchar(10) DEFAULT NULL COMMENT 'The branchcode of a branch belonging to the parent group',
3872 `title` varchar(100) DEFAULT NULL COMMENT 'Short description of the goup',
3873 `description` mediumtext DEFAULT NULL COMMENT 'Longer explanation of the group, if necessary',
3874 `ft_hide_patron_info` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Turn on the feature ''Hide patron''s info'' for this group',
3875 `ft_limit_item_editing` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Turn on the feature "Limit item editing by group" for this group',
3876 `ft_search_groups_opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for staff side search groups',
3877 `ft_search_groups_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for opac side search groups',
3878 `ft_local_hold_group` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group to identify libraries as pick up location for holds',
3879 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Date and time of creation',
3880 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time of last',
3882 UNIQUE KEY `title` (`title`),
3883 UNIQUE KEY `library_groups_uniq_2` (`parent_id`,`branchcode`),
3884 KEY `branchcode` (`branchcode`),
3885 CONSTRAINT `library_groups_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `library_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
3886 CONSTRAINT `library_groups_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
3887 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3888 /*!40101 SET character_set_client = @saved_cs_client */;
3891 -- Table structure for table `library_smtp_servers`
3894 DROP TABLE IF EXISTS `library_smtp_servers`;
3895 /*!40101 SET @saved_cs_client = @@character_set_client */;
3896 /*!40101 SET character_set_client = utf8 */;
3897 CREATE TABLE `library_smtp_servers` (
3898 `id` int(11) NOT NULL AUTO_INCREMENT,
3899 `library_id` varchar(10) NOT NULL,
3900 `smtp_server_id` int(11) NOT NULL,
3902 UNIQUE KEY `library_id_idx` (`library_id`),
3903 KEY `smtp_server_id_idx` (`smtp_server_id`),
3904 CONSTRAINT `library_smtp_servers_library_fk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3905 CONSTRAINT `library_smtp_servers_smtp_servers_fk` FOREIGN KEY (`smtp_server_id`) REFERENCES `smtp_servers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
3906 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3907 /*!40101 SET character_set_client = @saved_cs_client */;
3910 -- Table structure for table `linktracker`
3913 DROP TABLE IF EXISTS `linktracker`;
3914 /*!40101 SET @saved_cs_client = @@character_set_client */;
3915 /*!40101 SET character_set_client = utf8 */;
3916 CREATE TABLE `linktracker` (
3917 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
3918 `biblionumber` int(11) DEFAULT NULL COMMENT 'biblionumber of the record the link is from',
3919 `itemnumber` int(11) DEFAULT NULL COMMENT 'itemnumber if applicable that the link was from',
3920 `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrowernumber who clicked the link',
3921 `url` mediumtext DEFAULT NULL COMMENT 'the link itself',
3922 `timeclicked` datetime DEFAULT NULL COMMENT 'the date and time the link was clicked',
3924 KEY `bibidx` (`biblionumber`),
3925 KEY `itemidx` (`itemnumber`),
3926 KEY `borridx` (`borrowernumber`),
3927 KEY `dateidx` (`timeclicked`),
3928 CONSTRAINT `linktracker_biblio_ibfk` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3929 CONSTRAINT `linktracker_borrower_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3930 CONSTRAINT `linktracker_item_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL
3931 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3932 /*!40101 SET character_set_client = @saved_cs_client */;
3935 -- Table structure for table `localization`
3938 DROP TABLE IF EXISTS `localization`;
3939 /*!40101 SET @saved_cs_client = @@character_set_client */;
3940 /*!40101 SET character_set_client = utf8 */;
3941 CREATE TABLE `localization` (
3942 `localization_id` int(11) NOT NULL AUTO_INCREMENT,
3943 `entity` varchar(16) NOT NULL,
3944 `code` varchar(64) NOT NULL,
3945 `lang` varchar(25) NOT NULL COMMENT 'could be a foreign key',
3946 `translation` mediumtext DEFAULT NULL,
3947 PRIMARY KEY (`localization_id`),
3948 UNIQUE KEY `entity_code_lang` (`entity`,`code`,`lang`)
3949 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3950 /*!40101 SET character_set_client = @saved_cs_client */;
3953 -- Table structure for table `marc_matchers`
3956 DROP TABLE IF EXISTS `marc_matchers`;
3957 /*!40101 SET @saved_cs_client = @@character_set_client */;
3958 /*!40101 SET character_set_client = utf8 */;
3959 CREATE TABLE `marc_matchers` (
3960 `matcher_id` int(11) NOT NULL AUTO_INCREMENT,
3961 `code` varchar(10) NOT NULL DEFAULT '',
3962 `description` varchar(255) NOT NULL DEFAULT '',
3963 `record_type` varchar(10) NOT NULL DEFAULT 'biblio',
3964 `threshold` int(11) NOT NULL DEFAULT 0,
3965 PRIMARY KEY (`matcher_id`),
3966 KEY `code` (`code`),
3967 KEY `record_type` (`record_type`)
3968 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3969 /*!40101 SET character_set_client = @saved_cs_client */;
3972 -- Table structure for table `marc_modification_template_actions`
3975 DROP TABLE IF EXISTS `marc_modification_template_actions`;
3976 /*!40101 SET @saved_cs_client = @@character_set_client */;
3977 /*!40101 SET character_set_client = utf8 */;
3978 CREATE TABLE `marc_modification_template_actions` (
3979 `mmta_id` int(11) NOT NULL AUTO_INCREMENT,
3980 `template_id` int(11) NOT NULL,
3981 `ordering` int(3) NOT NULL,
3982 `action` enum('delete_field','add_field','update_field','move_field','copy_field','copy_and_replace_field') NOT NULL,
3983 `field_number` smallint(6) NOT NULL DEFAULT 0,
3984 `from_field` varchar(3) NOT NULL,
3985 `from_subfield` varchar(1) DEFAULT NULL,
3986 `field_value` varchar(100) DEFAULT NULL,
3987 `to_field` varchar(3) DEFAULT NULL,
3988 `to_subfield` varchar(1) DEFAULT NULL,
3989 `to_regex_search` mediumtext DEFAULT NULL,
3990 `to_regex_replace` mediumtext DEFAULT NULL,
3991 `to_regex_modifiers` varchar(8) DEFAULT '',
3992 `conditional` enum('if','unless') DEFAULT NULL,
3993 `conditional_field` varchar(3) DEFAULT NULL,
3994 `conditional_subfield` varchar(1) DEFAULT NULL,
3995 `conditional_comparison` enum('exists','not_exists','equals','not_equals') DEFAULT NULL,
3996 `conditional_value` mediumtext DEFAULT NULL,
3997 `conditional_regex` tinyint(1) NOT NULL DEFAULT 0,
3998 `description` mediumtext DEFAULT NULL,
3999 PRIMARY KEY (`mmta_id`),
4000 KEY `mmta_ibfk_1` (`template_id`),
4001 CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
4002 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4003 /*!40101 SET character_set_client = @saved_cs_client */;
4006 -- Table structure for table `marc_modification_templates`
4009 DROP TABLE IF EXISTS `marc_modification_templates`;
4010 /*!40101 SET @saved_cs_client = @@character_set_client */;
4011 /*!40101 SET character_set_client = utf8 */;
4012 CREATE TABLE `marc_modification_templates` (
4013 `template_id` int(11) NOT NULL AUTO_INCREMENT,
4014 `name` mediumtext NOT NULL,
4015 PRIMARY KEY (`template_id`)
4016 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4017 /*!40101 SET character_set_client = @saved_cs_client */;
4020 -- Table structure for table `marc_overlay_rules`
4023 DROP TABLE IF EXISTS `marc_overlay_rules`;
4024 /*!40101 SET @saved_cs_client = @@character_set_client */;
4025 /*!40101 SET character_set_client = utf8 */;
4026 CREATE TABLE `marc_overlay_rules` (
4027 `id` int(11) NOT NULL AUTO_INCREMENT,
4028 `tag` varchar(255) NOT NULL,
4029 `module` varchar(127) NOT NULL,
4030 `filter` varchar(255) NOT NULL,
4031 `add` tinyint(1) NOT NULL DEFAULT 0,
4032 `append` tinyint(1) NOT NULL DEFAULT 0,
4033 `remove` tinyint(1) NOT NULL DEFAULT 0,
4034 `delete` tinyint(1) NOT NULL DEFAULT 0,
4036 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4037 /*!40101 SET character_set_client = @saved_cs_client */;
4040 -- Table structure for table `marc_subfield_structure`
4043 DROP TABLE IF EXISTS `marc_subfield_structure`;
4044 /*!40101 SET @saved_cs_client = @@character_set_client */;
4045 /*!40101 SET character_set_client = utf8 */;
4046 CREATE TABLE `marc_subfield_structure` (
4047 `tagfield` varchar(3) NOT NULL DEFAULT '',
4048 `tagsubfield` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
4049 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
4050 `libopac` varchar(255) NOT NULL DEFAULT '',
4051 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
4052 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4053 `important` tinyint(4) NOT NULL DEFAULT 0,
4054 `kohafield` varchar(40) DEFAULT NULL,
4055 `tab` tinyint(1) DEFAULT NULL,
4056 `authorised_value` varchar(32) DEFAULT NULL,
4057 `authtypecode` varchar(20) DEFAULT NULL,
4058 `value_builder` varchar(80) DEFAULT NULL,
4059 `isurl` tinyint(1) DEFAULT NULL,
4060 `hidden` tinyint(1) NOT NULL DEFAULT 8,
4061 `frameworkcode` varchar(4) NOT NULL DEFAULT '',
4062 `seealso` varchar(1100) DEFAULT NULL,
4063 `link` varchar(80) DEFAULT NULL,
4064 `defaultvalue` mediumtext DEFAULT NULL,
4065 `maxlength` int(4) NOT NULL DEFAULT 9999,
4066 `display_order` int(2) NOT NULL DEFAULT 0,
4067 PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`),
4068 KEY `kohafield_2` (`kohafield`),
4069 KEY `tab` (`frameworkcode`,`tab`),
4070 KEY `kohafield` (`frameworkcode`,`kohafield`),
4071 KEY `marc_subfield_structure_ibfk_1` (`authorised_value`),
4072 CONSTRAINT `marc_subfield_structure_ibfk_1` FOREIGN KEY (`authorised_value`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE SET NULL ON UPDATE CASCADE
4073 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4074 /*!40101 SET character_set_client = @saved_cs_client */;
4077 -- Table structure for table `marc_tag_structure`
4080 DROP TABLE IF EXISTS `marc_tag_structure`;
4081 /*!40101 SET @saved_cs_client = @@character_set_client */;
4082 /*!40101 SET character_set_client = utf8 */;
4083 CREATE TABLE `marc_tag_structure` (
4084 `tagfield` varchar(3) NOT NULL DEFAULT '',
4085 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
4086 `libopac` varchar(255) NOT NULL DEFAULT '',
4087 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
4088 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4089 `important` tinyint(4) NOT NULL DEFAULT 0,
4090 `authorised_value` varchar(32) DEFAULT NULL,
4091 `ind1_defaultvalue` varchar(1) NOT NULL DEFAULT '',
4092 `ind2_defaultvalue` varchar(1) NOT NULL DEFAULT '',
4093 `frameworkcode` varchar(4) NOT NULL DEFAULT '',
4094 PRIMARY KEY (`frameworkcode`,`tagfield`)
4095 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4096 /*!40101 SET character_set_client = @saved_cs_client */;
4099 -- Table structure for table `matchchecks`
4102 DROP TABLE IF EXISTS `matchchecks`;
4103 /*!40101 SET @saved_cs_client = @@character_set_client */;
4104 /*!40101 SET character_set_client = utf8 */;
4105 CREATE TABLE `matchchecks` (
4106 `matcher_id` int(11) NOT NULL,
4107 `matchcheck_id` int(11) NOT NULL AUTO_INCREMENT,
4108 `source_matchpoint_id` int(11) NOT NULL,
4109 `target_matchpoint_id` int(11) NOT NULL,
4110 PRIMARY KEY (`matchcheck_id`),
4111 KEY `matcher_matchchecks_ifbk_1` (`matcher_id`),
4112 KEY `matcher_matchchecks_ifbk_2` (`source_matchpoint_id`),
4113 KEY `matcher_matchchecks_ifbk_3` (`target_matchpoint_id`),
4114 CONSTRAINT `matcher_matchchecks_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4115 CONSTRAINT `matcher_matchchecks_ifbk_2` FOREIGN KEY (`source_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4116 CONSTRAINT `matcher_matchchecks_ifbk_3` FOREIGN KEY (`target_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4117 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4118 /*!40101 SET character_set_client = @saved_cs_client */;
4121 -- Table structure for table `matcher_matchpoints`
4124 DROP TABLE IF EXISTS `matcher_matchpoints`;
4125 /*!40101 SET @saved_cs_client = @@character_set_client */;
4126 /*!40101 SET character_set_client = utf8 */;
4127 CREATE TABLE `matcher_matchpoints` (
4128 `matcher_id` int(11) NOT NULL,
4129 `matchpoint_id` int(11) NOT NULL,
4130 KEY `matcher_matchpoints_ifbk_1` (`matcher_id`),
4131 KEY `matcher_matchpoints_ifbk_2` (`matchpoint_id`),
4132 CONSTRAINT `matcher_matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4133 CONSTRAINT `matcher_matchpoints_ifbk_2` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4134 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4135 /*!40101 SET character_set_client = @saved_cs_client */;
4138 -- Table structure for table `matchpoint_component_norms`
4141 DROP TABLE IF EXISTS `matchpoint_component_norms`;
4142 /*!40101 SET @saved_cs_client = @@character_set_client */;
4143 /*!40101 SET character_set_client = utf8 */;
4144 CREATE TABLE `matchpoint_component_norms` (
4145 `matchpoint_component_id` int(11) NOT NULL,
4146 `sequence` int(11) NOT NULL DEFAULT 0,
4147 `norm_routine` varchar(50) NOT NULL DEFAULT '',
4148 KEY `matchpoint_component_norms` (`matchpoint_component_id`,`sequence`),
4149 CONSTRAINT `matchpoint_component_norms_ifbk_1` FOREIGN KEY (`matchpoint_component_id`) REFERENCES `matchpoint_components` (`matchpoint_component_id`) ON DELETE CASCADE ON UPDATE CASCADE
4150 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4151 /*!40101 SET character_set_client = @saved_cs_client */;
4154 -- Table structure for table `matchpoint_components`
4157 DROP TABLE IF EXISTS `matchpoint_components`;
4158 /*!40101 SET @saved_cs_client = @@character_set_client */;
4159 /*!40101 SET character_set_client = utf8 */;
4160 CREATE TABLE `matchpoint_components` (
4161 `matchpoint_id` int(11) NOT NULL,
4162 `matchpoint_component_id` int(11) NOT NULL AUTO_INCREMENT,
4163 `sequence` int(11) NOT NULL DEFAULT 0,
4164 `tag` varchar(3) NOT NULL DEFAULT '',
4165 `subfields` varchar(40) NOT NULL DEFAULT '',
4166 `offset` int(4) NOT NULL DEFAULT 0,
4167 `length` int(4) NOT NULL DEFAULT 0,
4168 PRIMARY KEY (`matchpoint_component_id`),
4169 KEY `by_sequence` (`matchpoint_id`,`sequence`),
4170 CONSTRAINT `matchpoint_components_ifbk_1` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4171 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4172 /*!40101 SET character_set_client = @saved_cs_client */;
4175 -- Table structure for table `matchpoints`
4178 DROP TABLE IF EXISTS `matchpoints`;
4179 /*!40101 SET @saved_cs_client = @@character_set_client */;
4180 /*!40101 SET character_set_client = utf8 */;
4181 CREATE TABLE `matchpoints` (
4182 `matcher_id` int(11) NOT NULL,
4183 `matchpoint_id` int(11) NOT NULL AUTO_INCREMENT,
4184 `search_index` varchar(30) NOT NULL DEFAULT '',
4185 `score` int(11) NOT NULL DEFAULT 0,
4186 PRIMARY KEY (`matchpoint_id`),
4187 KEY `matchpoints_ifbk_1` (`matcher_id`),
4188 CONSTRAINT `matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE
4189 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4190 /*!40101 SET character_set_client = @saved_cs_client */;
4193 -- Table structure for table `message_attributes`
4196 DROP TABLE IF EXISTS `message_attributes`;
4197 /*!40101 SET @saved_cs_client = @@character_set_client */;
4198 /*!40101 SET character_set_client = utf8 */;
4199 CREATE TABLE `message_attributes` (
4200 `message_attribute_id` int(11) NOT NULL AUTO_INCREMENT,
4201 `message_name` varchar(40) NOT NULL DEFAULT '',
4202 `takes_days` tinyint(1) NOT NULL DEFAULT 0,
4203 PRIMARY KEY (`message_attribute_id`),
4204 UNIQUE KEY `message_name` (`message_name`)
4205 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4206 /*!40101 SET character_set_client = @saved_cs_client */;
4209 -- Table structure for table `message_queue`
4212 DROP TABLE IF EXISTS `message_queue`;
4213 /*!40101 SET @saved_cs_client = @@character_set_client */;
4214 /*!40101 SET character_set_client = utf8 */;
4215 CREATE TABLE `message_queue` (
4216 `message_id` int(11) NOT NULL AUTO_INCREMENT,
4217 `letter_id` int(11) DEFAULT NULL COMMENT 'Foreign key to the letters table',
4218 `borrowernumber` int(11) DEFAULT NULL,
4219 `subject` mediumtext DEFAULT NULL,
4220 `content` mediumtext DEFAULT NULL,
4221 `metadata` mediumtext DEFAULT NULL,
4222 `letter_code` varchar(64) DEFAULT NULL,
4223 `message_transport_type` varchar(20) NOT NULL,
4224 `status` enum('sent','pending','failed','deleted') NOT NULL DEFAULT 'pending',
4225 `time_queued` timestamp NULL DEFAULT NULL,
4226 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
4227 `to_address` longtext DEFAULT NULL,
4228 `from_address` longtext DEFAULT NULL,
4229 `reply_address` longtext DEFAULT NULL,
4230 `content_type` mediumtext DEFAULT NULL,
4231 `failure_code` mediumtext DEFAULT NULL,
4232 PRIMARY KEY (`message_id`),
4233 KEY `borrowernumber` (`borrowernumber`),
4234 KEY `message_transport_type` (`message_transport_type`),
4235 KEY `letter_fk` (`letter_id`),
4236 CONSTRAINT `letter_fk` FOREIGN KEY (`letter_id`) REFERENCES `letter` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
4237 CONSTRAINT `messageq_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4238 CONSTRAINT `messageq_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON UPDATE CASCADE
4239 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4240 /*!40101 SET character_set_client = @saved_cs_client */;
4243 -- Table structure for table `message_transport_types`
4246 DROP TABLE IF EXISTS `message_transport_types`;
4247 /*!40101 SET @saved_cs_client = @@character_set_client */;
4248 /*!40101 SET character_set_client = utf8 */;
4249 CREATE TABLE `message_transport_types` (
4250 `message_transport_type` varchar(20) NOT NULL,
4251 PRIMARY KEY (`message_transport_type`)
4252 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4253 /*!40101 SET character_set_client = @saved_cs_client */;
4256 -- Table structure for table `message_transports`
4259 DROP TABLE IF EXISTS `message_transports`;
4260 /*!40101 SET @saved_cs_client = @@character_set_client */;
4261 /*!40101 SET character_set_client = utf8 */;
4262 CREATE TABLE `message_transports` (
4263 `message_attribute_id` int(11) NOT NULL,
4264 `message_transport_type` varchar(20) NOT NULL,
4265 `is_digest` tinyint(1) NOT NULL DEFAULT 0,
4266 `letter_module` varchar(20) NOT NULL DEFAULT '',
4267 `letter_code` varchar(20) NOT NULL DEFAULT '',
4268 `branchcode` varchar(10) NOT NULL DEFAULT '',
4269 PRIMARY KEY (`message_attribute_id`,`message_transport_type`,`is_digest`),
4270 KEY `message_transport_type` (`message_transport_type`),
4271 KEY `letter_module` (`letter_module`,`letter_code`),
4272 CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4273 CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
4274 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4275 /*!40101 SET character_set_client = @saved_cs_client */;
4278 -- Table structure for table `messages`
4281 DROP TABLE IF EXISTS `messages`;
4282 /*!40101 SET @saved_cs_client = @@character_set_client */;
4283 /*!40101 SET character_set_client = utf8 */;
4284 CREATE TABLE `messages` (
4285 `message_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4286 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking this message to the borrowers table',
4287 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key linking the message to the branches table',
4288 `message_type` varchar(1) NOT NULL COMMENT 'whether the message is for the librarians (L) or the patron (B)',
4289 `message` mediumtext NOT NULL COMMENT 'the text of the message',
4290 `message_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the message was written',
4291 `manager_id` int(11) DEFAULT NULL COMMENT 'creator of message',
4292 PRIMARY KEY (`message_id`),
4293 KEY `messages_ibfk_1` (`manager_id`),
4294 KEY `messages_borrowernumber` (`borrowernumber`),
4295 CONSTRAINT `messages_borrowernumber` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4296 CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL
4297 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4298 /*!40101 SET character_set_client = @saved_cs_client */;
4301 -- Table structure for table `misc_files`
4304 DROP TABLE IF EXISTS `misc_files`;
4305 /*!40101 SET @saved_cs_client = @@character_set_client */;
4306 /*!40101 SET character_set_client = utf8 */;
4307 CREATE TABLE `misc_files` (
4308 `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the file record',
4309 `table_tag` varchar(255) NOT NULL COMMENT 'usually table name, or arbitrary unique tag',
4310 `record_id` int(11) NOT NULL COMMENT 'record id from the table this file is associated to',
4311 `file_name` varchar(255) NOT NULL COMMENT 'file name',
4312 `file_type` varchar(255) NOT NULL COMMENT 'MIME type of the file',
4313 `file_description` varchar(255) DEFAULT NULL COMMENT 'description given to the file',
4314 `file_content` longblob NOT NULL COMMENT 'file content',
4315 `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
4316 PRIMARY KEY (`file_id`),
4317 KEY `table_tag` (`table_tag`(191)),
4318 KEY `record_id` (`record_id`)
4319 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4320 /*!40101 SET character_set_client = @saved_cs_client */;
4323 -- Table structure for table `need_merge_authorities`
4326 DROP TABLE IF EXISTS `need_merge_authorities`;
4327 /*!40101 SET @saved_cs_client = @@character_set_client */;
4328 /*!40101 SET character_set_client = utf8 */;
4329 CREATE TABLE `need_merge_authorities` (
4330 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id',
4331 `authid` bigint(20) NOT NULL COMMENT 'reference to original authority record',
4332 `authid_new` bigint(20) DEFAULT NULL COMMENT 'reference to optional new authority record',
4333 `reportxml` mediumtext DEFAULT NULL COMMENT 'xml showing original reporting tag',
4334 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time last modified',
4335 `done` tinyint(4) DEFAULT 0,
4337 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4338 /*!40101 SET character_set_client = @saved_cs_client */;
4341 -- Table structure for table `oai_sets`
4344 DROP TABLE IF EXISTS `oai_sets`;
4345 /*!40101 SET @saved_cs_client = @@character_set_client */;
4346 /*!40101 SET character_set_client = utf8 */;
4347 CREATE TABLE `oai_sets` (
4348 `id` int(11) NOT NULL AUTO_INCREMENT,
4349 `spec` varchar(80) NOT NULL,
4350 `name` varchar(80) NOT NULL,
4352 UNIQUE KEY `spec` (`spec`)
4353 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4354 /*!40101 SET character_set_client = @saved_cs_client */;
4357 -- Table structure for table `oai_sets_biblios`
4360 DROP TABLE IF EXISTS `oai_sets_biblios`;
4361 /*!40101 SET @saved_cs_client = @@character_set_client */;
4362 /*!40101 SET character_set_client = utf8 */;
4363 CREATE TABLE `oai_sets_biblios` (
4364 `biblionumber` int(11) NOT NULL,
4365 `set_id` int(11) NOT NULL,
4366 PRIMARY KEY (`biblionumber`,`set_id`),
4367 KEY `oai_sets_biblios_ibfk_2` (`set_id`),
4368 CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4369 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4370 /*!40101 SET character_set_client = @saved_cs_client */;
4373 -- Table structure for table `oai_sets_descriptions`
4376 DROP TABLE IF EXISTS `oai_sets_descriptions`;
4377 /*!40101 SET @saved_cs_client = @@character_set_client */;
4378 /*!40101 SET character_set_client = utf8 */;
4379 CREATE TABLE `oai_sets_descriptions` (
4380 `set_id` int(11) NOT NULL,
4381 `description` varchar(255) NOT NULL,
4382 KEY `oai_sets_descriptions_ibfk_1` (`set_id`),
4383 CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4384 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4385 /*!40101 SET character_set_client = @saved_cs_client */;
4388 -- Table structure for table `oai_sets_mappings`
4391 DROP TABLE IF EXISTS `oai_sets_mappings`;
4392 /*!40101 SET @saved_cs_client = @@character_set_client */;
4393 /*!40101 SET character_set_client = utf8 */;
4394 CREATE TABLE `oai_sets_mappings` (
4395 `set_id` int(11) NOT NULL,
4396 `rule_order` int(11) DEFAULT NULL,
4397 `rule_operator` varchar(3) DEFAULT NULL,
4398 `marcfield` char(3) NOT NULL,
4399 `marcsubfield` char(1) NOT NULL,
4400 `operator` varchar(8) NOT NULL DEFAULT 'equal',
4401 `marcvalue` varchar(80) NOT NULL,
4402 KEY `oai_sets_mappings_ibfk_1` (`set_id`),
4403 CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4404 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4405 /*!40101 SET character_set_client = @saved_cs_client */;
4408 -- Table structure for table `oauth_access_tokens`
4411 DROP TABLE IF EXISTS `oauth_access_tokens`;
4412 /*!40101 SET @saved_cs_client = @@character_set_client */;
4413 /*!40101 SET character_set_client = utf8 */;
4414 CREATE TABLE `oauth_access_tokens` (
4415 `access_token` varchar(191) NOT NULL COMMENT 'generarated access token',
4416 `client_id` varchar(191) NOT NULL COMMENT 'the client id the access token belongs to',
4417 `expires` int(11) NOT NULL COMMENT 'expiration time in seconds',
4418 PRIMARY KEY (`access_token`)
4419 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4420 /*!40101 SET character_set_client = @saved_cs_client */;
4423 -- Table structure for table `old_issues`
4426 DROP TABLE IF EXISTS `old_issues`;
4427 /*!40101 SET @saved_cs_client = @@character_set_client */;
4428 /*!40101 SET character_set_client = utf8 */;
4429 CREATE TABLE `old_issues` (
4430 `issue_id` int(11) NOT NULL COMMENT 'primary key for issues table',
4431 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
4432 `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
4433 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
4434 `date_due` datetime DEFAULT NULL COMMENT 'date the item is due (yyyy-mm-dd)',
4435 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
4436 `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned',
4437 `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
4438 `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
4439 `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
4440 `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
4441 `auto_renew_error` varchar(32) DEFAULT NULL COMMENT 'automatic renewal error',
4442 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
4443 `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
4444 `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
4445 `note` longtext DEFAULT NULL COMMENT 'issue note text',
4446 `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
4447 `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
4448 PRIMARY KEY (`issue_id`),
4449 KEY `old_issuesborridx` (`borrowernumber`),
4450 KEY `old_issuesitemidx` (`itemnumber`),
4451 KEY `branchcode_idx` (`branchcode`),
4452 KEY `old_bordate` (`borrowernumber`,`timestamp`),
4453 KEY `old_issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
4454 CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4455 CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4456 CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
4457 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4458 /*!40101 SET character_set_client = @saved_cs_client */;
4461 -- Table structure for table `old_reserves`
4464 DROP TABLE IF EXISTS `old_reserves`;
4465 /*!40101 SET @saved_cs_client = @@character_set_client */;
4466 /*!40101 SET character_set_client = utf8 */;
4467 CREATE TABLE `old_reserves` (
4468 `reserve_id` int(11) NOT NULL COMMENT 'primary key',
4469 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4470 `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places',
4471 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4472 `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
4473 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
4474 `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4475 `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4476 `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4477 `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4478 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4479 `reservenotes` longtext DEFAULT NULL COMMENT 'notes related to this hold',
4480 `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4481 `found` varchar(1) DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
4482 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4483 `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',
4484 `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4485 `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)',
4486 `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',
4487 `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)',
4488 `suspend` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'in this hold suspended (1 for yes, 0 for no)',
4489 `suspend_until` datetime DEFAULT NULL COMMENT 'the date this hold is suspended until (NULL for infinitely)',
4490 `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4491 `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
4492 `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4493 PRIMARY KEY (`reserve_id`),
4494 KEY `old_reserves_borrowernumber` (`borrowernumber`),
4495 KEY `old_reserves_biblionumber` (`biblionumber`),
4496 KEY `old_reserves_itemnumber` (`itemnumber`),
4497 KEY `old_reserves_branchcode` (`branchcode`),
4498 KEY `old_reserves_itemtype` (`itemtype`),
4499 KEY `old_reserves_ibfk_ig` (`item_group_id`),
4500 CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4501 CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4502 CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4503 CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
4504 CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
4505 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4506 /*!40101 SET character_set_client = @saved_cs_client */;
4509 -- Table structure for table `overduerules`
4512 DROP TABLE IF EXISTS `overduerules`;
4513 /*!40101 SET @saved_cs_client = @@character_set_client */;
4514 /*!40101 SET character_set_client = utf8 */;
4515 CREATE TABLE `overduerules` (
4516 `overduerules_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the overduerules',
4517 `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)',
4518 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table to define which patron category this rule is for',
4519 `delay1` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the first notice is sent',
4520 `letter1` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the first notice',
4521 `debarred1` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the first notice is sent (1 for yes, 0 for no)',
4522 `delay2` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the second notice is sent',
4523 `debarred2` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the second notice is sent (1 for yes, 0 for no)',
4524 `letter2` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the second notice',
4525 `delay3` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the third notice is sent',
4526 `letter3` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the third notice',
4527 `debarred3` int(1) DEFAULT 0 COMMENT 'is the patron restricted when the third notice is sent (1 for yes, 0 for no)',
4528 PRIMARY KEY (`overduerules_id`),
4529 UNIQUE KEY `overduerules_branch_cat` (`branchcode`,`categorycode`)
4530 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4531 /*!40101 SET character_set_client = @saved_cs_client */;
4534 -- Table structure for table `overduerules_transport_types`
4537 DROP TABLE IF EXISTS `overduerules_transport_types`;
4538 /*!40101 SET @saved_cs_client = @@character_set_client */;
4539 /*!40101 SET character_set_client = utf8 */;
4540 CREATE TABLE `overduerules_transport_types` (
4541 `id` int(11) NOT NULL AUTO_INCREMENT,
4542 `letternumber` int(1) NOT NULL DEFAULT 1,
4543 `message_transport_type` varchar(20) NOT NULL DEFAULT 'email',
4544 `overduerules_id` int(11) NOT NULL,
4546 KEY `overduerules_fk` (`overduerules_id`),
4547 KEY `mtt_fk` (`message_transport_type`),
4548 CONSTRAINT `mtt_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
4549 CONSTRAINT `overduerules_fk` FOREIGN KEY (`overduerules_id`) REFERENCES `overduerules` (`overduerules_id`) ON DELETE CASCADE ON UPDATE CASCADE
4550 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4551 /*!40101 SET character_set_client = @saved_cs_client */;
4554 -- Table structure for table `patron_consent`
4557 DROP TABLE IF EXISTS `patron_consent`;
4558 /*!40101 SET @saved_cs_client = @@character_set_client */;
4559 /*!40101 SET character_set_client = utf8 */;
4560 CREATE TABLE `patron_consent` (
4561 `id` int(11) NOT NULL AUTO_INCREMENT,
4562 `borrowernumber` int(11) NOT NULL,
4563 `type` enum('GDPR_PROCESSING') DEFAULT NULL COMMENT 'allows for future extension',
4564 `given_on` datetime DEFAULT NULL,
4565 `refused_on` datetime DEFAULT NULL,
4567 KEY `borrowernumber` (`borrowernumber`),
4568 CONSTRAINT `patron_consent_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4569 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4570 /*!40101 SET character_set_client = @saved_cs_client */;
4573 -- Table structure for table `patron_list_patrons`
4576 DROP TABLE IF EXISTS `patron_list_patrons`;
4577 /*!40101 SET @saved_cs_client = @@character_set_client */;
4578 /*!40101 SET character_set_client = utf8 */;
4579 CREATE TABLE `patron_list_patrons` (
4580 `patron_list_patron_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
4581 `patron_list_id` int(11) NOT NULL COMMENT 'the list this entry is part of',
4582 `borrowernumber` int(11) NOT NULL COMMENT 'the borrower that is part of this list',
4583 PRIMARY KEY (`patron_list_patron_id`),
4584 KEY `patron_list_id` (`patron_list_id`),
4585 KEY `borrowernumber` (`borrowernumber`),
4586 CONSTRAINT `patron_list_patrons_ibfk_1` FOREIGN KEY (`patron_list_id`) REFERENCES `patron_lists` (`patron_list_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4587 CONSTRAINT `patron_list_patrons_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4588 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4589 /*!40101 SET character_set_client = @saved_cs_client */;
4592 -- Table structure for table `patron_lists`
4595 DROP TABLE IF EXISTS `patron_lists`;
4596 /*!40101 SET @saved_cs_client = @@character_set_client */;
4597 /*!40101 SET character_set_client = utf8 */;
4598 CREATE TABLE `patron_lists` (
4599 `patron_list_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
4600 `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'the list''s name',
4601 `owner` int(11) NOT NULL COMMENT 'borrowernumber of the list creator',
4602 `shared` tinyint(1) DEFAULT 0,
4603 PRIMARY KEY (`patron_list_id`),
4604 KEY `owner` (`owner`),
4605 CONSTRAINT `patron_lists_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4606 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4607 /*!40101 SET character_set_client = @saved_cs_client */;
4610 -- Table structure for table `patronimage`
4613 DROP TABLE IF EXISTS `patronimage`;
4614 /*!40101 SET @saved_cs_client = @@character_set_client */;
4615 /*!40101 SET character_set_client = utf8 */;
4616 CREATE TABLE `patronimage` (
4617 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron this image is attached to (borrowers.borrowernumber)',
4618 `mimetype` varchar(15) NOT NULL COMMENT 'the format of the image (png, jpg, etc)',
4619 `imagefile` mediumblob NOT NULL COMMENT 'the image',
4620 PRIMARY KEY (`borrowernumber`),
4621 CONSTRAINT `patronimage_fk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4622 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4623 /*!40101 SET character_set_client = @saved_cs_client */;
4626 -- Table structure for table `pending_offline_operations`
4629 DROP TABLE IF EXISTS `pending_offline_operations`;
4630 /*!40101 SET @saved_cs_client = @@character_set_client */;
4631 /*!40101 SET character_set_client = utf8 */;
4632 CREATE TABLE `pending_offline_operations` (
4633 `operationid` int(11) NOT NULL AUTO_INCREMENT,
4634 `userid` varchar(30) NOT NULL,
4635 `branchcode` varchar(10) NOT NULL,
4636 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
4637 `action` varchar(10) NOT NULL,
4638 `barcode` varchar(20) DEFAULT NULL,
4639 `cardnumber` varchar(32) DEFAULT NULL,
4640 `amount` decimal(28,6) DEFAULT NULL,
4641 PRIMARY KEY (`operationid`)
4642 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4643 /*!40101 SET character_set_client = @saved_cs_client */;
4646 -- Table structure for table `permissions`
4649 DROP TABLE IF EXISTS `permissions`;
4650 /*!40101 SET @saved_cs_client = @@character_set_client */;
4651 /*!40101 SET character_set_client = utf8 */;
4652 CREATE TABLE `permissions` (
4653 `module_bit` int(11) NOT NULL DEFAULT 0,
4654 `code` varchar(64) NOT NULL DEFAULT '',
4655 `description` varchar(255) DEFAULT NULL,
4656 PRIMARY KEY (`module_bit`,`code`),
4657 CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`) ON DELETE CASCADE ON UPDATE CASCADE
4658 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4659 /*!40101 SET character_set_client = @saved_cs_client */;
4662 -- Table structure for table `plugin_data`
4665 DROP TABLE IF EXISTS `plugin_data`;
4666 /*!40101 SET @saved_cs_client = @@character_set_client */;
4667 /*!40101 SET character_set_client = utf8 */;
4668 CREATE TABLE `plugin_data` (
4669 `plugin_class` varchar(255) NOT NULL,
4670 `plugin_key` varchar(255) NOT NULL,
4671 `plugin_value` mediumtext DEFAULT NULL,
4672 PRIMARY KEY (`plugin_class`(191),`plugin_key`(191))
4673 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4674 /*!40101 SET character_set_client = @saved_cs_client */;
4677 -- Table structure for table `plugin_methods`
4680 DROP TABLE IF EXISTS `plugin_methods`;
4681 /*!40101 SET @saved_cs_client = @@character_set_client */;
4682 /*!40101 SET character_set_client = utf8 */;
4683 CREATE TABLE `plugin_methods` (
4684 `plugin_class` varchar(255) NOT NULL,
4685 `plugin_method` varchar(255) NOT NULL,
4686 PRIMARY KEY (`plugin_class`(191),`plugin_method`(191))
4687 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4688 /*!40101 SET character_set_client = @saved_cs_client */;
4691 -- Table structure for table `printers_profile`
4694 DROP TABLE IF EXISTS `printers_profile`;
4695 /*!40101 SET @saved_cs_client = @@character_set_client */;
4696 /*!40101 SET character_set_client = utf8 */;
4697 CREATE TABLE `printers_profile` (
4698 `profile_id` int(4) NOT NULL AUTO_INCREMENT,
4699 `printer_name` varchar(40) NOT NULL DEFAULT 'Default Printer',
4700 `template_id` int(4) NOT NULL DEFAULT 0,
4701 `paper_bin` varchar(20) NOT NULL DEFAULT 'Bypass',
4702 `offset_horz` float NOT NULL DEFAULT 0,
4703 `offset_vert` float NOT NULL DEFAULT 0,
4704 `creep_horz` float NOT NULL DEFAULT 0,
4705 `creep_vert` float NOT NULL DEFAULT 0,
4706 `units` char(20) NOT NULL DEFAULT 'POINT',
4707 `creator` char(15) NOT NULL DEFAULT 'Labels',
4708 PRIMARY KEY (`profile_id`),
4709 UNIQUE KEY `printername` (`printer_name`,`template_id`,`paper_bin`,`creator`)
4710 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4711 /*!40101 SET character_set_client = @saved_cs_client */;
4714 -- Table structure for table `problem_reports`
4717 DROP TABLE IF EXISTS `problem_reports`;
4718 /*!40101 SET @saved_cs_client = @@character_set_client */;
4719 /*!40101 SET character_set_client = utf8 */;
4720 CREATE TABLE `problem_reports` (
4721 `reportid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4722 `title` varchar(40) NOT NULL DEFAULT '' COMMENT 'report subject line',
4723 `content` text NOT NULL COMMENT 'report message content',
4724 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the user who created the problem report',
4725 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'borrower''s branch',
4726 `username` varchar(75) DEFAULT NULL COMMENT 'OPAC username',
4727 `problempage` text DEFAULT NULL COMMENT 'page the user triggered the problem report form from',
4728 `recipient` enum('admin','library') NOT NULL DEFAULT 'library' COMMENT 'the ''to-address'' of the problem report',
4729 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'timestamp of report submission',
4730 `status` varchar(6) NOT NULL DEFAULT 'New' COMMENT 'status of the report. New, Viewed, Closed',
4731 PRIMARY KEY (`reportid`),
4732 KEY `problem_reports_ibfk1` (`borrowernumber`),
4733 KEY `problem_reports_ibfk2` (`branchcode`),
4734 CONSTRAINT `problem_reports_ibfk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4735 CONSTRAINT `problem_reports_ibfk2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4736 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4737 /*!40101 SET character_set_client = @saved_cs_client */;
4740 -- Table structure for table `pseudonymized_borrower_attributes`
4743 DROP TABLE IF EXISTS `pseudonymized_borrower_attributes`;
4744 /*!40101 SET @saved_cs_client = @@character_set_client */;
4745 /*!40101 SET character_set_client = utf8 */;
4746 CREATE TABLE `pseudonymized_borrower_attributes` (
4747 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
4748 `transaction_id` int(11) NOT NULL,
4749 `code` varchar(10) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
4750 `attribute` varchar(255) DEFAULT NULL COMMENT 'custom patron field value',
4752 KEY `pseudonymized_borrower_attributes_ibfk_1` (`transaction_id`),
4753 KEY `anonymized_borrower_attributes_ibfk_2` (`code`),
4754 CONSTRAINT `anonymized_borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
4755 CONSTRAINT `pseudonymized_borrower_attributes_ibfk_1` FOREIGN KEY (`transaction_id`) REFERENCES `pseudonymized_transactions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4756 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4757 /*!40101 SET character_set_client = @saved_cs_client */;
4760 -- Table structure for table `pseudonymized_transactions`
4763 DROP TABLE IF EXISTS `pseudonymized_transactions`;
4764 /*!40101 SET @saved_cs_client = @@character_set_client */;
4765 /*!40101 SET character_set_client = utf8 */;
4766 CREATE TABLE `pseudonymized_transactions` (
4767 `id` int(11) NOT NULL AUTO_INCREMENT,
4768 `hashed_borrowernumber` varchar(60) NOT NULL,
4769 `has_cardnumber` tinyint(1) NOT NULL DEFAULT 0,
4770 `title` longtext DEFAULT NULL,
4771 `city` longtext DEFAULT NULL,
4772 `state` mediumtext DEFAULT NULL,
4773 `zipcode` varchar(25) DEFAULT NULL,
4774 `country` mediumtext DEFAULT NULL,
4775 `branchcode` varchar(10) NOT NULL DEFAULT '',
4776 `categorycode` varchar(10) NOT NULL DEFAULT '',
4777 `dateenrolled` date DEFAULT NULL,
4778 `sex` varchar(1) DEFAULT NULL,
4779 `sort1` varchar(80) DEFAULT NULL,
4780 `sort2` varchar(80) DEFAULT NULL,
4781 `datetime` datetime DEFAULT NULL,
4782 `transaction_branchcode` varchar(10) DEFAULT NULL,
4783 `transaction_type` varchar(16) DEFAULT NULL,
4784 `itemnumber` int(11) DEFAULT NULL,
4785 `itemtype` varchar(10) DEFAULT NULL,
4786 `holdingbranch` varchar(10) DEFAULT NULL,
4787 `homebranch` varchar(10) DEFAULT NULL,
4788 `location` varchar(80) DEFAULT NULL,
4789 `itemcallnumber` varchar(255) DEFAULT NULL,
4790 `ccode` varchar(80) DEFAULT NULL,
4792 KEY `pseudonymized_transactions_ibfk_1` (`categorycode`),
4793 KEY `pseudonymized_transactions_borrowers_ibfk_2` (`branchcode`),
4794 KEY `pseudonymized_transactions_borrowers_ibfk_3` (`transaction_branchcode`)
4795 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4796 /*!40101 SET character_set_client = @saved_cs_client */;
4799 -- Table structure for table `quotes`
4802 DROP TABLE IF EXISTS `quotes`;
4803 /*!40101 SET @saved_cs_client = @@character_set_client */;
4804 /*!40101 SET character_set_client = utf8 */;
4805 CREATE TABLE `quotes` (
4806 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the quote',
4807 `source` mediumtext DEFAULT NULL COMMENT 'source/credit for the quote',
4808 `text` longtext NOT NULL COMMENT 'text of the quote',
4809 `timestamp` datetime DEFAULT NULL COMMENT 'date and time that the quote last appeared in the opac',
4811 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4812 /*!40101 SET character_set_client = @saved_cs_client */;
4815 -- Table structure for table `ratings`
4818 DROP TABLE IF EXISTS `ratings`;
4819 /*!40101 SET @saved_cs_client = @@character_set_client */;
4820 /*!40101 SET character_set_client = utf8 */;
4821 CREATE TABLE `ratings` (
4822 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron who left this rating (borrowers.borrowernumber)',
4823 `biblionumber` int(11) NOT NULL COMMENT 'the biblio this rating is for (biblio.biblionumber)',
4824 `rating_value` tinyint(1) NOT NULL COMMENT 'the rating, from 1 to 5',
4825 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
4826 PRIMARY KEY (`borrowernumber`,`biblionumber`),
4827 KEY `ratings_ibfk_2` (`biblionumber`),
4828 CONSTRAINT `ratings_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4829 CONSTRAINT `ratings_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
4830 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4831 /*!40101 SET character_set_client = @saved_cs_client */;
4834 -- Table structure for table `recalls`
4837 DROP TABLE IF EXISTS `recalls`;
4838 /*!40101 SET @saved_cs_client = @@character_set_client */;
4839 /*!40101 SET character_set_client = utf8 */;
4840 CREATE TABLE `recalls` (
4841 `recall_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier for this recall',
4842 `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Identifier for patron who requested recall',
4843 `created_date` datetime DEFAULT NULL COMMENT 'Date the recall was requested',
4844 `biblio_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Identifier for bibliographic record that has been recalled',
4845 `pickup_library_id` varchar(10) DEFAULT NULL COMMENT 'Identifier for recall pickup library',
4846 `completed_date` datetime DEFAULT NULL COMMENT 'Date the recall is completed (fulfilled, cancelled or expired)',
4847 `notes` mediumtext DEFAULT NULL COMMENT 'Notes related to the recall',
4848 `priority` smallint(6) DEFAULT NULL COMMENT 'Where in the queue the patron sits',
4849 `status` enum('requested','overdue','waiting','in_transit','cancelled','expired','fulfilled') DEFAULT 'requested' COMMENT 'Status of recall',
4850 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time the recall was last updated',
4851 `item_id` int(11) DEFAULT NULL COMMENT 'Identifier for item record that was recalled, if an item-level recall',
4852 `waiting_date` datetime DEFAULT NULL COMMENT 'Date an item was marked as waiting for the patron at the library',
4853 `expiration_date` datetime DEFAULT NULL COMMENT 'Date recall is no longer required, or date recall will expire after waiting on shelf for pickup',
4854 `completed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is old and no longer active, i.e. expired, cancelled or completed',
4855 `item_level` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is for a specific item',
4856 PRIMARY KEY (`recall_id`),
4857 KEY `recalls_ibfk_1` (`patron_id`),
4858 KEY `recalls_ibfk_2` (`biblio_id`),
4859 KEY `recalls_ibfk_3` (`item_id`),
4860 KEY `recalls_ibfk_4` (`pickup_library_id`),
4861 CONSTRAINT `recalls_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4862 CONSTRAINT `recalls_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4863 CONSTRAINT `recalls_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4864 CONSTRAINT `recalls_ibfk_4` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4865 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Information related to recalls in Koha';
4866 /*!40101 SET character_set_client = @saved_cs_client */;
4869 -- Table structure for table `repeatable_holidays`
4872 DROP TABLE IF EXISTS `repeatable_holidays`;
4873 /*!40101 SET @saved_cs_client = @@character_set_client */;
4874 /*!40101 SET character_set_client = utf8 */;
4875 CREATE TABLE `repeatable_holidays` (
4876 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4877 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
4878 `weekday` smallint(6) DEFAULT NULL COMMENT 'day of the week (0=Sunday, 1=Monday, etc) this closing is repeated on',
4879 `day` smallint(6) DEFAULT NULL COMMENT 'day of the month this closing is on',
4880 `month` smallint(6) DEFAULT NULL COMMENT 'month this closing is in',
4881 `title` varchar(50) NOT NULL DEFAULT '' COMMENT 'title of this closing',
4882 `description` mediumtext NOT NULL COMMENT 'description for this closing',
4884 KEY `repeatable_holidays_ibfk_1` (`branchcode`),
4885 CONSTRAINT `repeatable_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4886 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4887 /*!40101 SET character_set_client = @saved_cs_client */;
4890 -- Table structure for table `reports_dictionary`
4893 DROP TABLE IF EXISTS `reports_dictionary`;
4894 /*!40101 SET @saved_cs_client = @@character_set_client */;
4895 /*!40101 SET character_set_client = utf8 */;
4896 CREATE TABLE `reports_dictionary` (
4897 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4898 `name` varchar(255) DEFAULT NULL COMMENT 'name for this definition',
4899 `description` mediumtext DEFAULT NULL COMMENT 'description for this definition',
4900 `date_created` datetime DEFAULT NULL COMMENT 'date and time this definition was created',
4901 `date_modified` datetime DEFAULT NULL COMMENT 'date and time this definition was last modified',
4902 `saved_sql` mediumtext DEFAULT NULL COMMENT 'SQL snippet for us in reports',
4903 `report_area` varchar(6) DEFAULT NULL COMMENT 'Koha module this definition is for Circulation, Catalog, Patrons, Acquistions, Accounts)',
4905 KEY `dictionary_area_idx` (`report_area`)
4906 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4907 /*!40101 SET character_set_client = @saved_cs_client */;
4910 -- Table structure for table `reserves`
4913 DROP TABLE IF EXISTS `reserves`;
4914 /*!40101 SET @saved_cs_client = @@character_set_client */;
4915 /*!40101 SET character_set_client = utf8 */;
4916 CREATE TABLE `reserves` (
4917 `reserve_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4918 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4919 `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
4920 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4921 `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
4922 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
4923 `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4924 `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4925 `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4926 `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4927 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4928 `reservenotes` longtext DEFAULT NULL COMMENT 'notes related to this hold',
4929 `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4930 `found` varchar(1) DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
4931 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4932 `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',
4933 `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4934 `expirationdate` date DEFAULT NULL COMMENT 'the date the hold expires (calculated value)',
4935 `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',
4936 `lowestPriority` tinyint(1) NOT NULL DEFAULT 0,
4937 `suspend` tinyint(1) NOT NULL DEFAULT 0,
4938 `suspend_until` datetime DEFAULT NULL,
4939 `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4940 `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
4941 `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4942 PRIMARY KEY (`reserve_id`),
4943 KEY `priorityfoundidx` (`priority`,`found`),
4944 KEY `borrowernumber` (`borrowernumber`),
4945 KEY `biblionumber` (`biblionumber`),
4946 KEY `itemnumber` (`itemnumber`),
4947 KEY `branchcode` (`branchcode`),
4948 KEY `desk_id` (`desk_id`),
4949 KEY `itemtype` (`itemtype`),
4950 KEY `reserves_ibfk_ig` (`item_group_id`),
4951 CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4952 CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4953 CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4954 CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4955 CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4956 CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE,
4957 CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE
4958 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4959 /*!40101 SET character_set_client = @saved_cs_client */;
4962 -- Table structure for table `restriction_types`
4965 DROP TABLE IF EXISTS `restriction_types`;
4966 /*!40101 SET @saved_cs_client = @@character_set_client */;
4967 /*!40101 SET character_set_client = utf8 */;
4968 CREATE TABLE `restriction_types` (
4969 `code` varchar(50) NOT NULL,
4970 `display_text` text NOT NULL,
4971 `is_system` tinyint(1) NOT NULL DEFAULT 0,
4972 `is_default` tinyint(1) NOT NULL DEFAULT 0,
4973 PRIMARY KEY (`code`)
4974 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4975 /*!40101 SET character_set_client = @saved_cs_client */;
4978 -- Table structure for table `return_claims`
4981 DROP TABLE IF EXISTS `return_claims`;
4982 /*!40101 SET @saved_cs_client = @@character_set_client */;
4983 /*!40101 SET character_set_client = utf8 */;
4984 CREATE TABLE `return_claims` (
4985 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the return claim',
4986 `itemnumber` int(11) NOT NULL COMMENT 'ID of the item',
4987 `issue_id` int(11) DEFAULT NULL COMMENT 'ID of the checkout that triggered the claim',
4988 `borrowernumber` int(11) NOT NULL COMMENT 'ID of the patron',
4989 `notes` mediumtext DEFAULT NULL COMMENT 'Notes about the claim',
4990 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was created',
4991 `created_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that registered the claim',
4992 `updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the claim (notes)',
4993 `updated_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that updated the claim',
4994 `resolution` varchar(80) DEFAULT NULL COMMENT 'Resolution code (RETURN_CLAIM_RESOLUTION AVs)',
4995 `resolved_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was resolved',
4996 `resolved_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that resolved the claim',
4998 UNIQUE KEY `item_issue` (`itemnumber`,`issue_id`),
4999 KEY `itemnumber` (`itemnumber`),
5000 KEY `rc_borrowers_ibfk` (`borrowernumber`),
5001 KEY `rc_created_by_ibfk` (`created_by`),
5002 KEY `rc_updated_by_ibfk` (`updated_by`),
5003 KEY `rc_resolved_by_ibfk` (`resolved_by`),
5004 CONSTRAINT `rc_borrowers_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5005 CONSTRAINT `rc_created_by_ibfk` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5006 CONSTRAINT `rc_items_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5007 CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5008 CONSTRAINT `rc_updated_by_ibfk` FOREIGN KEY (`updated_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5009 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5010 /*!40101 SET character_set_client = @saved_cs_client */;
5013 -- Table structure for table `reviews`
5016 DROP TABLE IF EXISTS `reviews`;
5017 /*!40101 SET @saved_cs_client = @@character_set_client */;
5018 /*!40101 SET character_set_client = utf8 */;
5019 CREATE TABLE `reviews` (
5020 `reviewid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for this comment',
5021 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron left this comment',
5022 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bibliographic record this comment is for',
5023 `review` mediumtext DEFAULT NULL COMMENT 'the body of the comment',
5024 `approved` tinyint(4) DEFAULT 0 COMMENT 'whether this comment has been approved by a librarian (1 for yes, 0 for no)',
5025 `datereviewed` datetime DEFAULT NULL COMMENT 'the date the comment was left',
5026 PRIMARY KEY (`reviewid`),
5027 KEY `reviews_ibfk_1` (`borrowernumber`),
5028 KEY `reviews_ibfk_2` (`biblionumber`),
5029 CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5030 CONSTRAINT `reviews_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5031 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5032 /*!40101 SET character_set_client = @saved_cs_client */;
5035 -- Table structure for table `saved_reports`
5038 DROP TABLE IF EXISTS `saved_reports`;
5039 /*!40101 SET @saved_cs_client = @@character_set_client */;
5040 /*!40101 SET character_set_client = utf8 */;
5041 CREATE TABLE `saved_reports` (
5042 `id` int(11) NOT NULL AUTO_INCREMENT,
5043 `report_id` int(11) DEFAULT NULL,
5044 `report` longtext DEFAULT NULL,
5045 `date_run` datetime DEFAULT NULL,
5047 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5048 /*!40101 SET character_set_client = @saved_cs_client */;
5051 -- Table structure for table `saved_sql`
5054 DROP TABLE IF EXISTS `saved_sql`;
5055 /*!40101 SET @saved_cs_client = @@character_set_client */;
5056 /*!40101 SET character_set_client = utf8 */;
5057 CREATE TABLE `saved_sql` (
5058 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key assigned by Koha',
5059 `borrowernumber` int(11) DEFAULT NULL COMMENT 'the staff member who created this report (borrowers.borrowernumber)',
5060 `date_created` datetime DEFAULT NULL COMMENT 'the date this report was created',
5061 `last_modified` datetime DEFAULT NULL COMMENT 'the date this report was last edited',
5062 `savedsql` mediumtext DEFAULT NULL COMMENT 'the SQL for this report',
5063 `last_run` datetime DEFAULT NULL,
5064 `report_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'the name of this report',
5065 `type` varchar(255) DEFAULT NULL COMMENT 'always 1 for tabular',
5066 `notes` mediumtext DEFAULT NULL COMMENT 'the notes or description given to this report',
5067 `cache_expiry` int(11) NOT NULL DEFAULT 300,
5068 `public` tinyint(1) NOT NULL DEFAULT 0,
5069 `report_area` varchar(6) DEFAULT NULL,
5070 `report_group` varchar(80) DEFAULT NULL,
5071 `report_subgroup` varchar(80) DEFAULT NULL,
5072 `mana_id` int(11) DEFAULT NULL,
5074 KEY `sql_area_group_idx` (`report_group`,`report_subgroup`),
5075 KEY `boridx` (`borrowernumber`)
5076 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5077 /*!40101 SET character_set_client = @saved_cs_client */;
5080 -- Table structure for table `search_field`
5083 DROP TABLE IF EXISTS `search_field`;
5084 /*!40101 SET @saved_cs_client = @@character_set_client */;
5085 /*!40101 SET character_set_client = utf8 */;
5086 CREATE TABLE `search_field` (
5087 `id` int(11) NOT NULL AUTO_INCREMENT,
5088 `name` varchar(255) NOT NULL COMMENT 'the name of the field as it will be stored in the search engine',
5089 `label` varchar(255) NOT NULL COMMENT 'the human readable name of the field, for display',
5090 `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',
5091 `weight` decimal(5,2) DEFAULT NULL,
5092 `facet_order` tinyint(4) DEFAULT NULL COMMENT 'the order place of the field in facet list if faceted',
5093 `staff_client` tinyint(1) NOT NULL DEFAULT 1,
5094 `opac` tinyint(1) NOT NULL DEFAULT 1,
5095 `mandatory` tinyint(1) DEFAULT NULL COMMENT 'if marked this field is not editable or removable',
5097 UNIQUE KEY `name` (`name`(191))
5098 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5099 /*!40101 SET character_set_client = @saved_cs_client */;
5102 -- Table structure for table `search_filters`
5105 DROP TABLE IF EXISTS `search_filters`;
5106 /*!40101 SET @saved_cs_client = @@character_set_client */;
5107 /*!40101 SET character_set_client = utf8 */;
5108 CREATE TABLE `search_filters` (
5109 `search_filter_id` int(11) NOT NULL AUTO_INCREMENT,
5110 `name` varchar(255) NOT NULL COMMENT 'filter name',
5111 `query` mediumtext DEFAULT NULL COMMENT 'filter query part',
5112 `limits` mediumtext DEFAULT NULL COMMENT 'filter limits part',
5113 `opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown on OPAC',
5114 `staff_client` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown in staff client',
5115 PRIMARY KEY (`search_filter_id`)
5116 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5117 /*!40101 SET character_set_client = @saved_cs_client */;
5120 -- Table structure for table `search_history`
5123 DROP TABLE IF EXISTS `search_history`;
5124 /*!40101 SET @saved_cs_client = @@character_set_client */;
5125 /*!40101 SET character_set_client = utf8 */;
5126 CREATE TABLE `search_history` (
5127 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'search history id',
5128 `userid` int(11) NOT NULL COMMENT 'the patron who performed the search (borrowers.borrowernumber)',
5129 `sessionid` varchar(32) NOT NULL COMMENT 'a system generated session id',
5130 `query_desc` varchar(255) NOT NULL COMMENT 'the search that was performed',
5131 `query_cgi` mediumtext NOT NULL COMMENT 'the string to append to the search url to rerun the search',
5132 `type` varchar(16) NOT NULL DEFAULT 'biblio' COMMENT 'search type, must be ''biblio'' or ''authority''',
5133 `total` int(11) NOT NULL COMMENT 'the total of results found',
5134 `time` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the search was run',
5136 KEY `userid` (`userid`),
5137 KEY `sessionid` (`sessionid`)
5138 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Opac search history results';
5139 /*!40101 SET character_set_client = @saved_cs_client */;
5142 -- Table structure for table `search_marc_map`
5145 DROP TABLE IF EXISTS `search_marc_map`;
5146 /*!40101 SET @saved_cs_client = @@character_set_client */;
5147 /*!40101 SET character_set_client = utf8 */;
5148 CREATE TABLE `search_marc_map` (
5149 `id` int(11) NOT NULL AUTO_INCREMENT,
5150 `index_name` enum('biblios','authorities') NOT NULL COMMENT 'what storage index this map is for',
5151 `marc_type` enum('marc21','unimarc') NOT NULL COMMENT 'what MARC type this map is for',
5152 `marc_field` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the MARC specifier for this field',
5154 UNIQUE KEY `index_name` (`index_name`,`marc_field`(191),`marc_type`),
5155 KEY `index_name_2` (`index_name`)
5156 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5157 /*!40101 SET character_set_client = @saved_cs_client */;
5160 -- Table structure for table `search_marc_to_field`
5163 DROP TABLE IF EXISTS `search_marc_to_field`;
5164 /*!40101 SET @saved_cs_client = @@character_set_client */;
5165 /*!40101 SET character_set_client = utf8 */;
5166 CREATE TABLE `search_marc_to_field` (
5167 `search` tinyint(1) NOT NULL DEFAULT 1,
5168 `search_marc_map_id` int(11) NOT NULL,
5169 `search_field_id` int(11) NOT NULL,
5170 `facet` tinyint(1) DEFAULT 0 COMMENT 'true if a facet field should be generated for this',
5171 `suggestible` tinyint(1) DEFAULT 0 COMMENT 'true if this field can be used to generate suggestions for browse',
5172 `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',
5173 PRIMARY KEY (`search_marc_map_id`,`search_field_id`),
5174 KEY `search_field_id` (`search_field_id`),
5175 CONSTRAINT `search_marc_to_field_ibfk_1` FOREIGN KEY (`search_marc_map_id`) REFERENCES `search_marc_map` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
5176 CONSTRAINT `search_marc_to_field_ibfk_2` FOREIGN KEY (`search_field_id`) REFERENCES `search_field` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
5177 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5178 /*!40101 SET character_set_client = @saved_cs_client */;
5181 -- Table structure for table `serial`
5184 DROP TABLE IF EXISTS `serial`;
5185 /*!40101 SET @saved_cs_client = @@character_set_client */;
5186 /*!40101 SET character_set_client = utf8 */;
5187 CREATE TABLE `serial` (
5188 `serialid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the issue',
5189 `biblionumber` int(11) NOT NULL COMMENT 'foreign key for the biblio.biblionumber that this issue is attached to',
5190 `subscriptionid` int(11) NOT NULL COMMENT 'foreign key to the subscription.subscriptionid that this issue is part of',
5191 `serialseq` varchar(100) NOT NULL DEFAULT '' COMMENT 'issue information (volume, number, etc)',
5192 `serialseq_x` varchar(100) DEFAULT NULL COMMENT 'first part of issue information',
5193 `serialseq_y` varchar(100) DEFAULT NULL COMMENT 'second part of issue information',
5194 `serialseq_z` varchar(100) DEFAULT NULL COMMENT 'third part of issue information',
5195 `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'status code for this issue (see manual for full descriptions)',
5196 `planneddate` date DEFAULT NULL COMMENT 'date expected',
5197 `notes` mediumtext DEFAULT NULL COMMENT 'notes',
5198 `publisheddate` date DEFAULT NULL COMMENT 'date published',
5199 `publisheddatetext` varchar(100) DEFAULT NULL COMMENT 'date published (descriptive)',
5200 `claimdate` date DEFAULT NULL COMMENT 'date claimed',
5201 `claims_count` int(11) DEFAULT 0 COMMENT 'number of claims made related to this issue',
5202 `routingnotes` mediumtext DEFAULT NULL COMMENT 'notes from the routing list',
5203 PRIMARY KEY (`serialid`),
5204 KEY `serial_ibfk_1` (`biblionumber`),
5205 KEY `serial_ibfk_2` (`subscriptionid`),
5206 CONSTRAINT `serial_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5207 CONSTRAINT `serial_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5208 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5209 /*!40101 SET character_set_client = @saved_cs_client */;
5212 -- Table structure for table `serialitems`
5215 DROP TABLE IF EXISTS `serialitems`;
5216 /*!40101 SET @saved_cs_client = @@character_set_client */;
5217 /*!40101 SET character_set_client = utf8 */;
5218 CREATE TABLE `serialitems` (
5219 `itemnumber` int(11) NOT NULL,
5220 `serialid` int(11) NOT NULL,
5221 PRIMARY KEY (`itemnumber`),
5222 KEY `serialitems_sfk_1` (`serialid`),
5223 CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE,
5224 CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
5225 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5226 /*!40101 SET character_set_client = @saved_cs_client */;
5229 -- Table structure for table `sessions`
5232 DROP TABLE IF EXISTS `sessions`;
5233 /*!40101 SET @saved_cs_client = @@character_set_client */;
5234 /*!40101 SET character_set_client = utf8 */;
5235 CREATE TABLE `sessions` (
5236 `id` varchar(32) NOT NULL,
5237 `a_session` longblob NOT NULL,
5239 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5240 /*!40101 SET character_set_client = @saved_cs_client */;
5243 -- Table structure for table `sms_providers`
5246 DROP TABLE IF EXISTS `sms_providers`;
5247 /*!40101 SET @saved_cs_client = @@character_set_client */;
5248 /*!40101 SET character_set_client = utf8 */;
5249 CREATE TABLE `sms_providers` (
5250 `id` int(11) NOT NULL AUTO_INCREMENT,
5251 `name` varchar(255) NOT NULL,
5252 `domain` varchar(255) NOT NULL,
5254 UNIQUE KEY `name` (`name`(191))
5255 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5256 /*!40101 SET character_set_client = @saved_cs_client */;
5259 -- Table structure for table `smtp_servers`
5262 DROP TABLE IF EXISTS `smtp_servers`;
5263 /*!40101 SET @saved_cs_client = @@character_set_client */;
5264 /*!40101 SET character_set_client = utf8 */;
5265 CREATE TABLE `smtp_servers` (
5266 `id` int(11) NOT NULL AUTO_INCREMENT,
5267 `name` varchar(80) NOT NULL,
5268 `host` varchar(80) NOT NULL DEFAULT 'localhost',
5269 `port` int(11) NOT NULL DEFAULT 25,
5270 `timeout` int(11) NOT NULL DEFAULT 120,
5271 `ssl_mode` enum('disabled','ssl','starttls') NOT NULL,
5272 `user_name` varchar(80) DEFAULT NULL,
5273 `password` varchar(80) DEFAULT NULL,
5274 `debug` tinyint(1) NOT NULL DEFAULT 0,
5275 `is_default` tinyint(1) NOT NULL DEFAULT 0,
5277 KEY `host_idx` (`host`)
5278 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5279 /*!40101 SET character_set_client = @saved_cs_client */;
5282 -- Table structure for table `social_data`
5285 DROP TABLE IF EXISTS `social_data`;
5286 /*!40101 SET @saved_cs_client = @@character_set_client */;
5287 /*!40101 SET character_set_client = utf8 */;
5288 CREATE TABLE `social_data` (
5289 `isbn` varchar(30) NOT NULL DEFAULT '',
5290 `num_critics` int(11) DEFAULT NULL,
5291 `num_critics_pro` int(11) DEFAULT NULL,
5292 `num_quotations` int(11) DEFAULT NULL,
5293 `num_videos` int(11) DEFAULT NULL,
5294 `score_avg` decimal(5,2) DEFAULT NULL,
5295 `num_scores` int(11) DEFAULT NULL,
5296 PRIMARY KEY (`isbn`)
5297 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5298 /*!40101 SET character_set_client = @saved_cs_client */;
5301 -- Table structure for table `special_holidays`
5304 DROP TABLE IF EXISTS `special_holidays`;
5305 /*!40101 SET @saved_cs_client = @@character_set_client */;
5306 /*!40101 SET character_set_client = utf8 */;
5307 CREATE TABLE `special_holidays` (
5308 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5309 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
5310 `day` smallint(6) NOT NULL DEFAULT 0 COMMENT 'day of the month this closing is on',
5311 `month` smallint(6) NOT NULL DEFAULT 0 COMMENT 'month this closing is in',
5312 `year` smallint(6) NOT NULL DEFAULT 0 COMMENT 'year this closing is in',
5313 `isexception` smallint(1) NOT NULL DEFAULT 1 COMMENT 'is this a holiday exception to a repeatable holiday (1 for yes, 0 for no)',
5314 `title` varchar(50) NOT NULL DEFAULT '' COMMENT 'title for this closing',
5315 `description` mediumtext NOT NULL COMMENT 'description of this closing',
5317 KEY `special_holidays_ibfk_1` (`branchcode`),
5318 CONSTRAINT `special_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5319 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5320 /*!40101 SET character_set_client = @saved_cs_client */;
5323 -- Table structure for table `statistics`
5326 DROP TABLE IF EXISTS `statistics`;
5327 /*!40101 SET @saved_cs_client = @@character_set_client */;
5328 /*!40101 SET character_set_client = utf8 */;
5329 CREATE TABLE `statistics` (
5330 `datetime` datetime DEFAULT NULL COMMENT 'date and time of the transaction',
5331 `branch` varchar(10) DEFAULT NULL COMMENT 'foreign key, branch where the transaction occurred',
5332 `value` double(16,4) DEFAULT NULL COMMENT 'monetary value associated with the transaction',
5333 `type` varchar(16) DEFAULT NULL COMMENT 'transaction type (localuse, issue, return, renew, writeoff, payment)',
5334 `other` longtext DEFAULT NULL COMMENT 'used by SIP',
5335 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific item',
5336 `itemtype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table, links transaction to a specific item type',
5337 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
5338 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower',
5339 `ccode` varchar(80) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific collection code',
5340 `categorycode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower category',
5341 KEY `timeidx` (`datetime`),
5342 KEY `branch_idx` (`branch`),
5343 KEY `type_idx` (`type`),
5344 KEY `itemnumber_idx` (`itemnumber`),
5345 KEY `itemtype_idx` (`itemtype`),
5346 KEY `borrowernumber_idx` (`borrowernumber`),
5347 KEY `ccode_idx` (`ccode`)
5348 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5349 /*!40101 SET character_set_client = @saved_cs_client */;
5352 -- Table structure for table `stockrotationitems`
5355 DROP TABLE IF EXISTS `stockrotationitems`;
5356 /*!40101 SET @saved_cs_client = @@character_set_client */;
5357 /*!40101 SET character_set_client = utf8 */;
5358 CREATE TABLE `stockrotationitems` (
5359 `itemnumber_id` int(11) NOT NULL COMMENT 'Itemnumber to link to a stage & rota',
5360 `stage_id` int(11) NOT NULL COMMENT 'stage ID to link the item to',
5361 `indemand` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should this item be skipped for rotation?',
5362 `fresh` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag showing item is only just added to rota',
5363 PRIMARY KEY (`itemnumber_id`),
5364 KEY `stockrotationitems_sifk` (`stage_id`),
5365 CONSTRAINT `stockrotationitems_iifk` FOREIGN KEY (`itemnumber_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5366 CONSTRAINT `stockrotationitems_sifk` FOREIGN KEY (`stage_id`) REFERENCES `stockrotationstages` (`stage_id`) ON DELETE CASCADE ON UPDATE CASCADE
5367 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5368 /*!40101 SET character_set_client = @saved_cs_client */;
5371 -- Table structure for table `stockrotationrotas`
5374 DROP TABLE IF EXISTS `stockrotationrotas`;
5375 /*!40101 SET @saved_cs_client = @@character_set_client */;
5376 /*!40101 SET character_set_client = utf8 */;
5377 CREATE TABLE `stockrotationrotas` (
5378 `rota_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Stockrotation rota ID',
5379 `title` varchar(100) NOT NULL COMMENT 'Title for this rota',
5380 `description` text NOT NULL COMMENT 'Description for this rota',
5381 `cyclical` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should items on this rota keep cycling?',
5382 `active` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this rota currently active?',
5383 PRIMARY KEY (`rota_id`),
5384 UNIQUE KEY `stockrotationrotas_title` (`title`)
5385 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5386 /*!40101 SET character_set_client = @saved_cs_client */;
5389 -- Table structure for table `stockrotationstages`
5392 DROP TABLE IF EXISTS `stockrotationstages`;
5393 /*!40101 SET @saved_cs_client = @@character_set_client */;
5394 /*!40101 SET character_set_client = utf8 */;
5395 CREATE TABLE `stockrotationstages` (
5396 `stage_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique stage ID',
5397 `position` int(11) NOT NULL COMMENT 'The position of this stage within its rota',
5398 `rota_id` int(11) NOT NULL COMMENT 'The rota this stage belongs to',
5399 `branchcode_id` varchar(10) NOT NULL COMMENT 'Branch this stage relates to',
5400 `duration` int(11) NOT NULL DEFAULT 4 COMMENT 'The number of days items shoud occupy this stage',
5401 PRIMARY KEY (`stage_id`),
5402 KEY `stockrotationstages_rifk` (`rota_id`),
5403 KEY `stockrotationstages_bifk` (`branchcode_id`),
5404 CONSTRAINT `stockrotationstages_bifk` FOREIGN KEY (`branchcode_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5405 CONSTRAINT `stockrotationstages_rifk` FOREIGN KEY (`rota_id`) REFERENCES `stockrotationrotas` (`rota_id`) ON DELETE CASCADE ON UPDATE CASCADE
5406 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5407 /*!40101 SET character_set_client = @saved_cs_client */;
5410 -- Table structure for table `subscription`
5413 DROP TABLE IF EXISTS `subscription`;
5414 /*!40101 SET @saved_cs_client = @@character_set_client */;
5415 /*!40101 SET character_set_client = utf8 */;
5416 CREATE TABLE `subscription` (
5417 `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
5418 `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
5419 `librarian` varchar(100) DEFAULT '' COMMENT 'the librarian''s username from borrowers.userid',
5420 `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
5421 `aqbooksellerid` int(11) DEFAULT 0 COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
5422 `cost` int(11) DEFAULT 0,
5423 `aqbudgetid` int(11) DEFAULT 0,
5424 `weeklength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or numberlength is set)',
5425 `monthlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if weeklength or numberlength is set)',
5426 `numberlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or weeklength is set)',
5427 `periodicity` int(11) DEFAULT NULL COMMENT 'frequency type links to subscription_frequencies.id',
5428 `countissuesperunit` int(11) NOT NULL DEFAULT 1,
5429 `notes` longtext DEFAULT NULL COMMENT 'notes',
5430 `status` varchar(100) NOT NULL DEFAULT '' COMMENT 'status of this subscription',
5431 `lastvalue1` int(11) DEFAULT NULL,
5432 `innerloop1` int(11) DEFAULT 0,
5433 `lastvalue2` int(11) DEFAULT NULL,
5434 `innerloop2` int(11) DEFAULT 0,
5435 `lastvalue3` int(11) DEFAULT NULL,
5436 `innerloop3` int(11) DEFAULT 0,
5437 `firstacquidate` date DEFAULT NULL COMMENT 'first issue received date',
5438 `manualhistory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes or no to managing the history manually',
5439 `irregularity` mediumtext DEFAULT NULL COMMENT 'any irregularities in the subscription',
5440 `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
5441 `letter` varchar(20) DEFAULT NULL,
5442 `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
5443 `locale` varchar(80) DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
5444 `distributedto` mediumtext DEFAULT NULL,
5445 `internalnotes` longtext DEFAULT NULL,
5446 `callnumber` mediumtext DEFAULT NULL COMMENT 'default call number',
5447 `location` varchar(80) DEFAULT '' COMMENT 'default shelving location (items.location)',
5448 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'default branches (items.homebranch)',
5449 `lastbranch` varchar(10) DEFAULT NULL,
5450 `serialsadditems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'does receiving this serial create an item record',
5451 `staffdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the staff',
5452 `opacdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the public',
5453 `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
5454 `enddate` date DEFAULT NULL COMMENT 'subscription end date',
5455 `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
5456 `reneweddate` date DEFAULT NULL COMMENT 'date of last renewal for the subscription',
5457 `itemtype` varchar(10) DEFAULT NULL,
5458 `previousitemtype` varchar(10) DEFAULT NULL,
5459 `mana_id` int(11) DEFAULT NULL,
5460 `ccode` varchar(80) DEFAULT NULL COMMENT 'collection code to assign to serial items',
5461 PRIMARY KEY (`subscriptionid`),
5462 KEY `subscription_ibfk_1` (`periodicity`),
5463 KEY `subscription_ibfk_2` (`numberpattern`),
5464 KEY `subscription_ibfk_3` (`biblionumber`),
5465 CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5466 CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5467 CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5468 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5469 /*!40101 SET character_set_client = @saved_cs_client */;
5472 -- Table structure for table `subscription_frequencies`
5475 DROP TABLE IF EXISTS `subscription_frequencies`;
5476 /*!40101 SET @saved_cs_client = @@character_set_client */;
5477 /*!40101 SET character_set_client = utf8 */;
5478 CREATE TABLE `subscription_frequencies` (
5479 `id` int(11) NOT NULL AUTO_INCREMENT,
5480 `description` mediumtext NOT NULL,
5481 `displayorder` int(11) DEFAULT NULL,
5482 `unit` enum('day','week','month','year') DEFAULT NULL,
5483 `unitsperissue` int(11) NOT NULL DEFAULT 1,
5484 `issuesperunit` int(11) NOT NULL DEFAULT 1,
5486 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5487 /*!40101 SET character_set_client = @saved_cs_client */;
5490 -- Table structure for table `subscription_numberpatterns`
5493 DROP TABLE IF EXISTS `subscription_numberpatterns`;
5494 /*!40101 SET @saved_cs_client = @@character_set_client */;
5495 /*!40101 SET character_set_client = utf8 */;
5496 CREATE TABLE `subscription_numberpatterns` (
5497 `id` int(11) NOT NULL AUTO_INCREMENT,
5498 `label` varchar(255) NOT NULL,
5499 `displayorder` int(11) DEFAULT NULL,
5500 `description` mediumtext NOT NULL,
5501 `numberingmethod` varchar(255) NOT NULL,
5502 `label1` varchar(255) DEFAULT NULL,
5503 `add1` int(11) DEFAULT NULL,
5504 `every1` int(11) DEFAULT NULL,
5505 `whenmorethan1` int(11) DEFAULT NULL,
5506 `setto1` int(11) DEFAULT NULL,
5507 `numbering1` varchar(255) DEFAULT NULL,
5508 `label2` varchar(255) DEFAULT NULL,
5509 `add2` int(11) DEFAULT NULL,
5510 `every2` int(11) DEFAULT NULL,
5511 `whenmorethan2` int(11) DEFAULT NULL,
5512 `setto2` int(11) DEFAULT NULL,
5513 `numbering2` varchar(255) DEFAULT NULL,
5514 `label3` varchar(255) DEFAULT NULL,
5515 `add3` int(11) DEFAULT NULL,
5516 `every3` int(11) DEFAULT NULL,
5517 `whenmorethan3` int(11) DEFAULT NULL,
5518 `setto3` int(11) DEFAULT NULL,
5519 `numbering3` varchar(255) DEFAULT NULL,
5521 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5522 /*!40101 SET character_set_client = @saved_cs_client */;
5525 -- Table structure for table `subscriptionhistory`
5528 DROP TABLE IF EXISTS `subscriptionhistory`;
5529 /*!40101 SET @saved_cs_client = @@character_set_client */;
5530 /*!40101 SET character_set_client = utf8 */;
5531 CREATE TABLE `subscriptionhistory` (
5532 `biblionumber` int(11) NOT NULL,
5533 `subscriptionid` int(11) NOT NULL,
5534 `histstartdate` date DEFAULT NULL,
5535 `histenddate` date DEFAULT NULL,
5536 `missinglist` longtext NOT NULL,
5537 `recievedlist` longtext NOT NULL,
5538 `opacnote` longtext DEFAULT NULL,
5539 `librariannote` longtext DEFAULT NULL,
5540 PRIMARY KEY (`subscriptionid`),
5541 KEY `subscription_history_ibfk_1` (`biblionumber`),
5542 CONSTRAINT `subscription_history_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5543 CONSTRAINT `subscription_history_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5544 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5545 /*!40101 SET character_set_client = @saved_cs_client */;
5548 -- Table structure for table `subscriptionroutinglist`
5551 DROP TABLE IF EXISTS `subscriptionroutinglist`;
5552 /*!40101 SET @saved_cs_client = @@character_set_client */;
5553 /*!40101 SET character_set_client = utf8 */;
5554 CREATE TABLE `subscriptionroutinglist` (
5555 `routingid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5556 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines with patron is on the routing list',
5557 `ranking` int(11) DEFAULT NULL COMMENT 'where the patron stands in line to receive the serial',
5558 `subscriptionid` int(11) NOT NULL COMMENT 'foreign key from the subscription table, defines which subscription this routing list is for',
5559 PRIMARY KEY (`routingid`),
5560 UNIQUE KEY `subscriptionid` (`subscriptionid`,`borrowernumber`),
5561 KEY `subscriptionroutinglist_ibfk_1` (`borrowernumber`),
5562 CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5563 CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5564 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5565 /*!40101 SET character_set_client = @saved_cs_client */;
5568 -- Table structure for table `suggestions`
5571 DROP TABLE IF EXISTS `suggestions`;
5572 /*!40101 SET @saved_cs_client = @@character_set_client */;
5573 /*!40101 SET character_set_client = utf8 */;
5574 CREATE TABLE `suggestions` (
5575 `suggestionid` int(8) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned automatically by Koha',
5576 `suggestedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the person making the suggestion, foreign key linking to the borrowers table',
5577 `suggesteddate` date NOT NULL COMMENT 'date the suggestion was submitted',
5578 `managedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian managing the suggestion, foreign key linking to the borrowers table',
5579 `manageddate` date DEFAULT NULL COMMENT 'date the suggestion was updated',
5580 `acceptedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who accepted the suggestion, foreign key linking to the borrowers table',
5581 `accepteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as accepted',
5582 `rejectedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table',
5583 `rejecteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as rejected',
5584 `lastmodificationby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who edit the suggestion for the last time',
5585 `lastmodificationdate` date DEFAULT NULL COMMENT 'date of the last modification',
5586 `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)',
5587 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the suggestion archived?',
5588 `note` longtext DEFAULT NULL COMMENT 'note entered on the suggestion',
5589 `staff_note` longtext DEFAULT NULL COMMENT 'non-public note entered on the suggestion',
5590 `author` varchar(80) DEFAULT NULL COMMENT 'author of the suggested item',
5591 `title` varchar(255) DEFAULT NULL COMMENT 'title of the suggested item',
5592 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'copyright date of the suggested item',
5593 `publishercode` varchar(255) DEFAULT NULL COMMENT 'publisher of the suggested item',
5594 `date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the suggestion was updated',
5595 `volumedesc` varchar(255) DEFAULT NULL,
5596 `publicationyear` smallint(6) DEFAULT 0,
5597 `place` varchar(255) DEFAULT NULL COMMENT 'publication place of the suggested item',
5598 `isbn` varchar(30) DEFAULT NULL COMMENT 'isbn of the suggested item',
5599 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggestion to the biblio table after the suggestion has been ordered',
5600 `reason` mediumtext DEFAULT NULL COMMENT 'reason for accepting or rejecting the suggestion',
5601 `patronreason` mediumtext DEFAULT NULL COMMENT 'reason for making the suggestion',
5602 `budgetid` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggested budget to the aqbudgets table',
5603 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key linking the suggested branch to the branches table',
5604 `collectiontitle` mediumtext DEFAULT NULL COMMENT 'collection name for the suggested item',
5605 `itemtype` varchar(30) DEFAULT NULL COMMENT 'suggested item type',
5606 `quantity` smallint(6) DEFAULT NULL COMMENT 'suggested quantity to be purchased',
5607 `currency` varchar(10) DEFAULT NULL COMMENT 'suggested currency for the suggested price',
5608 `price` decimal(28,6) DEFAULT NULL COMMENT 'suggested price',
5609 `total` decimal(28,6) DEFAULT NULL COMMENT 'suggested total cost (price*quantity updated for currency)',
5610 PRIMARY KEY (`suggestionid`),
5611 KEY `suggestedby` (`suggestedby`),
5612 KEY `managedby` (`managedby`),
5613 KEY `acceptedby` (`acceptedby`),
5614 KEY `rejectedby` (`rejectedby`),
5615 KEY `biblionumber` (`biblionumber`),
5616 KEY `budgetid` (`budgetid`),
5617 KEY `branchcode` (`branchcode`),
5618 KEY `status` (`STATUS`),
5619 KEY `suggestions_ibfk_lastmodificationby` (`lastmodificationby`),
5620 CONSTRAINT `suggestions_budget_id_fk` FOREIGN KEY (`budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5621 CONSTRAINT `suggestions_ibfk_acceptedby` FOREIGN KEY (`acceptedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5622 CONSTRAINT `suggestions_ibfk_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5623 CONSTRAINT `suggestions_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
5624 CONSTRAINT `suggestions_ibfk_lastmodificationby` FOREIGN KEY (`lastmodificationby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5625 CONSTRAINT `suggestions_ibfk_managedby` FOREIGN KEY (`managedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5626 CONSTRAINT `suggestions_ibfk_rejectedby` FOREIGN KEY (`rejectedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5627 CONSTRAINT `suggestions_ibfk_suggestedby` FOREIGN KEY (`suggestedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5628 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5629 /*!40101 SET character_set_client = @saved_cs_client */;
5632 -- Table structure for table `systempreferences`
5635 DROP TABLE IF EXISTS `systempreferences`;
5636 /*!40101 SET @saved_cs_client = @@character_set_client */;
5637 /*!40101 SET character_set_client = utf8 */;
5638 CREATE TABLE `systempreferences` (
5639 `variable` varchar(50) NOT NULL DEFAULT '' COMMENT 'system preference name',
5640 `value` mediumtext DEFAULT NULL COMMENT 'system preference values',
5641 `options` longtext DEFAULT NULL COMMENT 'options for multiple choice system preferences',
5642 `explanation` mediumtext DEFAULT NULL COMMENT 'descriptive text for the system preference',
5643 `type` varchar(20) DEFAULT NULL COMMENT 'type of question this preference asks (multiple choice, plain text, yes or no, etc)',
5644 PRIMARY KEY (`variable`)
5645 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5646 /*!40101 SET character_set_client = @saved_cs_client */;
5649 -- Table structure for table `tables_settings`
5652 DROP TABLE IF EXISTS `tables_settings`;
5653 /*!40101 SET @saved_cs_client = @@character_set_client */;
5654 /*!40101 SET character_set_client = utf8 */;
5655 CREATE TABLE `tables_settings` (
5656 `module` varchar(255) NOT NULL,
5657 `page` varchar(255) NOT NULL,
5658 `tablename` varchar(255) NOT NULL,
5659 `default_display_length` smallint(6) DEFAULT NULL,
5660 `default_sort_order` varchar(255) DEFAULT NULL,
5661 PRIMARY KEY (`module`(191),`page`(191),`tablename`(191))
5662 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5663 /*!40101 SET character_set_client = @saved_cs_client */;
5666 -- Table structure for table `tags`
5669 DROP TABLE IF EXISTS `tags`;
5670 /*!40101 SET @saved_cs_client = @@character_set_client */;
5671 /*!40101 SET character_set_client = utf8 */;
5672 CREATE TABLE `tags` (
5673 `entry` varchar(255) NOT NULL DEFAULT '',
5674 `weight` bigint(20) NOT NULL DEFAULT 0,
5675 PRIMARY KEY (`entry`(191))
5676 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5677 /*!40101 SET character_set_client = @saved_cs_client */;
5680 -- Table structure for table `tags_all`
5683 DROP TABLE IF EXISTS `tags_all`;
5684 /*!40101 SET @saved_cs_client = @@character_set_client */;
5685 /*!40101 SET character_set_client = utf8 */;
5686 CREATE TABLE `tags_all` (
5687 `tag_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key',
5688 `borrowernumber` int(11) DEFAULT NULL COMMENT 'the patron who added the tag (borrowers.borrowernumber)',
5689 `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was left on (biblio.biblionumber)',
5690 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5691 `language` int(4) DEFAULT NULL COMMENT 'the language the tag was left in',
5692 `date_created` datetime NOT NULL COMMENT 'the date the tag was added',
5693 PRIMARY KEY (`tag_id`),
5694 KEY `tags_borrowers_fk_1` (`borrowernumber`),
5695 KEY `tags_biblionumber_fk_1` (`biblionumber`),
5696 CONSTRAINT `tags_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5697 CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5698 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5699 /*!40101 SET character_set_client = @saved_cs_client */;
5702 -- Table structure for table `tags_approval`
5705 DROP TABLE IF EXISTS `tags_approval`;
5706 /*!40101 SET @saved_cs_client = @@character_set_client */;
5707 /*!40101 SET character_set_client = utf8 */;
5708 CREATE TABLE `tags_approval` (
5709 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5710 `approved` int(1) NOT NULL DEFAULT 0 COMMENT 'whether the tag is approved or not (1=yes, 0=pending, -1=rejected)',
5711 `date_approved` datetime DEFAULT NULL COMMENT 'the date this tag was approved',
5712 `approved_by` int(11) DEFAULT NULL COMMENT 'the librarian who approved the tag (borrowers.borrowernumber)',
5713 `weight_total` int(9) NOT NULL DEFAULT 1 COMMENT 'the total number of times this tag was used',
5714 PRIMARY KEY (`term`),
5715 KEY `tags_approval_borrowers_fk_1` (`approved_by`),
5716 CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5717 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5718 /*!40101 SET character_set_client = @saved_cs_client */;
5721 -- Table structure for table `tags_index`
5724 DROP TABLE IF EXISTS `tags_index`;
5725 /*!40101 SET @saved_cs_client = @@character_set_client */;
5726 /*!40101 SET character_set_client = utf8 */;
5727 CREATE TABLE `tags_index` (
5728 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5729 `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was used on (biblio.biblionumber)',
5730 `weight` int(9) NOT NULL DEFAULT 1 COMMENT 'the number of times this term was used on this bib record',
5731 PRIMARY KEY (`term`,`biblionumber`),
5732 KEY `tags_index_biblionumber_fk_1` (`biblionumber`),
5733 CONSTRAINT `tags_index_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5734 CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`) REFERENCES `tags_approval` (`term`) ON DELETE CASCADE ON UPDATE CASCADE
5735 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5736 /*!40101 SET character_set_client = @saved_cs_client */;
5739 -- Table structure for table `tmp_holdsqueue`
5742 DROP TABLE IF EXISTS `tmp_holdsqueue`;
5743 /*!40101 SET @saved_cs_client = @@character_set_client */;
5744 /*!40101 SET character_set_client = utf8 */;
5745 CREATE TABLE `tmp_holdsqueue` (
5746 `biblionumber` int(11) DEFAULT NULL,
5747 `itemnumber` int(11) DEFAULT NULL,
5748 `barcode` varchar(20) DEFAULT NULL,
5749 `surname` longtext NOT NULL,
5750 `firstname` mediumtext DEFAULT NULL,
5751 `phone` mediumtext DEFAULT NULL,
5752 `borrowernumber` int(11) NOT NULL,
5753 `cardnumber` varchar(32) DEFAULT NULL,
5754 `reservedate` date DEFAULT NULL,
5755 `title` longtext DEFAULT NULL,
5756 `itemcallnumber` varchar(255) DEFAULT NULL,
5757 `holdingbranch` varchar(10) DEFAULT NULL,
5758 `pickbranch` varchar(10) DEFAULT NULL,
5759 `notes` mediumtext DEFAULT NULL,
5760 `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
5761 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this entry as added/last updated',
5762 KEY `tmp_holdsqueue_ibfk_1` (`itemnumber`),
5763 KEY `tmp_holdsqueue_ibfk_2` (`biblionumber`),
5764 KEY `tmp_holdsqueue_ibfk_3` (`borrowernumber`),
5765 CONSTRAINT `tmp_holdsqueue_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5766 CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5767 CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE 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 `transport_cost`
5775 DROP TABLE IF EXISTS `transport_cost`;
5776 /*!40101 SET @saved_cs_client = @@character_set_client */;
5777 /*!40101 SET character_set_client = utf8 */;
5778 CREATE TABLE `transport_cost` (
5779 `frombranch` varchar(10) NOT NULL,
5780 `tobranch` varchar(10) NOT NULL,
5781 `cost` decimal(6,2) NOT NULL,
5782 `disable_transfer` tinyint(1) NOT NULL DEFAULT 0,
5783 PRIMARY KEY (`frombranch`,`tobranch`),
5784 KEY `transport_cost_ibfk_2` (`tobranch`),
5785 CONSTRAINT `transport_cost_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5786 CONSTRAINT `transport_cost_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5787 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5788 /*!40101 SET character_set_client = @saved_cs_client */;
5791 -- Table structure for table `uploaded_files`
5794 DROP TABLE IF EXISTS `uploaded_files`;
5795 /*!40101 SET @saved_cs_client = @@character_set_client */;
5796 /*!40101 SET character_set_client = utf8 */;
5797 CREATE TABLE `uploaded_files` (
5798 `id` int(11) NOT NULL AUTO_INCREMENT,
5799 `hashvalue` char(40) NOT NULL,
5800 `filename` mediumtext NOT NULL,
5801 `dir` mediumtext NOT NULL,
5802 `filesize` int(11) DEFAULT NULL,
5803 `dtcreated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
5804 `uploadcategorycode` text DEFAULT NULL,
5805 `owner` int(11) DEFAULT NULL,
5806 `public` tinyint(4) DEFAULT NULL,
5807 `permanent` tinyint(4) DEFAULT NULL,
5809 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5810 /*!40101 SET character_set_client = @saved_cs_client */;
5813 -- Table structure for table `user_permissions`
5816 DROP TABLE IF EXISTS `user_permissions`;
5817 /*!40101 SET @saved_cs_client = @@character_set_client */;
5818 /*!40101 SET character_set_client = utf8 */;
5819 CREATE TABLE `user_permissions` (
5820 `borrowernumber` int(11) NOT NULL DEFAULT 0,
5821 `module_bit` int(11) NOT NULL DEFAULT 0,
5822 `code` varchar(64) NOT NULL,
5823 PRIMARY KEY (`borrowernumber`,`module_bit`,`code`),
5824 KEY `user_permissions_ibfk_1` (`borrowernumber`),
5825 KEY `user_permissions_ibfk_2` (`module_bit`,`code`),
5826 CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5827 CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`) ON DELETE CASCADE ON UPDATE CASCADE
5828 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5829 /*!40101 SET character_set_client = @saved_cs_client */;
5832 -- Table structure for table `userflags`
5835 DROP TABLE IF EXISTS `userflags`;
5836 /*!40101 SET @saved_cs_client = @@character_set_client */;
5837 /*!40101 SET character_set_client = utf8 */;
5838 CREATE TABLE `userflags` (
5839 `bit` int(11) NOT NULL DEFAULT 0,
5840 `flag` varchar(30) DEFAULT NULL,
5841 `flagdesc` varchar(255) DEFAULT NULL,
5842 `defaulton` int(11) DEFAULT NULL,
5844 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5845 /*!40101 SET character_set_client = @saved_cs_client */;
5848 -- Table structure for table `vendor_edi_accounts`
5851 DROP TABLE IF EXISTS `vendor_edi_accounts`;
5852 /*!40101 SET @saved_cs_client = @@character_set_client */;
5853 /*!40101 SET character_set_client = utf8 */;
5854 CREATE TABLE `vendor_edi_accounts` (
5855 `id` int(11) NOT NULL AUTO_INCREMENT,
5856 `description` mediumtext NOT NULL,
5857 `host` varchar(40) DEFAULT NULL,
5858 `username` varchar(40) DEFAULT NULL,
5859 `password` varchar(40) DEFAULT NULL,
5860 `last_activity` date DEFAULT NULL,
5861 `vendor_id` int(11) DEFAULT NULL,
5862 `download_directory` mediumtext DEFAULT NULL,
5863 `upload_directory` mediumtext DEFAULT NULL,
5864 `san` varchar(20) DEFAULT NULL,
5865 `standard` varchar(3) DEFAULT 'EUR',
5866 `id_code_qualifier` varchar(3) DEFAULT '14',
5867 `transport` varchar(6) DEFAULT 'FTP',
5868 `quotes_enabled` tinyint(1) NOT NULL DEFAULT 0,
5869 `invoices_enabled` tinyint(1) NOT NULL DEFAULT 0,
5870 `orders_enabled` tinyint(1) NOT NULL DEFAULT 0,
5871 `responses_enabled` tinyint(1) NOT NULL DEFAULT 0,
5872 `auto_orders` tinyint(1) NOT NULL DEFAULT 0,
5873 `shipment_budget` int(11) DEFAULT NULL,
5874 `plugin` varchar(256) NOT NULL DEFAULT '',
5876 KEY `vendorid` (`vendor_id`),
5877 KEY `shipmentbudget` (`shipment_budget`),
5878 CONSTRAINT `vfk_shipment_budget` FOREIGN KEY (`shipment_budget`) REFERENCES `aqbudgets` (`budget_id`),
5879 CONSTRAINT `vfk_vendor_id` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`)
5880 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5881 /*!40101 SET character_set_client = @saved_cs_client */;
5884 -- Table structure for table `virtualshelfcontents`
5887 DROP TABLE IF EXISTS `virtualshelfcontents`;
5888 /*!40101 SET @saved_cs_client = @@character_set_client */;
5889 /*!40101 SET character_set_client = utf8 */;
5890 CREATE TABLE `virtualshelfcontents` (
5891 `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',
5892 `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',
5893 `flags` int(11) DEFAULT NULL,
5894 `dateadded` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this bib record was added to the list',
5895 `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)',
5896 KEY `shelfnumber` (`shelfnumber`),
5897 KEY `biblionumber` (`biblionumber`),
5898 KEY `shelfcontents_ibfk_3` (`borrowernumber`),
5899 CONSTRAINT `shelfcontents_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5900 CONSTRAINT `shelfcontents_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
5901 CONSTRAINT `virtualshelfcontents_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE
5902 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5903 /*!40101 SET character_set_client = @saved_cs_client */;
5906 -- Table structure for table `virtualshelfshares`
5909 DROP TABLE IF EXISTS `virtualshelfshares`;
5910 /*!40101 SET @saved_cs_client = @@character_set_client */;
5911 /*!40101 SET character_set_client = utf8 */;
5912 CREATE TABLE `virtualshelfshares` (
5913 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
5914 `shelfnumber` int(11) NOT NULL COMMENT 'foreign key for virtualshelves',
5915 `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrower that accepted access to this list',
5916 `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',
5917 `sharedate` datetime DEFAULT NULL COMMENT 'date of invitation or acceptance of invitation',
5919 KEY `virtualshelfshares_ibfk_1` (`shelfnumber`),
5920 KEY `virtualshelfshares_ibfk_2` (`borrowernumber`),
5921 CONSTRAINT `virtualshelfshares_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5922 CONSTRAINT `virtualshelfshares_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
5923 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5924 /*!40101 SET character_set_client = @saved_cs_client */;
5927 -- Table structure for table `virtualshelves`
5930 DROP TABLE IF EXISTS `virtualshelves`;
5931 /*!40101 SET @saved_cs_client = @@character_set_client */;
5932 /*!40101 SET character_set_client = utf8 */;
5933 CREATE TABLE `virtualshelves` (
5934 `shelfnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5935 `shelfname` varchar(255) DEFAULT NULL COMMENT 'name of the list',
5936 `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)',
5937 `public` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If the list is public',
5938 `sortfield` varchar(16) DEFAULT 'title' COMMENT 'the field this list is sorted on',
5939 `lastmodified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the list was last modified',
5940 `created_on` datetime NOT NULL COMMENT 'creation time',
5941 `allow_change_from_owner` tinyint(1) DEFAULT 1 COMMENT 'can owner change contents?',
5942 `allow_change_from_others` tinyint(1) DEFAULT 0 COMMENT 'can others change contents?',
5943 `allow_change_from_staff` tinyint(1) DEFAULT 0 COMMENT 'can staff change contents?',
5944 PRIMARY KEY (`shelfnumber`),
5945 KEY `virtualshelves_ibfk_1` (`owner`),
5946 CONSTRAINT `virtualshelves_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
5947 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5948 /*!40101 SET character_set_client = @saved_cs_client */;
5951 -- Table structure for table `z3950servers`
5954 DROP TABLE IF EXISTS `z3950servers`;
5955 /*!40101 SET @saved_cs_client = @@character_set_client */;
5956 /*!40101 SET character_set_client = utf8 */;
5957 CREATE TABLE `z3950servers` (
5958 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5959 `host` varchar(255) NOT NULL COMMENT 'target''s host name',
5960 `port` int(11) DEFAULT NULL COMMENT 'port number used to connect to target',
5961 `db` varchar(255) DEFAULT NULL COMMENT 'target''s database name',
5962 `userid` varchar(255) DEFAULT NULL COMMENT 'username needed to log in to target',
5963 `password` varchar(255) DEFAULT NULL COMMENT 'password needed to log in to target',
5964 `servername` longtext NOT NULL COMMENT 'name given to the target by the library',
5965 `checked` smallint(6) DEFAULT NULL COMMENT 'whether this target is checked by default (1 for yes, 0 for no)',
5966 `rank` int(11) DEFAULT NULL COMMENT 'where this target appears in the list of targets',
5967 `syntax` varchar(80) NOT NULL COMMENT 'MARC format provided by this target',
5968 `timeout` int(11) NOT NULL DEFAULT 0 COMMENT 'number of seconds before Koha stops trying to access this server',
5969 `servertype` enum('zed','sru') NOT NULL DEFAULT 'zed' COMMENT 'zed means z39.50 server',
5970 `encoding` mediumtext NOT NULL COMMENT 'characters encoding provided by this target',
5971 `recordtype` enum('authority','biblio') NOT NULL DEFAULT 'biblio' COMMENT 'server contains bibliographic or authority records',
5972 `sru_options` varchar(255) DEFAULT NULL COMMENT 'options like sru=get, sru_version=1.1; will be passed to the server via ZOOM',
5973 `sru_fields` longtext DEFAULT NULL COMMENT 'contains the mapping between the Z3950 search fields and the specific SRU server indexes',
5974 `add_xslt` longtext DEFAULT NULL COMMENT 'zero or more paths to XSLT files to be processed on the search results',
5975 `attributes` varchar(255) DEFAULT NULL COMMENT 'additional attributes passed to PQF queries',
5977 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5978 /*!40101 SET character_set_client = @saved_cs_client */;
5981 -- Table structure for table `zebraqueue`
5984 DROP TABLE IF EXISTS `zebraqueue`;
5985 /*!40101 SET @saved_cs_client = @@character_set_client */;
5986 /*!40101 SET character_set_client = utf8 */;
5987 CREATE TABLE `zebraqueue` (
5988 `id` int(11) NOT NULL AUTO_INCREMENT,
5989 `biblio_auth_number` bigint(20) unsigned NOT NULL DEFAULT 0,
5990 `operation` char(20) NOT NULL DEFAULT '',
5991 `server` char(20) NOT NULL DEFAULT '',
5992 `done` int(11) NOT NULL DEFAULT 0,
5993 `time` timestamp NOT NULL DEFAULT current_timestamp(),
5995 KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
5996 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5997 /*!40101 SET character_set_client = @saved_cs_client */;
5998 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
6000 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
6001 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
6002 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
6003 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
6004 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
6005 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
6006 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
6008 -- Dump completed on 2022-11-25 14:12:24