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 `deleted_biblionumber` int(11) DEFAULT NULL COMMENT 'links the order to the deleted bibliographic record (deletedbiblio.biblionumber)',
646 `entrydate` date DEFAULT NULL COMMENT 'the date the bib was added to the basket',
647 `quantity` smallint(6) DEFAULT NULL COMMENT 'the quantity ordered',
648 `currency` varchar(10) DEFAULT NULL COMMENT 'the currency used for the purchase',
649 `listprice` decimal(28,6) DEFAULT NULL COMMENT 'the vendor price for this line item',
650 `datereceived` date DEFAULT NULL COMMENT 'the date this order was received',
651 `invoiceid` int(11) DEFAULT NULL COMMENT 'id of invoice',
652 `freight` decimal(28,6) DEFAULT NULL COMMENT 'shipping costs (not used)',
653 `unitprice` decimal(28,6) DEFAULT NULL COMMENT 'the actual cost entered when receiving this line item',
654 `unitprice_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the unit price excluding tax (on receiving)',
655 `unitprice_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the unit price including tax (on receiving)',
656 `quantityreceived` smallint(6) NOT NULL DEFAULT 0 COMMENT 'the quantity that have been received so far',
657 `created_by` int(11) DEFAULT NULL COMMENT 'the borrowernumber of order line''s creator',
658 `datecancellationprinted` date DEFAULT NULL COMMENT 'the date the line item was deleted',
659 `cancellationreason` mediumtext DEFAULT NULL COMMENT 'reason of cancellation',
660 `order_internalnote` longtext DEFAULT NULL COMMENT 'notes related to this order line, made for staff',
661 `order_vendornote` longtext DEFAULT NULL COMMENT 'notes related to this order line, made for vendor',
662 `purchaseordernumber` longtext DEFAULT NULL COMMENT 'not used? always NULL',
663 `basketno` int(11) DEFAULT NULL COMMENT 'links this order line to a specific basket (aqbasket.basketno)',
664 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this order line was last modified',
665 `rrp` decimal(13,2) DEFAULT NULL COMMENT 'the retail cost for this line item',
666 `replacementprice` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost for this line item',
667 `rrp_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost excluding tax',
668 `rrp_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost including tax',
669 `ecost` decimal(13,2) DEFAULT NULL COMMENT 'the replacement cost for this line item',
670 `ecost_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the estimated cost excluding tax',
671 `ecost_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the estimated cost including tax',
672 `tax_rate_bak` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate for this line item (%)',
673 `tax_rate_on_ordering` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate on ordering for this line item (%)',
674 `tax_rate_on_receiving` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate on receiving for this line item (%)',
675 `tax_value_bak` decimal(28,6) DEFAULT NULL COMMENT 'the tax value for this line item',
676 `tax_value_on_ordering` decimal(28,6) DEFAULT NULL COMMENT 'the tax value on ordering for this line item',
677 `tax_value_on_receiving` decimal(28,6) DEFAULT NULL COMMENT 'the tax value on receiving for this line item',
678 `discount` float(6,4) DEFAULT NULL COMMENT 'the discount for this line item (%)',
679 `budget_id` int(11) NOT NULL COMMENT 'the fund this order goes against (aqbudgets.budget_id)',
680 `budgetdate` date DEFAULT NULL COMMENT 'not used? always NULL',
681 `sort1` varchar(80) DEFAULT NULL COMMENT 'statistical field',
682 `sort2` varchar(80) DEFAULT NULL COMMENT 'second statistical field',
683 `sort1_authcat` varchar(10) DEFAULT NULL,
684 `sort2_authcat` varchar(10) DEFAULT NULL,
685 `uncertainprice` tinyint(1) DEFAULT NULL COMMENT 'was this price uncertain (1 for yes, 0 for no)',
686 `subscriptionid` int(11) DEFAULT NULL COMMENT 'links this order line to a subscription (subscription.subscriptionid)',
687 `parent_ordernumber` int(11) DEFAULT NULL COMMENT 'ordernumber of parent order line, or same as ordernumber if no parent',
688 `orderstatus` varchar(16) DEFAULT 'new' COMMENT 'the current status for this line item. Can be ''new'', ''ordered'', ''partial'', ''complete'' or ''cancelled''',
689 `line_item_id` varchar(35) DEFAULT NULL COMMENT 'Supplier''s article id for Edifact orderline',
690 `suppliers_reference_number` varchar(35) DEFAULT NULL COMMENT 'Suppliers unique edifact quote ref',
691 `suppliers_reference_qualifier` varchar(3) DEFAULT NULL COMMENT 'Type of number above usually ''QLI''',
692 `suppliers_report` mediumtext DEFAULT NULL COMMENT 'reports received from suppliers',
693 `estimated_delivery_date` date DEFAULT NULL COMMENT 'Estimated delivery date',
694 PRIMARY KEY (`ordernumber`),
695 KEY `basketno` (`basketno`),
696 KEY `biblionumber` (`biblionumber`),
697 KEY `budget_id` (`budget_id`),
698 KEY `parent_ordernumber` (`parent_ordernumber`),
699 KEY `orderstatus` (`orderstatus`),
700 KEY `aqorders_created_by` (`created_by`),
701 KEY `aqorders_ibfk_3` (`invoiceid`),
702 KEY `aqorders_subscriptionid` (`subscriptionid`),
703 KEY `aqorders_currency` (`currency`),
704 CONSTRAINT `aqorders_budget_id_fk` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
705 CONSTRAINT `aqorders_created_by` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
706 CONSTRAINT `aqorders_currency` FOREIGN KEY (`currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
707 CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
708 CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
709 CONSTRAINT `aqorders_ibfk_3` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE SET NULL ON UPDATE CASCADE,
710 CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE SET NULL ON UPDATE CASCADE
711 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
712 /*!40101 SET character_set_client = @saved_cs_client */;
715 -- Table structure for table `aqorders_claims`
718 DROP TABLE IF EXISTS `aqorders_claims`;
719 /*!40101 SET @saved_cs_client = @@character_set_client */;
720 /*!40101 SET character_set_client = utf8 */;
721 CREATE TABLE `aqorders_claims` (
722 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the claims',
723 `ordernumber` int(11) NOT NULL COMMENT 'order linked to this claim',
724 `claimed_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date of the claims',
726 KEY `aqorders_claims_ibfk_1` (`ordernumber`),
727 CONSTRAINT `aqorders_claims_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE
728 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
729 /*!40101 SET character_set_client = @saved_cs_client */;
732 -- Table structure for table `aqorders_items`
735 DROP TABLE IF EXISTS `aqorders_items`;
736 /*!40101 SET @saved_cs_client = @@character_set_client */;
737 /*!40101 SET character_set_client = utf8 */;
738 CREATE TABLE `aqorders_items` (
739 `ordernumber` int(11) NOT NULL COMMENT 'the order this item is attached to (aqorders.ordernumber)',
740 `itemnumber` int(11) NOT NULL COMMENT 'the item number for this item (items.itemnumber)',
741 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this order item was last touched',
742 PRIMARY KEY (`itemnumber`),
743 KEY `ordernumber` (`ordernumber`),
744 CONSTRAINT `aqorders_items_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE
745 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
746 /*!40101 SET character_set_client = @saved_cs_client */;
749 -- Table structure for table `aqorders_transfers`
752 DROP TABLE IF EXISTS `aqorders_transfers`;
753 /*!40101 SET @saved_cs_client = @@character_set_client */;
754 /*!40101 SET character_set_client = utf8 */;
755 CREATE TABLE `aqorders_transfers` (
756 `ordernumber_from` int(11) DEFAULT NULL,
757 `ordernumber_to` int(11) DEFAULT NULL,
758 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
759 UNIQUE KEY `ordernumber_from` (`ordernumber_from`),
760 UNIQUE KEY `ordernumber_to` (`ordernumber_to`),
761 CONSTRAINT `aqorders_transfers_ordernumber_from` FOREIGN KEY (`ordernumber_from`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
762 CONSTRAINT `aqorders_transfers_ordernumber_to` FOREIGN KEY (`ordernumber_to`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE
763 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
764 /*!40101 SET character_set_client = @saved_cs_client */;
767 -- Table structure for table `article_requests`
770 DROP TABLE IF EXISTS `article_requests`;
771 /*!40101 SET @saved_cs_client = @@character_set_client */;
772 /*!40101 SET character_set_client = utf8 */;
773 CREATE TABLE `article_requests` (
774 `id` int(11) NOT NULL AUTO_INCREMENT,
775 `borrowernumber` int(11) NOT NULL,
776 `biblionumber` int(11) NOT NULL,
777 `itemnumber` int(11) DEFAULT NULL,
778 `branchcode` varchar(10) DEFAULT NULL,
779 `title` mediumtext DEFAULT NULL,
780 `author` mediumtext DEFAULT NULL,
781 `volume` mediumtext DEFAULT NULL,
782 `issue` mediumtext DEFAULT NULL,
783 `date` mediumtext DEFAULT NULL,
784 `pages` mediumtext DEFAULT NULL,
785 `chapters` mediumtext DEFAULT NULL,
786 `patron_notes` mediumtext DEFAULT NULL,
787 `status` enum('REQUESTED','PENDING','PROCESSING','COMPLETED','CANCELED') NOT NULL DEFAULT 'REQUESTED',
788 `notes` mediumtext DEFAULT NULL,
789 `format` enum('PHOTOCOPY','SCAN') NOT NULL DEFAULT 'PHOTOCOPY',
790 `urls` mediumtext DEFAULT NULL,
791 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value AR_CANCELLATION',
792 `debit_id` int(11) DEFAULT NULL COMMENT 'Debit line with cost for article scan request',
793 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Be careful with two timestamps in one table not allowing NULL',
794 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
795 `toc_request` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'borrower requested table of contents',
797 KEY `borrowernumber` (`borrowernumber`),
798 KEY `biblionumber` (`biblionumber`),
799 KEY `itemnumber` (`itemnumber`),
800 KEY `branchcode` (`branchcode`),
801 KEY `debit_id` (`debit_id`),
802 CONSTRAINT `article_requests_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
803 CONSTRAINT `article_requests_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
804 CONSTRAINT `article_requests_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
805 CONSTRAINT `article_requests_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
806 CONSTRAINT `article_requests_ibfk_5` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE SET NULL ON UPDATE CASCADE
807 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
808 /*!40101 SET character_set_client = @saved_cs_client */;
811 -- Table structure for table `audio_alerts`
814 DROP TABLE IF EXISTS `audio_alerts`;
815 /*!40101 SET @saved_cs_client = @@character_set_client */;
816 /*!40101 SET character_set_client = utf8 */;
817 CREATE TABLE `audio_alerts` (
818 `id` int(11) NOT NULL AUTO_INCREMENT,
819 `precedence` smallint(5) unsigned NOT NULL,
820 `selector` varchar(255) NOT NULL,
821 `sound` varchar(255) NOT NULL,
823 KEY `precedence` (`precedence`)
824 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
825 /*!40101 SET character_set_client = @saved_cs_client */;
828 -- Table structure for table `auth_header`
831 DROP TABLE IF EXISTS `auth_header`;
832 /*!40101 SET @saved_cs_client = @@character_set_client */;
833 /*!40101 SET character_set_client = utf8 */;
834 CREATE TABLE `auth_header` (
835 `authid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
836 `authtypecode` varchar(10) NOT NULL DEFAULT '',
837 `datecreated` date DEFAULT NULL,
838 `modification_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
839 `origincode` varchar(20) DEFAULT NULL,
840 `authtrees` longtext DEFAULT NULL,
841 `marc` blob DEFAULT NULL,
842 `linkid` bigint(20) DEFAULT NULL,
843 `marcxml` longtext NOT NULL,
844 PRIMARY KEY (`authid`),
845 KEY `origincode` (`origincode`)
846 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
847 /*!40101 SET character_set_client = @saved_cs_client */;
850 -- Table structure for table `auth_subfield_structure`
853 DROP TABLE IF EXISTS `auth_subfield_structure`;
854 /*!40101 SET @saved_cs_client = @@character_set_client */;
855 /*!40101 SET character_set_client = utf8 */;
856 CREATE TABLE `auth_subfield_structure` (
857 `authtypecode` varchar(10) NOT NULL DEFAULT '',
858 `tagfield` varchar(3) NOT NULL DEFAULT '',
859 `tagsubfield` varchar(1) NOT NULL DEFAULT '',
860 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
861 `libopac` varchar(255) NOT NULL DEFAULT '',
862 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
863 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
864 `tab` tinyint(1) DEFAULT NULL,
865 `authorised_value` varchar(32) DEFAULT NULL,
866 `value_builder` varchar(80) DEFAULT NULL,
867 `seealso` varchar(255) DEFAULT NULL,
868 `isurl` tinyint(1) DEFAULT NULL,
869 `hidden` tinyint(3) NOT NULL DEFAULT 0,
870 `linkid` tinyint(1) NOT NULL DEFAULT 0,
871 `kohafield` varchar(45) DEFAULT '',
872 `frameworkcode` varchar(10) NOT NULL DEFAULT '',
873 `defaultvalue` mediumtext DEFAULT NULL,
874 `display_order` int(2) NOT NULL DEFAULT 0,
875 PRIMARY KEY (`authtypecode`,`tagfield`,`tagsubfield`),
876 KEY `tab` (`authtypecode`,`tab`),
877 CONSTRAINT `auth_subfield_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
878 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
879 /*!40101 SET character_set_client = @saved_cs_client */;
882 -- Table structure for table `auth_tag_structure`
885 DROP TABLE IF EXISTS `auth_tag_structure`;
886 /*!40101 SET @saved_cs_client = @@character_set_client */;
887 /*!40101 SET character_set_client = utf8 */;
888 CREATE TABLE `auth_tag_structure` (
889 `authtypecode` varchar(10) NOT NULL DEFAULT '',
890 `tagfield` varchar(3) NOT NULL DEFAULT '',
891 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
892 `libopac` varchar(255) NOT NULL DEFAULT '',
893 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
894 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
895 `authorised_value` varchar(32) DEFAULT NULL,
896 PRIMARY KEY (`authtypecode`,`tagfield`),
897 CONSTRAINT `auth_tag_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
898 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
899 /*!40101 SET character_set_client = @saved_cs_client */;
902 -- Table structure for table `auth_types`
905 DROP TABLE IF EXISTS `auth_types`;
906 /*!40101 SET @saved_cs_client = @@character_set_client */;
907 /*!40101 SET character_set_client = utf8 */;
908 CREATE TABLE `auth_types` (
909 `authtypecode` varchar(10) NOT NULL DEFAULT '',
910 `authtypetext` varchar(255) NOT NULL DEFAULT '',
911 `auth_tag_to_report` varchar(3) NOT NULL DEFAULT '',
912 `summary` longtext NOT NULL,
913 PRIMARY KEY (`authtypecode`)
914 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
915 /*!40101 SET character_set_client = @saved_cs_client */;
918 -- Table structure for table `authorised_value_categories`
921 DROP TABLE IF EXISTS `authorised_value_categories`;
922 /*!40101 SET @saved_cs_client = @@character_set_client */;
923 /*!40101 SET character_set_client = utf8 */;
924 CREATE TABLE `authorised_value_categories` (
925 `category_name` varchar(32) NOT NULL DEFAULT '',
926 `is_system` tinyint(1) DEFAULT 0,
927 PRIMARY KEY (`category_name`)
928 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
929 /*!40101 SET character_set_client = @saved_cs_client */;
932 -- Table structure for table `authorised_values`
935 DROP TABLE IF EXISTS `authorised_values`;
936 /*!40101 SET @saved_cs_client = @@character_set_client */;
937 /*!40101 SET character_set_client = utf8 */;
938 CREATE TABLE `authorised_values` (
939 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify the authorized value',
940 `category` varchar(32) NOT NULL DEFAULT '' COMMENT 'key used to identify the authorized value category',
941 `authorised_value` varchar(80) NOT NULL DEFAULT '' COMMENT 'code use to identify the authorized value',
942 `lib` varchar(200) DEFAULT NULL COMMENT 'authorized value description as printed in the staff interface',
943 `lib_opac` varchar(200) DEFAULT NULL COMMENT 'authorized value description as printed in the OPAC',
944 `imageurl` varchar(200) DEFAULT NULL COMMENT 'authorized value URL',
946 UNIQUE KEY `av_uniq` (`category`,`authorised_value`),
947 KEY `name` (`category`),
948 KEY `lib` (`lib`(191)),
949 KEY `auth_value_idx` (`authorised_value`),
950 CONSTRAINT `authorised_values_authorised_values_category` FOREIGN KEY (`category`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE CASCADE ON UPDATE CASCADE
951 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
952 /*!40101 SET character_set_client = @saved_cs_client */;
955 -- Table structure for table `authorised_values_branches`
958 DROP TABLE IF EXISTS `authorised_values_branches`;
959 /*!40101 SET @saved_cs_client = @@character_set_client */;
960 /*!40101 SET character_set_client = utf8 */;
961 CREATE TABLE `authorised_values_branches` (
962 `av_id` int(11) NOT NULL,
963 `branchcode` varchar(10) NOT NULL,
964 KEY `av_id` (`av_id`),
965 KEY `branchcode` (`branchcode`),
966 CONSTRAINT `authorised_values_branches_ibfk_1` FOREIGN KEY (`av_id`) REFERENCES `authorised_values` (`id`) ON DELETE CASCADE,
967 CONSTRAINT `authorised_values_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
968 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
969 /*!40101 SET character_set_client = @saved_cs_client */;
972 -- Table structure for table `background_jobs`
975 DROP TABLE IF EXISTS `background_jobs`;
976 /*!40101 SET @saved_cs_client = @@character_set_client */;
977 /*!40101 SET character_set_client = utf8 */;
978 CREATE TABLE `background_jobs` (
979 `id` int(11) NOT NULL AUTO_INCREMENT,
980 `status` varchar(32) DEFAULT NULL,
981 `progress` int(11) DEFAULT NULL,
982 `size` int(11) DEFAULT NULL,
983 `borrowernumber` int(11) DEFAULT NULL,
984 `type` varchar(64) DEFAULT NULL,
985 `queue` varchar(191) NOT NULL DEFAULT 'default' COMMENT 'Name of the queue the job is sent to',
986 `data` longtext DEFAULT NULL,
987 `context` longtext DEFAULT NULL COMMENT 'JSON-serialized context information for the job',
988 `enqueued_on` datetime DEFAULT NULL,
989 `started_on` datetime DEFAULT NULL,
990 `ended_on` datetime DEFAULT NULL,
992 KEY `borrowernumber` (`borrowernumber`),
993 KEY `queue` (`queue`),
994 KEY `status` (`status`)
995 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
996 /*!40101 SET character_set_client = @saved_cs_client */;
999 -- Table structure for table `biblio`
1002 DROP TABLE IF EXISTS `biblio`;
1003 /*!40101 SET @saved_cs_client = @@character_set_client */;
1004 /*!40101 SET character_set_client = utf8 */;
1005 CREATE TABLE `biblio` (
1006 `biblionumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned to each bibliographic record',
1007 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'foreign key from the biblio_framework table to identify which framework was used in cataloging this record',
1008 `author` longtext DEFAULT NULL COMMENT 'statement of responsibility from MARC record (100$a in MARC21)',
1009 `title` longtext DEFAULT NULL COMMENT 'title (without the subtitle) from the MARC record (245$a in MARC21)',
1010 `medium` longtext DEFAULT NULL COMMENT 'medium from the MARC record (245$h in MARC21)',
1011 `subtitle` longtext DEFAULT NULL COMMENT 'remainder of the title from the MARC record (245$b in MARC21)',
1012 `part_number` longtext DEFAULT NULL COMMENT 'part number from the MARC record (245$n in MARC21)',
1013 `part_name` longtext DEFAULT NULL COMMENT 'part name from the MARC record (245$p in MARC21)',
1014 `unititle` longtext DEFAULT NULL COMMENT 'uniform title (without the subtitle) from the MARC record (240$a in MARC21)',
1015 `notes` longtext DEFAULT NULL COMMENT 'values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)',
1016 `serial` tinyint(1) DEFAULT NULL COMMENT 'Boolean indicating whether biblio is for a serial',
1017 `seriestitle` longtext DEFAULT NULL,
1018 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'publication or copyright date from the MARC record',
1019 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
1020 `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
1021 `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
1022 PRIMARY KEY (`biblionumber`),
1023 KEY `blbnoidx` (`biblionumber`)
1024 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1025 /*!40101 SET character_set_client = @saved_cs_client */;
1028 -- Table structure for table `biblio_framework`
1031 DROP TABLE IF EXISTS `biblio_framework`;
1032 /*!40101 SET @saved_cs_client = @@character_set_client */;
1033 /*!40101 SET character_set_client = utf8 */;
1034 CREATE TABLE `biblio_framework` (
1035 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'the unique code assigned to the framework',
1036 `frameworktext` varchar(255) NOT NULL DEFAULT '' COMMENT 'the description/name given to the framework',
1037 PRIMARY KEY (`frameworkcode`)
1038 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1039 /*!40101 SET character_set_client = @saved_cs_client */;
1042 -- Table structure for table `biblio_metadata`
1045 DROP TABLE IF EXISTS `biblio_metadata`;
1046 /*!40101 SET @saved_cs_client = @@character_set_client */;
1047 /*!40101 SET character_set_client = utf8 */;
1048 CREATE TABLE `biblio_metadata` (
1049 `id` int(11) NOT NULL AUTO_INCREMENT,
1050 `biblionumber` int(11) NOT NULL,
1051 `format` varchar(16) NOT NULL,
1052 `schema` varchar(16) NOT NULL,
1053 `metadata` longtext NOT NULL,
1054 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1056 UNIQUE KEY `biblio_metadata_uniq_key` (`biblionumber`,`format`,`schema`),
1057 KEY `timestamp` (`timestamp`),
1058 CONSTRAINT `record_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1059 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1060 /*!40101 SET character_set_client = @saved_cs_client */;
1063 -- Table structure for table `biblioitems`
1066 DROP TABLE IF EXISTS `biblioitems`;
1067 /*!40101 SET @saved_cs_client = @@character_set_client */;
1068 /*!40101 SET character_set_client = utf8 */;
1069 CREATE TABLE `biblioitems` (
1070 `biblioitemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, unique identifier assigned by Koha',
1071 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the biblio table',
1072 `volume` longtext DEFAULT NULL,
1073 `number` longtext DEFAULT NULL,
1074 `itemtype` varchar(10) DEFAULT NULL COMMENT 'biblio level item type (MARC21 942$c)',
1075 `isbn` longtext DEFAULT NULL COMMENT 'ISBN (MARC21 020$a)',
1076 `issn` longtext DEFAULT NULL COMMENT 'ISSN (MARC21 022$a)',
1077 `ean` longtext DEFAULT NULL,
1078 `publicationyear` mediumtext DEFAULT NULL,
1079 `publishercode` text DEFAULT NULL COMMENT 'publisher (MARC21 260$b and 264$b)',
1080 `volumedate` date DEFAULT NULL,
1081 `volumedesc` mediumtext DEFAULT NULL COMMENT 'volume information (MARC21 362$a)',
1082 `collectiontitle` longtext DEFAULT NULL,
1083 `collectionissn` mediumtext DEFAULT NULL,
1084 `collectionvolume` longtext DEFAULT NULL,
1085 `editionstatement` mediumtext DEFAULT NULL,
1086 `editionresponsibility` mediumtext DEFAULT NULL,
1087 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1088 `illus` text DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)',
1089 `pages` text DEFAULT NULL COMMENT 'number of pages (MARC21 300$a)',
1090 `notes` longtext DEFAULT NULL,
1091 `size` text DEFAULT NULL COMMENT 'material size (MARC21 300$c)',
1092 `place` text DEFAULT NULL COMMENT 'publication place (MARC21 260$a and 264$a)',
1093 `lccn` longtext DEFAULT NULL COMMENT 'library of congress control number (MARC21 010$a)',
1094 `url` mediumtext DEFAULT NULL COMMENT 'url (MARC21 856$u)',
1095 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source (MARC21 942$2)',
1096 `cn_class` varchar(30) DEFAULT NULL,
1097 `cn_item` varchar(10) DEFAULT NULL,
1098 `cn_suffix` varchar(10) DEFAULT NULL,
1099 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized version of the call number used for sorting',
1100 `agerestriction` varchar(255) DEFAULT NULL COMMENT 'target audience/age restriction from the bib record (MARC21 521$a)',
1101 `totalissues` int(10) DEFAULT NULL,
1102 PRIMARY KEY (`biblioitemnumber`),
1103 KEY `bibinoidx` (`biblioitemnumber`),
1104 KEY `bibnoidx` (`biblionumber`),
1105 KEY `itemtype_idx` (`itemtype`),
1106 KEY `isbn` (`isbn`(191)),
1107 KEY `issn` (`issn`(191)),
1108 KEY `ean` (`ean`(191)),
1109 KEY `publishercode` (`publishercode`(191)),
1110 KEY `timestamp` (`timestamp`),
1111 CONSTRAINT `biblioitems_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1112 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1113 /*!40101 SET character_set_client = @saved_cs_client */;
1116 -- Table structure for table `borrower_attribute_types`
1119 DROP TABLE IF EXISTS `borrower_attribute_types`;
1120 /*!40101 SET @saved_cs_client = @@character_set_client */;
1121 /*!40101 SET character_set_client = utf8 */;
1122 CREATE TABLE `borrower_attribute_types` (
1123 `code` varchar(10) NOT NULL COMMENT 'unique key used to identify each custom field',
1124 `description` varchar(255) NOT NULL COMMENT 'description for each custom field',
1125 `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)',
1126 `unique_id` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this value needs to be unique (1 for yes, 0 for no)',
1127 `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)',
1128 `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)',
1129 `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)',
1130 `authorised_value_category` varchar(32) DEFAULT NULL COMMENT 'foreign key from authorised_values that links this custom field to an authorized value category',
1131 `display_checkout` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field displays in checkout screens',
1132 `category_code` varchar(10) DEFAULT NULL COMMENT 'defines a category for an attribute_type',
1133 `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1134 `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)',
1135 `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1136 PRIMARY KEY (`code`),
1137 KEY `auth_val_cat_idx` (`authorised_value_category`),
1138 KEY `category_code` (`category_code`),
1139 CONSTRAINT `borrower_attribute_types_ibfk_1` FOREIGN KEY (`category_code`) REFERENCES `categories` (`categorycode`)
1140 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1141 /*!40101 SET character_set_client = @saved_cs_client */;
1144 -- Table structure for table `borrower_attribute_types_branches`
1147 DROP TABLE IF EXISTS `borrower_attribute_types_branches`;
1148 /*!40101 SET @saved_cs_client = @@character_set_client */;
1149 /*!40101 SET character_set_client = utf8 */;
1150 CREATE TABLE `borrower_attribute_types_branches` (
1151 `bat_code` varchar(10) DEFAULT NULL,
1152 `b_branchcode` varchar(10) DEFAULT NULL,
1153 KEY `bat_code` (`bat_code`),
1154 KEY `b_branchcode` (`b_branchcode`),
1155 CONSTRAINT `borrower_attribute_types_branches_ibfk_1` FOREIGN KEY (`bat_code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE,
1156 CONSTRAINT `borrower_attribute_types_branches_ibfk_2` FOREIGN KEY (`b_branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1157 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1158 /*!40101 SET character_set_client = @saved_cs_client */;
1161 -- Table structure for table `borrower_attributes`
1164 DROP TABLE IF EXISTS `borrower_attributes`;
1165 /*!40101 SET @saved_cs_client = @@character_set_client */;
1166 /*!40101 SET character_set_client = utf8 */;
1167 CREATE TABLE `borrower_attributes` (
1168 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
1169 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines which patron/borrower has this attribute',
1170 `code` varchar(10) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
1171 `attribute` varchar(255) DEFAULT NULL COMMENT 'custom patron field value',
1173 KEY `borrowernumber` (`borrowernumber`),
1174 KEY `code_attribute` (`code`,`attribute`(191)),
1175 CONSTRAINT `borrower_attributes_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1176 CONSTRAINT `borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE
1177 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1178 /*!40101 SET character_set_client = @saved_cs_client */;
1181 -- Table structure for table `borrower_debarments`
1184 DROP TABLE IF EXISTS `borrower_debarments`;
1185 /*!40101 SET @saved_cs_client = @@character_set_client */;
1186 /*!40101 SET character_set_client = utf8 */;
1187 CREATE TABLE `borrower_debarments` (
1188 `borrower_debarment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the restriction',
1189 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key for borrowers.borrowernumber for patron who is restricted',
1190 `expiration` date DEFAULT NULL COMMENT 'expiration date of the restriction',
1191 `type` varchar(50) NOT NULL COMMENT 'type of restriction, FK to restriction_types.code',
1192 `comment` mediumtext DEFAULT NULL COMMENT 'comments about the restriction',
1193 `manager_id` int(11) DEFAULT NULL COMMENT 'foreign key for borrowers.borrowernumber for the librarian managing the restriction',
1194 `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date the restriction was added',
1195 `updated` timestamp NULL DEFAULT NULL COMMENT 'date the restriction was updated',
1196 PRIMARY KEY (`borrower_debarment_id`),
1197 KEY `borrowernumber` (`borrowernumber`),
1198 KEY `borrower_debarments_ibfk_2` (`type`),
1199 CONSTRAINT `borrower_debarments_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1200 CONSTRAINT `borrower_debarments_ibfk_2` FOREIGN KEY (`type`) REFERENCES `restriction_types` (`code`) ON DELETE NO ACTION ON UPDATE CASCADE
1201 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1202 /*!40101 SET character_set_client = @saved_cs_client */;
1205 -- Table structure for table `borrower_files`
1208 DROP TABLE IF EXISTS `borrower_files`;
1209 /*!40101 SET @saved_cs_client = @@character_set_client */;
1210 /*!40101 SET character_set_client = utf8 */;
1211 CREATE TABLE `borrower_files` (
1212 `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
1213 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking to the patron via the borrowernumber',
1214 `file_name` varchar(255) NOT NULL COMMENT 'file name',
1215 `file_type` varchar(255) NOT NULL COMMENT 'type of file',
1216 `file_description` varchar(255) DEFAULT NULL COMMENT 'description given to the file',
1217 `file_content` longblob NOT NULL COMMENT 'the file',
1218 `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
1219 PRIMARY KEY (`file_id`),
1220 KEY `borrowernumber` (`borrowernumber`),
1221 CONSTRAINT `borrower_files_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1222 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1223 /*!40101 SET character_set_client = @saved_cs_client */;
1226 -- Table structure for table `borrower_message_preferences`
1229 DROP TABLE IF EXISTS `borrower_message_preferences`;
1230 /*!40101 SET @saved_cs_client = @@character_set_client */;
1231 /*!40101 SET character_set_client = utf8 */;
1232 CREATE TABLE `borrower_message_preferences` (
1233 `borrower_message_preference_id` int(11) NOT NULL AUTO_INCREMENT,
1234 `borrowernumber` int(11) DEFAULT NULL,
1235 `categorycode` varchar(10) DEFAULT NULL,
1236 `message_attribute_id` int(11) DEFAULT 0,
1237 `days_in_advance` int(11) DEFAULT NULL,
1238 `wants_digest` tinyint(1) NOT NULL DEFAULT 0,
1239 PRIMARY KEY (`borrower_message_preference_id`),
1240 KEY `borrowernumber` (`borrowernumber`),
1241 KEY `categorycode` (`categorycode`),
1242 KEY `message_attribute_id` (`message_attribute_id`),
1243 CONSTRAINT `borrower_message_preferences_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1244 CONSTRAINT `borrower_message_preferences_ibfk_2` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1245 CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
1246 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1247 /*!40101 SET character_set_client = @saved_cs_client */;
1250 -- Table structure for table `borrower_message_transport_preferences`
1253 DROP TABLE IF EXISTS `borrower_message_transport_preferences`;
1254 /*!40101 SET @saved_cs_client = @@character_set_client */;
1255 /*!40101 SET character_set_client = utf8 */;
1256 CREATE TABLE `borrower_message_transport_preferences` (
1257 `borrower_message_preference_id` int(11) NOT NULL DEFAULT 0,
1258 `message_transport_type` varchar(20) NOT NULL DEFAULT '0',
1259 PRIMARY KEY (`borrower_message_preference_id`,`message_transport_type`),
1260 KEY `message_transport_type` (`message_transport_type`),
1261 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,
1262 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
1263 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1264 /*!40101 SET character_set_client = @saved_cs_client */;
1267 -- Table structure for table `borrower_modifications`
1270 DROP TABLE IF EXISTS `borrower_modifications`;
1271 /*!40101 SET @saved_cs_client = @@character_set_client */;
1272 /*!40101 SET character_set_client = utf8 */;
1273 CREATE TABLE `borrower_modifications` (
1274 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1275 `verification_token` varchar(255) NOT NULL DEFAULT '',
1276 `changed_fields` mediumtext DEFAULT NULL,
1277 `borrowernumber` int(11) NOT NULL DEFAULT 0,
1278 `cardnumber` varchar(32) DEFAULT NULL,
1279 `surname` longtext DEFAULT NULL,
1280 `firstname` mediumtext DEFAULT NULL,
1281 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1282 `title` longtext DEFAULT NULL,
1283 `othernames` longtext DEFAULT NULL,
1284 `initials` mediumtext DEFAULT NULL,
1285 `pronouns` longtext DEFAULT NULL,
1286 `streetnumber` varchar(10) DEFAULT NULL,
1287 `streettype` varchar(50) DEFAULT NULL,
1288 `address` longtext DEFAULT NULL,
1289 `address2` mediumtext DEFAULT NULL,
1290 `city` longtext DEFAULT NULL,
1291 `state` mediumtext DEFAULT NULL,
1292 `zipcode` varchar(25) DEFAULT NULL,
1293 `country` mediumtext DEFAULT NULL,
1294 `email` longtext DEFAULT NULL,
1295 `phone` mediumtext DEFAULT NULL,
1296 `mobile` varchar(50) DEFAULT NULL,
1297 `fax` longtext DEFAULT NULL,
1298 `emailpro` mediumtext DEFAULT NULL,
1299 `phonepro` mediumtext DEFAULT NULL,
1300 `B_streetnumber` varchar(10) DEFAULT NULL,
1301 `B_streettype` varchar(50) DEFAULT NULL,
1302 `B_address` varchar(100) DEFAULT NULL,
1303 `B_address2` mediumtext DEFAULT NULL,
1304 `B_city` longtext DEFAULT NULL,
1305 `B_state` mediumtext DEFAULT NULL,
1306 `B_zipcode` varchar(25) DEFAULT NULL,
1307 `B_country` mediumtext DEFAULT NULL,
1308 `B_email` mediumtext DEFAULT NULL,
1309 `B_phone` longtext DEFAULT NULL,
1310 `dateofbirth` date DEFAULT NULL,
1311 `branchcode` varchar(10) DEFAULT NULL,
1312 `categorycode` varchar(10) DEFAULT NULL,
1313 `dateenrolled` date DEFAULT NULL,
1314 `dateexpiry` date DEFAULT NULL,
1315 `date_renewed` date DEFAULT NULL,
1316 `gonenoaddress` tinyint(1) DEFAULT NULL,
1317 `lost` tinyint(1) DEFAULT NULL,
1318 `debarred` date DEFAULT NULL,
1319 `debarredcomment` varchar(255) DEFAULT NULL,
1320 `contactname` longtext DEFAULT NULL,
1321 `contactfirstname` mediumtext DEFAULT NULL,
1322 `contacttitle` mediumtext DEFAULT NULL,
1323 `borrowernotes` longtext DEFAULT NULL,
1324 `relationship` varchar(100) DEFAULT NULL,
1325 `sex` varchar(1) DEFAULT NULL,
1326 `password` varchar(30) DEFAULT NULL,
1327 `flags` bigint(11) DEFAULT NULL,
1328 `userid` varchar(75) DEFAULT NULL,
1329 `opacnote` longtext DEFAULT NULL,
1330 `contactnote` varchar(255) DEFAULT NULL,
1331 `sort1` varchar(80) DEFAULT NULL,
1332 `sort2` varchar(80) DEFAULT NULL,
1333 `altcontactfirstname` varchar(255) DEFAULT NULL,
1334 `altcontactsurname` varchar(255) DEFAULT NULL,
1335 `altcontactaddress1` varchar(255) DEFAULT NULL,
1336 `altcontactaddress2` varchar(255) DEFAULT NULL,
1337 `altcontactaddress3` varchar(255) DEFAULT NULL,
1338 `altcontactstate` mediumtext DEFAULT NULL,
1339 `altcontactzipcode` varchar(50) DEFAULT NULL,
1340 `altcontactcountry` mediumtext DEFAULT NULL,
1341 `altcontactphone` varchar(50) DEFAULT NULL,
1342 `smsalertnumber` varchar(50) DEFAULT NULL,
1343 `privacy` int(11) DEFAULT NULL,
1344 `extended_attributes` mediumtext DEFAULT NULL,
1345 `gdpr_proc_consent` datetime DEFAULT NULL COMMENT 'data processing consent',
1346 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1347 PRIMARY KEY (`verification_token`(191),`borrowernumber`),
1348 KEY `verification_token` (`verification_token`(191)),
1349 KEY `borrowernumber` (`borrowernumber`)
1350 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1351 /*!40101 SET character_set_client = @saved_cs_client */;
1354 -- Table structure for table `borrower_password_recovery`
1357 DROP TABLE IF EXISTS `borrower_password_recovery`;
1358 /*!40101 SET @saved_cs_client = @@character_set_client */;
1359 /*!40101 SET character_set_client = utf8 */;
1360 CREATE TABLE `borrower_password_recovery` (
1361 `borrowernumber` int(11) NOT NULL COMMENT 'the user asking a password recovery',
1362 `uuid` varchar(128) NOT NULL COMMENT 'a unique string to identify a password recovery attempt',
1363 `valid_until` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'a time limit on the password recovery attempt',
1364 PRIMARY KEY (`borrowernumber`),
1365 KEY `borrowernumber` (`borrowernumber`)
1366 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1367 /*!40101 SET character_set_client = @saved_cs_client */;
1370 -- Table structure for table `borrower_relationships`
1373 DROP TABLE IF EXISTS `borrower_relationships`;
1374 /*!40101 SET @saved_cs_client = @@character_set_client */;
1375 /*!40101 SET character_set_client = utf8 */;
1376 CREATE TABLE `borrower_relationships` (
1377 `id` int(11) NOT NULL AUTO_INCREMENT,
1378 `guarantor_id` int(11) NOT NULL,
1379 `guarantee_id` int(11) NOT NULL,
1380 `relationship` varchar(100) NOT NULL,
1382 UNIQUE KEY `guarantor_guarantee_idx` (`guarantor_id`,`guarantee_id`),
1383 KEY `r_guarantee` (`guarantee_id`),
1384 CONSTRAINT `r_guarantee` FOREIGN KEY (`guarantee_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1385 CONSTRAINT `r_guarantor` FOREIGN KEY (`guarantor_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1386 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1387 /*!40101 SET character_set_client = @saved_cs_client */;
1390 -- Table structure for table `borrowers`
1393 DROP TABLE IF EXISTS `borrowers`;
1394 /*!40101 SET @saved_cs_client = @@character_set_client */;
1395 /*!40101 SET character_set_client = utf8 */;
1396 CREATE TABLE `borrowers` (
1397 `borrowernumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, Koha assigned ID number for patrons/borrowers',
1398 `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
1399 `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1400 `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
1401 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1402 `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1403 `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
1404 `initials` mediumtext DEFAULT NULL COMMENT 'initials for your patron/borrower',
1405 `pronouns` longtext DEFAULT NULL COMMENT 'patron/borrower pronouns',
1406 `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',
1407 `streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s primary address',
1408 `address` longtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s primary address',
1409 `address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s primary address',
1410 `city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s primary address',
1411 `state` mediumtext DEFAULT NULL COMMENT 'the state or province for your patron/borrower''s primary address',
1412 `zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s primary address',
1413 `country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s primary address',
1414 `email` longtext DEFAULT NULL COMMENT 'the primary email address for your patron/borrower''s primary address',
1415 `phone` mediumtext DEFAULT NULL COMMENT 'the primary phone number for your patron/borrower''s primary address',
1416 `mobile` tinytext DEFAULT NULL COMMENT 'the other phone number for your patron/borrower''s primary address',
1417 `fax` longtext DEFAULT NULL COMMENT 'the fax number for your patron/borrower''s primary address',
1418 `emailpro` mediumtext DEFAULT NULL COMMENT 'the secondary email addres for your patron/borrower''s primary address',
1419 `phonepro` mediumtext DEFAULT NULL COMMENT 'the secondary phone number for your patron/borrower''s primary address',
1420 `B_streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address',
1421 `B_streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s alternate address',
1422 `B_address` mediumtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s alternate address',
1423 `B_address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s alternate address',
1424 `B_city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s alternate address',
1425 `B_state` mediumtext DEFAULT NULL COMMENT 'the state for your patron/borrower''s alternate address',
1426 `B_zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s alternate address',
1427 `B_country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s alternate address',
1428 `B_email` mediumtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate email address',
1429 `B_phone` longtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate phone number',
1430 `dateofbirth` date DEFAULT NULL COMMENT 'the patron/borrower''s date of birth (YYYY-MM-DD)',
1431 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table, includes the code of the patron/borrower''s home branch',
1432 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category',
1433 `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)',
1434 `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)',
1435 `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)',
1436 `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed',
1437 `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',
1438 `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',
1439 `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)',
1440 `debarredcomment` varchar(255) DEFAULT NULL COMMENT 'comment on the stop of the patron',
1441 `contactname` longtext DEFAULT NULL COMMENT 'used for children and profesionals to include surname or last name of guarantor or organization name',
1442 `contactfirstname` mediumtext DEFAULT NULL COMMENT 'used for children to include first name of guarantor',
1443 `contacttitle` mediumtext DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor',
1444 `borrowernotes` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface',
1445 `relationship` varchar(100) DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor',
1446 `sex` varchar(1) DEFAULT NULL COMMENT 'patron/borrower''s gender',
1447 `password` varchar(60) DEFAULT NULL COMMENT 'patron/borrower''s Bcrypt encrypted password',
1448 `secret` mediumtext DEFAULT NULL COMMENT 'Secret for 2FA',
1449 `auth_method` enum('password','two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method',
1450 `flags` bigint(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions',
1451 `userid` varchar(75) DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in',
1452 `opacnote` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface',
1453 `contactnote` varchar(255) DEFAULT NULL COMMENT 'a note related to the patron/borrower''s alternate address',
1454 `sort1` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
1455 `sort2` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
1456 `altcontactfirstname` mediumtext DEFAULT NULL COMMENT 'first name of alternate contact for the patron/borrower',
1457 `altcontactsurname` mediumtext DEFAULT NULL COMMENT 'surname or last name of the alternate contact for the patron/borrower',
1458 `altcontactaddress1` mediumtext DEFAULT NULL COMMENT 'the first address line for the alternate contact for the patron/borrower',
1459 `altcontactaddress2` mediumtext DEFAULT NULL COMMENT 'the second address line for the alternate contact for the patron/borrower',
1460 `altcontactaddress3` mediumtext DEFAULT NULL COMMENT 'the city for the alternate contact for the patron/borrower',
1461 `altcontactstate` mediumtext DEFAULT NULL COMMENT 'the state for the alternate contact for the patron/borrower',
1462 `altcontactzipcode` mediumtext DEFAULT NULL COMMENT 'the zipcode for the alternate contact for the patron/borrower',
1463 `altcontactcountry` mediumtext DEFAULT NULL COMMENT 'the country for the alternate contact for the patron/borrower',
1464 `altcontactphone` mediumtext DEFAULT NULL COMMENT 'the phone number for the alternate contact for the patron/borrower',
1465 `smsalertnumber` varchar(50) DEFAULT NULL COMMENT 'the mobile phone number where the patron/borrower would like to receive notices (if SMS turned on)',
1466 `sms_provider_id` int(11) DEFAULT NULL COMMENT 'the provider of the mobile phone number defined in smsalertnumber',
1467 `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history',
1468 `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines',
1469 `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
1470 `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''.',
1471 `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)',
1472 `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
1473 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
1474 `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
1475 `overdrive_auth_token` mediumtext DEFAULT NULL COMMENT 'persist OverDrive auth token',
1476 `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1477 `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1478 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1479 PRIMARY KEY (`borrowernumber`),
1480 UNIQUE KEY `cardnumber` (`cardnumber`),
1481 UNIQUE KEY `userid` (`userid`),
1482 KEY `categorycode` (`categorycode`),
1483 KEY `branchcode` (`branchcode`),
1484 KEY `surname_idx` (`surname`(191)),
1485 KEY `firstname_idx` (`firstname`(191)),
1486 KEY `othernames_idx` (`othernames`(191)),
1487 KEY `sms_provider_id` (`sms_provider_id`),
1488 KEY `cardnumber_idx` (`cardnumber`),
1489 KEY `userid_idx` (`userid`),
1490 KEY `middle_name_idx` (`middle_name`(768)),
1491 CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
1492 CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`),
1493 CONSTRAINT `borrowers_ibfk_3` FOREIGN KEY (`sms_provider_id`) REFERENCES `sms_providers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
1494 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1495 /*!40101 SET character_set_client = @saved_cs_client */;
1498 -- Table structure for table `branch_transfer_limits`
1501 DROP TABLE IF EXISTS `branch_transfer_limits`;
1502 /*!40101 SET @saved_cs_client = @@character_set_client */;
1503 /*!40101 SET character_set_client = utf8 */;
1504 CREATE TABLE `branch_transfer_limits` (
1505 `limitId` int(8) NOT NULL AUTO_INCREMENT,
1506 `toBranch` varchar(10) NOT NULL,
1507 `fromBranch` varchar(10) NOT NULL,
1508 `itemtype` varchar(10) DEFAULT NULL,
1509 `ccode` varchar(80) DEFAULT NULL,
1510 PRIMARY KEY (`limitId`),
1511 KEY `fromBranch_idx` (`fromBranch`)
1512 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1513 /*!40101 SET character_set_client = @saved_cs_client */;
1516 -- Table structure for table `branches`
1519 DROP TABLE IF EXISTS `branches`;
1520 /*!40101 SET @saved_cs_client = @@character_set_client */;
1521 /*!40101 SET character_set_client = utf8 */;
1522 CREATE TABLE `branches` (
1523 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'a unique key assigned to each branch',
1524 `branchname` longtext NOT NULL COMMENT 'the name of your library or branch',
1525 `branchaddress1` longtext DEFAULT NULL COMMENT 'the first address line of for your library or branch',
1526 `branchaddress2` longtext DEFAULT NULL COMMENT 'the second address line of for your library or branch',
1527 `branchaddress3` longtext DEFAULT NULL COMMENT 'the third address line of for your library or branch',
1528 `branchzip` varchar(25) DEFAULT NULL COMMENT 'the zip or postal code for your library or branch',
1529 `branchcity` longtext DEFAULT NULL COMMENT 'the city or province for your library or branch',
1530 `branchstate` longtext DEFAULT NULL COMMENT 'the state for your library or branch',
1531 `branchcountry` mediumtext DEFAULT NULL COMMENT 'the county for your library or branch',
1532 `branchphone` longtext DEFAULT NULL COMMENT 'the primary phone for your library or branch',
1533 `branchfax` longtext DEFAULT NULL COMMENT 'the fax number for your library or branch',
1534 `branchemail` longtext DEFAULT NULL COMMENT 'the primary email address for your library or branch',
1535 `branchillemail` longtext DEFAULT NULL COMMENT 'the ILL staff email address for your library or branch',
1536 `branchreplyto` longtext DEFAULT NULL COMMENT 'the email to be used as a Reply-To',
1537 `branchreturnpath` longtext DEFAULT NULL COMMENT 'the email to be used as Return-Path',
1538 `branchurl` longtext DEFAULT NULL COMMENT 'the URL for your library or branch''s website',
1539 `issuing` tinyint(4) DEFAULT NULL COMMENT 'unused in Koha',
1540 `branchip` varchar(15) DEFAULT NULL COMMENT 'the IP address for your library or branch',
1541 `branchnotes` longtext DEFAULT NULL COMMENT 'notes related to your library or branch',
1542 `geolocation` varchar(255) DEFAULT NULL COMMENT 'geolocation of your library',
1543 `marcorgcode` varchar(16) DEFAULT NULL COMMENT 'MARC Organization Code, see http://www.loc.gov/marc/organizations/orgshome.html, when empty defaults to syspref MARCOrgCode',
1544 `pickup_location` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'the ability to act as a pickup location',
1545 `public` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'whether this library should show in the opac',
1546 PRIMARY KEY (`branchcode`)
1547 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1548 /*!40101 SET character_set_client = @saved_cs_client */;
1551 -- Table structure for table `branches_overdrive`
1554 DROP TABLE IF EXISTS `branches_overdrive`;
1555 /*!40101 SET @saved_cs_client = @@character_set_client */;
1556 /*!40101 SET character_set_client = utf8 */;
1557 CREATE TABLE `branches_overdrive` (
1558 `branchcode` varchar(10) NOT NULL,
1559 `authname` varchar(255) NOT NULL,
1560 PRIMARY KEY (`branchcode`),
1561 CONSTRAINT `branches_overdrive_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1562 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1563 /*!40101 SET character_set_client = @saved_cs_client */;
1566 -- Table structure for table `branchtransfers`
1569 DROP TABLE IF EXISTS `branchtransfers`;
1570 /*!40101 SET @saved_cs_client = @@character_set_client */;
1571 /*!40101 SET character_set_client = utf8 */;
1572 CREATE TABLE `branchtransfers` (
1573 `branchtransfer_id` int(12) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
1574 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the itemnumber that it is in transit (items.itemnumber)',
1575 `daterequested` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date the transfer was requested',
1576 `datesent` datetime DEFAULT NULL COMMENT 'the date the transfer was initialized',
1577 `frombranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer is coming from',
1578 `datearrived` datetime DEFAULT NULL COMMENT 'the date the transfer arrived at its destination',
1579 `datecancelled` datetime DEFAULT NULL COMMENT 'the date the transfer was cancelled',
1580 `tobranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer was going to',
1581 `comments` longtext DEFAULT NULL COMMENT 'any comments related to the transfer',
1582 `reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation','Recall','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer',
1583 `cancellation_reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','ItemLost','WrongTransfer','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer cancellation',
1584 PRIMARY KEY (`branchtransfer_id`),
1585 KEY `frombranch` (`frombranch`),
1586 KEY `tobranch` (`tobranch`),
1587 KEY `itemnumber` (`itemnumber`),
1588 CONSTRAINT `branchtransfers_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1589 CONSTRAINT `branchtransfers_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1590 CONSTRAINT `branchtransfers_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1591 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1592 /*!40101 SET character_set_client = @saved_cs_client */;
1595 -- Table structure for table `browser`
1598 DROP TABLE IF EXISTS `browser`;
1599 /*!40101 SET @saved_cs_client = @@character_set_client */;
1600 /*!40101 SET character_set_client = utf8 */;
1601 CREATE TABLE `browser` (
1602 `level` int(11) NOT NULL,
1603 `classification` varchar(20) NOT NULL,
1604 `description` varchar(255) NOT NULL,
1605 `number` bigint(20) NOT NULL,
1606 `endnode` tinyint(4) NOT NULL
1607 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1608 /*!40101 SET character_set_client = @saved_cs_client */;
1611 -- Table structure for table `cash_register_actions`
1614 DROP TABLE IF EXISTS `cash_register_actions`;
1615 /*!40101 SET @saved_cs_client = @@character_set_client */;
1616 /*!40101 SET character_set_client = utf8 */;
1617 CREATE TABLE `cash_register_actions` (
1618 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each account register action',
1619 `code` varchar(24) NOT NULL COMMENT 'action code denoting the type of action recorded (enum),',
1620 `register_id` int(11) NOT NULL COMMENT 'id of cash_register this action belongs to,',
1621 `manager_id` int(11) NOT NULL COMMENT 'staff member performing the action',
1622 `amount` decimal(28,6) DEFAULT NULL COMMENT 'amount recorded in action (signed)',
1623 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1625 KEY `cash_register_actions_manager` (`manager_id`),
1626 KEY `cash_register_actions_register` (`register_id`),
1627 CONSTRAINT `cash_register_actions_manager` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1628 CONSTRAINT `cash_register_actions_register` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1629 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1630 /*!40101 SET character_set_client = @saved_cs_client */;
1633 -- Table structure for table `cash_registers`
1636 DROP TABLE IF EXISTS `cash_registers`;
1637 /*!40101 SET @saved_cs_client = @@character_set_client */;
1638 /*!40101 SET character_set_client = utf8 */;
1639 CREATE TABLE `cash_registers` (
1640 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each account register',
1641 `name` varchar(24) NOT NULL COMMENT 'the user friendly identifier for each account register',
1642 `description` longtext NOT NULL COMMENT 'the user friendly description for each account register',
1643 `branch` varchar(10) NOT NULL COMMENT 'the foreign key the library this account register belongs',
1644 `branch_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote that this till is the branch default',
1645 `starting_float` decimal(28,6) DEFAULT NULL COMMENT 'the starting float this account register should be assigned',
1646 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote if this till is archived or not',
1648 UNIQUE KEY `name` (`name`,`branch`),
1649 KEY `cash_registers_branch` (`branch`),
1650 CONSTRAINT `cash_registers_branch` FOREIGN KEY (`branch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1651 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1652 /*!40101 SET character_set_client = @saved_cs_client */;
1655 -- Table structure for table `categories`
1658 DROP TABLE IF EXISTS `categories`;
1659 /*!40101 SET @saved_cs_client = @@character_set_client */;
1660 /*!40101 SET character_set_client = utf8 */;
1661 CREATE TABLE `categories` (
1662 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'unique primary key used to idenfity the patron category',
1663 `description` longtext DEFAULT NULL COMMENT 'description of the patron category',
1664 `enrolmentperiod` smallint(6) DEFAULT NULL COMMENT 'number of months the patron is enrolled for (will be NULL if enrolmentperioddate is set)',
1665 `enrolmentperioddate` date DEFAULT NULL COMMENT 'date the patron is enrolled until (will be NULL if enrolmentperiod is set)',
1666 `password_expiry_days` smallint(6) DEFAULT NULL COMMENT 'number of days after which the patron must reset their password',
1667 `upperagelimit` smallint(6) DEFAULT NULL COMMENT 'age limit for the patron',
1668 `dateofbirthrequired` tinyint(1) DEFAULT NULL COMMENT 'the minimum age required for the patron category',
1669 `finetype` varchar(30) DEFAULT NULL COMMENT 'unused in Koha',
1670 `bulk` tinyint(1) DEFAULT NULL,
1671 `enrolmentfee` decimal(28,6) DEFAULT NULL COMMENT 'enrollment fee for the patron',
1672 `overduenoticerequired` tinyint(1) DEFAULT NULL COMMENT 'are overdue notices sent to this patron category (1 for yes, 0 for no)',
1673 `issuelimit` smallint(6) DEFAULT NULL COMMENT 'unused in Koha',
1674 `reservefee` decimal(28,6) DEFAULT NULL COMMENT 'cost to place holds',
1675 `hidelostitems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'are lost items shown to this category (1 for yes, 0 for no)',
1676 `category_type` varchar(1) NOT NULL DEFAULT 'A' COMMENT 'type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)',
1677 `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',
1678 `default_privacy` enum('default','never','forever') NOT NULL DEFAULT 'default' COMMENT 'Default privacy setting for this patron category',
1679 `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''.',
1680 `can_be_guarantee` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if patrons of this category can be guarantees',
1681 `reset_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can do the password reset flow,',
1682 `change_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can change their passwords in the OAPC',
1683 `min_password_length` smallint(6) DEFAULT NULL COMMENT 'set minimum password length for patrons in this category',
1684 `require_strong_password` tinyint(1) DEFAULT NULL COMMENT 'set required password strength for patrons in this category',
1685 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude patrons of this category from local holds priority',
1686 PRIMARY KEY (`categorycode`),
1687 UNIQUE KEY `categorycode` (`categorycode`)
1688 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1689 /*!40101 SET character_set_client = @saved_cs_client */;
1692 -- Table structure for table `categories_branches`
1695 DROP TABLE IF EXISTS `categories_branches`;
1696 /*!40101 SET @saved_cs_client = @@character_set_client */;
1697 /*!40101 SET character_set_client = utf8 */;
1698 CREATE TABLE `categories_branches` (
1699 `categorycode` varchar(10) DEFAULT NULL,
1700 `branchcode` varchar(10) DEFAULT NULL,
1701 KEY `categorycode` (`categorycode`),
1702 KEY `branchcode` (`branchcode`),
1703 CONSTRAINT `categories_branches_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE,
1704 CONSTRAINT `categories_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1705 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1706 /*!40101 SET character_set_client = @saved_cs_client */;
1709 -- Table structure for table `checkout_renewals`
1712 DROP TABLE IF EXISTS `checkout_renewals`;
1713 /*!40101 SET @saved_cs_client = @@character_set_client */;
1714 /*!40101 SET character_set_client = utf8 */;
1715 CREATE TABLE `checkout_renewals` (
1716 `renewal_id` int(11) NOT NULL AUTO_INCREMENT,
1717 `checkout_id` int(11) DEFAULT NULL COMMENT 'the id of the checkout this renewal pertains to',
1718 `renewer_id` int(11) DEFAULT NULL COMMENT 'the id of the user who processed the renewal',
1719 `seen` tinyint(1) DEFAULT 0 COMMENT 'boolean denoting whether the item was present or not',
1720 `interface` varchar(16) NOT NULL COMMENT 'the interface this renewal took place on',
1721 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the renewal took place',
1722 `renewal_type` enum('Automatic', 'Manual') NOT NULL DEFAULT 'Manual' COMMENT 'whether the renewal was an automatic or manual renewal',
1723 PRIMARY KEY (`renewal_id`),
1724 KEY `renewer_id` (`renewer_id`),
1725 CONSTRAINT `renewals_renewer_id` FOREIGN KEY (`renewer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
1726 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1727 /*!40101 SET character_set_client = @saved_cs_client */;
1730 -- Table structure for table `circulation_rules`
1733 DROP TABLE IF EXISTS `circulation_rules`;
1734 /*!40101 SET @saved_cs_client = @@character_set_client */;
1735 /*!40101 SET character_set_client = utf8 */;
1736 CREATE TABLE `circulation_rules` (
1737 `id` int(11) NOT NULL AUTO_INCREMENT,
1738 `branchcode` varchar(10) DEFAULT NULL,
1739 `categorycode` varchar(10) DEFAULT NULL,
1740 `itemtype` varchar(10) DEFAULT NULL,
1741 `rule_name` varchar(32) NOT NULL,
1742 `rule_value` varchar(32) NOT NULL,
1744 UNIQUE KEY `branchcode` (`branchcode`,`categorycode`,`itemtype`,`rule_name`),
1745 KEY `circ_rules_ibfk_2` (`categorycode`),
1746 KEY `circ_rules_ibfk_3` (`itemtype`),
1747 KEY `rule_name` (`rule_name`),
1748 CONSTRAINT `circ_rules_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1749 CONSTRAINT `circ_rules_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
1750 CONSTRAINT `circ_rules_ibfk_3` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
1751 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1752 /*!40101 SET character_set_client = @saved_cs_client */;
1755 -- Table structure for table `cities`
1758 DROP TABLE IF EXISTS `cities`;
1759 /*!40101 SET @saved_cs_client = @@character_set_client */;
1760 /*!40101 SET character_set_client = utf8 */;
1761 CREATE TABLE `cities` (
1762 `cityid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier added by Koha',
1763 `city_name` varchar(100) NOT NULL DEFAULT '' COMMENT 'name of the city',
1764 `city_state` varchar(100) DEFAULT NULL COMMENT 'name of the state/province',
1765 `city_country` varchar(100) DEFAULT NULL COMMENT 'name of the country',
1766 `city_zipcode` varchar(20) DEFAULT NULL COMMENT 'zip or postal code',
1767 PRIMARY KEY (`cityid`)
1768 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1769 /*!40101 SET character_set_client = @saved_cs_client */;
1772 -- Table structure for table `class_sort_rules`
1775 DROP TABLE IF EXISTS `class_sort_rules`;
1776 /*!40101 SET @saved_cs_client = @@character_set_client */;
1777 /*!40101 SET character_set_client = utf8 */;
1778 CREATE TABLE `class_sort_rules` (
1779 `class_sort_rule` varchar(10) NOT NULL DEFAULT '',
1780 `description` longtext DEFAULT NULL,
1781 `sort_routine` varchar(30) NOT NULL DEFAULT '',
1782 PRIMARY KEY (`class_sort_rule`),
1783 UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
1784 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1785 /*!40101 SET character_set_client = @saved_cs_client */;
1788 -- Table structure for table `class_sources`
1791 DROP TABLE IF EXISTS `class_sources`;
1792 /*!40101 SET @saved_cs_client = @@character_set_client */;
1793 /*!40101 SET character_set_client = utf8 */;
1794 CREATE TABLE `class_sources` (
1795 `cn_source` varchar(10) NOT NULL DEFAULT '',
1796 `description` longtext DEFAULT NULL,
1797 `used` tinyint(4) NOT NULL DEFAULT 0,
1798 `class_sort_rule` varchar(10) NOT NULL DEFAULT '',
1799 `class_split_rule` varchar(10) NOT NULL DEFAULT '',
1800 PRIMARY KEY (`cn_source`),
1801 UNIQUE KEY `cn_source_idx` (`cn_source`),
1802 KEY `used_idx` (`used`),
1803 KEY `class_source_ibfk_1` (`class_sort_rule`),
1804 KEY `class_source_ibfk_2` (`class_split_rule`),
1805 CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`),
1806 CONSTRAINT `class_source_ibfk_2` FOREIGN KEY (`class_split_rule`) REFERENCES `class_split_rules` (`class_split_rule`)
1807 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1808 /*!40101 SET character_set_client = @saved_cs_client */;
1811 -- Table structure for table `class_split_rules`
1814 DROP TABLE IF EXISTS `class_split_rules`;
1815 /*!40101 SET @saved_cs_client = @@character_set_client */;
1816 /*!40101 SET character_set_client = utf8 */;
1817 CREATE TABLE `class_split_rules` (
1818 `class_split_rule` varchar(10) NOT NULL DEFAULT '',
1819 `description` longtext DEFAULT NULL,
1820 `split_routine` varchar(30) NOT NULL DEFAULT '',
1821 `split_regex` varchar(255) NOT NULL DEFAULT '',
1822 PRIMARY KEY (`class_split_rule`),
1823 UNIQUE KEY `class_split_rule_idx` (`class_split_rule`)
1824 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1825 /*!40101 SET character_set_client = @saved_cs_client */;
1828 -- Table structure for table `club_enrollment_fields`
1831 DROP TABLE IF EXISTS `club_enrollment_fields`;
1832 /*!40101 SET @saved_cs_client = @@character_set_client */;
1833 /*!40101 SET character_set_client = utf8 */;
1834 CREATE TABLE `club_enrollment_fields` (
1835 `id` int(11) NOT NULL AUTO_INCREMENT,
1836 `club_enrollment_id` int(11) NOT NULL,
1837 `club_template_enrollment_field_id` int(11) NOT NULL,
1838 `value` mediumtext NOT NULL,
1840 KEY `club_enrollment_id` (`club_enrollment_id`),
1841 KEY `club_template_enrollment_field_id` (`club_template_enrollment_field_id`),
1842 CONSTRAINT `club_enrollment_fields_ibfk_1` FOREIGN KEY (`club_enrollment_id`) REFERENCES `club_enrollments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1843 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
1844 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1845 /*!40101 SET character_set_client = @saved_cs_client */;
1848 -- Table structure for table `club_enrollments`
1851 DROP TABLE IF EXISTS `club_enrollments`;
1852 /*!40101 SET @saved_cs_client = @@character_set_client */;
1853 /*!40101 SET character_set_client = utf8 */;
1854 CREATE TABLE `club_enrollments` (
1855 `id` int(11) NOT NULL AUTO_INCREMENT,
1856 `club_id` int(11) NOT NULL,
1857 `borrowernumber` int(11) NOT NULL,
1858 `date_enrolled` timestamp NOT NULL DEFAULT current_timestamp(),
1859 `date_canceled` timestamp NULL DEFAULT NULL,
1860 `date_created` timestamp NULL DEFAULT NULL,
1861 `date_updated` timestamp NULL DEFAULT NULL,
1862 `branchcode` varchar(10) DEFAULT NULL,
1864 KEY `club_id` (`club_id`),
1865 KEY `borrowernumber` (`borrowernumber`),
1866 KEY `branchcode` (`branchcode`),
1867 CONSTRAINT `club_enrollments_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1868 CONSTRAINT `club_enrollments_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1869 CONSTRAINT `club_enrollments_ibfk_3` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
1870 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1871 /*!40101 SET character_set_client = @saved_cs_client */;
1874 -- Table structure for table `club_fields`
1877 DROP TABLE IF EXISTS `club_fields`;
1878 /*!40101 SET @saved_cs_client = @@character_set_client */;
1879 /*!40101 SET character_set_client = utf8 */;
1880 CREATE TABLE `club_fields` (
1881 `id` int(11) NOT NULL AUTO_INCREMENT,
1882 `club_template_field_id` int(11) NOT NULL,
1883 `club_id` int(11) NOT NULL,
1884 `value` mediumtext DEFAULT NULL,
1886 KEY `club_template_field_id` (`club_template_field_id`),
1887 KEY `club_id` (`club_id`),
1888 CONSTRAINT `club_fields_ibfk_3` FOREIGN KEY (`club_template_field_id`) REFERENCES `club_template_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1889 CONSTRAINT `club_fields_ibfk_4` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1890 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1891 /*!40101 SET character_set_client = @saved_cs_client */;
1894 -- Table structure for table `club_holds`
1897 DROP TABLE IF EXISTS `club_holds`;
1898 /*!40101 SET @saved_cs_client = @@character_set_client */;
1899 /*!40101 SET character_set_client = utf8 */;
1900 CREATE TABLE `club_holds` (
1901 `id` int(11) NOT NULL AUTO_INCREMENT,
1902 `club_id` int(11) NOT NULL COMMENT 'id for the club the hold was generated for',
1903 `biblio_id` int(11) NOT NULL COMMENT 'id for the bibliographic record the hold has been placed against',
1904 `item_id` int(11) DEFAULT NULL COMMENT 'If item-level, the id for the item the hold has been placed agains',
1905 `date_created` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Timestamp for the placed hold',
1907 KEY `clubs_holds_ibfk_1` (`club_id`),
1908 KEY `clubs_holds_ibfk_2` (`biblio_id`),
1909 KEY `clubs_holds_ibfk_3` (`item_id`),
1910 CONSTRAINT `clubs_holds_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1911 CONSTRAINT `clubs_holds_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1912 CONSTRAINT `clubs_holds_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1913 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1914 /*!40101 SET character_set_client = @saved_cs_client */;
1917 -- Table structure for table `club_holds_to_patron_holds`
1920 DROP TABLE IF EXISTS `club_holds_to_patron_holds`;
1921 /*!40101 SET @saved_cs_client = @@character_set_client */;
1922 /*!40101 SET character_set_client = utf8 */;
1923 CREATE TABLE `club_holds_to_patron_holds` (
1924 `id` int(11) NOT NULL AUTO_INCREMENT,
1925 `club_hold_id` int(11) NOT NULL,
1926 `patron_id` int(11) NOT NULL,
1927 `hold_id` int(11) DEFAULT NULL,
1928 `error_code` enum('damaged','ageRestricted','itemAlreadyOnHold','tooManyHoldsForThisRecord','tooManyReservesToday','tooManyReserves','notReservable','cannotReserveFromOtherBranches','libraryNotFound','libraryNotPickupLocation','cannotBeTransferred','noReservesAllowed') DEFAULT NULL,
1929 `error_message` varchar(100) DEFAULT NULL,
1931 KEY `clubs_holds_paton_holds_ibfk_1` (`club_hold_id`),
1932 KEY `clubs_holds_paton_holds_ibfk_2` (`patron_id`),
1933 KEY `clubs_holds_paton_holds_ibfk_3` (`hold_id`),
1934 CONSTRAINT `clubs_holds_paton_holds_ibfk_1` FOREIGN KEY (`club_hold_id`) REFERENCES `club_holds` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1935 CONSTRAINT `clubs_holds_paton_holds_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1936 CONSTRAINT `clubs_holds_paton_holds_ibfk_3` FOREIGN KEY (`hold_id`) REFERENCES `reserves` (`reserve_id`) ON DELETE CASCADE ON UPDATE CASCADE
1937 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1938 /*!40101 SET character_set_client = @saved_cs_client */;
1941 -- Table structure for table `club_template_enrollment_fields`
1944 DROP TABLE IF EXISTS `club_template_enrollment_fields`;
1945 /*!40101 SET @saved_cs_client = @@character_set_client */;
1946 /*!40101 SET character_set_client = utf8 */;
1947 CREATE TABLE `club_template_enrollment_fields` (
1948 `id` int(11) NOT NULL AUTO_INCREMENT,
1949 `club_template_id` int(11) NOT NULL,
1950 `name` text NOT NULL,
1951 `description` mediumtext DEFAULT NULL,
1952 `authorised_value_category` varchar(32) DEFAULT NULL,
1954 KEY `club_template_id` (`club_template_id`),
1955 CONSTRAINT `club_template_enrollment_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1956 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1957 /*!40101 SET character_set_client = @saved_cs_client */;
1960 -- Table structure for table `club_template_fields`
1963 DROP TABLE IF EXISTS `club_template_fields`;
1964 /*!40101 SET @saved_cs_client = @@character_set_client */;
1965 /*!40101 SET character_set_client = utf8 */;
1966 CREATE TABLE `club_template_fields` (
1967 `id` int(11) NOT NULL AUTO_INCREMENT,
1968 `club_template_id` int(11) NOT NULL,
1969 `name` text NOT NULL,
1970 `description` mediumtext DEFAULT NULL,
1971 `authorised_value_category` varchar(32) DEFAULT NULL,
1973 KEY `club_template_id` (`club_template_id`),
1974 CONSTRAINT `club_template_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1975 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1976 /*!40101 SET character_set_client = @saved_cs_client */;
1979 -- Table structure for table `club_templates`
1982 DROP TABLE IF EXISTS `club_templates`;
1983 /*!40101 SET @saved_cs_client = @@character_set_client */;
1984 /*!40101 SET character_set_client = utf8 */;
1985 CREATE TABLE `club_templates` (
1986 `id` int(11) NOT NULL AUTO_INCREMENT,
1987 `name` text NOT NULL,
1988 `description` mediumtext DEFAULT NULL,
1989 `is_enrollable_from_opac` tinyint(1) NOT NULL DEFAULT 0,
1990 `is_email_required` tinyint(1) NOT NULL DEFAULT 0,
1991 `branchcode` varchar(10) DEFAULT NULL,
1992 `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
1993 `date_updated` timestamp NULL DEFAULT NULL,
1994 `is_deletable` tinyint(1) NOT NULL DEFAULT 1,
1996 KEY `ct_branchcode` (`branchcode`),
1997 CONSTRAINT `club_templates_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1998 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1999 /*!40101 SET character_set_client = @saved_cs_client */;
2002 -- Table structure for table `clubs`
2005 DROP TABLE IF EXISTS `clubs`;
2006 /*!40101 SET @saved_cs_client = @@character_set_client */;
2007 /*!40101 SET character_set_client = utf8 */;
2008 CREATE TABLE `clubs` (
2009 `id` int(11) NOT NULL AUTO_INCREMENT,
2010 `club_template_id` int(11) NOT NULL,
2011 `name` text NOT NULL,
2012 `description` mediumtext DEFAULT NULL,
2013 `date_start` date DEFAULT NULL,
2014 `date_end` date DEFAULT NULL,
2015 `branchcode` varchar(10) DEFAULT NULL,
2016 `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
2017 `date_updated` timestamp NULL DEFAULT NULL,
2019 KEY `club_template_id` (`club_template_id`),
2020 KEY `branchcode` (`branchcode`),
2021 CONSTRAINT `clubs_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2022 CONSTRAINT `clubs_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
2023 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2024 /*!40101 SET character_set_client = @saved_cs_client */;
2027 -- Table structure for table `collections`
2030 DROP TABLE IF EXISTS `collections`;
2031 /*!40101 SET @saved_cs_client = @@character_set_client */;
2032 /*!40101 SET character_set_client = utf8 */;
2033 CREATE TABLE `collections` (
2034 `colId` int(11) NOT NULL AUTO_INCREMENT,
2035 `colTitle` varchar(100) NOT NULL DEFAULT '',
2036 `colDesc` mediumtext NOT NULL,
2037 `colBranchcode` varchar(10) DEFAULT NULL COMMENT '''branchcode for branch where item should be held.''',
2038 PRIMARY KEY (`colId`),
2039 KEY `collections_ibfk_1` (`colBranchcode`),
2040 CONSTRAINT `collections_ibfk_1` FOREIGN KEY (`colBranchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2041 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2042 /*!40101 SET character_set_client = @saved_cs_client */;
2045 -- Table structure for table `collections_tracking`
2048 DROP TABLE IF EXISTS `collections_tracking`;
2049 /*!40101 SET @saved_cs_client = @@character_set_client */;
2050 /*!40101 SET character_set_client = utf8 */;
2051 CREATE TABLE `collections_tracking` (
2052 `collections_tracking_id` int(11) NOT NULL AUTO_INCREMENT,
2053 `colId` int(11) NOT NULL DEFAULT 0 COMMENT 'collections.colId',
2054 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'items.itemnumber',
2055 PRIMARY KEY (`collections_tracking_id`),
2056 KEY `collectionst_ibfk_1` (`colId`),
2057 CONSTRAINT `collectionst_ibfk_1` FOREIGN KEY (`colId`) REFERENCES `collections` (`colId`) ON DELETE CASCADE ON UPDATE CASCADE
2058 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2059 /*!40101 SET character_set_client = @saved_cs_client */;
2062 -- Table structure for table `columns_settings`
2065 DROP TABLE IF EXISTS `columns_settings`;
2066 /*!40101 SET @saved_cs_client = @@character_set_client */;
2067 /*!40101 SET character_set_client = utf8 */;
2068 CREATE TABLE `columns_settings` (
2069 `module` varchar(255) NOT NULL,
2070 `page` varchar(255) NOT NULL,
2071 `tablename` varchar(255) NOT NULL,
2072 `columnname` varchar(255) NOT NULL,
2073 `cannot_be_toggled` int(1) NOT NULL DEFAULT 0,
2074 `is_hidden` int(1) NOT NULL DEFAULT 0,
2075 PRIMARY KEY (`module`(191),`page`(191),`tablename`(191),`columnname`(191))
2076 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2077 /*!40101 SET character_set_client = @saved_cs_client */;
2080 -- Table structure for table `course_instructors`
2083 DROP TABLE IF EXISTS `course_instructors`;
2084 /*!40101 SET @saved_cs_client = @@character_set_client */;
2085 /*!40101 SET character_set_client = utf8 */;
2086 CREATE TABLE `course_instructors` (
2087 `course_id` int(11) NOT NULL COMMENT 'foreign key to link to courses.course_id',
2088 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key to link to borrowers.borrowernumber for instructor information',
2089 PRIMARY KEY (`course_id`,`borrowernumber`),
2090 KEY `borrowernumber` (`borrowernumber`),
2091 CONSTRAINT `course_instructors_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2092 CONSTRAINT `course_instructors_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`)
2093 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2094 /*!40101 SET character_set_client = @saved_cs_client */;
2097 -- Table structure for table `course_items`
2100 DROP TABLE IF EXISTS `course_items`;
2101 /*!40101 SET @saved_cs_client = @@character_set_client */;
2102 /*!40101 SET character_set_client = utf8 */;
2103 CREATE TABLE `course_items` (
2104 `ci_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'course item id',
2105 `itemnumber` int(11) DEFAULT NULL COMMENT 'items.itemnumber for the item on reserve',
2106 `biblionumber` int(11) NOT NULL COMMENT 'biblio.biblionumber for the bibliographic record on reserve',
2107 `itype` varchar(10) DEFAULT NULL COMMENT 'new itemtype for the item to have while on reserve (optional)',
2108 `itype_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2109 `itype_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the itype when item is on course reserve',
2110 `ccode` varchar(80) DEFAULT NULL COMMENT 'new category code for the item to have while on reserve (optional)',
2111 `ccode_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if ccode should be changed while on course reserve',
2112 `ccode_storage` varchar(80) DEFAULT NULL COMMENT 'a place to store the ccode when item is on course reserve',
2113 `homebranch` varchar(10) DEFAULT NULL COMMENT 'new home branch for the item to have while on reserve (optional)',
2114 `homebranch_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if homebranch should be changed while on course reserve',
2115 `homebranch_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the homebranch when item is on course reserve',
2116 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'new holding branch for the item to have while on reserve (optional)',
2117 `holdingbranch_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2118 `holdingbranch_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the holdingbranch when item is on course reserve',
2119 `location` varchar(80) DEFAULT NULL COMMENT 'new shelving location for the item to have while on reseve (optional)',
2120 `location_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2121 `location_storage` varchar(80) DEFAULT NULL COMMENT 'a place to store the location when the item is on course reserve',
2122 `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''',
2123 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2124 PRIMARY KEY (`ci_id`),
2125 UNIQUE KEY `itemnumber` (`itemnumber`),
2126 KEY `holdingbranch` (`holdingbranch`),
2127 KEY `fk_course_items_homebranch` (`homebranch`),
2128 KEY `fk_course_items_homebranch_storage` (`homebranch_storage`),
2129 KEY `fk_course_items_biblionumber` (`biblionumber`),
2130 CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2131 CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2132 CONSTRAINT `fk_course_items_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2133 CONSTRAINT `fk_course_items_homebranch` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2134 CONSTRAINT `fk_course_items_homebranch_storage` FOREIGN KEY (`homebranch_storage`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2135 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2136 /*!40101 SET character_set_client = @saved_cs_client */;
2139 -- Table structure for table `course_reserves`
2142 DROP TABLE IF EXISTS `course_reserves`;
2143 /*!40101 SET @saved_cs_client = @@character_set_client */;
2144 /*!40101 SET character_set_client = utf8 */;
2145 CREATE TABLE `course_reserves` (
2146 `cr_id` int(11) NOT NULL AUTO_INCREMENT,
2147 `course_id` int(11) NOT NULL COMMENT 'foreign key to link to courses.course_id',
2148 `ci_id` int(11) NOT NULL COMMENT 'foreign key to link to courses_items.ci_id',
2149 `staff_note` longtext DEFAULT NULL COMMENT 'staff only note',
2150 `public_note` longtext DEFAULT NULL COMMENT 'public, OPAC visible note',
2151 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2152 PRIMARY KEY (`cr_id`),
2153 UNIQUE KEY `pseudo_key` (`course_id`,`ci_id`),
2154 KEY `course_id` (`course_id`),
2155 KEY `course_reserves_ibfk_2` (`ci_id`),
2156 CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`),
2157 CONSTRAINT `course_reserves_ibfk_2` FOREIGN KEY (`ci_id`) REFERENCES `course_items` (`ci_id`) ON DELETE CASCADE ON UPDATE CASCADE
2158 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2159 /*!40101 SET character_set_client = @saved_cs_client */;
2162 -- Table structure for table `courses`
2165 DROP TABLE IF EXISTS `courses`;
2166 /*!40101 SET @saved_cs_client = @@character_set_client */;
2167 /*!40101 SET character_set_client = utf8 */;
2168 CREATE TABLE `courses` (
2169 `course_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the course',
2170 `department` varchar(80) DEFAULT NULL COMMENT 'the authorised value for the DEPARTMENT',
2171 `course_number` varchar(255) DEFAULT NULL COMMENT 'the ''course number'' assigned to a course',
2172 `section` varchar(255) DEFAULT NULL COMMENT 'the ''section'' of a course',
2173 `course_name` varchar(255) DEFAULT NULL COMMENT 'the name of the course',
2174 `term` varchar(80) DEFAULT NULL COMMENT 'the authorised value for the TERM',
2175 `staff_note` longtext DEFAULT NULL COMMENT 'the text of the staff only note',
2176 `public_note` longtext DEFAULT NULL COMMENT 'the text of the public / opac note',
2177 `students_count` varchar(20) DEFAULT NULL COMMENT 'how many students will be taking this course/section',
2178 `enabled` enum('yes','no') NOT NULL DEFAULT 'yes' COMMENT 'determines whether the course is active',
2179 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2180 PRIMARY KEY (`course_id`)
2181 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2182 /*!40101 SET character_set_client = @saved_cs_client */;
2185 -- Table structure for table `cover_images`
2188 DROP TABLE IF EXISTS `cover_images`;
2189 /*!40101 SET @saved_cs_client = @@character_set_client */;
2190 /*!40101 SET character_set_client = utf8 */;
2191 CREATE TABLE `cover_images` (
2192 `imagenumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the image',
2193 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from biblio table to link to biblionumber',
2194 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from item table to link to itemnumber',
2195 `mimetype` varchar(15) NOT NULL COMMENT 'image type',
2196 `imagefile` mediumblob NOT NULL COMMENT 'image file contents',
2197 `thumbnail` mediumblob NOT NULL COMMENT 'thumbnail file contents',
2198 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'image creation/update time',
2199 PRIMARY KEY (`imagenumber`),
2200 KEY `bibliocoverimage_fk1` (`biblionumber`),
2201 KEY `bibliocoverimage_fk2` (`itemnumber`),
2202 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2203 CONSTRAINT `bibliocoverimage_fk2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
2204 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2205 /*!40101 SET character_set_client = @saved_cs_client */;
2208 -- Table structure for table `creator_batches`
2211 DROP TABLE IF EXISTS `creator_batches`;
2212 /*!40101 SET @saved_cs_client = @@character_set_client */;
2213 /*!40101 SET character_set_client = utf8 */;
2214 CREATE TABLE `creator_batches` (
2215 `label_id` int(11) NOT NULL AUTO_INCREMENT,
2216 `batch_id` int(10) NOT NULL DEFAULT 1,
2217 `description` mediumtext DEFAULT NULL,
2218 `item_number` int(11) DEFAULT NULL,
2219 `borrower_number` int(11) DEFAULT NULL,
2220 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2221 `branch_code` varchar(10) NOT NULL DEFAULT 'NB',
2222 `creator` char(15) NOT NULL DEFAULT 'Labels',
2223 PRIMARY KEY (`label_id`),
2224 KEY `branch_fk_constraint` (`branch_code`),
2225 KEY `item_fk_constraint` (`item_number`),
2226 KEY `borrower_fk_constraint` (`borrower_number`),
2227 CONSTRAINT `creator_batches_ibfk_1` FOREIGN KEY (`borrower_number`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2228 CONSTRAINT `creator_batches_ibfk_2` FOREIGN KEY (`branch_code`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
2229 CONSTRAINT `creator_batches_ibfk_3` FOREIGN KEY (`item_number`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE
2230 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2231 /*!40101 SET character_set_client = @saved_cs_client */;
2234 -- Table structure for table `creator_images`
2237 DROP TABLE IF EXISTS `creator_images`;
2238 /*!40101 SET @saved_cs_client = @@character_set_client */;
2239 /*!40101 SET character_set_client = utf8 */;
2240 CREATE TABLE `creator_images` (
2241 `image_id` int(4) NOT NULL AUTO_INCREMENT,
2242 `imagefile` mediumblob DEFAULT NULL,
2243 `image_name` char(20) NOT NULL DEFAULT 'DEFAULT',
2244 PRIMARY KEY (`image_id`),
2245 UNIQUE KEY `image_name_index` (`image_name`)
2246 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2247 /*!40101 SET character_set_client = @saved_cs_client */;
2250 -- Table structure for table `creator_layouts`
2253 DROP TABLE IF EXISTS `creator_layouts`;
2254 /*!40101 SET @saved_cs_client = @@character_set_client */;
2255 /*!40101 SET character_set_client = utf8 */;
2256 CREATE TABLE `creator_layouts` (
2257 `layout_id` int(4) NOT NULL AUTO_INCREMENT,
2258 `barcode_type` char(100) NOT NULL DEFAULT 'CODE39',
2259 `start_label` int(2) NOT NULL DEFAULT 1,
2260 `printing_type` char(32) NOT NULL DEFAULT 'BAR',
2261 `layout_name` char(25) NOT NULL DEFAULT 'DEFAULT',
2262 `guidebox` int(1) DEFAULT 0,
2263 `oblique_title` int(1) DEFAULT 1,
2264 `font` char(10) NOT NULL DEFAULT 'TR',
2265 `font_size` int(4) NOT NULL DEFAULT 10,
2266 `units` char(20) NOT NULL DEFAULT 'POINT',
2267 `callnum_split` int(1) DEFAULT 0,
2268 `text_justify` char(1) NOT NULL DEFAULT 'L',
2269 `format_string` varchar(210) NOT NULL DEFAULT 'barcode',
2270 `layout_xml` mediumtext NOT NULL,
2271 `creator` char(15) NOT NULL DEFAULT 'Labels',
2272 PRIMARY KEY (`layout_id`)
2273 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2274 /*!40101 SET character_set_client = @saved_cs_client */;
2277 -- Table structure for table `creator_templates`
2280 DROP TABLE IF EXISTS `creator_templates`;
2281 /*!40101 SET @saved_cs_client = @@character_set_client */;
2282 /*!40101 SET character_set_client = utf8 */;
2283 CREATE TABLE `creator_templates` (
2284 `template_id` int(4) NOT NULL AUTO_INCREMENT,
2285 `profile_id` int(4) DEFAULT NULL,
2286 `template_code` char(100) NOT NULL DEFAULT 'DEFAULT TEMPLATE',
2287 `template_desc` char(100) NOT NULL DEFAULT 'Default description',
2288 `page_width` float NOT NULL DEFAULT 0,
2289 `page_height` float NOT NULL DEFAULT 0,
2290 `label_width` float NOT NULL DEFAULT 0,
2291 `label_height` float NOT NULL DEFAULT 0,
2292 `top_text_margin` float NOT NULL DEFAULT 0,
2293 `left_text_margin` float NOT NULL DEFAULT 0,
2294 `top_margin` float NOT NULL DEFAULT 0,
2295 `left_margin` float NOT NULL DEFAULT 0,
2296 `cols` int(2) NOT NULL DEFAULT 0,
2297 `rows` int(2) NOT NULL DEFAULT 0,
2298 `col_gap` float NOT NULL DEFAULT 0,
2299 `row_gap` float NOT NULL DEFAULT 0,
2300 `units` char(20) NOT NULL DEFAULT 'POINT',
2301 `creator` char(15) NOT NULL DEFAULT 'Labels',
2302 PRIMARY KEY (`template_id`),
2303 KEY `template_profile_fk_constraint` (`profile_id`)
2304 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2305 /*!40101 SET character_set_client = @saved_cs_client */;
2308 -- Table structure for table `curbside_pickup_issues`
2311 DROP TABLE IF EXISTS `curbside_pickup_issues`;
2312 /*!40101 SET @saved_cs_client = @@character_set_client */;
2313 /*!40101 SET character_set_client = utf8 */;
2314 CREATE TABLE `curbside_pickup_issues` (
2315 `id` int(11) NOT NULL AUTO_INCREMENT,
2316 `curbside_pickup_id` int(11) NOT NULL,
2317 `issue_id` int(11) NOT NULL,
2318 `reserve_id` int(11) NOT NULL,
2320 KEY `curbside_pickup_id` (`curbside_pickup_id`),
2321 CONSTRAINT `curbside_pickup_issues_ibfk_1` FOREIGN KEY (`curbside_pickup_id`) REFERENCES `curbside_pickups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2322 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2323 /*!40101 SET character_set_client = @saved_cs_client */;
2326 -- Table structure for table `curbside_pickup_opening_slots`
2329 DROP TABLE IF EXISTS `curbside_pickup_opening_slots`;
2330 /*!40101 SET @saved_cs_client = @@character_set_client */;
2331 /*!40101 SET character_set_client = utf8 */;
2332 CREATE TABLE `curbside_pickup_opening_slots` (
2333 `id` int(11) NOT NULL AUTO_INCREMENT,
2334 `curbside_pickup_policy_id` int(11) NOT NULL,
2335 `day` tinyint(1) NOT NULL,
2336 `start_hour` int(2) NOT NULL,
2337 `start_minute` int(2) NOT NULL,
2338 `end_hour` int(2) NOT NULL,
2339 `end_minute` int(2) NOT NULL,
2341 KEY `curbside_pickup_policy_id` (`curbside_pickup_policy_id`),
2342 CONSTRAINT `curbside_pickup_opening_slots_ibfk_1` FOREIGN KEY (`curbside_pickup_policy_id`) REFERENCES `curbside_pickup_policy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2343 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2344 /*!40101 SET character_set_client = @saved_cs_client */;
2347 -- Table structure for table `curbside_pickup_policy`
2350 DROP TABLE IF EXISTS `curbside_pickup_policy`;
2351 /*!40101 SET @saved_cs_client = @@character_set_client */;
2352 /*!40101 SET character_set_client = utf8 */;
2353 CREATE TABLE `curbside_pickup_policy` (
2354 `id` int(11) NOT NULL AUTO_INCREMENT,
2355 `branchcode` varchar(10) NOT NULL,
2356 `enabled` tinyint(1) NOT NULL DEFAULT 0,
2357 `enable_waiting_holds_only` tinyint(1) NOT NULL DEFAULT 0,
2358 `pickup_interval` int(2) NOT NULL DEFAULT 0,
2359 `patrons_per_interval` int(2) NOT NULL DEFAULT 0,
2360 `patron_scheduled_pickup` tinyint(1) NOT NULL DEFAULT 0,
2362 UNIQUE KEY `branchcode` (`branchcode`),
2363 CONSTRAINT `curbside_pickup_policy_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2364 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2365 /*!40101 SET character_set_client = @saved_cs_client */;
2368 -- Table structure for table `curbside_pickups`
2371 DROP TABLE IF EXISTS `curbside_pickups`;
2372 /*!40101 SET @saved_cs_client = @@character_set_client */;
2373 /*!40101 SET character_set_client = utf8 */;
2374 CREATE TABLE `curbside_pickups` (
2375 `id` int(11) NOT NULL AUTO_INCREMENT,
2376 `borrowernumber` int(11) NOT NULL,
2377 `branchcode` varchar(10) NOT NULL,
2378 `scheduled_pickup_datetime` datetime NOT NULL,
2379 `staged_datetime` datetime DEFAULT NULL,
2380 `staged_by` int(11) DEFAULT NULL,
2381 `arrival_datetime` datetime DEFAULT NULL,
2382 `delivered_datetime` datetime DEFAULT NULL,
2383 `delivered_by` int(11) DEFAULT NULL,
2384 `notes` text DEFAULT NULL,
2386 KEY `branchcode` (`branchcode`),
2387 KEY `borrowernumber` (`borrowernumber`),
2388 KEY `staged_by` (`staged_by`),
2389 CONSTRAINT `curbside_pickups_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2390 CONSTRAINT `curbside_pickups_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2391 CONSTRAINT `curbside_pickups_ibfk_3` FOREIGN KEY (`staged_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
2392 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2393 /*!40101 SET character_set_client = @saved_cs_client */;
2396 -- Table structure for table `currency`
2399 DROP TABLE IF EXISTS `currency`;
2400 /*!40101 SET @saved_cs_client = @@character_set_client */;
2401 /*!40101 SET character_set_client = utf8 */;
2402 CREATE TABLE `currency` (
2403 `currency` varchar(10) NOT NULL DEFAULT '',
2404 `symbol` varchar(5) DEFAULT NULL,
2405 `isocode` varchar(5) DEFAULT NULL,
2406 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2407 `rate` float(15,5) DEFAULT NULL,
2408 `active` tinyint(1) DEFAULT NULL,
2409 `archived` tinyint(1) DEFAULT 0,
2410 `p_sep_by_space` tinyint(1) DEFAULT 0,
2411 PRIMARY KEY (`currency`)
2412 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2413 /*!40101 SET character_set_client = @saved_cs_client */;
2416 -- Table structure for table `deletedbiblio`
2419 DROP TABLE IF EXISTS `deletedbiblio`;
2420 /*!40101 SET @saved_cs_client = @@character_set_client */;
2421 /*!40101 SET character_set_client = utf8 */;
2422 CREATE TABLE `deletedbiblio` (
2423 `biblionumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned to each bibliographic record',
2424 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'foriegn key from the biblio_framework table to identify which framework was used in cataloging this record',
2425 `author` longtext DEFAULT NULL COMMENT 'statement of responsibility from MARC record (100$a in MARC21)',
2426 `title` longtext DEFAULT NULL COMMENT 'title (without the subtitle) from the MARC record (245$a in MARC21)',
2427 `medium` longtext DEFAULT NULL COMMENT 'medium from the MARC record (245$h in MARC21)',
2428 `subtitle` longtext DEFAULT NULL COMMENT 'remainder of the title from the MARC record (245$b in MARC21)',
2429 `part_number` longtext DEFAULT NULL COMMENT 'part number from the MARC record (245$n in MARC21)',
2430 `part_name` longtext DEFAULT NULL COMMENT 'part name from the MARC record (245$p in MARC21)',
2431 `unititle` longtext DEFAULT NULL COMMENT 'uniform title (without the subtitle) from the MARC record (240$a in MARC21)',
2432 `notes` longtext DEFAULT NULL COMMENT 'values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)',
2433 `serial` tinyint(1) DEFAULT NULL COMMENT 'Boolean indicating whether biblio is for a serial',
2434 `seriestitle` longtext DEFAULT NULL,
2435 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'publication or copyright date from the MARC record',
2436 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
2437 `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
2438 `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
2439 PRIMARY KEY (`biblionumber`),
2440 KEY `blbnoidx` (`biblionumber`)
2441 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2442 /*!40101 SET character_set_client = @saved_cs_client */;
2445 -- Table structure for table `deletedbiblio_metadata`
2448 DROP TABLE IF EXISTS `deletedbiblio_metadata`;
2449 /*!40101 SET @saved_cs_client = @@character_set_client */;
2450 /*!40101 SET character_set_client = utf8 */;
2451 CREATE TABLE `deletedbiblio_metadata` (
2452 `id` int(11) NOT NULL AUTO_INCREMENT,
2453 `biblionumber` int(11) NOT NULL,
2454 `format` varchar(16) NOT NULL,
2455 `schema` varchar(16) NOT NULL,
2456 `metadata` longtext NOT NULL,
2457 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2459 UNIQUE KEY `deletedbiblio_metadata_uniq_key` (`biblionumber`,`format`,`schema`),
2460 KEY `timestamp` (`timestamp`),
2461 CONSTRAINT `deletedrecord_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `deletedbiblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2462 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2463 /*!40101 SET character_set_client = @saved_cs_client */;
2466 -- Table structure for table `deletedbiblioitems`
2469 DROP TABLE IF EXISTS `deletedbiblioitems`;
2470 /*!40101 SET @saved_cs_client = @@character_set_client */;
2471 /*!40101 SET character_set_client = utf8 */;
2472 CREATE TABLE `deletedbiblioitems` (
2473 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key, unique identifier assigned by Koha',
2474 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the biblio table',
2475 `volume` longtext DEFAULT NULL,
2476 `number` longtext DEFAULT NULL,
2477 `itemtype` varchar(10) DEFAULT NULL COMMENT 'biblio level item type (MARC21 942$c)',
2478 `isbn` longtext DEFAULT NULL COMMENT 'ISBN (MARC21 020$a)',
2479 `issn` longtext DEFAULT NULL COMMENT 'ISSN (MARC21 022$a)',
2480 `ean` longtext DEFAULT NULL,
2481 `publicationyear` mediumtext DEFAULT NULL,
2482 `publishercode` text DEFAULT NULL COMMENT 'publisher (MARC21 260$b and 264$b)',
2483 `volumedate` date DEFAULT NULL,
2484 `volumedesc` mediumtext DEFAULT NULL COMMENT 'volume information (MARC21 362$a)',
2485 `collectiontitle` longtext DEFAULT NULL,
2486 `collectionissn` mediumtext DEFAULT NULL,
2487 `collectionvolume` longtext DEFAULT NULL,
2488 `editionstatement` mediumtext DEFAULT NULL,
2489 `editionresponsibility` mediumtext DEFAULT NULL,
2490 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2491 `illus` text DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)',
2492 `pages` text DEFAULT NULL COMMENT 'number of pages (MARC21 300$a)',
2493 `notes` longtext DEFAULT NULL,
2494 `size` text DEFAULT NULL COMMENT 'material size (MARC21 300$c)',
2495 `place` text DEFAULT NULL COMMENT 'publication place (MARC21 260$a and 264$a)',
2496 `lccn` longtext DEFAULT NULL COMMENT 'library of congress control number (MARC21 010$a)',
2497 `url` mediumtext DEFAULT NULL COMMENT 'url (MARC21 856$u)',
2498 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source (MARC21 942$2)',
2499 `cn_class` varchar(30) DEFAULT NULL,
2500 `cn_item` varchar(10) DEFAULT NULL,
2501 `cn_suffix` varchar(10) DEFAULT NULL,
2502 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized version of the call number used for sorting',
2503 `agerestriction` varchar(255) DEFAULT NULL COMMENT 'target audience/age restriction from the bib record (MARC21 521$a)',
2504 `totalissues` int(10) DEFAULT NULL,
2505 PRIMARY KEY (`biblioitemnumber`),
2506 KEY `bibinoidx` (`biblioitemnumber`),
2507 KEY `bibnoidx` (`biblionumber`),
2508 KEY `itemtype_idx` (`itemtype`),
2509 KEY `isbn` (`isbn`(191)),
2510 KEY `ean` (`ean`(191)),
2511 KEY `publishercode` (`publishercode`(191)),
2512 KEY `timestamp` (`timestamp`)
2513 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2514 /*!40101 SET character_set_client = @saved_cs_client */;
2517 -- Table structure for table `deletedborrowers`
2520 DROP TABLE IF EXISTS `deletedborrowers`;
2521 /*!40101 SET @saved_cs_client = @@character_set_client */;
2522 /*!40101 SET character_set_client = utf8 */;
2523 CREATE TABLE `deletedborrowers` (
2524 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key, Koha assigned ID number for patrons/borrowers',
2525 `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
2526 `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2527 `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
2528 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
2529 `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2530 `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
2531 `initials` mediumtext DEFAULT NULL COMMENT 'initials for your patron/borrower',
2532 `pronouns` longtext DEFAULT NULL COMMENT 'patron/borrower pronouns',
2533 `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',
2534 `streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s primary address',
2535 `address` longtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s primary address',
2536 `address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s primary address',
2537 `city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s primary address',
2538 `state` mediumtext DEFAULT NULL COMMENT 'the state or province for your patron/borrower''s primary address',
2539 `zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s primary address',
2540 `country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s primary address',
2541 `email` longtext DEFAULT NULL COMMENT 'the primary email address for your patron/borrower''s primary address',
2542 `phone` mediumtext DEFAULT NULL COMMENT 'the primary phone number for your patron/borrower''s primary address',
2543 `mobile` tinytext DEFAULT NULL COMMENT 'the other phone number for your patron/borrower''s primary address',
2544 `fax` longtext DEFAULT NULL COMMENT 'the fax number for your patron/borrower''s primary address',
2545 `emailpro` mediumtext DEFAULT NULL COMMENT 'the secondary email addres for your patron/borrower''s primary address',
2546 `phonepro` mediumtext DEFAULT NULL COMMENT 'the secondary phone number for your patron/borrower''s primary address',
2547 `B_streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address',
2548 `B_streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s alternate address',
2549 `B_address` mediumtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s alternate address',
2550 `B_address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s alternate address',
2551 `B_city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s alternate address',
2552 `B_state` mediumtext DEFAULT NULL COMMENT 'the state for your patron/borrower''s alternate address',
2553 `B_zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s alternate address',
2554 `B_country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s alternate address',
2555 `B_email` mediumtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate email address',
2556 `B_phone` longtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate phone number',
2557 `dateofbirth` date DEFAULT NULL COMMENT 'the patron/borrower''s date of birth (YYYY-MM-DD)',
2558 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table, includes the code of the patron/borrower''s home branch',
2559 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category',
2560 `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)',
2561 `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)',
2562 `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)',
2563 `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed',
2564 `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',
2565 `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',
2566 `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)',
2567 `debarredcomment` varchar(255) DEFAULT NULL COMMENT 'comment on the stop of patron',
2568 `contactname` longtext DEFAULT NULL COMMENT 'used for children and profesionals to include surname or last name of guarantor or organization name',
2569 `contactfirstname` mediumtext DEFAULT NULL COMMENT 'used for children to include first name of guarantor',
2570 `contacttitle` mediumtext DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor',
2571 `borrowernotes` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface',
2572 `relationship` varchar(100) DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor',
2573 `sex` varchar(1) DEFAULT NULL COMMENT 'patron/borrower''s gender',
2574 `password` varchar(60) DEFAULT NULL COMMENT 'patron/borrower''s encrypted password',
2575 `secret` mediumtext DEFAULT NULL COMMENT 'Secret for 2FA',
2576 `auth_method` enum('password','two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method',
2577 `flags` bigint(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions',
2578 `userid` varchar(75) DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in',
2579 `opacnote` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface',
2580 `contactnote` varchar(255) DEFAULT NULL COMMENT 'a note related to the patron/borrower''s alternate address',
2581 `sort1` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
2582 `sort2` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
2583 `altcontactfirstname` mediumtext DEFAULT NULL COMMENT 'first name of alternate contact for the patron/borrower',
2584 `altcontactsurname` mediumtext DEFAULT NULL COMMENT 'surname or last name of the alternate contact for the patron/borrower',
2585 `altcontactaddress1` mediumtext DEFAULT NULL COMMENT 'the first address line for the alternate contact for the patron/borrower',
2586 `altcontactaddress2` mediumtext DEFAULT NULL COMMENT 'the second address line for the alternate contact for the patron/borrower',
2587 `altcontactaddress3` mediumtext DEFAULT NULL COMMENT 'the city for the alternate contact for the patron/borrower',
2588 `altcontactstate` mediumtext DEFAULT NULL COMMENT 'the state for the alternate contact for the patron/borrower',
2589 `altcontactzipcode` mediumtext DEFAULT NULL COMMENT 'the zipcode for the alternate contact for the patron/borrower',
2590 `altcontactcountry` mediumtext DEFAULT NULL COMMENT 'the country for the alternate contact for the patron/borrower',
2591 `altcontactphone` mediumtext DEFAULT NULL COMMENT 'the phone number for the alternate contact for the patron/borrower',
2592 `smsalertnumber` varchar(50) DEFAULT NULL COMMENT 'the mobile phone number where the patron/borrower would like to receive notices (if SMS turned on)',
2593 `sms_provider_id` int(11) DEFAULT NULL COMMENT 'the provider of the mobile phone number defined in smsalertnumber',
2594 `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history KEY `borrowernumber` (`borrowernumber`),',
2595 `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines',
2596 `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
2597 `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''.',
2598 `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)',
2599 `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
2600 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
2601 `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
2602 `overdrive_auth_token` mediumtext DEFAULT NULL COMMENT 'persist OverDrive auth token',
2603 `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2604 `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2605 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
2606 KEY `borrowernumber` (`borrowernumber`),
2607 KEY `cardnumber` (`cardnumber`),
2608 KEY `sms_provider_id` (`sms_provider_id`)
2609 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2610 /*!40101 SET character_set_client = @saved_cs_client */;
2613 -- Table structure for table `deleteditems`
2616 DROP TABLE IF EXISTS `deleteditems`;
2617 /*!40101 SET @saved_cs_client = @@character_set_client */;
2618 /*!40101 SET character_set_client = utf8 */;
2619 CREATE TABLE `deleteditems` (
2620 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key and unique identifier added by Koha',
2621 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
2622 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
2623 `barcode` varchar(20) DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
2624 `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
2625 `booksellerid` longtext DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
2626 `homebranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
2627 `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
2628 `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
2629 `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
2630 `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out',
2631 `datelastseen` date DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
2632 `stack` tinyint(1) DEFAULT NULL,
2633 `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
2634 `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
2635 `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
2636 `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
2637 `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
2638 `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
2639 `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
2640 `itemcallnumber` varchar(255) DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
2641 `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
2642 `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out',
2643 `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
2644 `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
2645 `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
2646 `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
2647 `itemnotes_nonpublic` longtext DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
2648 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
2649 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
2650 `deleted_on` datetime DEFAULT NULL COMMENT 'date/time of deletion',
2651 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
2652 `permanent_location` varchar(80) DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
2653 `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
2654 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
2655 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
2656 `ccode` varchar(80) DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
2657 `materials` mediumtext DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
2658 `uri` mediumtext DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
2659 `itype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
2660 `more_subfields_xml` longtext DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
2661 `enumchron` mediumtext DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
2662 `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
2663 `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
2664 `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.',
2665 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
2666 PRIMARY KEY (`itemnumber`),
2667 KEY `delitembarcodeidx` (`barcode`),
2668 KEY `delitemstocknumberidx` (`stocknumber`),
2669 KEY `delitembinoidx` (`biblioitemnumber`),
2670 KEY `delitembibnoidx` (`biblionumber`),
2671 KEY `delhomebranch` (`homebranch`),
2672 KEY `delholdingbranch` (`holdingbranch`),
2673 KEY `itype_idx` (`itype`),
2674 KEY `timestamp` (`timestamp`)
2675 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2676 /*!40101 SET character_set_client = @saved_cs_client */;
2679 -- Table structure for table `desks`
2682 DROP TABLE IF EXISTS `desks`;
2683 /*!40101 SET @saved_cs_client = @@character_set_client */;
2684 /*!40101 SET character_set_client = utf8 */;
2685 CREATE TABLE `desks` (
2686 `desk_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
2687 `desk_name` varchar(100) NOT NULL DEFAULT '' COMMENT 'name of the desk',
2688 `branchcode` varchar(10) NOT NULL COMMENT 'library the desk is located at',
2689 PRIMARY KEY (`desk_id`),
2690 KEY `fk_desks_branchcode` (`branchcode`),
2691 CONSTRAINT `fk_desks_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2692 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2693 /*!40101 SET character_set_client = @saved_cs_client */;
2696 -- Table structure for table `discharges`
2699 DROP TABLE IF EXISTS `discharges`;
2700 /*!40101 SET @saved_cs_client = @@character_set_client */;
2701 /*!40101 SET character_set_client = utf8 */;
2702 CREATE TABLE `discharges` (
2703 `discharge_id` int(11) NOT NULL AUTO_INCREMENT,
2704 `borrower` int(11) DEFAULT NULL,
2705 `needed` timestamp NULL DEFAULT NULL,
2706 `validated` timestamp NULL DEFAULT NULL,
2707 PRIMARY KEY (`discharge_id`),
2708 KEY `borrower_discharges_ibfk1` (`borrower`),
2709 CONSTRAINT `borrower_discharges_ibfk1` FOREIGN KEY (`borrower`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2710 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2711 /*!40101 SET character_set_client = @saved_cs_client */;
2714 -- Table structure for table `edifact_ean`
2717 DROP TABLE IF EXISTS `edifact_ean`;
2718 /*!40101 SET @saved_cs_client = @@character_set_client */;
2719 /*!40101 SET character_set_client = utf8 */;
2720 CREATE TABLE `edifact_ean` (
2721 `ee_id` int(11) NOT NULL AUTO_INCREMENT,
2722 `description` varchar(128) DEFAULT NULL,
2723 `branchcode` varchar(10) DEFAULT NULL,
2724 `ean` varchar(15) NOT NULL,
2725 `id_code_qualifier` varchar(3) NOT NULL DEFAULT '14',
2726 PRIMARY KEY (`ee_id`),
2727 KEY `efk_branchcode` (`branchcode`),
2728 CONSTRAINT `efk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
2729 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2730 /*!40101 SET character_set_client = @saved_cs_client */;
2733 -- Table structure for table `edifact_messages`
2736 DROP TABLE IF EXISTS `edifact_messages`;
2737 /*!40101 SET @saved_cs_client = @@character_set_client */;
2738 /*!40101 SET character_set_client = utf8 */;
2739 CREATE TABLE `edifact_messages` (
2740 `id` int(11) NOT NULL AUTO_INCREMENT,
2741 `message_type` varchar(10) NOT NULL,
2742 `transfer_date` date DEFAULT NULL,
2743 `vendor_id` int(11) DEFAULT NULL,
2744 `edi_acct` int(11) DEFAULT NULL,
2745 `status` mediumtext DEFAULT NULL,
2746 `basketno` int(11) DEFAULT NULL,
2747 `raw_msg` longtext DEFAULT NULL,
2748 `filename` mediumtext DEFAULT NULL,
2749 `deleted` tinyint(1) NOT NULL DEFAULT 0,
2751 KEY `vendorid` (`vendor_id`),
2752 KEY `ediacct` (`edi_acct`),
2753 KEY `basketno` (`basketno`),
2754 CONSTRAINT `emfk_basketno` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2755 CONSTRAINT `emfk_edi_acct` FOREIGN KEY (`edi_acct`) REFERENCES `vendor_edi_accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2756 CONSTRAINT `emfk_vendor` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2757 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2758 /*!40101 SET character_set_client = @saved_cs_client */;
2761 -- Table structure for table `erm_agreement_licenses`
2764 DROP TABLE IF EXISTS `erm_agreement_licenses`;
2765 /*!40101 SET @saved_cs_client = @@character_set_client */;
2766 /*!40101 SET character_set_client = utf8 */;
2767 CREATE TABLE `erm_agreement_licenses` (
2768 `agreement_license_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2769 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2770 `license_id` int(11) NOT NULL COMMENT 'link to the license',
2771 `status` varchar(80) NOT NULL COMMENT 'current status of the license',
2772 `physical_location` varchar(80) DEFAULT NULL COMMENT 'physical location of the license',
2773 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this license',
2774 `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the license',
2775 PRIMARY KEY (`agreement_license_id`),
2776 UNIQUE KEY `erm_agreement_licenses_uniq` (`agreement_id`,`license_id`),
2777 KEY `erm_agreement_licenses_ibfk_2` (`license_id`),
2778 CONSTRAINT `erm_agreement_licenses_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2779 CONSTRAINT `erm_agreement_licenses_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE
2780 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2781 /*!40101 SET character_set_client = @saved_cs_client */;
2784 -- Table structure for table `erm_agreement_periods`
2787 DROP TABLE IF EXISTS `erm_agreement_periods`;
2788 /*!40101 SET @saved_cs_client = @@character_set_client */;
2789 /*!40101 SET character_set_client = utf8 */;
2790 CREATE TABLE `erm_agreement_periods` (
2791 `agreement_period_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2792 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2793 `started_on` date NOT NULL COMMENT 'start of the agreement period',
2794 `ended_on` date DEFAULT NULL COMMENT 'end of the agreement period',
2795 `cancellation_deadline` date DEFAULT NULL COMMENT 'Deadline for the cancellation',
2796 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this period',
2797 PRIMARY KEY (`agreement_period_id`),
2798 KEY `erm_agreement_periods_ibfk_1` (`agreement_id`),
2799 CONSTRAINT `erm_agreement_periods_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2800 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2801 /*!40101 SET character_set_client = @saved_cs_client */;
2804 -- Table structure for table `erm_agreement_relationships`
2807 DROP TABLE IF EXISTS `erm_agreement_relationships`;
2808 /*!40101 SET @saved_cs_client = @@character_set_client */;
2809 /*!40101 SET character_set_client = utf8 */;
2810 CREATE TABLE `erm_agreement_relationships` (
2811 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2812 `related_agreement_id` int(11) NOT NULL COMMENT 'link to the related agreement',
2813 `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',
2814 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
2815 PRIMARY KEY (`agreement_id`,`related_agreement_id`),
2816 KEY `erm_agreement_relationships_ibfk_2` (`related_agreement_id`),
2817 CONSTRAINT `erm_agreement_relationships_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2818 CONSTRAINT `erm_agreement_relationships_ibfk_2` FOREIGN KEY (`related_agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2819 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2820 /*!40101 SET character_set_client = @saved_cs_client */;
2823 -- Table structure for table `erm_agreements`
2826 DROP TABLE IF EXISTS `erm_agreements`;
2827 /*!40101 SET @saved_cs_client = @@character_set_client */;
2828 /*!40101 SET character_set_client = utf8 */;
2829 CREATE TABLE `erm_agreements` (
2830 `agreement_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2831 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2832 `name` varchar(255) NOT NULL COMMENT 'name of the agreement',
2833 `description` longtext DEFAULT NULL COMMENT 'description of the agreement',
2834 `status` varchar(80) NOT NULL COMMENT 'current status of the agreement',
2835 `closure_reason` varchar(80) DEFAULT NULL COMMENT 'reason of the closure',
2836 `is_perpetual` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the agreement perpetual',
2837 `renewal_priority` varchar(80) DEFAULT NULL COMMENT 'priority of the renewal',
2838 `license_info` varchar(80) DEFAULT NULL COMMENT 'info about the license',
2839 PRIMARY KEY (`agreement_id`),
2840 KEY `erm_agreements_ibfk_1` (`vendor_id`),
2841 CONSTRAINT `erm_agreements_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2842 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2843 /*!40101 SET character_set_client = @saved_cs_client */;
2846 -- Table structure for table `erm_documents`
2849 DROP TABLE IF EXISTS `erm_documents`;
2850 /*!40101 SET @saved_cs_client = @@character_set_client */;
2851 /*!40101 SET character_set_client = utf8 */;
2852 CREATE TABLE `erm_documents` (
2853 `document_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2854 `agreement_id` int(11) DEFAULT NULL COMMENT 'link to the agreement',
2855 `license_id` int(11) DEFAULT NULL COMMENT 'link to the license',
2856 `file_name` varchar(255) DEFAULT NULL COMMENT 'name of the file',
2857 `file_type` varchar(255) DEFAULT NULL COMMENT 'type of the file',
2858 `file_description` varchar(255) DEFAULT NULL COMMENT 'description of the file',
2859 `file_content` longblob DEFAULT NULL COMMENT 'the content of the file',
2860 `uploaded_on` datetime DEFAULT NULL COMMENT 'datetime when the file as attached',
2861 `physical_location` varchar(255) DEFAULT NULL COMMENT 'physical location of the document',
2862 `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the document',
2863 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
2864 PRIMARY KEY (`document_id`),
2865 KEY `erm_documents_ibfk_1` (`agreement_id`),
2866 KEY `erm_documents_ibfk_2` (`license_id`),
2867 CONSTRAINT `erm_documents_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2868 CONSTRAINT `erm_documents_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE
2869 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2870 /*!40101 SET character_set_client = @saved_cs_client */;
2873 -- Table structure for table `erm_eholdings_packages`
2876 DROP TABLE IF EXISTS `erm_eholdings_packages`;
2877 /*!40101 SET @saved_cs_client = @@character_set_client */;
2878 /*!40101 SET character_set_client = utf8 */;
2879 CREATE TABLE `erm_eholdings_packages` (
2880 `package_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2881 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2882 `name` varchar(255) NOT NULL COMMENT 'name of the package',
2883 `external_id` varchar(255) DEFAULT NULL COMMENT 'External key',
2884 `provider` enum('ebsco') DEFAULT NULL COMMENT 'External provider',
2885 `package_type` varchar(80) DEFAULT NULL COMMENT 'type of the package',
2886 `content_type` varchar(80) DEFAULT NULL COMMENT 'type of the package',
2887 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this package',
2888 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date of creation of the package',
2889 PRIMARY KEY (`package_id`),
2890 KEY `erm_eholdings_packages_ibfk_1` (`vendor_id`),
2891 CONSTRAINT `erm_eholdings_packages_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2892 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2893 /*!40101 SET character_set_client = @saved_cs_client */;
2896 -- Table structure for table `erm_eholdings_packages_agreements`
2899 DROP TABLE IF EXISTS `erm_eholdings_packages_agreements`;
2900 /*!40101 SET @saved_cs_client = @@character_set_client */;
2901 /*!40101 SET character_set_client = utf8 */;
2902 CREATE TABLE `erm_eholdings_packages_agreements` (
2903 `package_id` int(11) NOT NULL COMMENT 'link to the package',
2904 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2905 PRIMARY KEY (`package_id`,`agreement_id`),
2906 KEY `erm_eholdings_packages_agreements_ibfk_2` (`agreement_id`),
2907 CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2908 CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2909 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2910 /*!40101 SET character_set_client = @saved_cs_client */;
2913 -- Table structure for table `erm_eholdings_resources`
2916 DROP TABLE IF EXISTS `erm_eholdings_resources`;
2917 /*!40101 SET @saved_cs_client = @@character_set_client */;
2918 /*!40101 SET character_set_client = utf8 */;
2919 CREATE TABLE `erm_eholdings_resources` (
2920 `resource_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2921 `title_id` int(11) NOT NULL,
2922 `package_id` int(11) NOT NULL,
2923 `vendor_id` int(11) DEFAULT NULL,
2924 `started_on` date DEFAULT NULL,
2925 `ended_on` date DEFAULT NULL,
2926 `proxy` varchar(80) DEFAULT NULL,
2927 PRIMARY KEY (`resource_id`),
2928 UNIQUE KEY `erm_eholdings_resources_uniq` (`title_id`,`package_id`),
2929 KEY `erm_eholdings_resources_ibfk_2` (`package_id`),
2930 KEY `erm_eholdings_resources_ibfk_3` (`vendor_id`),
2931 CONSTRAINT `erm_eholdings_resources_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_eholdings_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2932 CONSTRAINT `erm_eholdings_resources_ibfk_2` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2933 CONSTRAINT `erm_eholdings_resources_ibfk_3` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2934 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2935 /*!40101 SET character_set_client = @saved_cs_client */;
2938 -- Table structure for table `erm_eholdings_titles`
2941 DROP TABLE IF EXISTS `erm_eholdings_titles`;
2942 /*!40101 SET @saved_cs_client = @@character_set_client */;
2943 /*!40101 SET character_set_client = utf8 */;
2944 CREATE TABLE `erm_eholdings_titles` (
2945 `title_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2946 `biblio_id` int(11) DEFAULT NULL,
2947 `publication_title` mediumtext DEFAULT NULL,
2948 `external_id` varchar(255) DEFAULT NULL,
2949 `print_identifier` varchar(255) DEFAULT NULL,
2950 `online_identifier` varchar(255) DEFAULT NULL,
2951 `date_first_issue_online` varchar(255) DEFAULT NULL,
2952 `num_first_vol_online` varchar(255) DEFAULT NULL,
2953 `num_first_issue_online` varchar(255) DEFAULT NULL,
2954 `date_last_issue_online` varchar(255) DEFAULT NULL,
2955 `num_last_vol_online` varchar(255) DEFAULT NULL,
2956 `num_last_issue_online` varchar(255) DEFAULT NULL,
2957 `title_url` varchar(255) DEFAULT NULL,
2958 `first_author` varchar(255) DEFAULT NULL,
2959 `embargo_info` varchar(255) DEFAULT NULL,
2960 `coverage_depth` varchar(255) DEFAULT NULL,
2961 `notes` mediumtext DEFAULT NULL,
2962 `publisher_name` varchar(255) DEFAULT NULL,
2963 `publication_type` varchar(80) DEFAULT NULL,
2964 `date_monograph_published_print` varchar(255) DEFAULT NULL,
2965 `date_monograph_published_online` varchar(255) DEFAULT NULL,
2966 `monograph_volume` varchar(255) DEFAULT NULL,
2967 `monograph_edition` varchar(255) DEFAULT NULL,
2968 `first_editor` varchar(255) DEFAULT NULL,
2969 `parent_publication_title_id` varchar(255) DEFAULT NULL,
2970 `preceding_publication_title_id` varchar(255) DEFAULT NULL,
2971 `access_type` varchar(255) DEFAULT NULL,
2972 PRIMARY KEY (`title_id`),
2973 KEY `erm_eholdings_titles_ibfk_2` (`biblio_id`),
2974 CONSTRAINT `erm_eholdings_titles_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE
2975 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2976 /*!40101 SET character_set_client = @saved_cs_client */;
2979 -- Table structure for table `erm_licenses`
2982 DROP TABLE IF EXISTS `erm_licenses`;
2983 /*!40101 SET @saved_cs_client = @@character_set_client */;
2984 /*!40101 SET character_set_client = utf8 */;
2985 CREATE TABLE `erm_licenses` (
2986 `license_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2987 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2988 `name` varchar(255) NOT NULL COMMENT 'name of the license',
2989 `description` longtext DEFAULT NULL COMMENT 'description of the license',
2990 `type` varchar(80) NOT NULL COMMENT 'type of the license',
2991 `status` varchar(80) NOT NULL COMMENT 'current status of the license',
2992 `started_on` date DEFAULT NULL COMMENT 'start of the license',
2993 `ended_on` date DEFAULT NULL COMMENT 'end of the license',
2994 PRIMARY KEY (`license_id`),
2995 KEY `erm_licenses_ibfk_1` (`vendor_id`),
2996 CONSTRAINT `erm_licenses_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2997 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2998 /*!40101 SET character_set_client = @saved_cs_client */;
3001 -- Table structure for table `erm_user_roles`
3004 DROP TABLE IF EXISTS `erm_user_roles`;
3005 /*!40101 SET @saved_cs_client = @@character_set_client */;
3006 /*!40101 SET character_set_client = utf8 */;
3007 CREATE TABLE `erm_user_roles` (
3008 `user_role_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3009 `agreement_id` int(11) DEFAULT NULL COMMENT 'link to the agreement',
3010 `license_id` int(11) DEFAULT NULL COMMENT 'link to the license',
3011 `user_id` int(11) NOT NULL COMMENT 'link to the user',
3012 `role` varchar(80) NOT NULL COMMENT 'role of the user',
3013 PRIMARY KEY (`user_role_id`),
3014 KEY `erm_user_roles_ibfk_1` (`agreement_id`),
3015 KEY `erm_user_roles_ibfk_2` (`license_id`),
3016 KEY `erm_user_roles_ibfk_3` (`user_id`),
3017 CONSTRAINT `erm_user_roles_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3018 CONSTRAINT `erm_user_roles_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3019 CONSTRAINT `erm_user_roles_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3020 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3021 /*!40101 SET character_set_client = @saved_cs_client */;
3024 -- Table structure for table `export_format`
3027 DROP TABLE IF EXISTS `export_format`;
3028 /*!40101 SET @saved_cs_client = @@character_set_client */;
3029 /*!40101 SET character_set_client = utf8 */;
3030 CREATE TABLE `export_format` (
3031 `export_format_id` int(11) NOT NULL AUTO_INCREMENT,
3032 `profile` varchar(255) NOT NULL,
3033 `description` longtext NOT NULL,
3034 `content` longtext NOT NULL,
3035 `csv_separator` varchar(2) NOT NULL DEFAULT ',',
3036 `field_separator` varchar(2) DEFAULT NULL,
3037 `subfield_separator` varchar(2) DEFAULT NULL,
3038 `encoding` varchar(255) NOT NULL DEFAULT 'utf8',
3039 `type` varchar(255) DEFAULT 'marc',
3040 `used_for` varchar(255) DEFAULT 'export_records',
3041 `staff_only` tinyint(1) NOT NULL DEFAULT 0,
3042 PRIMARY KEY (`export_format_id`),
3043 KEY `used_for_idx` (`used_for`(191)),
3044 KEY `staff_only_idx` (`staff_only`)
3045 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Used for CSV export';
3046 /*!40101 SET character_set_client = @saved_cs_client */;
3049 -- Table structure for table `hold_cancellation_requests`
3052 DROP TABLE IF EXISTS `hold_cancellation_requests`;
3053 /*!40101 SET @saved_cs_client = @@character_set_client */;
3054 /*!40101 SET character_set_client = utf8 */;
3055 CREATE TABLE `hold_cancellation_requests` (
3056 `hold_cancellation_request_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the cancellation request',
3057 `hold_id` int(11) NOT NULL COMMENT 'ID of the hold',
3058 `creation_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Time and date the cancellation request was created',
3059 PRIMARY KEY (`hold_cancellation_request_id`)
3060 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3061 /*!40101 SET character_set_client = @saved_cs_client */;
3064 -- Table structure for table `hold_fill_targets`
3067 DROP TABLE IF EXISTS `hold_fill_targets`;
3068 /*!40101 SET @saved_cs_client = @@character_set_client */;
3069 /*!40101 SET character_set_client = utf8 */;
3070 CREATE TABLE `hold_fill_targets` (
3071 `borrowernumber` int(11) NOT NULL,
3072 `biblionumber` int(11) NOT NULL,
3073 `itemnumber` int(11) NOT NULL,
3074 `source_branchcode` varchar(10) DEFAULT NULL,
3075 `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
3076 `reserve_id` int(11) DEFAULT NULL,
3077 PRIMARY KEY (`itemnumber`),
3078 KEY `bib_branch` (`biblionumber`,`source_branchcode`),
3079 KEY `hold_fill_targets_ibfk_1` (`borrowernumber`),
3080 KEY `hold_fill_targets_ibfk_4` (`source_branchcode`),
3081 CONSTRAINT `hold_fill_targets_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3082 CONSTRAINT `hold_fill_targets_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3083 CONSTRAINT `hold_fill_targets_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3084 CONSTRAINT `hold_fill_targets_ibfk_4` FOREIGN KEY (`source_branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
3085 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3086 /*!40101 SET character_set_client = @saved_cs_client */;
3089 -- Table structure for table `housebound_profile`
3092 DROP TABLE IF EXISTS `housebound_profile`;
3093 /*!40101 SET @saved_cs_client = @@character_set_client */;
3094 /*!40101 SET character_set_client = utf8 */;
3095 CREATE TABLE `housebound_profile` (
3096 `borrowernumber` int(11) NOT NULL COMMENT 'Number of the borrower associated with this profile.',
3097 `day` mediumtext NOT NULL COMMENT 'The preferred day of the week for delivery.',
3098 `frequency` mediumtext NOT NULL COMMENT 'The Authorised_Value definining the pattern for delivery.',
3099 `fav_itemtypes` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred itemtypes.',
3100 `fav_subjects` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred subjects.',
3101 `fav_authors` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred authors.',
3102 `referral` mediumtext DEFAULT NULL COMMENT 'Free text indicating how the borrower was added to the service.',
3103 `notes` mediumtext DEFAULT NULL COMMENT 'Free text for additional notes.',
3104 PRIMARY KEY (`borrowernumber`),
3105 CONSTRAINT `housebound_profile_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3106 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3107 /*!40101 SET character_set_client = @saved_cs_client */;
3110 -- Table structure for table `housebound_role`
3113 DROP TABLE IF EXISTS `housebound_role`;
3114 /*!40101 SET @saved_cs_client = @@character_set_client */;
3115 /*!40101 SET character_set_client = utf8 */;
3116 CREATE TABLE `housebound_role` (
3117 `borrowernumber_id` int(11) NOT NULL COMMENT 'borrowernumber link',
3118 `housebound_chooser` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'set to 1 to indicate this patron is a housebound chooser volunteer',
3119 `housebound_deliverer` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'set to 1 to indicate this patron is a housebound deliverer volunteer',
3120 PRIMARY KEY (`borrowernumber_id`),
3121 CONSTRAINT `houseboundrole_bnfk` FOREIGN KEY (`borrowernumber_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3122 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3123 /*!40101 SET character_set_client = @saved_cs_client */;
3126 -- Table structure for table `housebound_visit`
3129 DROP TABLE IF EXISTS `housebound_visit`;
3130 /*!40101 SET @saved_cs_client = @@character_set_client */;
3131 /*!40101 SET character_set_client = utf8 */;
3132 CREATE TABLE `housebound_visit` (
3133 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the visit.',
3134 `borrowernumber` int(11) NOT NULL COMMENT 'Number of the borrower, & the profile, linked to this visit.',
3135 `appointment_date` date DEFAULT NULL COMMENT 'Date of visit.',
3136 `day_segment` varchar(10) DEFAULT NULL COMMENT 'Rough time frame: ''morning'', ''afternoon'' ''evening''',
3137 `chooser_brwnumber` int(11) DEFAULT NULL COMMENT 'Number of the borrower to choose items for delivery.',
3138 `deliverer_brwnumber` int(11) DEFAULT NULL COMMENT 'Number of the borrower to deliver items.',
3140 KEY `houseboundvisit_bnfk` (`borrowernumber`),
3141 KEY `houseboundvisit_bnfk_1` (`chooser_brwnumber`),
3142 KEY `houseboundvisit_bnfk_2` (`deliverer_brwnumber`),
3143 CONSTRAINT `houseboundvisit_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `housebound_profile` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3144 CONSTRAINT `houseboundvisit_bnfk_1` FOREIGN KEY (`chooser_brwnumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3145 CONSTRAINT `houseboundvisit_bnfk_2` FOREIGN KEY (`deliverer_brwnumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3146 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3147 /*!40101 SET character_set_client = @saved_cs_client */;
3150 -- Table structure for table `identity_provider_domains`
3153 DROP TABLE IF EXISTS `identity_provider_domains`;
3154 /*!40101 SET @saved_cs_client = @@character_set_client */;
3155 /*!40101 SET character_set_client = utf8 */;
3156 CREATE TABLE `identity_provider_domains` (
3157 `identity_provider_domain_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify providers domain',
3158 `identity_provider_id` int(11) NOT NULL COMMENT 'Reference to provider',
3159 `domain` varchar(100) DEFAULT NULL COMMENT 'Domain name. If null means all domains',
3160 `auto_register` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Allow user auto register',
3161 `update_on_auth` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Update user data on auth login',
3162 `default_library_id` varchar(10) DEFAULT NULL COMMENT 'Default library to create user if auto register is enabled',
3163 `default_category_id` varchar(10) DEFAULT NULL COMMENT 'Default category to create user if auto register is enabled',
3164 `allow_opac` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Allow provider from opac interface',
3165 `allow_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Allow provider from staff interface',
3166 PRIMARY KEY (`identity_provider_domain_id`),
3167 UNIQUE KEY `identity_provider_id` (`identity_provider_id`,`domain`),
3168 KEY `domain` (`domain`),
3169 KEY `allow_opac` (`allow_opac`),
3170 KEY `allow_staff` (`allow_staff`),
3171 KEY `identity_provider_domain_ibfk_2` (`default_library_id`),
3172 KEY `identity_provider_domain_ibfk_3` (`default_category_id`),
3173 CONSTRAINT `identity_provider_domain_ibfk_1` FOREIGN KEY (`identity_provider_id`) REFERENCES `identity_providers` (`identity_provider_id`) ON DELETE CASCADE,
3174 CONSTRAINT `identity_provider_domain_ibfk_2` FOREIGN KEY (`default_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
3175 CONSTRAINT `identity_provider_domain_ibfk_3` FOREIGN KEY (`default_category_id`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE
3176 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3177 /*!40101 SET character_set_client = @saved_cs_client */;
3180 -- Table structure for table `identity_providers`
3183 DROP TABLE IF EXISTS `identity_providers`;
3184 /*!40101 SET @saved_cs_client = @@character_set_client */;
3185 /*!40101 SET character_set_client = utf8 */;
3186 CREATE TABLE `identity_providers` (
3187 `identity_provider_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify the provider',
3188 `code` varchar(20) NOT NULL COMMENT 'Provider code',
3189 `description` varchar(255) NOT NULL COMMENT 'Description for the provider',
3190 `protocol` enum('OAuth','OIDC','LDAP','CAS') NOT NULL COMMENT 'Protocol provider speaks',
3191 `config` longtext NOT NULL COMMENT 'Configuration of the provider in JSON format',
3192 `mapping` longtext NOT NULL COMMENT 'Configuration to map provider data to Koha user',
3193 `matchpoint` enum('email','userid','cardnumber') NOT NULL COMMENT 'The patron attribute to be used as matchpoint',
3194 `icon_url` varchar(255) DEFAULT NULL COMMENT 'Provider icon URL',
3195 PRIMARY KEY (`identity_provider_id`),
3196 UNIQUE KEY `code` (`code`),
3197 KEY `protocol` (`protocol`)
3198 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3199 /*!40101 SET character_set_client = @saved_cs_client */;
3202 -- Table structure for table `illcomments`
3205 DROP TABLE IF EXISTS `illcomments`;
3206 /*!40101 SET @saved_cs_client = @@character_set_client */;
3207 /*!40101 SET character_set_client = utf8 */;
3208 CREATE TABLE `illcomments` (
3209 `illcomment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the comment',
3210 `illrequest_id` bigint(20) unsigned NOT NULL COMMENT 'ILL request number',
3211 `borrowernumber` int(11) DEFAULT NULL COMMENT 'Link to the user who made the comment (could be librarian, patron or ILL partner library)',
3212 `comment` text DEFAULT NULL COMMENT 'The text of the comment',
3213 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date and time when the comment was made',
3214 PRIMARY KEY (`illcomment_id`),
3215 KEY `illcomments_bnfk` (`borrowernumber`),
3216 KEY `illcomments_ifk` (`illrequest_id`),
3217 CONSTRAINT `illcomments_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3218 CONSTRAINT `illcomments_ifk` FOREIGN KEY (`illrequest_id`) REFERENCES `illrequests` (`illrequest_id`) ON DELETE CASCADE ON UPDATE CASCADE
3219 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3220 /*!40101 SET character_set_client = @saved_cs_client */;
3223 -- Table structure for table `illrequestattributes`
3226 DROP TABLE IF EXISTS `illrequestattributes`;
3227 /*!40101 SET @saved_cs_client = @@character_set_client */;
3228 /*!40101 SET character_set_client = utf8 */;
3229 CREATE TABLE `illrequestattributes` (
3230 `illrequest_id` bigint(20) unsigned NOT NULL COMMENT 'ILL request number',
3231 `type` varchar(200) NOT NULL COMMENT 'API ILL property name',
3232 `value` mediumtext NOT NULL COMMENT 'API ILL property value',
3233 `readonly` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Is this attribute read only',
3234 PRIMARY KEY (`illrequest_id`,`type`(191)),
3235 CONSTRAINT `illrequestattributes_ifk` FOREIGN KEY (`illrequest_id`) REFERENCES `illrequests` (`illrequest_id`) ON DELETE CASCADE ON UPDATE CASCADE
3236 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3237 /*!40101 SET character_set_client = @saved_cs_client */;
3240 -- Table structure for table `illrequests`
3243 DROP TABLE IF EXISTS `illrequests`;
3244 /*!40101 SET @saved_cs_client = @@character_set_client */;
3245 /*!40101 SET character_set_client = utf8 */;
3246 CREATE TABLE `illrequests` (
3247 `illrequest_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ILL request number',
3248 `borrowernumber` int(11) DEFAULT NULL COMMENT 'Patron associated with request',
3249 `biblio_id` int(11) DEFAULT NULL COMMENT 'Potential bib linked to request',
3250 `deleted_biblio_id` int(11) DEFAULT NULL COMMENT 'Deleted bib linked to request',
3251 `due_date` datetime DEFAULT NULL COMMENT 'Custom date due specified by backend, leave NULL for default date_due calculation',
3252 `branchcode` varchar(50) NOT NULL COMMENT 'The branch associated with the request',
3253 `status` varchar(50) DEFAULT NULL COMMENT 'Current Koha status of request',
3254 `status_alias` varchar(80) DEFAULT NULL COMMENT 'Foreign key to relevant authorised_values.authorised_value',
3255 `placed` date DEFAULT NULL COMMENT 'Date the request was placed',
3256 `replied` date DEFAULT NULL COMMENT 'Last API response',
3257 `updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
3258 `completed` date DEFAULT NULL COMMENT 'Date the request was completed',
3259 `medium` varchar(30) DEFAULT NULL COMMENT 'The Koha request type',
3260 `accessurl` varchar(500) DEFAULT NULL COMMENT 'Potential URL for accessing item',
3261 `cost` varchar(20) DEFAULT NULL COMMENT 'Quotes cost of request',
3262 `price_paid` varchar(20) DEFAULT NULL COMMENT 'Final cost of request',
3263 `notesopac` mediumtext DEFAULT NULL COMMENT 'Patron notes attached to request',
3264 `notesstaff` mediumtext DEFAULT NULL COMMENT 'Staff notes attached to request',
3265 `orderid` varchar(50) DEFAULT NULL COMMENT 'Backend id attached to request',
3266 `backend` varchar(20) DEFAULT NULL COMMENT 'The backend used to create request',
3267 PRIMARY KEY (`illrequest_id`),
3268 KEY `illrequests_bnfk` (`borrowernumber`),
3269 KEY `illrequests_bcfk_2` (`branchcode`),
3270 KEY `illrequests_safk` (`status_alias`),
3271 CONSTRAINT `illrequests_bibfk` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
3272 CONSTRAINT `illrequests_bcfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3273 CONSTRAINT `illrequests_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3274 CONSTRAINT `illrequests_safk` FOREIGN KEY (`status_alias`) REFERENCES `authorised_values` (`authorised_value`) ON DELETE SET NULL ON UPDATE CASCADE
3275 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3276 /*!40101 SET character_set_client = @saved_cs_client */;
3279 -- Table structure for table `import_auths`
3282 DROP TABLE IF EXISTS `import_auths`;
3283 /*!40101 SET @saved_cs_client = @@character_set_client */;
3284 /*!40101 SET character_set_client = utf8 */;
3285 CREATE TABLE `import_auths` (
3286 `import_record_id` int(11) NOT NULL,
3287 `matched_authid` int(11) DEFAULT NULL,
3288 `control_number` varchar(25) DEFAULT NULL,
3289 `authorized_heading` varchar(128) DEFAULT NULL,
3290 `original_source` varchar(25) DEFAULT NULL,
3291 PRIMARY KEY (`import_record_id`),
3292 KEY `import_auths_ibfk_1` (`import_record_id`),
3293 KEY `matched_authid` (`matched_authid`),
3294 CONSTRAINT `import_auths_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3295 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3296 /*!40101 SET character_set_client = @saved_cs_client */;
3299 -- Table structure for table `import_batch_profiles`
3302 DROP TABLE IF EXISTS `import_batch_profiles`;
3303 /*!40101 SET @saved_cs_client = @@character_set_client */;
3304 /*!40101 SET character_set_client = utf8 */;
3305 CREATE TABLE `import_batch_profiles` (
3306 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3307 `name` varchar(100) NOT NULL COMMENT 'name of this profile',
3308 `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3309 `template_id` int(11) DEFAULT NULL COMMENT 'the id of the marc modification template',
3310 `overlay_action` varchar(50) DEFAULT NULL COMMENT 'how to handle duplicate records',
3311 `nomatch_action` varchar(50) DEFAULT NULL COMMENT 'how to handle records where no match is found',
3312 `item_action` varchar(50) DEFAULT NULL COMMENT 'what to do with item records',
3313 `parse_items` tinyint(1) DEFAULT NULL COMMENT 'should items be parsed',
3314 `record_type` varchar(50) DEFAULT NULL COMMENT 'type of record in the batch',
3315 `encoding` varchar(50) DEFAULT NULL COMMENT 'file encoding',
3316 `format` varchar(50) DEFAULT NULL COMMENT 'marc format',
3317 `comments` longtext DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3319 UNIQUE KEY `u_import_batch_profiles__name` (`name`)
3320 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3321 /*!40101 SET character_set_client = @saved_cs_client */;
3324 -- Table structure for table `import_batches`
3327 DROP TABLE IF EXISTS `import_batches`;
3328 /*!40101 SET @saved_cs_client = @@character_set_client */;
3329 /*!40101 SET character_set_client = utf8 */;
3330 CREATE TABLE `import_batches` (
3331 `import_batch_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3332 `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3333 `template_id` int(11) DEFAULT NULL,
3334 `branchcode` varchar(10) DEFAULT NULL,
3335 `num_records` int(11) NOT NULL DEFAULT 0 COMMENT 'number of records in the file',
3336 `num_items` int(11) NOT NULL DEFAULT 0 COMMENT 'number of items in the file',
3337 `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was uploaded',
3338 `overlay_action` enum('replace','create_new','use_template','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle duplicate records',
3339 `nomatch_action` enum('create_new','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle records where no match is found',
3340 `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',
3341 `import_status` enum('staging','staged','importing','imported','reverting','reverted','cleaned') NOT NULL DEFAULT 'staging' COMMENT 'the status of the imported file',
3342 `batch_type` enum('batch','z3950','webservice') NOT NULL DEFAULT 'batch' COMMENT 'where this batch has come from',
3343 `record_type` enum('biblio','auth','holdings') NOT NULL DEFAULT 'biblio' COMMENT 'type of record in the batch',
3344 `file_name` varchar(100) DEFAULT NULL COMMENT 'the name of the file uploaded',
3345 `comments` longtext DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3346 `profile_id` int(11) DEFAULT NULL,
3347 PRIMARY KEY (`import_batch_id`),
3348 KEY `branchcode` (`branchcode`),
3349 KEY `import_batches_ibfk_1` (`profile_id`),
3350 CONSTRAINT `import_batches_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `import_batch_profiles` (`id`) ON DELETE SET NULL ON UPDATE SET NULL
3351 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3352 /*!40101 SET character_set_client = @saved_cs_client */;
3355 -- Table structure for table `import_biblios`
3358 DROP TABLE IF EXISTS `import_biblios`;
3359 /*!40101 SET @saved_cs_client = @@character_set_client */;
3360 /*!40101 SET character_set_client = utf8 */;
3361 CREATE TABLE `import_biblios` (
3362 `import_record_id` int(11) NOT NULL,
3363 `matched_biblionumber` int(11) DEFAULT NULL,
3364 `control_number` varchar(25) DEFAULT NULL,
3365 `original_source` varchar(25) DEFAULT NULL,
3366 `title` longtext DEFAULT NULL,
3367 `author` longtext DEFAULT NULL,
3368 `isbn` longtext DEFAULT NULL,
3369 `issn` longtext DEFAULT NULL,
3370 `has_items` tinyint(1) NOT NULL DEFAULT 0,
3371 PRIMARY KEY (`import_record_id`),
3372 KEY `import_biblios_ibfk_1` (`import_record_id`),
3373 KEY `matched_biblionumber` (`matched_biblionumber`),
3374 KEY `title` (`title`(191)),
3375 KEY `isbn` (`isbn`(191)),
3376 CONSTRAINT `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3377 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3378 /*!40101 SET character_set_client = @saved_cs_client */;
3381 -- Table structure for table `import_items`
3384 DROP TABLE IF EXISTS `import_items`;
3385 /*!40101 SET @saved_cs_client = @@character_set_client */;
3386 /*!40101 SET character_set_client = utf8 */;
3387 CREATE TABLE `import_items` (
3388 `import_items_id` int(11) NOT NULL AUTO_INCREMENT,
3389 `import_record_id` int(11) NOT NULL,
3390 `itemnumber` int(11) DEFAULT NULL,
3391 `branchcode` varchar(10) DEFAULT NULL,
3392 `status` enum('error','staged','imported','reverted','ignored') NOT NULL DEFAULT 'staged',
3393 `marcxml` longtext NOT NULL,
3394 `import_error` longtext DEFAULT NULL,
3395 PRIMARY KEY (`import_items_id`),
3396 KEY `import_items_ibfk_1` (`import_record_id`),
3397 KEY `itemnumber` (`itemnumber`),
3398 KEY `branchcode` (`branchcode`),
3399 CONSTRAINT `import_items_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3400 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3401 /*!40101 SET character_set_client = @saved_cs_client */;
3404 -- Table structure for table `import_record_matches`
3407 DROP TABLE IF EXISTS `import_record_matches`;
3408 /*!40101 SET @saved_cs_client = @@character_set_client */;
3409 /*!40101 SET character_set_client = utf8 */;
3410 CREATE TABLE `import_record_matches` (
3411 `import_record_id` int(11) NOT NULL COMMENT 'the id given to the imported bib record (import_records.import_record_id)',
3412 `candidate_match_id` int(11) NOT NULL COMMENT 'the biblio the imported record matches (biblio.biblionumber)',
3413 `score` int(11) NOT NULL DEFAULT 0 COMMENT 'the match score',
3414 `chosen` tinyint(1) DEFAULT NULL COMMENT 'whether this match has been allowed or denied',
3415 PRIMARY KEY (`import_record_id`,`candidate_match_id`),
3416 KEY `record_score` (`import_record_id`,`score`),
3417 CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3418 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3419 /*!40101 SET character_set_client = @saved_cs_client */;
3422 -- Table structure for table `import_records`
3425 DROP TABLE IF EXISTS `import_records`;
3426 /*!40101 SET @saved_cs_client = @@character_set_client */;
3427 /*!40101 SET character_set_client = utf8 */;
3428 CREATE TABLE `import_records` (
3429 `import_record_id` int(11) NOT NULL AUTO_INCREMENT,
3430 `import_batch_id` int(11) NOT NULL,
3431 `branchcode` varchar(10) DEFAULT NULL,
3432 `record_sequence` int(11) NOT NULL DEFAULT 0,
3433 `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
3434 `import_date` date DEFAULT NULL,
3435 `marc` longblob NOT NULL,
3436 `marcxml` longtext NOT NULL,
3437 `marcxml_old` longtext NOT NULL,
3438 `record_type` enum('biblio','auth','holdings') NOT NULL DEFAULT 'biblio',
3439 `overlay_status` enum('no_match','auto_match','manual_match','match_applied') NOT NULL DEFAULT 'no_match',
3440 `status` enum('error','staged','imported','reverted','items_reverted','ignored') NOT NULL DEFAULT 'staged',
3441 `import_error` longtext DEFAULT NULL,
3442 `encoding` varchar(40) NOT NULL DEFAULT '',
3443 PRIMARY KEY (`import_record_id`),
3444 KEY `branchcode` (`branchcode`),
3445 KEY `batch_sequence` (`import_batch_id`,`record_sequence`),
3446 KEY `batch_id_record_type` (`import_batch_id`,`record_type`),
3447 CONSTRAINT `import_records_ifbk_1` FOREIGN KEY (`import_batch_id`) REFERENCES `import_batches` (`import_batch_id`) ON DELETE CASCADE ON UPDATE CASCADE
3448 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3449 /*!40101 SET character_set_client = @saved_cs_client */;
3452 -- Table structure for table `issues`
3455 DROP TABLE IF EXISTS `issues`;
3456 /*!40101 SET @saved_cs_client = @@character_set_client */;
3457 /*!40101 SET character_set_client = utf8 */;
3458 CREATE TABLE `issues` (
3459 `issue_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key for issues table',
3460 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
3461 `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
3462 `itemnumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
3463 `date_due` datetime DEFAULT NULL COMMENT 'datetime the item is due (yyyy-mm-dd hh:mm::ss)',
3464 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
3465 `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned, will be NULL until moved to old_issues',
3466 `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
3467 `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
3468 `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
3469 `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
3470 `auto_renew_error` varchar(32) DEFAULT NULL COMMENT 'automatic renewal error',
3471 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
3472 `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
3473 `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
3474 `note` longtext DEFAULT NULL COMMENT 'issue note text',
3475 `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
3476 `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
3477 PRIMARY KEY (`issue_id`),
3478 UNIQUE KEY `itemnumber` (`itemnumber`),
3479 KEY `issuesborridx` (`borrowernumber`),
3480 KEY `itemnumber_idx` (`itemnumber`),
3481 KEY `branchcode_idx` (`branchcode`),
3482 KEY `bordate` (`borrowernumber`,`timestamp`),
3483 KEY `issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
3484 CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE,
3485 CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE,
3486 CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3487 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3488 /*!40101 SET character_set_client = @saved_cs_client */;
3491 -- Table structure for table `item_bundles`
3494 DROP TABLE IF EXISTS `item_bundles`;
3495 /*!40101 SET @saved_cs_client = @@character_set_client */;
3496 /*!40101 SET character_set_client = utf8 */;
3497 CREATE TABLE `item_bundles` (
3498 `item` int(11) NOT NULL,
3499 `host` int(11) NOT NULL,
3500 PRIMARY KEY (`host`,`item`),
3501 UNIQUE KEY `item_bundles_uniq_1` (`item`),
3502 CONSTRAINT `item_bundles_ibfk_1` FOREIGN KEY (`item`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3503 CONSTRAINT `item_bundles_ibfk_2` FOREIGN KEY (`host`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3504 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3505 /*!40101 SET character_set_client = @saved_cs_client */;
3508 -- Table structure for table `item_circulation_alert_preferences`
3511 DROP TABLE IF EXISTS `item_circulation_alert_preferences`;
3512 /*!40101 SET @saved_cs_client = @@character_set_client */;
3513 /*!40101 SET character_set_client = utf8 */;
3514 CREATE TABLE `item_circulation_alert_preferences` (
3515 `id` int(11) NOT NULL AUTO_INCREMENT,
3516 `branchcode` varchar(10) NOT NULL,
3517 `categorycode` varchar(10) NOT NULL,
3518 `item_type` varchar(10) NOT NULL,
3519 `notification` varchar(16) NOT NULL,
3521 KEY `branchcode` (`branchcode`,`categorycode`,`item_type`,`notification`)
3522 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3523 /*!40101 SET character_set_client = @saved_cs_client */;
3526 -- Table structure for table `item_editor_templates`
3529 DROP TABLE IF EXISTS `item_editor_templates`;
3530 /*!40101 SET @saved_cs_client = @@character_set_client */;
3531 /*!40101 SET character_set_client = utf8 */;
3532 CREATE TABLE `item_editor_templates` (
3533 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the template',
3534 `patron_id` int(11) DEFAULT NULL COMMENT 'creator of this template',
3535 `name` mediumtext NOT NULL COMMENT 'template name',
3536 `is_shared` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if template is shared',
3537 `contents` longtext NOT NULL COMMENT 'json encoded template data',
3539 KEY `bn` (`patron_id`),
3540 CONSTRAINT `bn` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3541 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3542 /*!40101 SET character_set_client = @saved_cs_client */;
3545 -- Table structure for table `item_group_items`
3548 DROP TABLE IF EXISTS `item_group_items`;
3549 /*!40101 SET @saved_cs_client = @@character_set_client */;
3550 /*!40101 SET character_set_client = utf8 */;
3551 CREATE TABLE `item_group_items` (
3552 `item_group_items_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the group/item link',
3553 `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',
3554 `item_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the items table',
3555 PRIMARY KEY (`item_group_items_id`),
3556 UNIQUE KEY `item_id` (`item_id`),
3557 KEY `item_group_items_gifk_1` (`item_group_id`),
3558 CONSTRAINT `item_group_items_gifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3559 CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3560 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3561 /*!40101 SET character_set_client = @saved_cs_client */;
3564 -- Table structure for table `item_groups`
3567 DROP TABLE IF EXISTS `item_groups`;
3568 /*!40101 SET @saved_cs_client = @@character_set_client */;
3569 /*!40101 SET character_set_client = utf8 */;
3570 CREATE TABLE `item_groups` (
3571 `item_group_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the items group',
3572 `biblio_id` int(11) NOT NULL COMMENT 'id for the bibliographic record the group belongs to',
3573 `display_order` int(4) NOT NULL DEFAULT 0 COMMENT 'The ''sort order'' for item_groups',
3574 `description` mediumtext DEFAULT NULL COMMENT 'A group description',
3575 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the group was created',
3576 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the group',
3577 PRIMARY KEY (`item_group_id`),
3578 KEY `item_groups_ibfk_1` (`biblio_id`),
3579 CONSTRAINT `item_groups_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
3580 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3581 /*!40101 SET character_set_client = @saved_cs_client */;
3584 -- Table structure for table `items`
3587 DROP TABLE IF EXISTS `items`;
3588 /*!40101 SET @saved_cs_client = @@character_set_client */;
3589 /*!40101 SET character_set_client = utf8 */;
3590 CREATE TABLE `items` (
3591 `itemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier added by Koha',
3592 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
3593 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
3594 `barcode` varchar(20) DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
3595 `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
3596 `booksellerid` longtext DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
3597 `homebranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
3598 `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
3599 `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
3600 `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
3601 `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out/issued',
3602 `datelastseen` date DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
3603 `stack` tinyint(1) DEFAULT NULL,
3604 `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
3605 `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
3606 `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
3607 `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
3608 `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
3609 `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
3610 `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
3611 `itemcallnumber` varchar(255) DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
3612 `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
3613 `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out/issued',
3614 `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
3615 `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
3616 `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
3617 `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
3618 `itemnotes_nonpublic` longtext DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
3619 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
3620 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
3621 `deleted_on` datetime DEFAULT NULL COMMENT 'date/time of deletion',
3622 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
3623 `permanent_location` varchar(80) DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
3624 `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
3625 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
3626 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
3627 `ccode` varchar(80) DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
3628 `materials` mediumtext DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
3629 `uri` mediumtext DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
3630 `itype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
3631 `more_subfields_xml` longtext DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
3632 `enumchron` mediumtext DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
3633 `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
3634 `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
3635 `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.',
3636 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
3637 PRIMARY KEY (`itemnumber`),
3638 UNIQUE KEY `itembarcodeidx` (`barcode`),
3639 KEY `itemstocknumberidx` (`stocknumber`),
3640 KEY `itembinoidx` (`biblioitemnumber`),
3641 KEY `itembibnoidx` (`biblionumber`),
3642 KEY `homebranch` (`homebranch`),
3643 KEY `holdingbranch` (`holdingbranch`),
3644 KEY `itemcallnumber` (`itemcallnumber`(191)),
3645 KEY `items_location` (`location`),
3646 KEY `items_ccode` (`ccode`),
3647 KEY `itype_idx` (`itype`),
3648 KEY `timestamp` (`timestamp`),
3649 CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3650 CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
3651 CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
3652 CONSTRAINT `items_ibfk_4` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
3653 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3654 /*!40101 SET character_set_client = @saved_cs_client */;
3657 -- Table structure for table `items_last_borrower`
3660 DROP TABLE IF EXISTS `items_last_borrower`;
3661 /*!40101 SET @saved_cs_client = @@character_set_client */;
3662 /*!40101 SET character_set_client = utf8 */;
3663 CREATE TABLE `items_last_borrower` (
3664 `id` int(11) NOT NULL AUTO_INCREMENT,
3665 `itemnumber` int(11) NOT NULL,
3666 `borrowernumber` int(11) NOT NULL,
3667 `created_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
3669 UNIQUE KEY `itemnumber` (`itemnumber`),
3670 KEY `borrowernumber` (`borrowernumber`),
3671 CONSTRAINT `items_last_borrower_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3672 CONSTRAINT `items_last_borrower_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3673 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3674 /*!40101 SET character_set_client = @saved_cs_client */;
3677 -- Table structure for table `items_search_fields`
3680 DROP TABLE IF EXISTS `items_search_fields`;
3681 /*!40101 SET @saved_cs_client = @@character_set_client */;
3682 /*!40101 SET character_set_client = utf8 */;
3683 CREATE TABLE `items_search_fields` (
3684 `name` varchar(255) NOT NULL,
3685 `label` varchar(255) NOT NULL,
3686 `tagfield` char(3) NOT NULL,
3687 `tagsubfield` char(1) DEFAULT NULL,
3688 `authorised_values_category` varchar(32) DEFAULT NULL,
3689 PRIMARY KEY (`name`(191)),
3690 KEY `items_search_fields_authorised_values_category` (`authorised_values_category`),
3691 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
3692 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3693 /*!40101 SET character_set_client = @saved_cs_client */;
3696 -- Table structure for table `itemtypes`
3699 DROP TABLE IF EXISTS `itemtypes`;
3700 /*!40101 SET @saved_cs_client = @@character_set_client */;
3701 /*!40101 SET character_set_client = utf8 */;
3702 CREATE TABLE `itemtypes` (
3703 `itemtype` varchar(10) NOT NULL DEFAULT '' COMMENT 'unique key, a code associated with the item type',
3704 `parent_type` varchar(10) DEFAULT NULL COMMENT 'unique key, a code associated with the item type',
3705 `description` longtext DEFAULT NULL COMMENT 'a plain text explanation of the item type',
3706 `rentalcharge` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged when this item is checked out/issued',
3707 `rentalcharge_daily` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each day between checkout date and due date',
3708 `rentalcharge_daily_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the daily rental fee is calculated directly or using finesCalendar',
3709 `rentalcharge_hourly` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each hour between checkout date and due date',
3710 `rentalcharge_hourly_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the hourly rental fee is calculated directly or using finesCalendar',
3711 `defaultreplacecost` decimal(28,6) DEFAULT NULL COMMENT 'default replacement cost',
3712 `processfee` decimal(28,6) DEFAULT NULL COMMENT 'default text be recorded in the column note when the processing fee is applied',
3713 `notforloan` smallint(6) DEFAULT NULL COMMENT '1 if the item is not for loan, 0 if the item is available for loan',
3714 `imageurl` varchar(200) DEFAULT NULL COMMENT 'URL for the item type icon',
3715 `summary` mediumtext DEFAULT NULL COMMENT 'information from the summary field, may include HTML',
3716 `checkinmsg` varchar(255) DEFAULT NULL COMMENT 'message that is displayed when an item with the given item type is checked in',
3717 `checkinmsgtype` char(16) NOT NULL DEFAULT 'message' COMMENT 'type (CSS class) for the checkinmsg, can be ''alert'' or ''message''',
3718 `sip_media_type` varchar(3) DEFAULT NULL COMMENT 'SIP2 protocol media type for this itemtype',
3719 `hideinopac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Hide the item type from the search options in OPAC',
3720 `searchcategory` varchar(80) DEFAULT NULL COMMENT 'Group this item type with others with the same value on OPAC search options',
3721 `automatic_checkin` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If automatic checkin is enabled for items of this type',
3722 PRIMARY KEY (`itemtype`),
3723 UNIQUE KEY `itemtype` (`itemtype`),
3724 KEY `itemtypes_ibfk_1` (`parent_type`),
3725 CONSTRAINT `itemtypes_ibfk_1` FOREIGN KEY (`parent_type`) REFERENCES `itemtypes` (`itemtype`)
3726 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3727 /*!40101 SET character_set_client = @saved_cs_client */;
3730 -- Table structure for table `itemtypes_branches`
3733 DROP TABLE IF EXISTS `itemtypes_branches`;
3734 /*!40101 SET @saved_cs_client = @@character_set_client */;
3735 /*!40101 SET character_set_client = utf8 */;
3736 CREATE TABLE `itemtypes_branches` (
3737 `itemtype` varchar(10) NOT NULL,
3738 `branchcode` varchar(10) NOT NULL,
3739 KEY `itemtype` (`itemtype`),
3740 KEY `branchcode` (`branchcode`),
3741 CONSTRAINT `itemtypes_branches_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE,
3742 CONSTRAINT `itemtypes_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
3743 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3744 /*!40101 SET character_set_client = @saved_cs_client */;
3747 -- Table structure for table `keyboard_shortcuts`
3750 DROP TABLE IF EXISTS `keyboard_shortcuts`;
3751 /*!40101 SET @saved_cs_client = @@character_set_client */;
3752 /*!40101 SET character_set_client = utf8 */;
3753 CREATE TABLE `keyboard_shortcuts` (
3754 `shortcut_name` varchar(80) NOT NULL,
3755 `shortcut_keys` varchar(80) NOT NULL,
3756 PRIMARY KEY (`shortcut_name`)
3757 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3758 /*!40101 SET character_set_client = @saved_cs_client */;
3761 -- Table structure for table `language_descriptions`
3764 DROP TABLE IF EXISTS `language_descriptions`;
3765 /*!40101 SET @saved_cs_client = @@character_set_client */;
3766 /*!40101 SET character_set_client = utf8 */;
3767 CREATE TABLE `language_descriptions` (
3768 `subtag` varchar(25) DEFAULT NULL,
3769 `type` varchar(25) DEFAULT NULL,
3770 `lang` varchar(25) DEFAULT NULL,
3771 `description` varchar(255) DEFAULT NULL,
3772 `id` int(11) NOT NULL AUTO_INCREMENT,
3774 UNIQUE KEY `uniq_desc` (`subtag`,`type`,`lang`),
3776 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3777 /*!40101 SET character_set_client = @saved_cs_client */;
3780 -- Table structure for table `language_rfc4646_to_iso639`
3783 DROP TABLE IF EXISTS `language_rfc4646_to_iso639`;
3784 /*!40101 SET @saved_cs_client = @@character_set_client */;
3785 /*!40101 SET character_set_client = utf8 */;
3786 CREATE TABLE `language_rfc4646_to_iso639` (
3787 `rfc4646_subtag` varchar(25) DEFAULT NULL,
3788 `iso639_2_code` varchar(25) DEFAULT NULL,
3789 `id` int(11) NOT NULL AUTO_INCREMENT,
3791 UNIQUE KEY `uniq_code` (`rfc4646_subtag`,`iso639_2_code`),
3792 KEY `rfc4646_subtag` (`rfc4646_subtag`)
3793 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3794 /*!40101 SET character_set_client = @saved_cs_client */;
3797 -- Table structure for table `language_script_bidi`
3800 DROP TABLE IF EXISTS `language_script_bidi`;
3801 /*!40101 SET @saved_cs_client = @@character_set_client */;
3802 /*!40101 SET character_set_client = utf8 */;
3803 CREATE TABLE `language_script_bidi` (
3804 `rfc4646_subtag` varchar(25) DEFAULT NULL COMMENT 'script subtag, Arab, Hebr, etc.',
3805 `bidi` varchar(3) DEFAULT NULL COMMENT 'rtl ltr',
3806 KEY `rfc4646_subtag` (`rfc4646_subtag`)
3807 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3808 /*!40101 SET character_set_client = @saved_cs_client */;
3811 -- Table structure for table `language_script_mapping`
3814 DROP TABLE IF EXISTS `language_script_mapping`;
3815 /*!40101 SET @saved_cs_client = @@character_set_client */;
3816 /*!40101 SET character_set_client = utf8 */;
3817 CREATE TABLE `language_script_mapping` (
3818 `language_subtag` varchar(25) NOT NULL,
3819 `script_subtag` varchar(25) DEFAULT NULL,
3820 PRIMARY KEY (`language_subtag`)
3821 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3822 /*!40101 SET character_set_client = @saved_cs_client */;
3825 -- Table structure for table `language_subtag_registry`
3828 DROP TABLE IF EXISTS `language_subtag_registry`;
3829 /*!40101 SET @saved_cs_client = @@character_set_client */;
3830 /*!40101 SET character_set_client = utf8 */;
3831 CREATE TABLE `language_subtag_registry` (
3832 `subtag` varchar(25) DEFAULT NULL,
3833 `type` varchar(25) DEFAULT NULL COMMENT 'language-script-region-variant-extension-privateuse',
3834 `description` varchar(255) DEFAULT NULL COMMENT 'only one of the possible descriptions for ease of reference, see language_descriptions for the complete list',
3835 `added` date DEFAULT NULL,
3836 `id` int(11) NOT NULL AUTO_INCREMENT,
3838 UNIQUE KEY `uniq_lang` (`subtag`,`type`),
3839 KEY `subtag` (`subtag`)
3840 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3841 /*!40101 SET character_set_client = @saved_cs_client */;
3844 -- Table structure for table `letter`
3847 DROP TABLE IF EXISTS `letter`;
3848 /*!40101 SET @saved_cs_client = @@character_set_client */;
3849 /*!40101 SET character_set_client = utf8 */;
3850 CREATE TABLE `letter` (
3851 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
3852 `module` varchar(20) NOT NULL DEFAULT '' COMMENT 'Koha module that triggers this notice or slip',
3853 `code` varchar(20) NOT NULL DEFAULT '' COMMENT 'unique identifier for this notice or slip',
3854 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch this notice or slip is used at (branches.branchcode)',
3855 `name` varchar(100) NOT NULL DEFAULT '' COMMENT 'plain text name for this notice or slip',
3856 `is_html` tinyint(1) DEFAULT 0 COMMENT 'does this notice or slip use HTML (1 for yes, 0 for no)',
3857 `title` varchar(200) NOT NULL DEFAULT '' COMMENT 'subject line of the notice',
3858 `content` mediumtext DEFAULT NULL COMMENT 'body text for the notice or slip',
3859 `message_transport_type` varchar(20) NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3860 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3861 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3863 UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3864 KEY `message_transport_type_fk` (`message_transport_type`),
3865 CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
3866 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3867 /*!40101 SET character_set_client = @saved_cs_client */;
3870 -- Table structure for table `library_groups`
3873 DROP TABLE IF EXISTS `library_groups`;
3874 /*!40101 SET @saved_cs_client = @@character_set_client */;
3875 /*!40101 SET character_set_client = utf8 */;
3876 CREATE TABLE `library_groups` (
3877 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for each group',
3878 `parent_id` int(11) DEFAULT NULL COMMENT 'if this is a child group, the id of the parent group',
3879 `branchcode` varchar(10) DEFAULT NULL COMMENT 'The branchcode of a branch belonging to the parent group',
3880 `title` varchar(100) DEFAULT NULL COMMENT 'Short description of the goup',
3881 `description` mediumtext DEFAULT NULL COMMENT 'Longer explanation of the group, if necessary',
3882 `ft_hide_patron_info` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Turn on the feature ''Hide patron''s info'' for this group',
3883 `ft_search_groups_opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for staff side search groups',
3884 `ft_search_groups_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for opac side search groups',
3885 `ft_local_hold_group` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group to identify libraries as pick up location for holds',
3886 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Date and time of creation',
3887 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time of last',
3889 UNIQUE KEY `title` (`title`),
3890 UNIQUE KEY `library_groups_uniq_2` (`parent_id`,`branchcode`),
3891 KEY `branchcode` (`branchcode`),
3892 CONSTRAINT `library_groups_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `library_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
3893 CONSTRAINT `library_groups_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
3894 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3895 /*!40101 SET character_set_client = @saved_cs_client */;
3898 -- Table structure for table `library_smtp_servers`
3901 DROP TABLE IF EXISTS `library_smtp_servers`;
3902 /*!40101 SET @saved_cs_client = @@character_set_client */;
3903 /*!40101 SET character_set_client = utf8 */;
3904 CREATE TABLE `library_smtp_servers` (
3905 `id` int(11) NOT NULL AUTO_INCREMENT,
3906 `library_id` varchar(10) NOT NULL,
3907 `smtp_server_id` int(11) NOT NULL,
3909 UNIQUE KEY `library_id_idx` (`library_id`),
3910 KEY `smtp_server_id_idx` (`smtp_server_id`),
3911 CONSTRAINT `library_smtp_servers_library_fk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3912 CONSTRAINT `library_smtp_servers_smtp_servers_fk` FOREIGN KEY (`smtp_server_id`) REFERENCES `smtp_servers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
3913 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3914 /*!40101 SET character_set_client = @saved_cs_client */;
3917 -- Table structure for table `linktracker`
3920 DROP TABLE IF EXISTS `linktracker`;
3921 /*!40101 SET @saved_cs_client = @@character_set_client */;
3922 /*!40101 SET character_set_client = utf8 */;
3923 CREATE TABLE `linktracker` (
3924 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
3925 `biblionumber` int(11) DEFAULT NULL COMMENT 'biblionumber of the record the link is from',
3926 `itemnumber` int(11) DEFAULT NULL COMMENT 'itemnumber if applicable that the link was from',
3927 `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrowernumber who clicked the link',
3928 `url` mediumtext DEFAULT NULL COMMENT 'the link itself',
3929 `timeclicked` datetime DEFAULT NULL COMMENT 'the date and time the link was clicked',
3931 KEY `bibidx` (`biblionumber`),
3932 KEY `itemidx` (`itemnumber`),
3933 KEY `borridx` (`borrowernumber`),
3934 KEY `dateidx` (`timeclicked`),
3935 CONSTRAINT `linktracker_biblio_ibfk` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3936 CONSTRAINT `linktracker_borrower_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3937 CONSTRAINT `linktracker_item_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL
3938 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3939 /*!40101 SET character_set_client = @saved_cs_client */;
3942 -- Table structure for table `localization`
3945 DROP TABLE IF EXISTS `localization`;
3946 /*!40101 SET @saved_cs_client = @@character_set_client */;
3947 /*!40101 SET character_set_client = utf8 */;
3948 CREATE TABLE `localization` (
3949 `localization_id` int(11) NOT NULL AUTO_INCREMENT,
3950 `entity` varchar(16) NOT NULL,
3951 `code` varchar(64) NOT NULL,
3952 `lang` varchar(25) NOT NULL COMMENT 'could be a foreign key',
3953 `translation` mediumtext DEFAULT NULL,
3954 PRIMARY KEY (`localization_id`),
3955 UNIQUE KEY `entity_code_lang` (`entity`,`code`,`lang`)
3956 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3957 /*!40101 SET character_set_client = @saved_cs_client */;
3960 -- Table structure for table `marc_matchers`
3963 DROP TABLE IF EXISTS `marc_matchers`;
3964 /*!40101 SET @saved_cs_client = @@character_set_client */;
3965 /*!40101 SET character_set_client = utf8 */;
3966 CREATE TABLE `marc_matchers` (
3967 `matcher_id` int(11) NOT NULL AUTO_INCREMENT,
3968 `code` varchar(10) NOT NULL DEFAULT '',
3969 `description` varchar(255) NOT NULL DEFAULT '',
3970 `record_type` varchar(10) NOT NULL DEFAULT 'biblio',
3971 `threshold` int(11) NOT NULL DEFAULT 0,
3972 PRIMARY KEY (`matcher_id`),
3973 KEY `code` (`code`),
3974 KEY `record_type` (`record_type`)
3975 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3976 /*!40101 SET character_set_client = @saved_cs_client */;
3979 -- Table structure for table `marc_modification_template_actions`
3982 DROP TABLE IF EXISTS `marc_modification_template_actions`;
3983 /*!40101 SET @saved_cs_client = @@character_set_client */;
3984 /*!40101 SET character_set_client = utf8 */;
3985 CREATE TABLE `marc_modification_template_actions` (
3986 `mmta_id` int(11) NOT NULL AUTO_INCREMENT,
3987 `template_id` int(11) NOT NULL,
3988 `ordering` int(3) NOT NULL,
3989 `action` enum('delete_field','add_field','update_field','move_field','copy_field','copy_and_replace_field') NOT NULL,
3990 `field_number` smallint(6) NOT NULL DEFAULT 0,
3991 `from_field` varchar(3) NOT NULL,
3992 `from_subfield` varchar(1) DEFAULT NULL,
3993 `field_value` text DEFAULT NULL,
3994 `to_field` varchar(3) DEFAULT NULL,
3995 `to_subfield` varchar(1) DEFAULT NULL,
3996 `to_regex_search` mediumtext DEFAULT NULL,
3997 `to_regex_replace` mediumtext DEFAULT NULL,
3998 `to_regex_modifiers` varchar(8) DEFAULT '',
3999 `conditional` enum('if','unless') DEFAULT NULL,
4000 `conditional_field` varchar(3) DEFAULT NULL,
4001 `conditional_subfield` varchar(1) DEFAULT NULL,
4002 `conditional_comparison` enum('exists','not_exists','equals','not_equals') DEFAULT NULL,
4003 `conditional_value` mediumtext DEFAULT NULL,
4004 `conditional_regex` tinyint(1) NOT NULL DEFAULT 0,
4005 `description` mediumtext DEFAULT NULL,
4006 PRIMARY KEY (`mmta_id`),
4007 KEY `mmta_ibfk_1` (`template_id`),
4008 CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
4009 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4010 /*!40101 SET character_set_client = @saved_cs_client */;
4013 -- Table structure for table `marc_modification_templates`
4016 DROP TABLE IF EXISTS `marc_modification_templates`;
4017 /*!40101 SET @saved_cs_client = @@character_set_client */;
4018 /*!40101 SET character_set_client = utf8 */;
4019 CREATE TABLE `marc_modification_templates` (
4020 `template_id` int(11) NOT NULL AUTO_INCREMENT,
4021 `name` mediumtext NOT NULL,
4022 PRIMARY KEY (`template_id`)
4023 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4024 /*!40101 SET character_set_client = @saved_cs_client */;
4027 -- Table structure for table `marc_overlay_rules`
4030 DROP TABLE IF EXISTS `marc_overlay_rules`;
4031 /*!40101 SET @saved_cs_client = @@character_set_client */;
4032 /*!40101 SET character_set_client = utf8 */;
4033 CREATE TABLE `marc_overlay_rules` (
4034 `id` int(11) NOT NULL AUTO_INCREMENT,
4035 `tag` varchar(255) NOT NULL,
4036 `module` varchar(127) NOT NULL,
4037 `filter` varchar(255) NOT NULL,
4038 `add` tinyint(1) NOT NULL DEFAULT 0,
4039 `append` tinyint(1) NOT NULL DEFAULT 0,
4040 `remove` tinyint(1) NOT NULL DEFAULT 0,
4041 `delete` tinyint(1) NOT NULL DEFAULT 0,
4043 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4044 /*!40101 SET character_set_client = @saved_cs_client */;
4047 -- Table structure for table `marc_subfield_structure`
4050 DROP TABLE IF EXISTS `marc_subfield_structure`;
4051 /*!40101 SET @saved_cs_client = @@character_set_client */;
4052 /*!40101 SET character_set_client = utf8 */;
4053 CREATE TABLE `marc_subfield_structure` (
4054 `tagfield` varchar(3) NOT NULL DEFAULT '',
4055 `tagsubfield` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
4056 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
4057 `libopac` varchar(255) NOT NULL DEFAULT '',
4058 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
4059 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4060 `important` tinyint(4) NOT NULL DEFAULT 0,
4061 `kohafield` varchar(40) DEFAULT NULL,
4062 `tab` tinyint(1) DEFAULT NULL,
4063 `authorised_value` varchar(32) DEFAULT NULL,
4064 `authtypecode` varchar(20) DEFAULT NULL,
4065 `value_builder` varchar(80) DEFAULT NULL,
4066 `isurl` tinyint(1) DEFAULT NULL,
4067 `hidden` tinyint(1) NOT NULL DEFAULT 8,
4068 `frameworkcode` varchar(4) NOT NULL DEFAULT '',
4069 `seealso` varchar(1100) DEFAULT NULL,
4070 `link` varchar(80) DEFAULT NULL,
4071 `defaultvalue` mediumtext DEFAULT NULL,
4072 `maxlength` int(4) NOT NULL DEFAULT 9999,
4073 `display_order` int(2) NOT NULL DEFAULT 0,
4074 PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`),
4075 KEY `kohafield_2` (`kohafield`),
4076 KEY `tab` (`frameworkcode`,`tab`),
4077 KEY `kohafield` (`frameworkcode`,`kohafield`),
4078 KEY `marc_subfield_structure_ibfk_1` (`authorised_value`),
4079 CONSTRAINT `marc_subfield_structure_ibfk_1` FOREIGN KEY (`authorised_value`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE SET NULL ON UPDATE CASCADE
4080 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4081 /*!40101 SET character_set_client = @saved_cs_client */;
4084 -- Table structure for table `marc_tag_structure`
4087 DROP TABLE IF EXISTS `marc_tag_structure`;
4088 /*!40101 SET @saved_cs_client = @@character_set_client */;
4089 /*!40101 SET character_set_client = utf8 */;
4090 CREATE TABLE `marc_tag_structure` (
4091 `tagfield` varchar(3) NOT NULL DEFAULT '',
4092 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
4093 `libopac` varchar(255) NOT NULL DEFAULT '',
4094 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
4095 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4096 `important` tinyint(4) NOT NULL DEFAULT 0,
4097 `authorised_value` varchar(32) DEFAULT NULL,
4098 `ind1_defaultvalue` varchar(1) NOT NULL DEFAULT '',
4099 `ind2_defaultvalue` varchar(1) NOT NULL DEFAULT '',
4100 `frameworkcode` varchar(4) NOT NULL DEFAULT '',
4101 PRIMARY KEY (`frameworkcode`,`tagfield`)
4102 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4103 /*!40101 SET character_set_client = @saved_cs_client */;
4106 -- Table structure for table `matchchecks`
4109 DROP TABLE IF EXISTS `matchchecks`;
4110 /*!40101 SET @saved_cs_client = @@character_set_client */;
4111 /*!40101 SET character_set_client = utf8 */;
4112 CREATE TABLE `matchchecks` (
4113 `matcher_id` int(11) NOT NULL,
4114 `matchcheck_id` int(11) NOT NULL AUTO_INCREMENT,
4115 `source_matchpoint_id` int(11) NOT NULL,
4116 `target_matchpoint_id` int(11) NOT NULL,
4117 PRIMARY KEY (`matchcheck_id`),
4118 KEY `matcher_matchchecks_ifbk_1` (`matcher_id`),
4119 KEY `matcher_matchchecks_ifbk_2` (`source_matchpoint_id`),
4120 KEY `matcher_matchchecks_ifbk_3` (`target_matchpoint_id`),
4121 CONSTRAINT `matcher_matchchecks_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4122 CONSTRAINT `matcher_matchchecks_ifbk_2` FOREIGN KEY (`source_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4123 CONSTRAINT `matcher_matchchecks_ifbk_3` FOREIGN KEY (`target_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4124 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4125 /*!40101 SET character_set_client = @saved_cs_client */;
4128 -- Table structure for table `matcher_matchpoints`
4131 DROP TABLE IF EXISTS `matcher_matchpoints`;
4132 /*!40101 SET @saved_cs_client = @@character_set_client */;
4133 /*!40101 SET character_set_client = utf8 */;
4134 CREATE TABLE `matcher_matchpoints` (
4135 `matcher_id` int(11) NOT NULL,
4136 `matchpoint_id` int(11) NOT NULL,
4137 KEY `matcher_matchpoints_ifbk_1` (`matcher_id`),
4138 KEY `matcher_matchpoints_ifbk_2` (`matchpoint_id`),
4139 CONSTRAINT `matcher_matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4140 CONSTRAINT `matcher_matchpoints_ifbk_2` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4141 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4142 /*!40101 SET character_set_client = @saved_cs_client */;
4145 -- Table structure for table `matchpoint_component_norms`
4148 DROP TABLE IF EXISTS `matchpoint_component_norms`;
4149 /*!40101 SET @saved_cs_client = @@character_set_client */;
4150 /*!40101 SET character_set_client = utf8 */;
4151 CREATE TABLE `matchpoint_component_norms` (
4152 `matchpoint_component_id` int(11) NOT NULL,
4153 `sequence` int(11) NOT NULL DEFAULT 0,
4154 `norm_routine` varchar(50) NOT NULL DEFAULT '',
4155 KEY `matchpoint_component_norms` (`matchpoint_component_id`,`sequence`),
4156 CONSTRAINT `matchpoint_component_norms_ifbk_1` FOREIGN KEY (`matchpoint_component_id`) REFERENCES `matchpoint_components` (`matchpoint_component_id`) ON DELETE CASCADE ON UPDATE CASCADE
4157 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4158 /*!40101 SET character_set_client = @saved_cs_client */;
4161 -- Table structure for table `matchpoint_components`
4164 DROP TABLE IF EXISTS `matchpoint_components`;
4165 /*!40101 SET @saved_cs_client = @@character_set_client */;
4166 /*!40101 SET character_set_client = utf8 */;
4167 CREATE TABLE `matchpoint_components` (
4168 `matchpoint_id` int(11) NOT NULL,
4169 `matchpoint_component_id` int(11) NOT NULL AUTO_INCREMENT,
4170 `sequence` int(11) NOT NULL DEFAULT 0,
4171 `tag` varchar(3) NOT NULL DEFAULT '',
4172 `subfields` varchar(40) NOT NULL DEFAULT '',
4173 `offset` int(4) NOT NULL DEFAULT 0,
4174 `length` int(4) NOT NULL DEFAULT 0,
4175 PRIMARY KEY (`matchpoint_component_id`),
4176 KEY `by_sequence` (`matchpoint_id`,`sequence`),
4177 CONSTRAINT `matchpoint_components_ifbk_1` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4178 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4179 /*!40101 SET character_set_client = @saved_cs_client */;
4182 -- Table structure for table `matchpoints`
4185 DROP TABLE IF EXISTS `matchpoints`;
4186 /*!40101 SET @saved_cs_client = @@character_set_client */;
4187 /*!40101 SET character_set_client = utf8 */;
4188 CREATE TABLE `matchpoints` (
4189 `matcher_id` int(11) NOT NULL,
4190 `matchpoint_id` int(11) NOT NULL AUTO_INCREMENT,
4191 `search_index` varchar(30) NOT NULL DEFAULT '',
4192 `score` int(11) NOT NULL DEFAULT 0,
4193 PRIMARY KEY (`matchpoint_id`),
4194 KEY `matchpoints_ifbk_1` (`matcher_id`),
4195 CONSTRAINT `matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE
4196 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4197 /*!40101 SET character_set_client = @saved_cs_client */;
4200 -- Table structure for table `message_attributes`
4203 DROP TABLE IF EXISTS `message_attributes`;
4204 /*!40101 SET @saved_cs_client = @@character_set_client */;
4205 /*!40101 SET character_set_client = utf8 */;
4206 CREATE TABLE `message_attributes` (
4207 `message_attribute_id` int(11) NOT NULL AUTO_INCREMENT,
4208 `message_name` varchar(40) NOT NULL DEFAULT '',
4209 `takes_days` tinyint(1) NOT NULL DEFAULT 0,
4210 PRIMARY KEY (`message_attribute_id`),
4211 UNIQUE KEY `message_name` (`message_name`)
4212 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4213 /*!40101 SET character_set_client = @saved_cs_client */;
4216 -- Table structure for table `message_queue`
4219 DROP TABLE IF EXISTS `message_queue`;
4220 /*!40101 SET @saved_cs_client = @@character_set_client */;
4221 /*!40101 SET character_set_client = utf8 */;
4222 CREATE TABLE `message_queue` (
4223 `message_id` int(11) NOT NULL AUTO_INCREMENT,
4224 `letter_id` int(11) DEFAULT NULL COMMENT 'Foreign key to the letters table',
4225 `borrowernumber` int(11) DEFAULT NULL,
4226 `subject` mediumtext DEFAULT NULL,
4227 `content` mediumtext DEFAULT NULL,
4228 `metadata` mediumtext DEFAULT NULL,
4229 `letter_code` varchar(64) DEFAULT NULL,
4230 `message_transport_type` varchar(20) NOT NULL,
4231 `status` enum('sent','pending','failed','deleted') NOT NULL DEFAULT 'pending',
4232 `time_queued` timestamp NULL DEFAULT NULL,
4233 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
4234 `to_address` longtext DEFAULT NULL,
4235 `from_address` longtext DEFAULT NULL,
4236 `reply_address` longtext DEFAULT NULL,
4237 `content_type` mediumtext DEFAULT NULL,
4238 `failure_code` mediumtext DEFAULT NULL,
4239 PRIMARY KEY (`message_id`),
4240 KEY `borrowernumber` (`borrowernumber`),
4241 KEY `message_transport_type` (`message_transport_type`),
4242 KEY `letter_fk` (`letter_id`),
4243 CONSTRAINT `letter_fk` FOREIGN KEY (`letter_id`) REFERENCES `letter` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
4244 CONSTRAINT `messageq_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4245 CONSTRAINT `messageq_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON UPDATE CASCADE
4246 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4247 /*!40101 SET character_set_client = @saved_cs_client */;
4250 -- Table structure for table `message_transport_types`
4253 DROP TABLE IF EXISTS `message_transport_types`;
4254 /*!40101 SET @saved_cs_client = @@character_set_client */;
4255 /*!40101 SET character_set_client = utf8 */;
4256 CREATE TABLE `message_transport_types` (
4257 `message_transport_type` varchar(20) NOT NULL,
4258 PRIMARY KEY (`message_transport_type`)
4259 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4260 /*!40101 SET character_set_client = @saved_cs_client */;
4263 -- Table structure for table `message_transports`
4266 DROP TABLE IF EXISTS `message_transports`;
4267 /*!40101 SET @saved_cs_client = @@character_set_client */;
4268 /*!40101 SET character_set_client = utf8 */;
4269 CREATE TABLE `message_transports` (
4270 `message_attribute_id` int(11) NOT NULL,
4271 `message_transport_type` varchar(20) NOT NULL,
4272 `is_digest` tinyint(1) NOT NULL DEFAULT 0,
4273 `letter_module` varchar(20) NOT NULL DEFAULT '',
4274 `letter_code` varchar(20) NOT NULL DEFAULT '',
4275 `branchcode` varchar(10) NOT NULL DEFAULT '',
4276 PRIMARY KEY (`message_attribute_id`,`message_transport_type`,`is_digest`),
4277 KEY `message_transport_type` (`message_transport_type`),
4278 KEY `letter_module` (`letter_module`,`letter_code`),
4279 CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4280 CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
4281 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4282 /*!40101 SET character_set_client = @saved_cs_client */;
4285 -- Table structure for table `messages`
4288 DROP TABLE IF EXISTS `messages`;
4289 /*!40101 SET @saved_cs_client = @@character_set_client */;
4290 /*!40101 SET character_set_client = utf8 */;
4291 CREATE TABLE `messages` (
4292 `message_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4293 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking this message to the borrowers table',
4294 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key linking the message to the branches table',
4295 `message_type` varchar(1) NOT NULL COMMENT 'whether the message is for the librarians (L) or the patron (B)',
4296 `message` mediumtext NOT NULL COMMENT 'the text of the message',
4297 `message_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the message was written',
4298 `manager_id` int(11) DEFAULT NULL COMMENT 'creator of message',
4299 PRIMARY KEY (`message_id`),
4300 KEY `messages_ibfk_1` (`manager_id`),
4301 KEY `messages_borrowernumber` (`borrowernumber`),
4302 CONSTRAINT `messages_borrowernumber` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4303 CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL
4304 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4305 /*!40101 SET character_set_client = @saved_cs_client */;
4308 -- Table structure for table `misc_files`
4311 DROP TABLE IF EXISTS `misc_files`;
4312 /*!40101 SET @saved_cs_client = @@character_set_client */;
4313 /*!40101 SET character_set_client = utf8 */;
4314 CREATE TABLE `misc_files` (
4315 `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the file record',
4316 `table_tag` varchar(255) NOT NULL COMMENT 'usually table name, or arbitrary unique tag',
4317 `record_id` int(11) NOT NULL COMMENT 'record id from the table this file is associated to',
4318 `file_name` varchar(255) NOT NULL COMMENT 'file name',
4319 `file_type` varchar(255) NOT NULL COMMENT 'MIME type of the file',
4320 `file_description` varchar(255) DEFAULT NULL COMMENT 'description given to the file',
4321 `file_content` longblob NOT NULL COMMENT 'file content',
4322 `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
4323 PRIMARY KEY (`file_id`),
4324 KEY `table_tag` (`table_tag`(191)),
4325 KEY `record_id` (`record_id`)
4326 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4327 /*!40101 SET character_set_client = @saved_cs_client */;
4330 -- Table structure for table `need_merge_authorities`
4333 DROP TABLE IF EXISTS `need_merge_authorities`;
4334 /*!40101 SET @saved_cs_client = @@character_set_client */;
4335 /*!40101 SET character_set_client = utf8 */;
4336 CREATE TABLE `need_merge_authorities` (
4337 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id',
4338 `authid` bigint(20) NOT NULL COMMENT 'reference to original authority record',
4339 `authid_new` bigint(20) DEFAULT NULL COMMENT 'reference to optional new authority record',
4340 `reportxml` mediumtext DEFAULT NULL COMMENT 'xml showing original reporting tag',
4341 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time last modified',
4342 `done` tinyint(4) DEFAULT 0,
4344 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4345 /*!40101 SET character_set_client = @saved_cs_client */;
4348 -- Table structure for table `oai_sets`
4351 DROP TABLE IF EXISTS `oai_sets`;
4352 /*!40101 SET @saved_cs_client = @@character_set_client */;
4353 /*!40101 SET character_set_client = utf8 */;
4354 CREATE TABLE `oai_sets` (
4355 `id` int(11) NOT NULL AUTO_INCREMENT,
4356 `spec` varchar(80) NOT NULL,
4357 `name` varchar(80) NOT NULL,
4359 UNIQUE KEY `spec` (`spec`)
4360 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4361 /*!40101 SET character_set_client = @saved_cs_client */;
4364 -- Table structure for table `oai_sets_biblios`
4367 DROP TABLE IF EXISTS `oai_sets_biblios`;
4368 /*!40101 SET @saved_cs_client = @@character_set_client */;
4369 /*!40101 SET character_set_client = utf8 */;
4370 CREATE TABLE `oai_sets_biblios` (
4371 `biblionumber` int(11) NOT NULL,
4372 `set_id` int(11) NOT NULL,
4373 PRIMARY KEY (`biblionumber`,`set_id`),
4374 KEY `oai_sets_biblios_ibfk_2` (`set_id`),
4375 CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4376 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4377 /*!40101 SET character_set_client = @saved_cs_client */;
4380 -- Table structure for table `oai_sets_descriptions`
4383 DROP TABLE IF EXISTS `oai_sets_descriptions`;
4384 /*!40101 SET @saved_cs_client = @@character_set_client */;
4385 /*!40101 SET character_set_client = utf8 */;
4386 CREATE TABLE `oai_sets_descriptions` (
4387 `set_id` int(11) NOT NULL,
4388 `description` varchar(255) NOT NULL,
4389 KEY `oai_sets_descriptions_ibfk_1` (`set_id`),
4390 CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4391 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4392 /*!40101 SET character_set_client = @saved_cs_client */;
4395 -- Table structure for table `oai_sets_mappings`
4398 DROP TABLE IF EXISTS `oai_sets_mappings`;
4399 /*!40101 SET @saved_cs_client = @@character_set_client */;
4400 /*!40101 SET character_set_client = utf8 */;
4401 CREATE TABLE `oai_sets_mappings` (
4402 `set_id` int(11) NOT NULL,
4403 `rule_order` int(11) DEFAULT NULL,
4404 `rule_operator` varchar(3) DEFAULT NULL,
4405 `marcfield` char(3) NOT NULL,
4406 `marcsubfield` char(1) NOT NULL,
4407 `operator` varchar(8) NOT NULL DEFAULT 'equal',
4408 `marcvalue` varchar(80) NOT NULL,
4409 KEY `oai_sets_mappings_ibfk_1` (`set_id`),
4410 CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4411 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4412 /*!40101 SET character_set_client = @saved_cs_client */;
4415 -- Table structure for table `oauth_access_tokens`
4418 DROP TABLE IF EXISTS `oauth_access_tokens`;
4419 /*!40101 SET @saved_cs_client = @@character_set_client */;
4420 /*!40101 SET character_set_client = utf8 */;
4421 CREATE TABLE `oauth_access_tokens` (
4422 `access_token` varchar(191) NOT NULL COMMENT 'generarated access token',
4423 `client_id` varchar(191) NOT NULL COMMENT 'the client id the access token belongs to',
4424 `expires` int(11) NOT NULL COMMENT 'expiration time in seconds',
4425 PRIMARY KEY (`access_token`)
4426 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4427 /*!40101 SET character_set_client = @saved_cs_client */;
4430 -- Table structure for table `old_issues`
4433 DROP TABLE IF EXISTS `old_issues`;
4434 /*!40101 SET @saved_cs_client = @@character_set_client */;
4435 /*!40101 SET character_set_client = utf8 */;
4436 CREATE TABLE `old_issues` (
4437 `issue_id` int(11) NOT NULL COMMENT 'primary key for issues table',
4438 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
4439 `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
4440 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
4441 `date_due` datetime DEFAULT NULL COMMENT 'date the item is due (yyyy-mm-dd)',
4442 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
4443 `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned',
4444 `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
4445 `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
4446 `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
4447 `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
4448 `auto_renew_error` varchar(32) DEFAULT NULL COMMENT 'automatic renewal error',
4449 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
4450 `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
4451 `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
4452 `note` longtext DEFAULT NULL COMMENT 'issue note text',
4453 `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
4454 `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
4455 PRIMARY KEY (`issue_id`),
4456 KEY `old_issuesborridx` (`borrowernumber`),
4457 KEY `old_issuesitemidx` (`itemnumber`),
4458 KEY `branchcode_idx` (`branchcode`),
4459 KEY `old_bordate` (`borrowernumber`,`timestamp`),
4460 KEY `old_issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
4461 CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4462 CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4463 CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
4464 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4465 /*!40101 SET character_set_client = @saved_cs_client */;
4468 -- Table structure for table `old_reserves`
4471 DROP TABLE IF EXISTS `old_reserves`;
4472 /*!40101 SET @saved_cs_client = @@character_set_client */;
4473 /*!40101 SET character_set_client = utf8 */;
4474 CREATE TABLE `old_reserves` (
4475 `reserve_id` int(11) NOT NULL COMMENT 'primary key',
4476 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4477 `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places',
4478 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4479 `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
4480 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
4481 `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4482 `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4483 `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4484 `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4485 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4486 `reservenotes` longtext DEFAULT NULL COMMENT 'notes related to this hold',
4487 `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4488 `found` varchar(1) DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
4489 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4490 `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',
4491 `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4492 `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)',
4493 `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',
4494 `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)',
4495 `suspend` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'in this hold suspended (1 for yes, 0 for no)',
4496 `suspend_until` datetime DEFAULT NULL COMMENT 'the date this hold is suspended until (NULL for infinitely)',
4497 `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4498 `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
4499 `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4500 PRIMARY KEY (`reserve_id`),
4501 KEY `old_reserves_borrowernumber` (`borrowernumber`),
4502 KEY `old_reserves_biblionumber` (`biblionumber`),
4503 KEY `old_reserves_itemnumber` (`itemnumber`),
4504 KEY `old_reserves_branchcode` (`branchcode`),
4505 KEY `old_reserves_itemtype` (`itemtype`),
4506 KEY `old_reserves_ibfk_ig` (`item_group_id`),
4507 CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4508 CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4509 CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4510 CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
4511 CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
4512 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4513 /*!40101 SET character_set_client = @saved_cs_client */;
4516 -- Table structure for table `overduerules`
4519 DROP TABLE IF EXISTS `overduerules`;
4520 /*!40101 SET @saved_cs_client = @@character_set_client */;
4521 /*!40101 SET character_set_client = utf8 */;
4522 CREATE TABLE `overduerules` (
4523 `overduerules_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the overduerules',
4524 `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)',
4525 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table to define which patron category this rule is for',
4526 `delay1` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the first notice is sent',
4527 `letter1` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the first notice',
4528 `debarred1` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the first notice is sent (1 for yes, 0 for no)',
4529 `delay2` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the second notice is sent',
4530 `debarred2` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the second notice is sent (1 for yes, 0 for no)',
4531 `letter2` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the second notice',
4532 `delay3` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the third notice is sent',
4533 `letter3` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the third notice',
4534 `debarred3` int(1) DEFAULT 0 COMMENT 'is the patron restricted when the third notice is sent (1 for yes, 0 for no)',
4535 PRIMARY KEY (`overduerules_id`),
4536 UNIQUE KEY `overduerules_branch_cat` (`branchcode`,`categorycode`)
4537 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4538 /*!40101 SET character_set_client = @saved_cs_client */;
4541 -- Table structure for table `overduerules_transport_types`
4544 DROP TABLE IF EXISTS `overduerules_transport_types`;
4545 /*!40101 SET @saved_cs_client = @@character_set_client */;
4546 /*!40101 SET character_set_client = utf8 */;
4547 CREATE TABLE `overduerules_transport_types` (
4548 `id` int(11) NOT NULL AUTO_INCREMENT,
4549 `letternumber` int(1) NOT NULL DEFAULT 1,
4550 `message_transport_type` varchar(20) NOT NULL DEFAULT 'email',
4551 `overduerules_id` int(11) NOT NULL,
4553 KEY `overduerules_fk` (`overduerules_id`),
4554 KEY `mtt_fk` (`message_transport_type`),
4555 CONSTRAINT `mtt_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
4556 CONSTRAINT `overduerules_fk` FOREIGN KEY (`overduerules_id`) REFERENCES `overduerules` (`overduerules_id`) ON DELETE CASCADE ON UPDATE CASCADE
4557 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4558 /*!40101 SET character_set_client = @saved_cs_client */;
4561 -- Table structure for table `patron_consent`
4564 DROP TABLE IF EXISTS `patron_consent`;
4565 /*!40101 SET @saved_cs_client = @@character_set_client */;
4566 /*!40101 SET character_set_client = utf8 */;
4567 CREATE TABLE `patron_consent` (
4568 `id` int(11) NOT NULL AUTO_INCREMENT,
4569 `borrowernumber` int(11) NOT NULL,
4570 `type` enum('GDPR_PROCESSING') DEFAULT NULL COMMENT 'allows for future extension',
4571 `given_on` datetime DEFAULT NULL,
4572 `refused_on` datetime DEFAULT NULL,
4574 KEY `borrowernumber` (`borrowernumber`),
4575 CONSTRAINT `patron_consent_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4576 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4577 /*!40101 SET character_set_client = @saved_cs_client */;
4580 -- Table structure for table `patron_list_patrons`
4583 DROP TABLE IF EXISTS `patron_list_patrons`;
4584 /*!40101 SET @saved_cs_client = @@character_set_client */;
4585 /*!40101 SET character_set_client = utf8 */;
4586 CREATE TABLE `patron_list_patrons` (
4587 `patron_list_patron_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
4588 `patron_list_id` int(11) NOT NULL COMMENT 'the list this entry is part of',
4589 `borrowernumber` int(11) NOT NULL COMMENT 'the borrower that is part of this list',
4590 PRIMARY KEY (`patron_list_patron_id`),
4591 KEY `patron_list_id` (`patron_list_id`),
4592 KEY `borrowernumber` (`borrowernumber`),
4593 CONSTRAINT `patron_list_patrons_ibfk_1` FOREIGN KEY (`patron_list_id`) REFERENCES `patron_lists` (`patron_list_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4594 CONSTRAINT `patron_list_patrons_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4595 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4596 /*!40101 SET character_set_client = @saved_cs_client */;
4599 -- Table structure for table `patron_lists`
4602 DROP TABLE IF EXISTS `patron_lists`;
4603 /*!40101 SET @saved_cs_client = @@character_set_client */;
4604 /*!40101 SET character_set_client = utf8 */;
4605 CREATE TABLE `patron_lists` (
4606 `patron_list_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
4607 `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'the list''s name',
4608 `owner` int(11) NOT NULL COMMENT 'borrowernumber of the list creator',
4609 `shared` tinyint(1) DEFAULT 0,
4610 PRIMARY KEY (`patron_list_id`),
4611 KEY `owner` (`owner`),
4612 CONSTRAINT `patron_lists_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4613 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4614 /*!40101 SET character_set_client = @saved_cs_client */;
4617 -- Table structure for table `patronimage`
4620 DROP TABLE IF EXISTS `patronimage`;
4621 /*!40101 SET @saved_cs_client = @@character_set_client */;
4622 /*!40101 SET character_set_client = utf8 */;
4623 CREATE TABLE `patronimage` (
4624 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron this image is attached to (borrowers.borrowernumber)',
4625 `mimetype` varchar(15) NOT NULL COMMENT 'the format of the image (png, jpg, etc)',
4626 `imagefile` mediumblob NOT NULL COMMENT 'the image',
4627 PRIMARY KEY (`borrowernumber`),
4628 CONSTRAINT `patronimage_fk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4629 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4630 /*!40101 SET character_set_client = @saved_cs_client */;
4633 -- Table structure for table `pending_offline_operations`
4636 DROP TABLE IF EXISTS `pending_offline_operations`;
4637 /*!40101 SET @saved_cs_client = @@character_set_client */;
4638 /*!40101 SET character_set_client = utf8 */;
4639 CREATE TABLE `pending_offline_operations` (
4640 `operationid` int(11) NOT NULL AUTO_INCREMENT,
4641 `userid` varchar(30) NOT NULL,
4642 `branchcode` varchar(10) NOT NULL,
4643 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
4644 `action` varchar(10) NOT NULL,
4645 `barcode` varchar(20) DEFAULT NULL,
4646 `cardnumber` varchar(32) DEFAULT NULL,
4647 `amount` decimal(28,6) DEFAULT NULL,
4648 PRIMARY KEY (`operationid`)
4649 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4650 /*!40101 SET character_set_client = @saved_cs_client */;
4653 -- Table structure for table `permissions`
4656 DROP TABLE IF EXISTS `permissions`;
4657 /*!40101 SET @saved_cs_client = @@character_set_client */;
4658 /*!40101 SET character_set_client = utf8 */;
4659 CREATE TABLE `permissions` (
4660 `module_bit` int(11) NOT NULL DEFAULT 0,
4661 `code` varchar(64) NOT NULL DEFAULT '',
4662 `description` varchar(255) DEFAULT NULL,
4663 PRIMARY KEY (`module_bit`,`code`),
4664 CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`) ON DELETE CASCADE ON UPDATE CASCADE
4665 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4666 /*!40101 SET character_set_client = @saved_cs_client */;
4669 -- Table structure for table `plugin_data`
4672 DROP TABLE IF EXISTS `plugin_data`;
4673 /*!40101 SET @saved_cs_client = @@character_set_client */;
4674 /*!40101 SET character_set_client = utf8 */;
4675 CREATE TABLE `plugin_data` (
4676 `plugin_class` varchar(255) NOT NULL,
4677 `plugin_key` varchar(255) NOT NULL,
4678 `plugin_value` mediumtext DEFAULT NULL,
4679 PRIMARY KEY (`plugin_class`(191),`plugin_key`(191))
4680 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4681 /*!40101 SET character_set_client = @saved_cs_client */;
4684 -- Table structure for table `plugin_methods`
4687 DROP TABLE IF EXISTS `plugin_methods`;
4688 /*!40101 SET @saved_cs_client = @@character_set_client */;
4689 /*!40101 SET character_set_client = utf8 */;
4690 CREATE TABLE `plugin_methods` (
4691 `plugin_class` varchar(255) NOT NULL,
4692 `plugin_method` varchar(255) NOT NULL,
4693 PRIMARY KEY (`plugin_class`(191),`plugin_method`(191))
4694 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4695 /*!40101 SET character_set_client = @saved_cs_client */;
4698 -- Table structure for table `printers_profile`
4701 DROP TABLE IF EXISTS `printers_profile`;
4702 /*!40101 SET @saved_cs_client = @@character_set_client */;
4703 /*!40101 SET character_set_client = utf8 */;
4704 CREATE TABLE `printers_profile` (
4705 `profile_id` int(4) NOT NULL AUTO_INCREMENT,
4706 `printer_name` varchar(40) NOT NULL DEFAULT 'Default Printer',
4707 `template_id` int(4) NOT NULL DEFAULT 0,
4708 `paper_bin` varchar(20) NOT NULL DEFAULT 'Bypass',
4709 `offset_horz` float NOT NULL DEFAULT 0,
4710 `offset_vert` float NOT NULL DEFAULT 0,
4711 `creep_horz` float NOT NULL DEFAULT 0,
4712 `creep_vert` float NOT NULL DEFAULT 0,
4713 `units` char(20) NOT NULL DEFAULT 'POINT',
4714 `creator` char(15) NOT NULL DEFAULT 'Labels',
4715 PRIMARY KEY (`profile_id`),
4716 UNIQUE KEY `printername` (`printer_name`,`template_id`,`paper_bin`,`creator`)
4717 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4718 /*!40101 SET character_set_client = @saved_cs_client */;
4721 -- Table structure for table `problem_reports`
4724 DROP TABLE IF EXISTS `problem_reports`;
4725 /*!40101 SET @saved_cs_client = @@character_set_client */;
4726 /*!40101 SET character_set_client = utf8 */;
4727 CREATE TABLE `problem_reports` (
4728 `reportid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4729 `title` varchar(40) NOT NULL DEFAULT '' COMMENT 'report subject line',
4730 `content` text NOT NULL COMMENT 'report message content',
4731 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the user who created the problem report',
4732 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'borrower''s branch',
4733 `username` varchar(75) DEFAULT NULL COMMENT 'OPAC username',
4734 `problempage` text DEFAULT NULL COMMENT 'page the user triggered the problem report form from',
4735 `recipient` enum('admin','library') NOT NULL DEFAULT 'library' COMMENT 'the ''to-address'' of the problem report',
4736 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'timestamp of report submission',
4737 `status` varchar(6) NOT NULL DEFAULT 'New' COMMENT 'status of the report. New, Viewed, Closed',
4738 PRIMARY KEY (`reportid`),
4739 KEY `problem_reports_ibfk1` (`borrowernumber`),
4740 KEY `problem_reports_ibfk2` (`branchcode`),
4741 CONSTRAINT `problem_reports_ibfk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4742 CONSTRAINT `problem_reports_ibfk2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4743 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4744 /*!40101 SET character_set_client = @saved_cs_client */;
4747 -- Table structure for table `pseudonymized_borrower_attributes`
4750 DROP TABLE IF EXISTS `pseudonymized_borrower_attributes`;
4751 /*!40101 SET @saved_cs_client = @@character_set_client */;
4752 /*!40101 SET character_set_client = utf8 */;
4753 CREATE TABLE `pseudonymized_borrower_attributes` (
4754 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
4755 `transaction_id` int(11) NOT NULL,
4756 `code` varchar(10) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
4757 `attribute` varchar(255) DEFAULT NULL COMMENT 'custom patron field value',
4759 KEY `pseudonymized_borrower_attributes_ibfk_1` (`transaction_id`),
4760 KEY `anonymized_borrower_attributes_ibfk_2` (`code`),
4761 CONSTRAINT `anonymized_borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
4762 CONSTRAINT `pseudonymized_borrower_attributes_ibfk_1` FOREIGN KEY (`transaction_id`) REFERENCES `pseudonymized_transactions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4763 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4764 /*!40101 SET character_set_client = @saved_cs_client */;
4767 -- Table structure for table `pseudonymized_transactions`
4770 DROP TABLE IF EXISTS `pseudonymized_transactions`;
4771 /*!40101 SET @saved_cs_client = @@character_set_client */;
4772 /*!40101 SET character_set_client = utf8 */;
4773 CREATE TABLE `pseudonymized_transactions` (
4774 `id` int(11) NOT NULL AUTO_INCREMENT,
4775 `hashed_borrowernumber` varchar(60) NOT NULL,
4776 `has_cardnumber` tinyint(1) NOT NULL DEFAULT 0,
4777 `title` longtext DEFAULT NULL,
4778 `city` longtext DEFAULT NULL,
4779 `state` mediumtext DEFAULT NULL,
4780 `zipcode` varchar(25) DEFAULT NULL,
4781 `country` mediumtext DEFAULT NULL,
4782 `branchcode` varchar(10) NOT NULL DEFAULT '',
4783 `categorycode` varchar(10) NOT NULL DEFAULT '',
4784 `dateenrolled` date DEFAULT NULL,
4785 `sex` varchar(1) DEFAULT NULL,
4786 `sort1` varchar(80) DEFAULT NULL,
4787 `sort2` varchar(80) DEFAULT NULL,
4788 `datetime` datetime DEFAULT NULL,
4789 `transaction_branchcode` varchar(10) DEFAULT NULL,
4790 `transaction_type` varchar(16) DEFAULT NULL,
4791 `itemnumber` int(11) DEFAULT NULL,
4792 `itemtype` varchar(10) DEFAULT NULL,
4793 `holdingbranch` varchar(10) DEFAULT NULL,
4794 `homebranch` varchar(10) DEFAULT NULL,
4795 `location` varchar(80) DEFAULT NULL,
4796 `itemcallnumber` varchar(255) DEFAULT NULL,
4797 `ccode` varchar(80) DEFAULT NULL,
4799 KEY `pseudonymized_transactions_ibfk_1` (`categorycode`),
4800 KEY `pseudonymized_transactions_borrowers_ibfk_2` (`branchcode`),
4801 KEY `pseudonymized_transactions_borrowers_ibfk_3` (`transaction_branchcode`)
4802 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4803 /*!40101 SET character_set_client = @saved_cs_client */;
4806 -- Table structure for table `quotes`
4809 DROP TABLE IF EXISTS `quotes`;
4810 /*!40101 SET @saved_cs_client = @@character_set_client */;
4811 /*!40101 SET character_set_client = utf8 */;
4812 CREATE TABLE `quotes` (
4813 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the quote',
4814 `source` mediumtext DEFAULT NULL COMMENT 'source/credit for the quote',
4815 `text` longtext NOT NULL COMMENT 'text of the quote',
4816 `timestamp` datetime DEFAULT NULL COMMENT 'date and time that the quote last appeared in the opac',
4818 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4819 /*!40101 SET character_set_client = @saved_cs_client */;
4822 -- Table structure for table `ratings`
4825 DROP TABLE IF EXISTS `ratings`;
4826 /*!40101 SET @saved_cs_client = @@character_set_client */;
4827 /*!40101 SET character_set_client = utf8 */;
4828 CREATE TABLE `ratings` (
4829 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron who left this rating (borrowers.borrowernumber)',
4830 `biblionumber` int(11) NOT NULL COMMENT 'the biblio this rating is for (biblio.biblionumber)',
4831 `rating_value` tinyint(1) NOT NULL COMMENT 'the rating, from 1 to 5',
4832 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
4833 PRIMARY KEY (`borrowernumber`,`biblionumber`),
4834 KEY `ratings_ibfk_2` (`biblionumber`),
4835 CONSTRAINT `ratings_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4836 CONSTRAINT `ratings_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
4837 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4838 /*!40101 SET character_set_client = @saved_cs_client */;
4841 -- Table structure for table `recalls`
4844 DROP TABLE IF EXISTS `recalls`;
4845 /*!40101 SET @saved_cs_client = @@character_set_client */;
4846 /*!40101 SET character_set_client = utf8 */;
4847 CREATE TABLE `recalls` (
4848 `recall_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier for this recall',
4849 `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Identifier for patron who requested recall',
4850 `created_date` datetime DEFAULT NULL COMMENT 'Date the recall was requested',
4851 `biblio_id` int(11) NOT NULL COMMENT 'Identifier for bibliographic record that has been recalled',
4852 `pickup_library_id` varchar(10) DEFAULT NULL COMMENT 'Identifier for recall pickup library',
4853 `completed_date` datetime DEFAULT NULL COMMENT 'Date the recall is completed (fulfilled, cancelled or expired)',
4854 `notes` mediumtext DEFAULT NULL COMMENT 'Notes related to the recall',
4855 `priority` smallint(6) DEFAULT NULL COMMENT 'Where in the queue the patron sits',
4856 `status` enum('requested','overdue','waiting','in_transit','cancelled','expired','fulfilled') DEFAULT 'requested' COMMENT 'Status of recall',
4857 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time the recall was last updated',
4858 `item_id` int(11) DEFAULT NULL COMMENT 'Identifier for item record that was recalled, if an item-level recall',
4859 `waiting_date` datetime DEFAULT NULL COMMENT 'Date an item was marked as waiting for the patron at the library',
4860 `expiration_date` datetime DEFAULT NULL COMMENT 'Date recall is no longer required, or date recall will expire after waiting on shelf for pickup',
4861 `completed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is old and no longer active, i.e. expired, cancelled or completed',
4862 `item_level` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is for a specific item',
4863 PRIMARY KEY (`recall_id`),
4864 KEY `recalls_ibfk_1` (`patron_id`),
4865 KEY `recalls_ibfk_2` (`biblio_id`),
4866 KEY `recalls_ibfk_3` (`item_id`),
4867 KEY `recalls_ibfk_4` (`pickup_library_id`),
4868 CONSTRAINT `recalls_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4869 CONSTRAINT `recalls_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4870 CONSTRAINT `recalls_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4871 CONSTRAINT `recalls_ibfk_4` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4872 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Information related to recalls in Koha';
4873 /*!40101 SET character_set_client = @saved_cs_client */;
4876 -- Table structure for table `repeatable_holidays`
4879 DROP TABLE IF EXISTS `repeatable_holidays`;
4880 /*!40101 SET @saved_cs_client = @@character_set_client */;
4881 /*!40101 SET character_set_client = utf8 */;
4882 CREATE TABLE `repeatable_holidays` (
4883 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4884 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
4885 `weekday` smallint(6) DEFAULT NULL COMMENT 'day of the week (0=Sunday, 1=Monday, etc) this closing is repeated on',
4886 `day` smallint(6) DEFAULT NULL COMMENT 'day of the month this closing is on',
4887 `month` smallint(6) DEFAULT NULL COMMENT 'month this closing is in',
4888 `title` varchar(50) NOT NULL DEFAULT '' COMMENT 'title of this closing',
4889 `description` mediumtext NOT NULL COMMENT 'description for this closing',
4891 KEY `repeatable_holidays_ibfk_1` (`branchcode`),
4892 CONSTRAINT `repeatable_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4893 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4894 /*!40101 SET character_set_client = @saved_cs_client */;
4897 -- Table structure for table `reports_dictionary`
4900 DROP TABLE IF EXISTS `reports_dictionary`;
4901 /*!40101 SET @saved_cs_client = @@character_set_client */;
4902 /*!40101 SET character_set_client = utf8 */;
4903 CREATE TABLE `reports_dictionary` (
4904 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4905 `name` varchar(255) DEFAULT NULL COMMENT 'name for this definition',
4906 `description` mediumtext DEFAULT NULL COMMENT 'description for this definition',
4907 `date_created` datetime DEFAULT NULL COMMENT 'date and time this definition was created',
4908 `date_modified` datetime DEFAULT NULL COMMENT 'date and time this definition was last modified',
4909 `saved_sql` mediumtext DEFAULT NULL COMMENT 'SQL snippet for us in reports',
4910 `report_area` varchar(6) DEFAULT NULL COMMENT 'Koha module this definition is for Circulation, Catalog, Patrons, Acquistions, Accounts)',
4912 KEY `dictionary_area_idx` (`report_area`)
4913 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4914 /*!40101 SET character_set_client = @saved_cs_client */;
4917 -- Table structure for table `reserves`
4920 DROP TABLE IF EXISTS `reserves`;
4921 /*!40101 SET @saved_cs_client = @@character_set_client */;
4922 /*!40101 SET character_set_client = utf8 */;
4923 CREATE TABLE `reserves` (
4924 `reserve_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4925 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4926 `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
4927 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4928 `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
4929 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
4930 `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4931 `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4932 `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4933 `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4934 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4935 `reservenotes` longtext DEFAULT NULL COMMENT 'notes related to this hold',
4936 `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4937 `found` varchar(1) DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
4938 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4939 `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',
4940 `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4941 `expirationdate` date DEFAULT NULL COMMENT 'the date the hold expires (calculated value)',
4942 `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',
4943 `lowestPriority` tinyint(1) NOT NULL DEFAULT 0,
4944 `suspend` tinyint(1) NOT NULL DEFAULT 0,
4945 `suspend_until` datetime DEFAULT NULL,
4946 `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4947 `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
4948 `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4949 PRIMARY KEY (`reserve_id`),
4950 KEY `priorityfoundidx` (`priority`,`found`),
4951 KEY `borrowernumber` (`borrowernumber`),
4952 KEY `biblionumber` (`biblionumber`),
4953 KEY `itemnumber` (`itemnumber`),
4954 KEY `branchcode` (`branchcode`),
4955 KEY `desk_id` (`desk_id`),
4956 KEY `itemtype` (`itemtype`),
4957 KEY `reserves_ibfk_ig` (`item_group_id`),
4958 CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4959 CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4960 CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4961 CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4962 CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4963 CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE,
4964 CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE
4965 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4966 /*!40101 SET character_set_client = @saved_cs_client */;
4969 -- Table structure for table `restriction_types`
4972 DROP TABLE IF EXISTS `restriction_types`;
4973 /*!40101 SET @saved_cs_client = @@character_set_client */;
4974 /*!40101 SET character_set_client = utf8 */;
4975 CREATE TABLE `restriction_types` (
4976 `code` varchar(50) NOT NULL,
4977 `display_text` text NOT NULL,
4978 `is_system` tinyint(1) NOT NULL DEFAULT 0,
4979 `is_default` tinyint(1) NOT NULL DEFAULT 0,
4980 PRIMARY KEY (`code`)
4981 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4982 /*!40101 SET character_set_client = @saved_cs_client */;
4985 -- Table structure for table `return_claims`
4988 DROP TABLE IF EXISTS `return_claims`;
4989 /*!40101 SET @saved_cs_client = @@character_set_client */;
4990 /*!40101 SET character_set_client = utf8 */;
4991 CREATE TABLE `return_claims` (
4992 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the return claim',
4993 `itemnumber` int(11) NOT NULL COMMENT 'ID of the item',
4994 `issue_id` int(11) DEFAULT NULL COMMENT 'ID of the checkout that triggered the claim',
4995 `borrowernumber` int(11) NOT NULL COMMENT 'ID of the patron',
4996 `notes` mediumtext DEFAULT NULL COMMENT 'Notes about the claim',
4997 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was created',
4998 `created_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that registered the claim',
4999 `updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the claim (notes)',
5000 `updated_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that updated the claim',
5001 `resolution` varchar(80) DEFAULT NULL COMMENT 'Resolution code (RETURN_CLAIM_RESOLUTION AVs)',
5002 `resolved_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was resolved',
5003 `resolved_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that resolved the claim',
5005 UNIQUE KEY `item_issue` (`itemnumber`,`issue_id`),
5006 KEY `itemnumber` (`itemnumber`),
5007 KEY `rc_borrowers_ibfk` (`borrowernumber`),
5008 KEY `rc_created_by_ibfk` (`created_by`),
5009 KEY `rc_updated_by_ibfk` (`updated_by`),
5010 KEY `rc_resolved_by_ibfk` (`resolved_by`),
5011 CONSTRAINT `rc_borrowers_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5012 CONSTRAINT `rc_created_by_ibfk` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5013 CONSTRAINT `rc_items_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5014 CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5015 CONSTRAINT `rc_updated_by_ibfk` FOREIGN KEY (`updated_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5016 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5017 /*!40101 SET character_set_client = @saved_cs_client */;
5020 -- Table structure for table `reviews`
5023 DROP TABLE IF EXISTS `reviews`;
5024 /*!40101 SET @saved_cs_client = @@character_set_client */;
5025 /*!40101 SET character_set_client = utf8 */;
5026 CREATE TABLE `reviews` (
5027 `reviewid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for this comment',
5028 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron left this comment',
5029 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bibliographic record this comment is for',
5030 `review` mediumtext DEFAULT NULL COMMENT 'the body of the comment',
5031 `approved` tinyint(4) DEFAULT 0 COMMENT 'whether this comment has been approved by a librarian (1 for yes, 0 for no)',
5032 `datereviewed` datetime DEFAULT NULL COMMENT 'the date the comment was left',
5033 PRIMARY KEY (`reviewid`),
5034 KEY `reviews_ibfk_1` (`borrowernumber`),
5035 KEY `reviews_ibfk_2` (`biblionumber`),
5036 CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5037 CONSTRAINT `reviews_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5038 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5039 /*!40101 SET character_set_client = @saved_cs_client */;
5042 -- Table structure for table `saved_reports`
5045 DROP TABLE IF EXISTS `saved_reports`;
5046 /*!40101 SET @saved_cs_client = @@character_set_client */;
5047 /*!40101 SET character_set_client = utf8 */;
5048 CREATE TABLE `saved_reports` (
5049 `id` int(11) NOT NULL AUTO_INCREMENT,
5050 `report_id` int(11) DEFAULT NULL,
5051 `report` longtext DEFAULT NULL,
5052 `date_run` datetime DEFAULT NULL,
5054 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5055 /*!40101 SET character_set_client = @saved_cs_client */;
5058 -- Table structure for table `saved_sql`
5061 DROP TABLE IF EXISTS `saved_sql`;
5062 /*!40101 SET @saved_cs_client = @@character_set_client */;
5063 /*!40101 SET character_set_client = utf8 */;
5064 CREATE TABLE `saved_sql` (
5065 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key assigned by Koha',
5066 `borrowernumber` int(11) DEFAULT NULL COMMENT 'the staff member who created this report (borrowers.borrowernumber)',
5067 `date_created` datetime DEFAULT NULL COMMENT 'the date this report was created',
5068 `last_modified` datetime DEFAULT NULL COMMENT 'the date this report was last edited',
5069 `savedsql` mediumtext DEFAULT NULL COMMENT 'the SQL for this report',
5070 `last_run` datetime DEFAULT NULL,
5071 `report_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'the name of this report',
5072 `type` varchar(255) DEFAULT NULL COMMENT 'always 1 for tabular',
5073 `notes` mediumtext DEFAULT NULL COMMENT 'the notes or description given to this report',
5074 `cache_expiry` int(11) NOT NULL DEFAULT 300,
5075 `public` tinyint(1) NOT NULL DEFAULT 0,
5076 `report_area` varchar(6) DEFAULT NULL,
5077 `report_group` varchar(80) DEFAULT NULL,
5078 `report_subgroup` varchar(80) DEFAULT NULL,
5079 `mana_id` int(11) DEFAULT NULL,
5081 KEY `sql_area_group_idx` (`report_group`,`report_subgroup`),
5082 KEY `boridx` (`borrowernumber`)
5083 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5084 /*!40101 SET character_set_client = @saved_cs_client */;
5087 -- Table structure for table `search_field`
5090 DROP TABLE IF EXISTS `search_field`;
5091 /*!40101 SET @saved_cs_client = @@character_set_client */;
5092 /*!40101 SET character_set_client = utf8 */;
5093 CREATE TABLE `search_field` (
5094 `id` int(11) NOT NULL AUTO_INCREMENT,
5095 `name` varchar(255) NOT NULL COMMENT 'the name of the field as it will be stored in the search engine',
5096 `label` varchar(255) NOT NULL COMMENT 'the human readable name of the field, for display',
5097 `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',
5098 `weight` decimal(5,2) DEFAULT NULL,
5099 `facet_order` tinyint(4) DEFAULT NULL COMMENT 'the order place of the field in facet list if faceted',
5100 `staff_client` tinyint(1) NOT NULL DEFAULT 1,
5101 `opac` tinyint(1) NOT NULL DEFAULT 1,
5102 `mandatory` tinyint(1) DEFAULT NULL COMMENT 'if marked this field is not editable or removable',
5104 UNIQUE KEY `name` (`name`(191))
5105 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5106 /*!40101 SET character_set_client = @saved_cs_client */;
5109 -- Table structure for table `search_filters`
5112 DROP TABLE IF EXISTS `search_filters`;
5113 /*!40101 SET @saved_cs_client = @@character_set_client */;
5114 /*!40101 SET character_set_client = utf8 */;
5115 CREATE TABLE `search_filters` (
5116 `search_filter_id` int(11) NOT NULL AUTO_INCREMENT,
5117 `name` varchar(255) NOT NULL COMMENT 'filter name',
5118 `query` mediumtext DEFAULT NULL COMMENT 'filter query part',
5119 `limits` mediumtext DEFAULT NULL COMMENT 'filter limits part',
5120 `opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown on OPAC',
5121 `staff_client` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown in staff client',
5122 PRIMARY KEY (`search_filter_id`)
5123 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5124 /*!40101 SET character_set_client = @saved_cs_client */;
5127 -- Table structure for table `search_history`
5130 DROP TABLE IF EXISTS `search_history`;
5131 /*!40101 SET @saved_cs_client = @@character_set_client */;
5132 /*!40101 SET character_set_client = utf8 */;
5133 CREATE TABLE `search_history` (
5134 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'search history id',
5135 `userid` int(11) NOT NULL COMMENT 'the patron who performed the search (borrowers.borrowernumber)',
5136 `sessionid` varchar(32) NOT NULL COMMENT 'a system generated session id',
5137 `query_desc` varchar(255) NOT NULL COMMENT 'the search that was performed',
5138 `query_cgi` mediumtext NOT NULL COMMENT 'the string to append to the search url to rerun the search',
5139 `type` varchar(16) NOT NULL DEFAULT 'biblio' COMMENT 'search type, must be ''biblio'' or ''authority''',
5140 `total` int(11) NOT NULL COMMENT 'the total of results found',
5141 `time` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the search was run',
5143 KEY `userid` (`userid`),
5144 KEY `sessionid` (`sessionid`)
5145 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Opac search history results';
5146 /*!40101 SET character_set_client = @saved_cs_client */;
5149 -- Table structure for table `search_marc_map`
5152 DROP TABLE IF EXISTS `search_marc_map`;
5153 /*!40101 SET @saved_cs_client = @@character_set_client */;
5154 /*!40101 SET character_set_client = utf8 */;
5155 CREATE TABLE `search_marc_map` (
5156 `id` int(11) NOT NULL AUTO_INCREMENT,
5157 `index_name` enum('biblios','authorities') NOT NULL COMMENT 'what storage index this map is for',
5158 `marc_type` enum('marc21','unimarc') NOT NULL COMMENT 'what MARC type this map is for',
5159 `marc_field` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the MARC specifier for this field',
5161 UNIQUE KEY `index_name` (`index_name`,`marc_field`(191),`marc_type`),
5162 KEY `index_name_2` (`index_name`)
5163 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5164 /*!40101 SET character_set_client = @saved_cs_client */;
5167 -- Table structure for table `search_marc_to_field`
5170 DROP TABLE IF EXISTS `search_marc_to_field`;
5171 /*!40101 SET @saved_cs_client = @@character_set_client */;
5172 /*!40101 SET character_set_client = utf8 */;
5173 CREATE TABLE `search_marc_to_field` (
5174 `search` tinyint(1) NOT NULL DEFAULT 1,
5175 `search_marc_map_id` int(11) NOT NULL,
5176 `search_field_id` int(11) NOT NULL,
5177 `facet` tinyint(1) DEFAULT 0 COMMENT 'true if a facet field should be generated for this',
5178 `suggestible` tinyint(1) DEFAULT 0 COMMENT 'true if this field can be used to generate suggestions for browse',
5179 `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',
5180 PRIMARY KEY (`search_marc_map_id`,`search_field_id`),
5181 KEY `search_field_id` (`search_field_id`),
5182 CONSTRAINT `search_marc_to_field_ibfk_1` FOREIGN KEY (`search_marc_map_id`) REFERENCES `search_marc_map` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
5183 CONSTRAINT `search_marc_to_field_ibfk_2` FOREIGN KEY (`search_field_id`) REFERENCES `search_field` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
5184 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5185 /*!40101 SET character_set_client = @saved_cs_client */;
5188 -- Table structure for table `serial`
5191 DROP TABLE IF EXISTS `serial`;
5192 /*!40101 SET @saved_cs_client = @@character_set_client */;
5193 /*!40101 SET character_set_client = utf8 */;
5194 CREATE TABLE `serial` (
5195 `serialid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the issue',
5196 `biblionumber` int(11) NOT NULL COMMENT 'foreign key for the biblio.biblionumber that this issue is attached to',
5197 `subscriptionid` int(11) NOT NULL COMMENT 'foreign key to the subscription.subscriptionid that this issue is part of',
5198 `serialseq` varchar(100) NOT NULL DEFAULT '' COMMENT 'issue information (volume, number, etc)',
5199 `serialseq_x` varchar(100) DEFAULT NULL COMMENT 'first part of issue information',
5200 `serialseq_y` varchar(100) DEFAULT NULL COMMENT 'second part of issue information',
5201 `serialseq_z` varchar(100) DEFAULT NULL COMMENT 'third part of issue information',
5202 `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'status code for this issue (see manual for full descriptions)',
5203 `planneddate` date DEFAULT NULL COMMENT 'date expected',
5204 `notes` mediumtext DEFAULT NULL COMMENT 'notes',
5205 `publisheddate` date DEFAULT NULL COMMENT 'date published',
5206 `publisheddatetext` varchar(100) DEFAULT NULL COMMENT 'date published (descriptive)',
5207 `claimdate` date DEFAULT NULL COMMENT 'date claimed',
5208 `claims_count` int(11) DEFAULT 0 COMMENT 'number of claims made related to this issue',
5209 `routingnotes` mediumtext DEFAULT NULL COMMENT 'notes from the routing list',
5210 PRIMARY KEY (`serialid`),
5211 KEY `serial_ibfk_1` (`biblionumber`),
5212 KEY `serial_ibfk_2` (`subscriptionid`),
5213 CONSTRAINT `serial_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5214 CONSTRAINT `serial_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5215 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5216 /*!40101 SET character_set_client = @saved_cs_client */;
5219 -- Table structure for table `serialitems`
5222 DROP TABLE IF EXISTS `serialitems`;
5223 /*!40101 SET @saved_cs_client = @@character_set_client */;
5224 /*!40101 SET character_set_client = utf8 */;
5225 CREATE TABLE `serialitems` (
5226 `itemnumber` int(11) NOT NULL,
5227 `serialid` int(11) NOT NULL,
5228 PRIMARY KEY (`itemnumber`),
5229 KEY `serialitems_sfk_1` (`serialid`),
5230 CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE,
5231 CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
5232 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5233 /*!40101 SET character_set_client = @saved_cs_client */;
5236 -- Table structure for table `sessions`
5239 DROP TABLE IF EXISTS `sessions`;
5240 /*!40101 SET @saved_cs_client = @@character_set_client */;
5241 /*!40101 SET character_set_client = utf8 */;
5242 CREATE TABLE `sessions` (
5243 `id` varchar(32) NOT NULL,
5244 `a_session` longblob NOT NULL,
5246 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5247 /*!40101 SET character_set_client = @saved_cs_client */;
5250 -- Table structure for table `sms_providers`
5253 DROP TABLE IF EXISTS `sms_providers`;
5254 /*!40101 SET @saved_cs_client = @@character_set_client */;
5255 /*!40101 SET character_set_client = utf8 */;
5256 CREATE TABLE `sms_providers` (
5257 `id` int(11) NOT NULL AUTO_INCREMENT,
5258 `name` varchar(255) NOT NULL,
5259 `domain` varchar(255) NOT NULL,
5261 UNIQUE KEY `name` (`name`(191))
5262 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5263 /*!40101 SET character_set_client = @saved_cs_client */;
5266 -- Table structure for table `smtp_servers`
5269 DROP TABLE IF EXISTS `smtp_servers`;
5270 /*!40101 SET @saved_cs_client = @@character_set_client */;
5271 /*!40101 SET character_set_client = utf8 */;
5272 CREATE TABLE `smtp_servers` (
5273 `id` int(11) NOT NULL AUTO_INCREMENT,
5274 `name` varchar(80) NOT NULL,
5275 `host` varchar(80) NOT NULL DEFAULT 'localhost',
5276 `port` int(11) NOT NULL DEFAULT 25,
5277 `timeout` int(11) NOT NULL DEFAULT 120,
5278 `ssl_mode` enum('disabled','ssl','starttls') NOT NULL,
5279 `user_name` varchar(80) DEFAULT NULL,
5280 `password` varchar(80) DEFAULT NULL,
5281 `debug` tinyint(1) NOT NULL DEFAULT 0,
5283 KEY `host_idx` (`host`)
5284 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5285 /*!40101 SET character_set_client = @saved_cs_client */;
5288 -- Table structure for table `social_data`
5291 DROP TABLE IF EXISTS `social_data`;
5292 /*!40101 SET @saved_cs_client = @@character_set_client */;
5293 /*!40101 SET character_set_client = utf8 */;
5294 CREATE TABLE `social_data` (
5295 `isbn` varchar(30) NOT NULL DEFAULT '',
5296 `num_critics` int(11) DEFAULT NULL,
5297 `num_critics_pro` int(11) DEFAULT NULL,
5298 `num_quotations` int(11) DEFAULT NULL,
5299 `num_videos` int(11) DEFAULT NULL,
5300 `score_avg` decimal(5,2) DEFAULT NULL,
5301 `num_scores` int(11) DEFAULT NULL,
5302 PRIMARY KEY (`isbn`)
5303 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5304 /*!40101 SET character_set_client = @saved_cs_client */;
5307 -- Table structure for table `special_holidays`
5310 DROP TABLE IF EXISTS `special_holidays`;
5311 /*!40101 SET @saved_cs_client = @@character_set_client */;
5312 /*!40101 SET character_set_client = utf8 */;
5313 CREATE TABLE `special_holidays` (
5314 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5315 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
5316 `day` smallint(6) NOT NULL DEFAULT 0 COMMENT 'day of the month this closing is on',
5317 `month` smallint(6) NOT NULL DEFAULT 0 COMMENT 'month this closing is in',
5318 `year` smallint(6) NOT NULL DEFAULT 0 COMMENT 'year this closing is in',
5319 `isexception` smallint(1) NOT NULL DEFAULT 1 COMMENT 'is this a holiday exception to a repeatable holiday (1 for yes, 0 for no)',
5320 `title` varchar(50) NOT NULL DEFAULT '' COMMENT 'title for this closing',
5321 `description` mediumtext NOT NULL COMMENT 'description of this closing',
5323 KEY `special_holidays_ibfk_1` (`branchcode`),
5324 CONSTRAINT `special_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5325 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5326 /*!40101 SET character_set_client = @saved_cs_client */;
5329 -- Table structure for table `statistics`
5332 DROP TABLE IF EXISTS `statistics`;
5333 /*!40101 SET @saved_cs_client = @@character_set_client */;
5334 /*!40101 SET character_set_client = utf8 */;
5335 CREATE TABLE `statistics` (
5336 `datetime` datetime DEFAULT NULL COMMENT 'date and time of the transaction',
5337 `branch` varchar(10) DEFAULT NULL COMMENT 'foreign key, branch where the transaction occurred',
5338 `value` double(16,4) DEFAULT NULL COMMENT 'monetary value associated with the transaction',
5339 `type` varchar(16) DEFAULT NULL COMMENT 'transaction type (localuse, issue, return, renew, writeoff, payment)',
5340 `other` longtext DEFAULT NULL COMMENT 'used by SIP',
5341 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific item',
5342 `itemtype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table, links transaction to a specific item type',
5343 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
5344 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower',
5345 `ccode` varchar(80) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific collection code',
5346 `categorycode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower category',
5347 KEY `timeidx` (`datetime`),
5348 KEY `branch_idx` (`branch`),
5349 KEY `type_idx` (`type`),
5350 KEY `itemnumber_idx` (`itemnumber`),
5351 KEY `itemtype_idx` (`itemtype`),
5352 KEY `borrowernumber_idx` (`borrowernumber`),
5353 KEY `ccode_idx` (`ccode`)
5354 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5355 /*!40101 SET character_set_client = @saved_cs_client */;
5358 -- Table structure for table `stockrotationitems`
5361 DROP TABLE IF EXISTS `stockrotationitems`;
5362 /*!40101 SET @saved_cs_client = @@character_set_client */;
5363 /*!40101 SET character_set_client = utf8 */;
5364 CREATE TABLE `stockrotationitems` (
5365 `itemnumber_id` int(11) NOT NULL COMMENT 'Itemnumber to link to a stage & rota',
5366 `stage_id` int(11) NOT NULL COMMENT 'stage ID to link the item to',
5367 `indemand` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should this item be skipped for rotation?',
5368 `fresh` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag showing item is only just added to rota',
5369 PRIMARY KEY (`itemnumber_id`),
5370 KEY `stockrotationitems_sifk` (`stage_id`),
5371 CONSTRAINT `stockrotationitems_iifk` FOREIGN KEY (`itemnumber_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5372 CONSTRAINT `stockrotationitems_sifk` FOREIGN KEY (`stage_id`) REFERENCES `stockrotationstages` (`stage_id`) ON DELETE CASCADE ON UPDATE CASCADE
5373 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5374 /*!40101 SET character_set_client = @saved_cs_client */;
5377 -- Table structure for table `stockrotationrotas`
5380 DROP TABLE IF EXISTS `stockrotationrotas`;
5381 /*!40101 SET @saved_cs_client = @@character_set_client */;
5382 /*!40101 SET character_set_client = utf8 */;
5383 CREATE TABLE `stockrotationrotas` (
5384 `rota_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Stockrotation rota ID',
5385 `title` varchar(100) NOT NULL COMMENT 'Title for this rota',
5386 `description` text NOT NULL COMMENT 'Description for this rota',
5387 `cyclical` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should items on this rota keep cycling?',
5388 `active` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this rota currently active?',
5389 PRIMARY KEY (`rota_id`),
5390 UNIQUE KEY `stockrotationrotas_title` (`title`)
5391 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5392 /*!40101 SET character_set_client = @saved_cs_client */;
5395 -- Table structure for table `stockrotationstages`
5398 DROP TABLE IF EXISTS `stockrotationstages`;
5399 /*!40101 SET @saved_cs_client = @@character_set_client */;
5400 /*!40101 SET character_set_client = utf8 */;
5401 CREATE TABLE `stockrotationstages` (
5402 `stage_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique stage ID',
5403 `position` int(11) NOT NULL COMMENT 'The position of this stage within its rota',
5404 `rota_id` int(11) NOT NULL COMMENT 'The rota this stage belongs to',
5405 `branchcode_id` varchar(10) NOT NULL COMMENT 'Branch this stage relates to',
5406 `duration` int(11) NOT NULL DEFAULT 4 COMMENT 'The number of days items shoud occupy this stage',
5407 PRIMARY KEY (`stage_id`),
5408 KEY `stockrotationstages_rifk` (`rota_id`),
5409 KEY `stockrotationstages_bifk` (`branchcode_id`),
5410 CONSTRAINT `stockrotationstages_bifk` FOREIGN KEY (`branchcode_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5411 CONSTRAINT `stockrotationstages_rifk` FOREIGN KEY (`rota_id`) REFERENCES `stockrotationrotas` (`rota_id`) ON DELETE CASCADE ON UPDATE CASCADE
5412 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5413 /*!40101 SET character_set_client = @saved_cs_client */;
5416 -- Table structure for table `subscription`
5419 DROP TABLE IF EXISTS `subscription`;
5420 /*!40101 SET @saved_cs_client = @@character_set_client */;
5421 /*!40101 SET character_set_client = utf8 */;
5422 CREATE TABLE `subscription` (
5423 `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
5424 `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
5425 `librarian` varchar(100) DEFAULT '' COMMENT 'the librarian''s username from borrowers.userid',
5426 `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
5427 `aqbooksellerid` int(11) DEFAULT 0 COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
5428 `cost` int(11) DEFAULT 0,
5429 `aqbudgetid` int(11) DEFAULT 0,
5430 `weeklength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or numberlength is set)',
5431 `monthlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if weeklength or numberlength is set)',
5432 `numberlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or weeklength is set)',
5433 `periodicity` int(11) DEFAULT NULL COMMENT 'frequency type links to subscription_frequencies.id',
5434 `countissuesperunit` int(11) NOT NULL DEFAULT 1,
5435 `notes` longtext DEFAULT NULL COMMENT 'notes',
5436 `status` varchar(100) NOT NULL DEFAULT '' COMMENT 'status of this subscription',
5437 `lastvalue1` int(11) DEFAULT NULL,
5438 `innerloop1` int(11) DEFAULT 0,
5439 `lastvalue2` int(11) DEFAULT NULL,
5440 `innerloop2` int(11) DEFAULT 0,
5441 `lastvalue3` int(11) DEFAULT NULL,
5442 `innerloop3` int(11) DEFAULT 0,
5443 `firstacquidate` date DEFAULT NULL COMMENT 'first issue received date',
5444 `manualhistory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes or no to managing the history manually',
5445 `irregularity` mediumtext DEFAULT NULL COMMENT 'any irregularities in the subscription',
5446 `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
5447 `letter` varchar(20) DEFAULT NULL,
5448 `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
5449 `locale` varchar(80) DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
5450 `distributedto` mediumtext DEFAULT NULL,
5451 `internalnotes` longtext DEFAULT NULL,
5452 `callnumber` mediumtext DEFAULT NULL COMMENT 'default call number',
5453 `location` varchar(80) DEFAULT '' COMMENT 'default shelving location (items.location)',
5454 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'default branches (items.homebranch)',
5455 `lastbranch` varchar(10) DEFAULT NULL,
5456 `serialsadditems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'does receiving this serial create an item record',
5457 `staffdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the staff',
5458 `opacdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the public',
5459 `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
5460 `enddate` date DEFAULT NULL COMMENT 'subscription end date',
5461 `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
5462 `reneweddate` date DEFAULT NULL COMMENT 'date of last renewal for the subscription',
5463 `itemtype` varchar(10) DEFAULT NULL,
5464 `previousitemtype` varchar(10) DEFAULT NULL,
5465 `mana_id` int(11) DEFAULT NULL,
5466 `ccode` varchar(80) DEFAULT NULL COMMENT 'collection code to assign to serial items',
5467 PRIMARY KEY (`subscriptionid`),
5468 KEY `subscription_ibfk_1` (`periodicity`),
5469 KEY `subscription_ibfk_2` (`numberpattern`),
5470 KEY `subscription_ibfk_3` (`biblionumber`),
5471 CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5472 CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5473 CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5474 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5475 /*!40101 SET character_set_client = @saved_cs_client */;
5478 -- Table structure for table `subscription_frequencies`
5481 DROP TABLE IF EXISTS `subscription_frequencies`;
5482 /*!40101 SET @saved_cs_client = @@character_set_client */;
5483 /*!40101 SET character_set_client = utf8 */;
5484 CREATE TABLE `subscription_frequencies` (
5485 `id` int(11) NOT NULL AUTO_INCREMENT,
5486 `description` mediumtext NOT NULL,
5487 `displayorder` int(11) DEFAULT NULL,
5488 `unit` enum('day','week','month','year') DEFAULT NULL,
5489 `unitsperissue` int(11) NOT NULL DEFAULT 1,
5490 `issuesperunit` int(11) NOT NULL DEFAULT 1,
5492 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5493 /*!40101 SET character_set_client = @saved_cs_client */;
5496 -- Table structure for table `subscription_numberpatterns`
5499 DROP TABLE IF EXISTS `subscription_numberpatterns`;
5500 /*!40101 SET @saved_cs_client = @@character_set_client */;
5501 /*!40101 SET character_set_client = utf8 */;
5502 CREATE TABLE `subscription_numberpatterns` (
5503 `id` int(11) NOT NULL AUTO_INCREMENT,
5504 `label` varchar(255) NOT NULL,
5505 `displayorder` int(11) DEFAULT NULL,
5506 `description` mediumtext NOT NULL,
5507 `numberingmethod` varchar(255) NOT NULL,
5508 `label1` varchar(255) DEFAULT NULL,
5509 `add1` int(11) DEFAULT NULL,
5510 `every1` int(11) DEFAULT NULL,
5511 `whenmorethan1` int(11) DEFAULT NULL,
5512 `setto1` int(11) DEFAULT NULL,
5513 `numbering1` varchar(255) DEFAULT NULL,
5514 `label2` varchar(255) DEFAULT NULL,
5515 `add2` int(11) DEFAULT NULL,
5516 `every2` int(11) DEFAULT NULL,
5517 `whenmorethan2` int(11) DEFAULT NULL,
5518 `setto2` int(11) DEFAULT NULL,
5519 `numbering2` varchar(255) DEFAULT NULL,
5520 `label3` varchar(255) DEFAULT NULL,
5521 `add3` int(11) DEFAULT NULL,
5522 `every3` int(11) DEFAULT NULL,
5523 `whenmorethan3` int(11) DEFAULT NULL,
5524 `setto3` int(11) DEFAULT NULL,
5525 `numbering3` varchar(255) DEFAULT NULL,
5527 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5528 /*!40101 SET character_set_client = @saved_cs_client */;
5531 -- Table structure for table `subscriptionhistory`
5534 DROP TABLE IF EXISTS `subscriptionhistory`;
5535 /*!40101 SET @saved_cs_client = @@character_set_client */;
5536 /*!40101 SET character_set_client = utf8 */;
5537 CREATE TABLE `subscriptionhistory` (
5538 `biblionumber` int(11) NOT NULL,
5539 `subscriptionid` int(11) NOT NULL,
5540 `histstartdate` date DEFAULT NULL,
5541 `histenddate` date DEFAULT NULL,
5542 `missinglist` longtext NOT NULL,
5543 `recievedlist` longtext NOT NULL,
5544 `opacnote` longtext DEFAULT NULL,
5545 `librariannote` longtext DEFAULT NULL,
5546 PRIMARY KEY (`subscriptionid`),
5547 KEY `subscription_history_ibfk_1` (`biblionumber`),
5548 CONSTRAINT `subscription_history_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5549 CONSTRAINT `subscription_history_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5550 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5551 /*!40101 SET character_set_client = @saved_cs_client */;
5554 -- Table structure for table `subscriptionroutinglist`
5557 DROP TABLE IF EXISTS `subscriptionroutinglist`;
5558 /*!40101 SET @saved_cs_client = @@character_set_client */;
5559 /*!40101 SET character_set_client = utf8 */;
5560 CREATE TABLE `subscriptionroutinglist` (
5561 `routingid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5562 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines with patron is on the routing list',
5563 `ranking` int(11) DEFAULT NULL COMMENT 'where the patron stands in line to receive the serial',
5564 `subscriptionid` int(11) NOT NULL COMMENT 'foreign key from the subscription table, defines which subscription this routing list is for',
5565 PRIMARY KEY (`routingid`),
5566 UNIQUE KEY `subscriptionid` (`subscriptionid`,`borrowernumber`),
5567 KEY `subscriptionroutinglist_ibfk_1` (`borrowernumber`),
5568 CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5569 CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5570 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5571 /*!40101 SET character_set_client = @saved_cs_client */;
5574 -- Table structure for table `suggestions`
5577 DROP TABLE IF EXISTS `suggestions`;
5578 /*!40101 SET @saved_cs_client = @@character_set_client */;
5579 /*!40101 SET character_set_client = utf8 */;
5580 CREATE TABLE `suggestions` (
5581 `suggestionid` int(8) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned automatically by Koha',
5582 `suggestedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the person making the suggestion, foreign key linking to the borrowers table',
5583 `suggesteddate` date NOT NULL COMMENT 'date the suggestion was submitted',
5584 `managedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian managing the suggestion, foreign key linking to the borrowers table',
5585 `manageddate` date DEFAULT NULL COMMENT 'date the suggestion was updated',
5586 `acceptedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who accepted the suggestion, foreign key linking to the borrowers table',
5587 `accepteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as accepted',
5588 `rejectedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table',
5589 `rejecteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as rejected',
5590 `lastmodificationby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who edit the suggestion for the last time',
5591 `lastmodificationdate` date DEFAULT NULL COMMENT 'date of the last modification',
5592 `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)',
5593 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the suggestion archived?',
5594 `note` longtext DEFAULT NULL COMMENT 'note entered on the suggestion',
5595 `staff_note` longtext DEFAULT NULL COMMENT 'non-public note entered on the suggestion',
5596 `author` varchar(80) DEFAULT NULL COMMENT 'author of the suggested item',
5597 `title` varchar(255) DEFAULT NULL COMMENT 'title of the suggested item',
5598 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'copyright date of the suggested item',
5599 `publishercode` varchar(255) DEFAULT NULL COMMENT 'publisher of the suggested item',
5600 `date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the suggestion was updated',
5601 `volumedesc` varchar(255) DEFAULT NULL,
5602 `publicationyear` smallint(6) DEFAULT 0,
5603 `place` varchar(255) DEFAULT NULL COMMENT 'publication place of the suggested item',
5604 `isbn` varchar(30) DEFAULT NULL COMMENT 'isbn of the suggested item',
5605 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggestion to the biblio table after the suggestion has been ordered',
5606 `reason` mediumtext DEFAULT NULL COMMENT 'reason for accepting or rejecting the suggestion',
5607 `patronreason` mediumtext DEFAULT NULL COMMENT 'reason for making the suggestion',
5608 `budgetid` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggested budget to the aqbudgets table',
5609 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key linking the suggested branch to the branches table',
5610 `collectiontitle` mediumtext DEFAULT NULL COMMENT 'collection name for the suggested item',
5611 `itemtype` varchar(30) DEFAULT NULL COMMENT 'suggested item type',
5612 `quantity` smallint(6) DEFAULT NULL COMMENT 'suggested quantity to be purchased',
5613 `currency` varchar(10) DEFAULT NULL COMMENT 'suggested currency for the suggested price',
5614 `price` decimal(28,6) DEFAULT NULL COMMENT 'suggested price',
5615 `total` decimal(28,6) DEFAULT NULL COMMENT 'suggested total cost (price*quantity updated for currency)',
5616 PRIMARY KEY (`suggestionid`),
5617 KEY `suggestedby` (`suggestedby`),
5618 KEY `managedby` (`managedby`),
5619 KEY `acceptedby` (`acceptedby`),
5620 KEY `rejectedby` (`rejectedby`),
5621 KEY `biblionumber` (`biblionumber`),
5622 KEY `budgetid` (`budgetid`),
5623 KEY `branchcode` (`branchcode`),
5624 KEY `status` (`STATUS`),
5625 KEY `suggestions_ibfk_lastmodificationby` (`lastmodificationby`),
5626 CONSTRAINT `suggestions_budget_id_fk` FOREIGN KEY (`budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5627 CONSTRAINT `suggestions_ibfk_acceptedby` FOREIGN KEY (`acceptedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5628 CONSTRAINT `suggestions_ibfk_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5629 CONSTRAINT `suggestions_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
5630 CONSTRAINT `suggestions_ibfk_lastmodificationby` FOREIGN KEY (`lastmodificationby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5631 CONSTRAINT `suggestions_ibfk_managedby` FOREIGN KEY (`managedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5632 CONSTRAINT `suggestions_ibfk_rejectedby` FOREIGN KEY (`rejectedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5633 CONSTRAINT `suggestions_ibfk_suggestedby` FOREIGN KEY (`suggestedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5634 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5635 /*!40101 SET character_set_client = @saved_cs_client */;
5638 -- Table structure for table `systempreferences`
5641 DROP TABLE IF EXISTS `systempreferences`;
5642 /*!40101 SET @saved_cs_client = @@character_set_client */;
5643 /*!40101 SET character_set_client = utf8 */;
5644 CREATE TABLE `systempreferences` (
5645 `variable` varchar(50) NOT NULL DEFAULT '' COMMENT 'system preference name',
5646 `value` mediumtext DEFAULT NULL COMMENT 'system preference values',
5647 `options` longtext DEFAULT NULL COMMENT 'options for multiple choice system preferences',
5648 `explanation` mediumtext DEFAULT NULL COMMENT 'descriptive text for the system preference',
5649 `type` varchar(20) DEFAULT NULL COMMENT 'type of question this preference asks (multiple choice, plain text, yes or no, etc)',
5650 PRIMARY KEY (`variable`)
5651 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5652 /*!40101 SET character_set_client = @saved_cs_client */;
5655 -- Table structure for table `tables_settings`
5658 DROP TABLE IF EXISTS `tables_settings`;
5659 /*!40101 SET @saved_cs_client = @@character_set_client */;
5660 /*!40101 SET character_set_client = utf8 */;
5661 CREATE TABLE `tables_settings` (
5662 `module` varchar(255) NOT NULL,
5663 `page` varchar(255) NOT NULL,
5664 `tablename` varchar(255) NOT NULL,
5665 `default_display_length` smallint(6) DEFAULT NULL,
5666 `default_sort_order` varchar(255) DEFAULT NULL,
5667 PRIMARY KEY (`module`(191),`page`(191),`tablename`(191))
5668 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5669 /*!40101 SET character_set_client = @saved_cs_client */;
5672 -- Table structure for table `tags`
5675 DROP TABLE IF EXISTS `tags`;
5676 /*!40101 SET @saved_cs_client = @@character_set_client */;
5677 /*!40101 SET character_set_client = utf8 */;
5678 CREATE TABLE `tags` (
5679 `entry` varchar(255) NOT NULL DEFAULT '',
5680 `weight` bigint(20) NOT NULL DEFAULT 0,
5681 PRIMARY KEY (`entry`(191))
5682 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5683 /*!40101 SET character_set_client = @saved_cs_client */;
5686 -- Table structure for table `tags_all`
5689 DROP TABLE IF EXISTS `tags_all`;
5690 /*!40101 SET @saved_cs_client = @@character_set_client */;
5691 /*!40101 SET character_set_client = utf8 */;
5692 CREATE TABLE `tags_all` (
5693 `tag_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key',
5694 `borrowernumber` int(11) DEFAULT NULL COMMENT 'the patron who added the tag (borrowers.borrowernumber)',
5695 `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was left on (biblio.biblionumber)',
5696 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5697 `language` int(4) DEFAULT NULL COMMENT 'the language the tag was left in',
5698 `date_created` datetime NOT NULL COMMENT 'the date the tag was added',
5699 PRIMARY KEY (`tag_id`),
5700 KEY `tags_borrowers_fk_1` (`borrowernumber`),
5701 KEY `tags_biblionumber_fk_1` (`biblionumber`),
5702 CONSTRAINT `tags_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5703 CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5704 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5705 /*!40101 SET character_set_client = @saved_cs_client */;
5708 -- Table structure for table `tags_approval`
5711 DROP TABLE IF EXISTS `tags_approval`;
5712 /*!40101 SET @saved_cs_client = @@character_set_client */;
5713 /*!40101 SET character_set_client = utf8 */;
5714 CREATE TABLE `tags_approval` (
5715 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5716 `approved` int(1) NOT NULL DEFAULT 0 COMMENT 'whether the tag is approved or not (1=yes, 0=pending, -1=rejected)',
5717 `date_approved` datetime DEFAULT NULL COMMENT 'the date this tag was approved',
5718 `approved_by` int(11) DEFAULT NULL COMMENT 'the librarian who approved the tag (borrowers.borrowernumber)',
5719 `weight_total` int(9) NOT NULL DEFAULT 1 COMMENT 'the total number of times this tag was used',
5720 PRIMARY KEY (`term`),
5721 KEY `tags_approval_borrowers_fk_1` (`approved_by`),
5722 CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5723 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5724 /*!40101 SET character_set_client = @saved_cs_client */;
5727 -- Table structure for table `tags_index`
5730 DROP TABLE IF EXISTS `tags_index`;
5731 /*!40101 SET @saved_cs_client = @@character_set_client */;
5732 /*!40101 SET character_set_client = utf8 */;
5733 CREATE TABLE `tags_index` (
5734 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5735 `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was used on (biblio.biblionumber)',
5736 `weight` int(9) NOT NULL DEFAULT 1 COMMENT 'the number of times this term was used on this bib record',
5737 PRIMARY KEY (`term`,`biblionumber`),
5738 KEY `tags_index_biblionumber_fk_1` (`biblionumber`),
5739 CONSTRAINT `tags_index_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5740 CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`) REFERENCES `tags_approval` (`term`) ON DELETE CASCADE ON UPDATE CASCADE
5741 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5742 /*!40101 SET character_set_client = @saved_cs_client */;
5745 -- Table structure for table `tmp_holdsqueue`
5748 DROP TABLE IF EXISTS `tmp_holdsqueue`;
5749 /*!40101 SET @saved_cs_client = @@character_set_client */;
5750 /*!40101 SET character_set_client = utf8 */;
5751 CREATE TABLE `tmp_holdsqueue` (
5752 `biblionumber` int(11) DEFAULT NULL,
5753 `itemnumber` int(11) DEFAULT NULL,
5754 `barcode` varchar(20) DEFAULT NULL,
5755 `surname` longtext NOT NULL,
5756 `firstname` mediumtext DEFAULT NULL,
5757 `phone` mediumtext DEFAULT NULL,
5758 `borrowernumber` int(11) NOT NULL,
5759 `cardnumber` varchar(32) DEFAULT NULL,
5760 `reservedate` date DEFAULT NULL,
5761 `title` longtext DEFAULT NULL,
5762 `itemcallnumber` varchar(255) DEFAULT NULL,
5763 `holdingbranch` varchar(10) DEFAULT NULL,
5764 `pickbranch` varchar(10) DEFAULT NULL,
5765 `notes` mediumtext DEFAULT NULL,
5766 `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
5767 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this entry as added/last updated',
5768 KEY `tmp_holdsqueue_ibfk_1` (`itemnumber`),
5769 KEY `tmp_holdsqueue_ibfk_2` (`biblionumber`),
5770 KEY `tmp_holdsqueue_ibfk_3` (`borrowernumber`),
5771 CONSTRAINT `tmp_holdsqueue_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5772 CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5773 CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
5774 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5775 /*!40101 SET character_set_client = @saved_cs_client */;
5778 -- Table structure for table `transport_cost`
5781 DROP TABLE IF EXISTS `transport_cost`;
5782 /*!40101 SET @saved_cs_client = @@character_set_client */;
5783 /*!40101 SET character_set_client = utf8 */;
5784 CREATE TABLE `transport_cost` (
5785 `frombranch` varchar(10) NOT NULL,
5786 `tobranch` varchar(10) NOT NULL,
5787 `cost` decimal(6,2) NOT NULL,
5788 `disable_transfer` tinyint(1) NOT NULL DEFAULT 0,
5789 PRIMARY KEY (`frombranch`,`tobranch`),
5790 KEY `transport_cost_ibfk_2` (`tobranch`),
5791 CONSTRAINT `transport_cost_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5792 CONSTRAINT `transport_cost_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5793 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5794 /*!40101 SET character_set_client = @saved_cs_client */;
5797 -- Table structure for table `uploaded_files`
5800 DROP TABLE IF EXISTS `uploaded_files`;
5801 /*!40101 SET @saved_cs_client = @@character_set_client */;
5802 /*!40101 SET character_set_client = utf8 */;
5803 CREATE TABLE `uploaded_files` (
5804 `id` int(11) NOT NULL AUTO_INCREMENT,
5805 `hashvalue` char(40) NOT NULL,
5806 `filename` mediumtext NOT NULL,
5807 `dir` mediumtext NOT NULL,
5808 `filesize` int(11) DEFAULT NULL,
5809 `dtcreated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
5810 `uploadcategorycode` text DEFAULT NULL,
5811 `owner` int(11) DEFAULT NULL,
5812 `public` tinyint(4) DEFAULT NULL,
5813 `permanent` tinyint(4) DEFAULT NULL,
5815 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5816 /*!40101 SET character_set_client = @saved_cs_client */;
5819 -- Table structure for table `user_permissions`
5822 DROP TABLE IF EXISTS `user_permissions`;
5823 /*!40101 SET @saved_cs_client = @@character_set_client */;
5824 /*!40101 SET character_set_client = utf8 */;
5825 CREATE TABLE `user_permissions` (
5826 `borrowernumber` int(11) NOT NULL DEFAULT 0,
5827 `module_bit` int(11) NOT NULL DEFAULT 0,
5828 `code` varchar(64) NOT NULL,
5829 PRIMARY KEY (`borrowernumber`,`module_bit`,`code`),
5830 KEY `user_permissions_ibfk_1` (`borrowernumber`),
5831 KEY `user_permissions_ibfk_2` (`module_bit`,`code`),
5832 CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5833 CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`) ON DELETE CASCADE ON UPDATE CASCADE
5834 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5835 /*!40101 SET character_set_client = @saved_cs_client */;
5838 -- Table structure for table `userflags`
5841 DROP TABLE IF EXISTS `userflags`;
5842 /*!40101 SET @saved_cs_client = @@character_set_client */;
5843 /*!40101 SET character_set_client = utf8 */;
5844 CREATE TABLE `userflags` (
5845 `bit` int(11) NOT NULL DEFAULT 0,
5846 `flag` varchar(30) DEFAULT NULL,
5847 `flagdesc` varchar(255) DEFAULT NULL,
5848 `defaulton` int(11) DEFAULT NULL,
5850 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5851 /*!40101 SET character_set_client = @saved_cs_client */;
5854 -- Table structure for table `vendor_edi_accounts`
5857 DROP TABLE IF EXISTS `vendor_edi_accounts`;
5858 /*!40101 SET @saved_cs_client = @@character_set_client */;
5859 /*!40101 SET character_set_client = utf8 */;
5860 CREATE TABLE `vendor_edi_accounts` (
5861 `id` int(11) NOT NULL AUTO_INCREMENT,
5862 `description` mediumtext NOT NULL,
5863 `host` varchar(40) DEFAULT NULL,
5864 `username` varchar(40) DEFAULT NULL,
5865 `password` mediumtext DEFAULT NULL,
5866 `last_activity` date DEFAULT NULL,
5867 `vendor_id` int(11) DEFAULT NULL,
5868 `download_directory` mediumtext DEFAULT NULL,
5869 `upload_directory` mediumtext DEFAULT NULL,
5870 `san` varchar(20) DEFAULT NULL,
5871 `standard` varchar(3) DEFAULT 'EUR',
5872 `id_code_qualifier` varchar(3) DEFAULT '14',
5873 `transport` varchar(6) DEFAULT 'FTP',
5874 `quotes_enabled` tinyint(1) NOT NULL DEFAULT 0,
5875 `invoices_enabled` tinyint(1) NOT NULL DEFAULT 0,
5876 `orders_enabled` tinyint(1) NOT NULL DEFAULT 0,
5877 `responses_enabled` tinyint(1) NOT NULL DEFAULT 0,
5878 `auto_orders` tinyint(1) NOT NULL DEFAULT 0,
5879 `shipment_budget` int(11) DEFAULT NULL,
5880 `plugin` varchar(256) NOT NULL DEFAULT '',
5882 KEY `vendorid` (`vendor_id`),
5883 KEY `shipmentbudget` (`shipment_budget`),
5884 CONSTRAINT `vfk_shipment_budget` FOREIGN KEY (`shipment_budget`) REFERENCES `aqbudgets` (`budget_id`),
5885 CONSTRAINT `vfk_vendor_id` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`)
5886 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5887 /*!40101 SET character_set_client = @saved_cs_client */;
5890 -- Table structure for table `virtualshelfcontents`
5893 DROP TABLE IF EXISTS `virtualshelfcontents`;
5894 /*!40101 SET @saved_cs_client = @@character_set_client */;
5895 /*!40101 SET character_set_client = utf8 */;
5896 CREATE TABLE `virtualshelfcontents` (
5897 `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',
5898 `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',
5899 `flags` int(11) DEFAULT NULL,
5900 `dateadded` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this bib record was added to the list',
5901 `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)',
5902 KEY `shelfnumber` (`shelfnumber`),
5903 KEY `biblionumber` (`biblionumber`),
5904 KEY `shelfcontents_ibfk_3` (`borrowernumber`),
5905 CONSTRAINT `shelfcontents_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5906 CONSTRAINT `shelfcontents_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
5907 CONSTRAINT `virtualshelfcontents_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE
5908 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5909 /*!40101 SET character_set_client = @saved_cs_client */;
5912 -- Table structure for table `virtualshelfshares`
5915 DROP TABLE IF EXISTS `virtualshelfshares`;
5916 /*!40101 SET @saved_cs_client = @@character_set_client */;
5917 /*!40101 SET character_set_client = utf8 */;
5918 CREATE TABLE `virtualshelfshares` (
5919 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
5920 `shelfnumber` int(11) NOT NULL COMMENT 'foreign key for virtualshelves',
5921 `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrower that accepted access to this list',
5922 `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',
5923 `sharedate` datetime DEFAULT NULL COMMENT 'date of invitation or acceptance of invitation',
5925 KEY `virtualshelfshares_ibfk_1` (`shelfnumber`),
5926 KEY `virtualshelfshares_ibfk_2` (`borrowernumber`),
5927 CONSTRAINT `virtualshelfshares_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5928 CONSTRAINT `virtualshelfshares_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
5929 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5930 /*!40101 SET character_set_client = @saved_cs_client */;
5933 -- Table structure for table `virtualshelves`
5936 DROP TABLE IF EXISTS `virtualshelves`;
5937 /*!40101 SET @saved_cs_client = @@character_set_client */;
5938 /*!40101 SET character_set_client = utf8 */;
5939 CREATE TABLE `virtualshelves` (
5940 `shelfnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5941 `shelfname` varchar(255) DEFAULT NULL COMMENT 'name of the list',
5942 `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)',
5943 `public` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If the list is public',
5944 `sortfield` varchar(16) DEFAULT 'title' COMMENT 'the field this list is sorted on',
5945 `lastmodified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the list was last modified',
5946 `created_on` datetime NOT NULL COMMENT 'creation time',
5947 `allow_change_from_owner` tinyint(1) DEFAULT 1 COMMENT 'can owner change contents?',
5948 `allow_change_from_others` tinyint(1) DEFAULT 0 COMMENT 'can others change contents?',
5949 `allow_change_from_staff` tinyint(1) DEFAULT 0 COMMENT 'can staff change contents?',
5950 PRIMARY KEY (`shelfnumber`),
5951 KEY `virtualshelves_ibfk_1` (`owner`),
5952 CONSTRAINT `virtualshelves_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
5953 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5954 /*!40101 SET character_set_client = @saved_cs_client */;
5957 -- Table structure for table `z3950servers`
5960 DROP TABLE IF EXISTS `z3950servers`;
5961 /*!40101 SET @saved_cs_client = @@character_set_client */;
5962 /*!40101 SET character_set_client = utf8 */;
5963 CREATE TABLE `z3950servers` (
5964 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5965 `host` varchar(255) NOT NULL COMMENT 'target''s host name',
5966 `port` int(11) DEFAULT NULL COMMENT 'port number used to connect to target',
5967 `db` varchar(255) DEFAULT NULL COMMENT 'target''s database name',
5968 `userid` varchar(255) DEFAULT NULL COMMENT 'username needed to log in to target',
5969 `password` varchar(255) DEFAULT NULL COMMENT 'password needed to log in to target',
5970 `servername` longtext NOT NULL COMMENT 'name given to the target by the library',
5971 `checked` smallint(6) DEFAULT NULL COMMENT 'whether this target is checked by default (1 for yes, 0 for no)',
5972 `rank` int(11) DEFAULT NULL COMMENT 'where this target appears in the list of targets',
5973 `syntax` varchar(80) NOT NULL COMMENT 'MARC format provided by this target',
5974 `timeout` int(11) NOT NULL DEFAULT 0 COMMENT 'number of seconds before Koha stops trying to access this server',
5975 `servertype` enum('zed','sru') NOT NULL DEFAULT 'zed' COMMENT 'zed means z39.50 server',
5976 `encoding` mediumtext NOT NULL COMMENT 'characters encoding provided by this target',
5977 `recordtype` enum('authority','biblio') NOT NULL DEFAULT 'biblio' COMMENT 'server contains bibliographic or authority records',
5978 `sru_options` varchar(255) DEFAULT NULL COMMENT 'options like sru=get, sru_version=1.1; will be passed to the server via ZOOM',
5979 `sru_fields` longtext DEFAULT NULL COMMENT 'contains the mapping between the Z3950 search fields and the specific SRU server indexes',
5980 `add_xslt` longtext DEFAULT NULL COMMENT 'zero or more paths to XSLT files to be processed on the search results',
5981 `attributes` varchar(255) DEFAULT NULL COMMENT 'additional attributes passed to PQF queries',
5983 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5984 /*!40101 SET character_set_client = @saved_cs_client */;
5987 -- Table structure for table `zebraqueue`
5990 DROP TABLE IF EXISTS `zebraqueue`;
5991 /*!40101 SET @saved_cs_client = @@character_set_client */;
5992 /*!40101 SET character_set_client = utf8 */;
5993 CREATE TABLE `zebraqueue` (
5994 `id` int(11) NOT NULL AUTO_INCREMENT,
5995 `biblio_auth_number` bigint(20) unsigned NOT NULL DEFAULT 0,
5996 `operation` char(20) NOT NULL DEFAULT '',
5997 `server` char(20) NOT NULL DEFAULT '',
5998 `done` int(11) NOT NULL DEFAULT 0,
5999 `time` timestamp NOT NULL DEFAULT current_timestamp(),
6001 KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
6002 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6003 /*!40101 SET character_set_client = @saved_cs_client */;
6004 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
6006 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
6007 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
6008 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
6009 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
6010 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
6011 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
6012 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
6014 -- Dump completed on 2022-11-25 14:12:24