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