1 -- MariaDB dump 10.19 Distrib 10.5.21-MariaDB, for debian-linux-gnu (aarch64)
3 -- Host: db Database: koha_kohadev
4 -- ------------------------------------------------------
5 -- Server version 11.2.2-MariaDB-1:11.2.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',
68 `restricts_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'boolean flag to denote if the noissuescharge syspref for this debit type is active',
70 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
71 /*!40101 SET character_set_client = @saved_cs_client */;
74 -- Table structure for table `account_debit_types_branches`
77 DROP TABLE IF EXISTS `account_debit_types_branches`;
78 /*!40101 SET @saved_cs_client = @@character_set_client */;
79 /*!40101 SET character_set_client = utf8 */;
80 CREATE TABLE `account_debit_types_branches` (
81 `debit_type_code` varchar(80) DEFAULT NULL,
82 `branchcode` varchar(10) DEFAULT NULL,
83 KEY `debit_type_code` (`debit_type_code`),
84 KEY `branchcode` (`branchcode`),
85 CONSTRAINT `account_debit_types_branches_ibfk_1` FOREIGN KEY (`debit_type_code`) REFERENCES `account_debit_types` (`code`) ON DELETE CASCADE,
86 CONSTRAINT `account_debit_types_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
87 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
88 /*!40101 SET character_set_client = @saved_cs_client */;
91 -- Table structure for table `account_offsets`
94 DROP TABLE IF EXISTS `account_offsets`;
95 /*!40101 SET @saved_cs_client = @@character_set_client */;
96 /*!40101 SET character_set_client = utf8 */;
97 CREATE TABLE `account_offsets` (
98 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each offset',
99 `credit_id` int(11) DEFAULT NULL COMMENT 'The id of the accountline the increased the patron''s balance',
100 `debit_id` int(11) DEFAULT NULL COMMENT 'The id of the accountline that decreased the patron''s balance',
101 `type` enum('CREATE','APPLY','VOID','OVERDUE_INCREASE','OVERDUE_DECREASE') NOT NULL COMMENT 'The type of offset this is',
102 `amount` decimal(26,6) NOT NULL COMMENT 'The amount of the change',
103 `created_on` timestamp NOT NULL DEFAULT current_timestamp(),
105 KEY `account_offsets_ibfk_p` (`credit_id`),
106 KEY `account_offsets_ibfk_f` (`debit_id`),
107 CONSTRAINT `account_offsets_ibfk_f` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE,
108 CONSTRAINT `account_offsets_ibfk_p` FOREIGN KEY (`credit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE
109 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
110 /*!40101 SET character_set_client = @saved_cs_client */;
113 -- Table structure for table `accountlines`
116 DROP TABLE IF EXISTS `accountlines`;
117 /*!40101 SET @saved_cs_client = @@character_set_client */;
118 /*!40101 SET character_set_client = utf8 */;
119 CREATE TABLE `accountlines` (
120 `accountlines_id` int(11) NOT NULL AUTO_INCREMENT,
121 `issue_id` int(11) DEFAULT NULL,
122 `borrowernumber` int(11) DEFAULT NULL,
123 `itemnumber` int(11) DEFAULT NULL,
124 `date` timestamp NULL DEFAULT NULL,
125 `amount` decimal(28,6) DEFAULT NULL,
126 `description` longtext DEFAULT NULL,
127 `credit_type_code` varchar(80) DEFAULT NULL,
128 `debit_type_code` varchar(80) DEFAULT NULL,
129 `credit_number` varchar(20) DEFAULT NULL COMMENT 'autogenerated number for credits',
130 `status` varchar(16) DEFAULT NULL,
131 `payment_type` varchar(80) DEFAULT NULL COMMENT 'optional authorised value PAYMENT_TYPE',
132 `amountoutstanding` decimal(28,6) DEFAULT NULL,
133 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
134 `note` mediumtext DEFAULT NULL,
135 `manager_id` int(11) DEFAULT NULL,
136 `register_id` int(11) DEFAULT NULL,
137 `interface` varchar(16) NOT NULL,
138 `branchcode` varchar(10) DEFAULT NULL COMMENT 'the branchcode of the library where a payment was made, a manual invoice created, etc.',
139 PRIMARY KEY (`accountlines_id`),
140 KEY `acctsborridx` (`borrowernumber`),
141 KEY `timeidx` (`timestamp`),
142 KEY `credit_type_code` (`credit_type_code`),
143 KEY `debit_type_code` (`debit_type_code`),
144 KEY `itemnumber` (`itemnumber`),
145 KEY `branchcode` (`branchcode`),
146 KEY `manager_id` (`manager_id`),
147 KEY `accountlines_ibfk_registers` (`register_id`),
148 CONSTRAINT `accountlines_ibfk_borrowers` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
149 CONSTRAINT `accountlines_ibfk_borrowers_2` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
150 CONSTRAINT `accountlines_ibfk_branches` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
151 CONSTRAINT `accountlines_ibfk_credit_type` FOREIGN KEY (`credit_type_code`) REFERENCES `account_credit_types` (`code`) ON UPDATE CASCADE,
152 CONSTRAINT `accountlines_ibfk_debit_type` FOREIGN KEY (`debit_type_code`) REFERENCES `account_debit_types` (`code`) ON UPDATE CASCADE,
153 CONSTRAINT `accountlines_ibfk_items` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
154 CONSTRAINT `accountlines_ibfk_registers` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
155 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
156 /*!40101 SET character_set_client = @saved_cs_client */;
159 -- Table structure for table `action_logs`
162 DROP TABLE IF EXISTS `action_logs`;
163 /*!40101 SET @saved_cs_client = @@character_set_client */;
164 /*!40101 SET character_set_client = utf8 */;
165 CREATE TABLE `action_logs` (
166 `action_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each action',
167 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the action took place',
168 `user` int(11) NOT NULL DEFAULT 0 COMMENT 'the staff member who performed the action (borrowers.borrowernumber)',
169 `module` mediumtext DEFAULT NULL COMMENT 'the module this action was taken against',
170 `action` mediumtext DEFAULT NULL COMMENT 'the action (includes things like DELETED, ADDED, MODIFY, etc)',
171 `object` int(11) DEFAULT NULL COMMENT 'the object that the action was taken against (could be a borrowernumber, itemnumber, etc)',
172 `info` mediumtext DEFAULT NULL COMMENT 'information about the action (usually includes SQL statement)',
173 `interface` varchar(30) DEFAULT NULL COMMENT 'the context this action was taken in',
174 `script` varchar(255) DEFAULT NULL COMMENT 'the name of the cron script that caused this change',
175 `trace` text DEFAULT NULL COMMENT 'An optional stack trace enabled by ActionLogsTraceDepth',
176 `diff` LONGTEXT NULL DEFAULT NULL COMMENT 'Stores a diff of the changed object',
177 PRIMARY KEY (`action_id`),
178 KEY `timestamp_idx` (`timestamp`),
179 KEY `user_idx` (`user`),
180 KEY `module_idx` (`module`(191)),
181 KEY `action_idx` (`action`(191)),
182 KEY `object_idx` (`object`),
183 KEY `info_idx` (`info`(191)),
184 KEY `interface` (`interface`)
185 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
186 /*!40101 SET character_set_client = @saved_cs_client */;
189 -- Table structure for table `additional_contents`
192 DROP TABLE IF EXISTS `additional_contents`;
193 /*!40101 SET @saved_cs_client = @@character_set_client */;
194 /*!40101 SET character_set_client = utf8 */;
195 CREATE TABLE `additional_contents` (
196 `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the additional content category',
197 `category` varchar(20) NOT NULL COMMENT 'category for the additional content',
198 `code` varchar(100) NOT NULL COMMENT 'code to group content per lang',
199 `location` varchar(255) NOT NULL COMMENT 'location of the additional content',
200 `branchcode` varchar(10) DEFAULT NULL COMMENT 'branch code users to create branch specific additional content, NULL is every branch.',
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',
207 UNIQUE KEY `additional_contents_uniq` (`category`,`code`,`branchcode`),
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_contents_localizations`
219 DROP TABLE IF EXISTS `additional_contents_localizations`;
220 /*!40101 SET @saved_cs_client = @@character_set_client */;
221 /*!40101 SET character_set_client = utf8 */;
222 CREATE TABLE `additional_contents_localizations` (
223 `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the additional content',
224 `additional_content_id` int(10) unsigned NOT NULL COMMENT 'link to the additional content',
225 `title` varchar(250) NOT NULL DEFAULT '' COMMENT 'title of the additional content',
226 `content` mediumtext NOT NULL COMMENT 'the body of your additional content',
227 `lang` varchar(50) NOT NULL DEFAULT '' COMMENT 'lang',
228 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
230 UNIQUE KEY `additional_contents_localizations_uniq` (`additional_content_id`,`lang`),
231 CONSTRAINT `additional_contents_localizations_ibfk1` FOREIGN KEY (`additional_content_id`) REFERENCES `additional_contents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
232 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
233 /*!40101 SET character_set_client = @saved_cs_client */;
236 -- Table structure for table `additional_field_values`
239 DROP TABLE IF EXISTS `additional_field_values`;
240 /*!40101 SET @saved_cs_client = @@character_set_client */;
241 /*!40101 SET character_set_client = utf8 */;
242 CREATE TABLE `additional_field_values` (
243 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
244 `field_id` int(11) NOT NULL COMMENT 'foreign key references additional_fields(id)',
245 `record_id` int(11) NOT NULL COMMENT 'record_id',
246 `value` varchar(255) NOT NULL DEFAULT '' COMMENT 'value for this field',
248 UNIQUE KEY `field_record` (`field_id`,`record_id`),
249 CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
250 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
251 /*!40101 SET character_set_client = @saved_cs_client */;
254 -- Table structure for table `additional_fields`
257 DROP TABLE IF EXISTS `additional_fields`;
258 /*!40101 SET @saved_cs_client = @@character_set_client */;
259 /*!40101 SET character_set_client = utf8 */;
260 CREATE TABLE `additional_fields` (
261 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
262 `tablename` varchar(255) NOT NULL DEFAULT '' COMMENT 'tablename of the new field',
263 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the field',
264 `authorised_value_category` varchar(32) DEFAULT NULL COMMENT 'is an authorised value category',
265 `marcfield` varchar(16) NOT NULL DEFAULT '' COMMENT 'contains the marc field to copied into the record',
266 `marcfield_mode` enum('get','set') NOT NULL DEFAULT 'get' COMMENT 'mode of operation (get or set) for marcfield',
267 `searchable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the field searchable?',
269 UNIQUE KEY `fields_uniq` (`tablename`(191),`name`(191))
270 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
271 /*!40101 SET character_set_client = @saved_cs_client */;
274 -- Table structure for table `advanced_editor_macros`
277 DROP TABLE IF EXISTS `advanced_editor_macros`;
278 /*!40101 SET @saved_cs_client = @@character_set_client */;
279 /*!40101 SET character_set_client = utf8 */;
280 CREATE TABLE `advanced_editor_macros` (
281 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the macro',
282 `name` varchar(80) NOT NULL COMMENT 'Name of the macro',
283 `macro` longtext DEFAULT NULL COMMENT 'The macro code itself',
284 `borrowernumber` int(11) DEFAULT NULL COMMENT 'ID of the borrower who created this macro',
285 `shared` tinyint(1) DEFAULT 0 COMMENT 'Bit to define if shared or private macro',
287 KEY `borrower_macro_fk` (`borrowernumber`),
288 CONSTRAINT `borrower_macro_fk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
289 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
290 /*!40101 SET character_set_client = @saved_cs_client */;
293 -- Table structure for table `alert`
296 DROP TABLE IF EXISTS `alert`;
297 /*!40101 SET @saved_cs_client = @@character_set_client */;
298 /*!40101 SET character_set_client = utf8 */;
299 CREATE TABLE `alert` (
300 `alertid` int(11) NOT NULL AUTO_INCREMENT,
301 `borrowernumber` int(11) NOT NULL DEFAULT 0,
302 `type` varchar(10) NOT NULL DEFAULT '',
303 `externalid` varchar(20) NOT NULL DEFAULT '',
304 PRIMARY KEY (`alertid`),
305 KEY `borrowernumber` (`borrowernumber`),
306 KEY `type` (`type`,`externalid`),
307 CONSTRAINT `alert_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
308 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
309 /*!40101 SET character_set_client = @saved_cs_client */;
312 -- Table structure for table `api_keys`
315 DROP TABLE IF EXISTS `api_keys`;
316 /*!40101 SET @saved_cs_client = @@character_set_client */;
317 /*!40101 SET character_set_client = utf8 */;
318 CREATE TABLE `api_keys` (
319 `client_id` varchar(191) NOT NULL COMMENT 'API client ID',
320 `secret` varchar(191) NOT NULL COMMENT 'API client secret used for API authentication',
321 `description` varchar(255) NOT NULL COMMENT 'API client description',
322 `patron_id` int(11) NOT NULL COMMENT 'Foreign key to the borrowers table',
323 `active` tinyint(1) NOT NULL DEFAULT 1 COMMENT '0 means this API key is revoked',
324 PRIMARY KEY (`client_id`),
325 UNIQUE KEY `secret` (`secret`),
326 KEY `patron_id` (`patron_id`),
327 CONSTRAINT `api_keys_fk_patron_id` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
328 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
329 /*!40101 SET character_set_client = @saved_cs_client */;
332 -- Table structure for table `aqbasket`
335 DROP TABLE IF EXISTS `aqbasket`;
336 /*!40101 SET @saved_cs_client = @@character_set_client */;
337 /*!40101 SET character_set_client = utf8 */;
338 CREATE TABLE `aqbasket` (
339 `basketno` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, Koha defined number',
340 `basketname` varchar(50) DEFAULT NULL COMMENT 'name given to the basket at creation',
341 `note` longtext DEFAULT NULL COMMENT 'the internal note added at basket creation',
342 `booksellernote` longtext DEFAULT NULL COMMENT 'the vendor note added at basket creation',
343 `contractnumber` int(11) DEFAULT NULL COMMENT 'links this basket to the aqcontract table (aqcontract.contractnumber)',
344 `creationdate` date DEFAULT NULL COMMENT 'the date the basket was created',
345 `closedate` date DEFAULT NULL COMMENT 'the date the basket was closed',
346 `booksellerid` int(11) NOT NULL DEFAULT 1 COMMENT 'the Koha assigned ID for the vendor (aqbooksellers.id)',
347 `authorisedby` varchar(10) DEFAULT NULL COMMENT 'the borrowernumber of the person who created the basket',
348 `booksellerinvoicenumber` longtext DEFAULT NULL COMMENT 'appears to always be NULL',
349 `basketgroupid` int(11) DEFAULT NULL COMMENT 'links this basket to its group (aqbasketgroups.id)',
350 `deliveryplace` varchar(10) DEFAULT NULL COMMENT 'basket delivery place',
351 `billingplace` varchar(10) DEFAULT NULL COMMENT 'basket billing place',
352 `branch` varchar(10) DEFAULT NULL COMMENT 'basket branch',
353 `is_standing` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'orders in this basket are standing',
354 `create_items` enum('ordering','receiving','cataloguing') DEFAULT NULL COMMENT 'when items should be created for orders in this basket',
355 PRIMARY KEY (`basketno`),
356 KEY `booksellerid` (`booksellerid`),
357 KEY `basketgroupid` (`basketgroupid`),
358 KEY `contractnumber` (`contractnumber`),
359 KEY `authorisedby` (`authorisedby`),
360 KEY `aqbasket_ibfk_4` (`branch`),
361 CONSTRAINT `aqbasket_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE,
362 CONSTRAINT `aqbasket_ibfk_2` FOREIGN KEY (`contractnumber`) REFERENCES `aqcontract` (`contractnumber`),
363 CONSTRAINT `aqbasket_ibfk_3` FOREIGN KEY (`basketgroupid`) REFERENCES `aqbasketgroups` (`id`) ON UPDATE CASCADE,
364 CONSTRAINT `aqbasket_ibfk_4` FOREIGN KEY (`branch`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
365 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
366 /*!40101 SET character_set_client = @saved_cs_client */;
369 -- Table structure for table `aqbasketgroups`
372 DROP TABLE IF EXISTS `aqbasketgroups`;
373 /*!40101 SET @saved_cs_client = @@character_set_client */;
374 /*!40101 SET character_set_client = utf8 */;
375 CREATE TABLE `aqbasketgroups` (
376 `id` int(11) NOT NULL AUTO_INCREMENT,
377 `name` varchar(50) DEFAULT NULL,
378 `closed` tinyint(1) DEFAULT NULL,
379 `booksellerid` int(11) NOT NULL,
380 `deliveryplace` varchar(10) DEFAULT NULL,
381 `freedeliveryplace` mediumtext DEFAULT NULL,
382 `deliverycomment` varchar(255) DEFAULT NULL,
383 `billingplace` varchar(10) DEFAULT NULL,
385 KEY `booksellerid` (`booksellerid`),
386 CONSTRAINT `aqbasketgroups_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
387 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
388 /*!40101 SET character_set_client = @saved_cs_client */;
391 -- Table structure for table `aqbasketusers`
394 DROP TABLE IF EXISTS `aqbasketusers`;
395 /*!40101 SET @saved_cs_client = @@character_set_client */;
396 /*!40101 SET character_set_client = utf8 */;
397 CREATE TABLE `aqbasketusers` (
398 `basketno` int(11) NOT NULL,
399 `borrowernumber` int(11) NOT NULL,
400 PRIMARY KEY (`basketno`,`borrowernumber`),
401 KEY `aqbasketusers_ibfk_2` (`borrowernumber`),
402 CONSTRAINT `aqbasketusers_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
403 CONSTRAINT `aqbasketusers_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
404 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
405 /*!40101 SET character_set_client = @saved_cs_client */;
408 -- Table structure for table `aqbookseller_aliases`
411 DROP TABLE IF EXISTS `aqbookseller_aliases`;
412 /*!40101 SET @saved_cs_client = @@character_set_client */;
413 /*!40101 SET character_set_client = utf8 */;
414 CREATE TABLE `aqbookseller_aliases` (
415 `alias_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha',
416 `vendor_id` int(11) NOT NULL COMMENT 'link to the vendor',
417 `alias` varchar(255) NOT NULL COMMENT 'the alias',
418 PRIMARY KEY (`alias_id`),
419 KEY `aqbookseller_aliases_ibfk_1` (`vendor_id`),
420 CONSTRAINT `aqbookseller_aliases_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
421 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
422 /*!40101 SET character_set_client = @saved_cs_client */;
425 -- Table structure for table `aqbookseller_interfaces`
428 DROP TABLE IF EXISTS `aqbookseller_interfaces`;
429 /*!40101 SET @saved_cs_client = @@character_set_client */;
430 /*!40101 SET character_set_client = utf8 */;
431 CREATE TABLE `aqbookseller_interfaces` (
432 `interface_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha',
433 `vendor_id` int(11) NOT NULL COMMENT 'link to the vendor',
434 `type` varchar(80) DEFAULT NULL COMMENT 'type of the interface, authorised value VENDOR_INTERFACE_TYPE',
435 `name` varchar(255) NOT NULL COMMENT 'name of the interface',
436 `uri` mediumtext DEFAULT NULL COMMENT 'uri of the interface',
437 `login` varchar(255) DEFAULT NULL COMMENT 'login',
438 `password` mediumtext DEFAULT NULL COMMENT 'hashed password',
439 `account_email` mediumtext DEFAULT NULL COMMENT 'account email',
440 `notes` longtext DEFAULT NULL COMMENT 'notes',
441 PRIMARY KEY (`interface_id`),
442 KEY `aqbookseller_interfaces_ibfk_1` (`vendor_id`),
443 CONSTRAINT `aqbookseller_interfaces_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
444 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
445 /*!40101 SET character_set_client = @saved_cs_client */;
448 -- Table structure for table `aqbookseller_issues`
451 DROP TABLE IF EXISTS `aqbookseller_issues`;
452 /*!40101 SET @saved_cs_client = @@character_set_client */;
453 /*!40101 SET character_set_client = utf8 */;
454 CREATE TABLE `aqbookseller_issues` (
455 `issue_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha',
456 `vendor_id` int(11) NOT NULL COMMENT 'link to the vendor',
457 `type` varchar(80) DEFAULT NULL COMMENT 'type of the issue, authorised value VENDOR_ISSUE_TYPE',
458 `started_on` date DEFAULT NULL COMMENT 'start of the issue',
459 `ended_on` date DEFAULT NULL COMMENT 'end of the issue',
460 `notes` longtext DEFAULT NULL COMMENT 'notes',
461 PRIMARY KEY (`issue_id`),
462 KEY `aqbookseller_issues_ibfk_1` (`vendor_id`),
463 CONSTRAINT `aqbookseller_issues_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
464 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
465 /*!40101 SET character_set_client = @saved_cs_client */;
468 -- Table structure for table `aqbooksellers`
471 DROP TABLE IF EXISTS `aqbooksellers`;
472 /*!40101 SET @saved_cs_client = @@character_set_client */;
473 /*!40101 SET character_set_client = utf8 */;
474 CREATE TABLE `aqbooksellers` (
475 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha',
476 `name` longtext NOT NULL COMMENT 'vendor name',
477 `address1` longtext DEFAULT NULL COMMENT 'first line of vendor physical address',
478 `address2` longtext DEFAULT NULL COMMENT 'second line of vendor physical address',
479 `address3` longtext DEFAULT NULL COMMENT 'third line of vendor physical address',
480 `address4` longtext DEFAULT NULL COMMENT 'fourth line of vendor physical address',
481 `phone` varchar(30) DEFAULT NULL COMMENT 'vendor phone number',
482 `accountnumber` longtext DEFAULT NULL COMMENT 'vendor account number',
483 `type` varchar(255) DEFAULT NULL,
484 `notes` longtext DEFAULT NULL COMMENT 'order notes',
485 `postal` longtext DEFAULT NULL COMMENT 'vendor postal address (all lines)',
486 `url` varchar(255) DEFAULT NULL COMMENT 'vendor web address',
487 `active` tinyint(4) DEFAULT NULL COMMENT 'is this vendor active (1 for yes, 0 for no)',
488 `listprice` varchar(10) DEFAULT NULL COMMENT 'currency code for list prices',
489 `invoiceprice` varchar(10) DEFAULT NULL COMMENT 'currency code for invoice prices',
490 `gstreg` tinyint(4) DEFAULT NULL COMMENT 'is your library charged tax (1 for yes, 0 for no)',
491 `listincgst` tinyint(4) DEFAULT NULL COMMENT 'is tax included in list prices (1 for yes, 0 for no)',
492 `invoiceincgst` tinyint(4) DEFAULT NULL COMMENT 'is tax included in invoice prices (1 for yes, 0 for no)',
493 `tax_rate` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate the library is charged',
494 `discount` float(6,4) DEFAULT NULL COMMENT 'discount offered on all items ordered from this vendor',
495 `fax` varchar(50) DEFAULT NULL COMMENT 'vendor fax number',
496 `deliverytime` int(11) DEFAULT NULL COMMENT 'vendor delivery time',
497 `external_id` varchar(255) DEFAULT NULL COMMENT 'external id of the vendor',
499 KEY `listprice` (`listprice`),
500 KEY `invoiceprice` (`invoiceprice`),
501 KEY `name` (`name`(191)),
502 CONSTRAINT `aqbooksellers_ibfk_1` FOREIGN KEY (`listprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE,
503 CONSTRAINT `aqbooksellers_ibfk_2` FOREIGN KEY (`invoiceprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE
504 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
505 /*!40101 SET character_set_client = @saved_cs_client */;
508 -- Table structure for table `aqbudgetborrowers`
511 DROP TABLE IF EXISTS `aqbudgetborrowers`;
512 /*!40101 SET @saved_cs_client = @@character_set_client */;
513 /*!40101 SET character_set_client = utf8 */;
514 CREATE TABLE `aqbudgetborrowers` (
515 `budget_id` int(11) NOT NULL,
516 `borrowernumber` int(11) NOT NULL,
517 PRIMARY KEY (`budget_id`,`borrowernumber`),
518 KEY `aqbudgetborrowers_ibfk_2` (`borrowernumber`),
519 CONSTRAINT `aqbudgetborrowers_ibfk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
520 CONSTRAINT `aqbudgetborrowers_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
521 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
522 /*!40101 SET character_set_client = @saved_cs_client */;
525 -- Table structure for table `aqbudgetperiods`
528 DROP TABLE IF EXISTS `aqbudgetperiods`;
529 /*!40101 SET @saved_cs_client = @@character_set_client */;
530 /*!40101 SET character_set_client = utf8 */;
531 CREATE TABLE `aqbudgetperiods` (
532 `budget_period_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned by Koha',
533 `budget_period_startdate` date NOT NULL COMMENT 'date when the budget starts',
534 `budget_period_enddate` date NOT NULL COMMENT 'date when the budget ends',
535 `budget_period_active` tinyint(1) DEFAULT 0 COMMENT 'whether this budget is active or not (1 for yes, 0 for no)',
536 `budget_period_description` longtext DEFAULT NULL COMMENT 'description assigned to this budget',
537 `budget_period_total` decimal(28,6) DEFAULT NULL COMMENT 'total amount available in this budget',
538 `budget_period_locked` tinyint(1) DEFAULT NULL COMMENT 'whether this budget is locked or not (1 for yes, 0 for no)',
539 `sort1_authcat` varchar(10) DEFAULT NULL COMMENT 'statistical category for this budget',
540 `sort2_authcat` varchar(10) DEFAULT NULL COMMENT 'second statistical category for this budget',
541 PRIMARY KEY (`budget_period_id`)
542 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
543 /*!40101 SET character_set_client = @saved_cs_client */;
546 -- Table structure for table `aqbudgets`
549 DROP TABLE IF EXISTS `aqbudgets`;
550 /*!40101 SET @saved_cs_client = @@character_set_client */;
551 /*!40101 SET character_set_client = utf8 */;
552 CREATE TABLE `aqbudgets` (
553 `budget_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned to each fund by Koha',
554 `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)',
555 `budget_code` varchar(30) DEFAULT NULL COMMENT 'code assigned to the fund by the user',
556 `budget_name` varchar(80) DEFAULT NULL COMMENT 'name assigned to the fund by the user',
557 `budget_branchcode` varchar(10) DEFAULT NULL COMMENT 'branch that this fund belongs to (branches.branchcode)',
558 `budget_amount` decimal(28,6) DEFAULT 0.000000 COMMENT 'total amount for this fund',
559 `budget_encumb` decimal(28,6) DEFAULT 0.000000 COMMENT 'budget warning at percentage',
560 `budget_expend` decimal(28,6) DEFAULT 0.000000 COMMENT 'budget warning at amount',
561 `budget_notes` longtext DEFAULT NULL COMMENT 'notes related to this fund',
562 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this fund was last touched (created or modified)',
563 `budget_period_id` int(11) NOT NULL COMMENT 'id of the budget that this fund belongs to (aqbudgetperiods.budget_period_id)',
564 `sort1_authcat` varchar(80) DEFAULT NULL COMMENT 'statistical category for this fund',
565 `sort2_authcat` varchar(80) DEFAULT NULL COMMENT 'second statistical category for this fund',
566 `budget_owner_id` int(11) DEFAULT NULL COMMENT 'borrowernumber of the person who owns this fund (borrowers.borrowernumber)',
567 `budget_permission` int(1) DEFAULT 0 COMMENT 'level of permission for this fund (used only by the owner, only by the library, or anyone)',
568 PRIMARY KEY (`budget_id`),
569 KEY `budget_parent_id` (`budget_parent_id`),
570 KEY `budget_code` (`budget_code`),
571 KEY `budget_branchcode` (`budget_branchcode`),
572 KEY `budget_period_id` (`budget_period_id`),
573 KEY `budget_owner_id` (`budget_owner_id`),
574 CONSTRAINT `aqbudgetperiods_ibfk_1` FOREIGN KEY (`budget_period_id`) REFERENCES `aqbudgetperiods` (`budget_period_id`) ON DELETE CASCADE ON UPDATE CASCADE
575 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
576 /*!40101 SET character_set_client = @saved_cs_client */;
579 -- Table structure for table `aqbudgets_planning`
582 DROP TABLE IF EXISTS `aqbudgets_planning`;
583 /*!40101 SET @saved_cs_client = @@character_set_client */;
584 /*!40101 SET character_set_client = utf8 */;
585 CREATE TABLE `aqbudgets_planning` (
586 `plan_id` int(11) NOT NULL AUTO_INCREMENT,
587 `budget_id` int(11) NOT NULL,
588 `budget_period_id` int(11) NOT NULL,
589 `estimated_amount` decimal(28,6) DEFAULT NULL,
590 `authcat` varchar(30) NOT NULL,
591 `authvalue` varchar(30) NOT NULL,
592 `display` tinyint(1) DEFAULT 1,
593 PRIMARY KEY (`plan_id`),
594 KEY `budget_period_id` (`budget_period_id`),
595 KEY `aqbudgets_planning_ifbk_1` (`budget_id`),
596 CONSTRAINT `aqbudgets_planning_ifbk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE
597 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
598 /*!40101 SET character_set_client = @saved_cs_client */;
601 -- Table structure for table `aqcontacts`
604 DROP TABLE IF EXISTS `aqcontacts`;
605 /*!40101 SET @saved_cs_client = @@character_set_client */;
606 /*!40101 SET character_set_client = utf8 */;
607 CREATE TABLE `aqcontacts` (
608 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned by Koha',
609 `name` varchar(100) DEFAULT NULL COMMENT 'name of contact at vendor',
610 `position` varchar(100) DEFAULT NULL COMMENT 'contact person''s position',
611 `phone` varchar(100) DEFAULT NULL COMMENT 'contact''s phone number',
612 `altphone` varchar(100) DEFAULT NULL COMMENT 'contact''s alternate phone number',
613 `fax` varchar(100) DEFAULT NULL COMMENT 'contact''s fax number',
614 `email` varchar(100) DEFAULT NULL COMMENT 'contact''s email address',
615 `notes` longtext DEFAULT NULL COMMENT 'notes related to the contact',
616 `orderacquisition` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive acquisition orders',
617 `claimacquisition` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive acquisitions claims',
618 `claimissues` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive serial claims',
619 `acqprimary` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is this the primary contact for acquisitions messages',
620 `serialsprimary` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is this the primary contact for serials messages',
621 `booksellerid` int(11) NOT NULL,
623 KEY `booksellerid_aqcontacts_fk` (`booksellerid`),
624 CONSTRAINT `booksellerid_aqcontacts_fk` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
625 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
626 /*!40101 SET character_set_client = @saved_cs_client */;
629 -- Table structure for table `aqcontract`
632 DROP TABLE IF EXISTS `aqcontract`;
633 /*!40101 SET @saved_cs_client = @@character_set_client */;
634 /*!40101 SET character_set_client = utf8 */;
635 CREATE TABLE `aqcontract` (
636 `contractnumber` int(11) NOT NULL AUTO_INCREMENT,
637 `contractstartdate` date DEFAULT NULL,
638 `contractenddate` date DEFAULT NULL,
639 `contractname` varchar(50) DEFAULT NULL,
640 `contractdescription` longtext DEFAULT NULL,
641 `booksellerid` int(11) NOT NULL,
642 PRIMARY KEY (`contractnumber`),
643 KEY `booksellerid_fk1` (`booksellerid`),
644 CONSTRAINT `booksellerid_fk1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
645 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
646 /*!40101 SET character_set_client = @saved_cs_client */;
649 -- Table structure for table `aqinvoice_adjustments`
652 DROP TABLE IF EXISTS `aqinvoice_adjustments`;
653 /*!40101 SET @saved_cs_client = @@character_set_client */;
654 /*!40101 SET character_set_client = utf8 */;
655 CREATE TABLE `aqinvoice_adjustments` (
656 `adjustment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key for adjustments',
657 `invoiceid` int(11) NOT NULL COMMENT 'foreign key to link an adjustment to an invoice',
658 `adjustment` decimal(28,6) DEFAULT NULL COMMENT 'amount of adjustment',
659 `reason` varchar(80) DEFAULT NULL COMMENT 'reason for adjustment defined by authorised values in ADJ_REASON category',
660 `note` mediumtext DEFAULT NULL COMMENT 'text to explain adjustment',
661 `budget_id` int(11) DEFAULT NULL COMMENT 'optional link to budget to apply adjustment to',
662 `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',
663 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'timestamp of last adjustment to adjustment',
664 PRIMARY KEY (`adjustment_id`),
665 KEY `aqinvoice_adjustments_fk_invoiceid` (`invoiceid`),
666 KEY `aqinvoice_adjustments_fk_budget_id` (`budget_id`),
667 CONSTRAINT `aqinvoice_adjustments_fk_budget_id` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
668 CONSTRAINT `aqinvoice_adjustments_fk_invoiceid` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE CASCADE ON UPDATE CASCADE
669 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
670 /*!40101 SET character_set_client = @saved_cs_client */;
673 -- Table structure for table `aqinvoices`
676 DROP TABLE IF EXISTS `aqinvoices`;
677 /*!40101 SET @saved_cs_client = @@character_set_client */;
678 /*!40101 SET character_set_client = utf8 */;
679 CREATE TABLE `aqinvoices` (
680 `invoiceid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the invoice, primary key',
681 `invoicenumber` longtext NOT NULL COMMENT 'Name of invoice',
682 `booksellerid` int(11) NOT NULL COMMENT 'foreign key to aqbooksellers',
683 `shipmentdate` date DEFAULT NULL COMMENT 'date of shipment',
684 `billingdate` date DEFAULT NULL COMMENT 'date of billing',
685 `closedate` date DEFAULT NULL COMMENT 'invoice close date, NULL means the invoice is open',
686 `shipmentcost` decimal(28,6) DEFAULT NULL COMMENT 'shipment cost',
687 `shipmentcost_budgetid` int(11) DEFAULT NULL COMMENT 'foreign key to aqbudgets, link the shipment cost to a budget',
688 `message_id` int(11) DEFAULT NULL COMMENT 'foreign key to edifact invoice message',
689 PRIMARY KEY (`invoiceid`),
690 KEY `aqinvoices_fk_aqbooksellerid` (`booksellerid`),
691 KEY `edifact_msg_fk` (`message_id`),
692 KEY `aqinvoices_fk_shipmentcost_budgetid` (`shipmentcost_budgetid`),
693 CONSTRAINT `aqinvoices_fk_aqbooksellerid` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
694 CONSTRAINT `aqinvoices_fk_shipmentcost_budgetid` FOREIGN KEY (`shipmentcost_budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
695 CONSTRAINT `edifact_msg_fk` FOREIGN KEY (`message_id`) REFERENCES `edifact_messages` (`id`) ON DELETE SET NULL
696 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
697 /*!40101 SET character_set_client = @saved_cs_client */;
700 -- Table structure for table `aqorder_users`
703 DROP TABLE IF EXISTS `aqorder_users`;
704 /*!40101 SET @saved_cs_client = @@character_set_client */;
705 /*!40101 SET character_set_client = utf8 */;
706 CREATE TABLE `aqorder_users` (
707 `ordernumber` int(11) NOT NULL COMMENT 'the order this patrons receive notifications from (aqorders.ordernumber)',
708 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber for the patron receiving notifications for this order (borrowers.borrowernumber)',
709 PRIMARY KEY (`ordernumber`,`borrowernumber`),
710 KEY `aqorder_users_ibfk_2` (`borrowernumber`),
711 CONSTRAINT `aqorder_users_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
712 CONSTRAINT `aqorder_users_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
713 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
714 /*!40101 SET character_set_client = @saved_cs_client */;
717 -- Table structure for table `aqorders`
720 DROP TABLE IF EXISTS `aqorders`;
721 /*!40101 SET @saved_cs_client = @@character_set_client */;
722 /*!40101 SET character_set_client = utf8 */;
723 CREATE TABLE `aqorders` (
724 `ordernumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha to each line',
725 `biblionumber` int(11) DEFAULT NULL COMMENT 'links the order to the biblio being ordered (biblio.biblionumber)',
726 `deleted_biblionumber` int(11) DEFAULT NULL COMMENT 'links the order to the deleted bibliographic record (deletedbiblio.biblionumber)',
727 `entrydate` date DEFAULT NULL COMMENT 'the date the bib was added to the basket',
728 `quantity` smallint(6) DEFAULT NULL COMMENT 'the quantity ordered',
729 `currency` varchar(10) DEFAULT NULL COMMENT 'the currency used for the purchase',
730 `listprice` decimal(28,6) DEFAULT NULL COMMENT 'the vendor price for this line item',
731 `datereceived` date DEFAULT NULL COMMENT 'the date this order was received',
732 `invoiceid` int(11) DEFAULT NULL COMMENT 'id of invoice',
733 `freight` decimal(28,6) DEFAULT NULL COMMENT 'shipping costs (not used)',
734 `unitprice` decimal(28,6) DEFAULT NULL COMMENT 'the actual cost entered when receiving this line item',
735 `unitprice_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the unit price excluding tax (on receiving)',
736 `unitprice_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the unit price including tax (on receiving)',
737 `quantityreceived` smallint(6) NOT NULL DEFAULT 0 COMMENT 'the quantity that have been received so far',
738 `created_by` int(11) DEFAULT NULL COMMENT 'the borrowernumber of order line''s creator',
739 `datecancellationprinted` date DEFAULT NULL COMMENT 'the date the line item was deleted',
740 `cancellationreason` mediumtext DEFAULT NULL COMMENT 'reason of cancellation',
741 `order_internalnote` longtext DEFAULT NULL COMMENT 'notes related to this order line, made for staff',
742 `order_vendornote` longtext DEFAULT NULL COMMENT 'notes related to this order line, made for vendor',
743 `basketno` int(11) DEFAULT NULL COMMENT 'links this order line to a specific basket (aqbasket.basketno)',
744 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this order line was last modified',
745 `rrp` decimal(13,2) DEFAULT NULL COMMENT 'the retail cost for this line item',
746 `replacementprice` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost for this line item',
747 `rrp_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost excluding tax',
748 `rrp_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost including tax',
749 `ecost` decimal(13,2) DEFAULT NULL COMMENT 'the replacement cost for this line item',
750 `ecost_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the estimated cost excluding tax',
751 `ecost_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the estimated cost including tax',
752 `tax_rate_bak` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate for this line item (%)',
753 `tax_rate_on_ordering` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate on ordering for this line item (%)',
754 `tax_rate_on_receiving` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate on receiving for this line item (%)',
755 `tax_value_bak` decimal(28,6) DEFAULT NULL COMMENT 'the tax value for this line item',
756 `tax_value_on_ordering` decimal(28,6) DEFAULT NULL COMMENT 'the tax value on ordering for this line item',
757 `tax_value_on_receiving` decimal(28,6) DEFAULT NULL COMMENT 'the tax value on receiving for this line item',
758 `discount` float(6,4) DEFAULT NULL COMMENT 'the discount for this line item (%)',
759 `budget_id` int(11) NOT NULL COMMENT 'the fund this order goes against (aqbudgets.budget_id)',
760 `budgetdate` date DEFAULT NULL COMMENT 'not used? always NULL',
761 `sort1` varchar(80) DEFAULT NULL COMMENT 'statistical field',
762 `sort2` varchar(80) DEFAULT NULL COMMENT 'second statistical field',
763 `sort1_authcat` varchar(10) DEFAULT NULL,
764 `sort2_authcat` varchar(10) DEFAULT NULL,
765 `uncertainprice` tinyint(1) DEFAULT NULL COMMENT 'was this price uncertain (1 for yes, 0 for no)',
766 `subscriptionid` int(11) DEFAULT NULL COMMENT 'links this order line to a subscription (subscription.subscriptionid)',
767 `parent_ordernumber` int(11) DEFAULT NULL COMMENT 'ordernumber of parent order line, or same as ordernumber if no parent',
768 `orderstatus` varchar(16) DEFAULT 'new' COMMENT 'the current status for this line item. Can be ''new'', ''ordered'', ''partial'', ''complete'' or ''cancelled''',
769 `line_item_id` varchar(35) DEFAULT NULL COMMENT 'Supplier''s article id for Edifact orderline',
770 `suppliers_reference_number` varchar(35) DEFAULT NULL COMMENT 'Suppliers unique edifact quote ref',
771 `suppliers_reference_qualifier` varchar(3) DEFAULT NULL COMMENT 'Type of number above usually ''QLI''',
772 `suppliers_report` mediumtext DEFAULT NULL COMMENT 'reports received from suppliers',
773 `estimated_delivery_date` date DEFAULT NULL COMMENT 'Estimated delivery date',
774 `invoice_unitprice` decimal(28,6) DEFAULT NULL COMMENT 'the unit price in foreign currency',
775 `invoice_currency` varchar(10) DEFAULT NULL COMMENT 'the currency of the invoice_unitprice',
776 PRIMARY KEY (`ordernumber`),
777 KEY `basketno` (`basketno`),
778 KEY `biblionumber` (`biblionumber`),
779 KEY `budget_id` (`budget_id`),
780 KEY `parent_ordernumber` (`parent_ordernumber`),
781 KEY `orderstatus` (`orderstatus`),
782 KEY `aqorders_created_by` (`created_by`),
783 KEY `aqorders_ibfk_3` (`invoiceid`),
784 KEY `aqorders_subscriptionid` (`subscriptionid`),
785 KEY `aqorders_currency` (`currency`),
786 KEY `aqorders_invoice_currency` (`invoice_currency`),
787 CONSTRAINT `aqorders_budget_id_fk` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
788 CONSTRAINT `aqorders_created_by` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
789 CONSTRAINT `aqorders_currency` FOREIGN KEY (`currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
790 CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
791 CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
792 CONSTRAINT `aqorders_ibfk_3` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE SET NULL ON UPDATE CASCADE,
793 CONSTRAINT `aqorders_invoice_currency` FOREIGN KEY (`invoice_currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
794 CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE SET NULL ON UPDATE CASCADE
795 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
796 /*!40101 SET character_set_client = @saved_cs_client */;
799 -- Table structure for table `aqorders_claims`
802 DROP TABLE IF EXISTS `aqorders_claims`;
803 /*!40101 SET @saved_cs_client = @@character_set_client */;
804 /*!40101 SET character_set_client = utf8 */;
805 CREATE TABLE `aqorders_claims` (
806 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the claims',
807 `ordernumber` int(11) NOT NULL COMMENT 'order linked to this claim',
808 `claimed_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date of the claims',
810 KEY `aqorders_claims_ibfk_1` (`ordernumber`),
811 CONSTRAINT `aqorders_claims_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE
812 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
813 /*!40101 SET character_set_client = @saved_cs_client */;
816 -- Table structure for table `aqorders_items`
819 DROP TABLE IF EXISTS `aqorders_items`;
820 /*!40101 SET @saved_cs_client = @@character_set_client */;
821 /*!40101 SET character_set_client = utf8 */;
822 CREATE TABLE `aqorders_items` (
823 `ordernumber` int(11) NOT NULL COMMENT 'the order this item is attached to (aqorders.ordernumber)',
824 `itemnumber` int(11) NOT NULL COMMENT 'the item number for this item (items.itemnumber)',
825 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this order item was last touched',
826 PRIMARY KEY (`itemnumber`),
827 KEY `ordernumber` (`ordernumber`),
828 CONSTRAINT `aqorders_items_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE
829 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
830 /*!40101 SET character_set_client = @saved_cs_client */;
833 -- Table structure for table `aqorders_transfers`
836 DROP TABLE IF EXISTS `aqorders_transfers`;
837 /*!40101 SET @saved_cs_client = @@character_set_client */;
838 /*!40101 SET character_set_client = utf8 */;
839 CREATE TABLE `aqorders_transfers` (
840 `ordernumber_from` int(11) DEFAULT NULL,
841 `ordernumber_to` int(11) DEFAULT NULL,
842 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
843 UNIQUE KEY `ordernumber_from` (`ordernumber_from`),
844 UNIQUE KEY `ordernumber_to` (`ordernumber_to`),
845 CONSTRAINT `aqorders_transfers_ordernumber_from` FOREIGN KEY (`ordernumber_from`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
846 CONSTRAINT `aqorders_transfers_ordernumber_to` FOREIGN KEY (`ordernumber_to`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE
847 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
848 /*!40101 SET character_set_client = @saved_cs_client */;
851 -- Table structure for table `article_requests`
854 DROP TABLE IF EXISTS `article_requests`;
855 /*!40101 SET @saved_cs_client = @@character_set_client */;
856 /*!40101 SET character_set_client = utf8 */;
857 CREATE TABLE `article_requests` (
858 `id` int(11) NOT NULL AUTO_INCREMENT,
859 `borrowernumber` int(11) NOT NULL,
860 `biblionumber` int(11) NOT NULL,
861 `itemnumber` int(11) DEFAULT NULL,
862 `branchcode` varchar(10) DEFAULT NULL,
863 `title` mediumtext DEFAULT NULL,
864 `author` mediumtext DEFAULT NULL,
865 `volume` mediumtext DEFAULT NULL,
866 `issue` mediumtext DEFAULT NULL,
867 `date` mediumtext DEFAULT NULL,
868 `pages` mediumtext DEFAULT NULL,
869 `chapters` mediumtext DEFAULT NULL,
870 `patron_notes` mediumtext DEFAULT NULL,
871 `status` enum('REQUESTED','PENDING','PROCESSING','COMPLETED','CANCELED') NOT NULL DEFAULT 'REQUESTED',
872 `notes` mediumtext DEFAULT NULL,
873 `format` enum('PHOTOCOPY','SCAN') NOT NULL DEFAULT 'PHOTOCOPY',
874 `urls` mediumtext DEFAULT NULL,
875 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value AR_CANCELLATION',
876 `debit_id` int(11) DEFAULT NULL COMMENT 'Debit line with cost for article scan request',
877 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Be careful with two timestamps in one table not allowing NULL',
878 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
879 `toc_request` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'borrower requested table of contents',
881 KEY `borrowernumber` (`borrowernumber`),
882 KEY `biblionumber` (`biblionumber`),
883 KEY `itemnumber` (`itemnumber`),
884 KEY `branchcode` (`branchcode`),
885 KEY `debit_id` (`debit_id`),
886 CONSTRAINT `article_requests_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
887 CONSTRAINT `article_requests_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
888 CONSTRAINT `article_requests_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
889 CONSTRAINT `article_requests_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
890 CONSTRAINT `article_requests_ibfk_5` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE SET NULL ON UPDATE CASCADE
891 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
892 /*!40101 SET character_set_client = @saved_cs_client */;
895 -- Table structure for table `audio_alerts`
898 DROP TABLE IF EXISTS `audio_alerts`;
899 /*!40101 SET @saved_cs_client = @@character_set_client */;
900 /*!40101 SET character_set_client = utf8 */;
901 CREATE TABLE `audio_alerts` (
902 `id` int(11) NOT NULL AUTO_INCREMENT,
903 `precedence` smallint(5) unsigned NOT NULL,
904 `selector` varchar(255) NOT NULL,
905 `sound` varchar(255) NOT NULL,
907 KEY `precedence` (`precedence`)
908 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
909 /*!40101 SET character_set_client = @saved_cs_client */;
912 -- Table structure for table `auth_header`
915 DROP TABLE IF EXISTS `auth_header`;
916 /*!40101 SET @saved_cs_client = @@character_set_client */;
917 /*!40101 SET character_set_client = utf8 */;
918 CREATE TABLE `auth_header` (
919 `authid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
920 `authtypecode` varchar(10) NOT NULL DEFAULT '',
921 `datecreated` date DEFAULT NULL,
922 `modification_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
923 `origincode` varchar(20) DEFAULT NULL,
924 `authtrees` longtext DEFAULT NULL,
925 `marc` blob DEFAULT NULL,
926 `linkid` bigint(20) DEFAULT NULL,
927 `marcxml` longtext NOT NULL,
928 PRIMARY KEY (`authid`),
929 KEY `origincode` (`origincode`)
930 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
931 /*!40101 SET character_set_client = @saved_cs_client */;
934 -- Table structure for table `auth_subfield_structure`
937 DROP TABLE IF EXISTS `auth_subfield_structure`;
938 /*!40101 SET @saved_cs_client = @@character_set_client */;
939 /*!40101 SET character_set_client = utf8 */;
940 CREATE TABLE `auth_subfield_structure` (
941 `authtypecode` varchar(10) NOT NULL DEFAULT '',
942 `tagfield` varchar(3) NOT NULL DEFAULT '',
943 `tagsubfield` varchar(1) NOT NULL DEFAULT '',
944 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
945 `libopac` varchar(255) NOT NULL DEFAULT '',
946 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
947 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
948 `tab` tinyint(1) DEFAULT NULL,
949 `authorised_value` varchar(32) DEFAULT NULL,
950 `value_builder` varchar(80) DEFAULT NULL,
951 `seealso` varchar(255) DEFAULT NULL,
952 `isurl` tinyint(1) DEFAULT NULL,
953 `hidden` tinyint(3) NOT NULL DEFAULT 0,
954 `linkid` tinyint(1) NOT NULL DEFAULT 0,
955 `kohafield` varchar(45) DEFAULT '',
956 `frameworkcode` varchar(10) NOT NULL DEFAULT '',
957 `defaultvalue` mediumtext DEFAULT NULL,
958 `display_order` int(2) NOT NULL DEFAULT 0,
959 PRIMARY KEY (`authtypecode`,`tagfield`,`tagsubfield`),
960 KEY `tab` (`authtypecode`,`tab`),
961 CONSTRAINT `auth_subfield_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
962 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
963 /*!40101 SET character_set_client = @saved_cs_client */;
966 -- Table structure for table `auth_tag_structure`
969 DROP TABLE IF EXISTS `auth_tag_structure`;
970 /*!40101 SET @saved_cs_client = @@character_set_client */;
971 /*!40101 SET character_set_client = utf8 */;
972 CREATE TABLE `auth_tag_structure` (
973 `authtypecode` varchar(10) NOT NULL DEFAULT '',
974 `tagfield` varchar(3) NOT NULL DEFAULT '',
975 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
976 `libopac` varchar(255) NOT NULL DEFAULT '',
977 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
978 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
979 `authorised_value` varchar(32) DEFAULT NULL,
980 PRIMARY KEY (`authtypecode`,`tagfield`),
981 CONSTRAINT `auth_tag_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
982 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
983 /*!40101 SET character_set_client = @saved_cs_client */;
986 -- Table structure for table `auth_types`
989 DROP TABLE IF EXISTS `auth_types`;
990 /*!40101 SET @saved_cs_client = @@character_set_client */;
991 /*!40101 SET character_set_client = utf8 */;
992 CREATE TABLE `auth_types` (
993 `authtypecode` varchar(10) NOT NULL DEFAULT '',
994 `authtypetext` varchar(255) NOT NULL DEFAULT '',
995 `auth_tag_to_report` varchar(3) NOT NULL DEFAULT '',
996 `summary` longtext NOT NULL,
997 PRIMARY KEY (`authtypecode`)
998 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
999 /*!40101 SET character_set_client = @saved_cs_client */;
1002 -- Table structure for table `authorised_value_categories`
1005 DROP TABLE IF EXISTS `authorised_value_categories`;
1006 /*!40101 SET @saved_cs_client = @@character_set_client */;
1007 /*!40101 SET character_set_client = utf8 */;
1008 CREATE TABLE `authorised_value_categories` (
1009 `category_name` varchar(32) NOT NULL DEFAULT '',
1010 `is_system` tinyint(1) DEFAULT 0,
1011 PRIMARY KEY (`category_name`)
1012 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1013 /*!40101 SET character_set_client = @saved_cs_client */;
1016 -- Table structure for table `authorised_values`
1019 DROP TABLE IF EXISTS `authorised_values`;
1020 /*!40101 SET @saved_cs_client = @@character_set_client */;
1021 /*!40101 SET character_set_client = utf8 */;
1022 CREATE TABLE `authorised_values` (
1023 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify the authorized value',
1024 `category` varchar(32) NOT NULL DEFAULT '' COMMENT 'key used to identify the authorized value category',
1025 `authorised_value` varchar(80) NOT NULL DEFAULT '' COMMENT 'code use to identify the authorized value',
1026 `lib` varchar(200) DEFAULT NULL COMMENT 'authorized value description as printed in the staff interface',
1027 `lib_opac` varchar(200) DEFAULT NULL COMMENT 'authorized value description as printed in the OPAC',
1028 `imageurl` varchar(200) DEFAULT NULL COMMENT 'authorized value URL',
1030 UNIQUE KEY `av_uniq` (`category`,`authorised_value`),
1031 KEY `name` (`category`),
1032 KEY `lib` (`lib`(191)),
1033 KEY `auth_value_idx` (`authorised_value`),
1034 CONSTRAINT `authorised_values_authorised_values_category` FOREIGN KEY (`category`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE CASCADE ON UPDATE CASCADE
1035 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1036 /*!40101 SET character_set_client = @saved_cs_client */;
1039 -- Table structure for table `authorised_values_branches`
1042 DROP TABLE IF EXISTS `authorised_values_branches`;
1043 /*!40101 SET @saved_cs_client = @@character_set_client */;
1044 /*!40101 SET character_set_client = utf8 */;
1045 CREATE TABLE `authorised_values_branches` (
1046 `av_id` int(11) NOT NULL,
1047 `branchcode` varchar(10) NOT NULL,
1048 KEY `av_id` (`av_id`),
1049 KEY `branchcode` (`branchcode`),
1050 CONSTRAINT `authorised_values_branches_ibfk_1` FOREIGN KEY (`av_id`) REFERENCES `authorised_values` (`id`) ON DELETE CASCADE,
1051 CONSTRAINT `authorised_values_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1052 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1053 /*!40101 SET character_set_client = @saved_cs_client */;
1056 -- Table structure for table `background_jobs`
1059 DROP TABLE IF EXISTS `background_jobs`;
1060 /*!40101 SET @saved_cs_client = @@character_set_client */;
1061 /*!40101 SET character_set_client = utf8 */;
1062 CREATE TABLE `background_jobs` (
1063 `id` int(11) NOT NULL AUTO_INCREMENT,
1064 `status` varchar(32) DEFAULT NULL,
1065 `progress` int(11) DEFAULT NULL,
1066 `size` int(11) DEFAULT NULL,
1067 `borrowernumber` int(11) DEFAULT NULL,
1068 `type` varchar(64) DEFAULT NULL,
1069 `queue` varchar(191) NOT NULL DEFAULT 'default' COMMENT 'Name of the queue the job is sent to',
1070 `data` longtext DEFAULT NULL,
1071 `context` longtext DEFAULT NULL COMMENT 'JSON-serialized context information for the job',
1072 `enqueued_on` datetime DEFAULT NULL,
1073 `started_on` datetime DEFAULT NULL,
1074 `ended_on` datetime DEFAULT NULL,
1076 KEY `borrowernumber` (`borrowernumber`),
1077 KEY `queue` (`queue`),
1078 KEY `status` (`status`)
1079 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1080 /*!40101 SET character_set_client = @saved_cs_client */;
1083 -- Table structure for table `biblio`
1086 DROP TABLE IF EXISTS `biblio`;
1087 /*!40101 SET @saved_cs_client = @@character_set_client */;
1088 /*!40101 SET character_set_client = utf8 */;
1089 CREATE TABLE `biblio` (
1090 `biblionumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned to each bibliographic record',
1091 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'foreign key from the biblio_framework table to identify which framework was used in cataloging this record',
1092 `author` longtext DEFAULT NULL COMMENT 'statement of responsibility from MARC record (100$a in MARC21)',
1093 `title` longtext DEFAULT NULL COMMENT 'title (without the subtitle) from the MARC record (245$a in MARC21)',
1094 `medium` longtext DEFAULT NULL COMMENT 'medium from the MARC record (245$h in MARC21)',
1095 `subtitle` longtext DEFAULT NULL COMMENT 'remainder of the title from the MARC record (245$b in MARC21)',
1096 `part_number` longtext DEFAULT NULL COMMENT 'part number from the MARC record (245$n in MARC21)',
1097 `part_name` longtext DEFAULT NULL COMMENT 'part name from the MARC record (245$p in MARC21)',
1098 `unititle` longtext DEFAULT NULL COMMENT 'uniform title (without the subtitle) from the MARC record (240$a in MARC21)',
1099 `notes` longtext DEFAULT NULL COMMENT 'values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)',
1100 `serial` tinyint(1) DEFAULT NULL COMMENT 'Boolean indicating whether biblio is for a serial',
1101 `seriestitle` longtext DEFAULT NULL,
1102 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'publication or copyright date from the MARC record',
1103 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
1104 `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
1105 `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
1106 PRIMARY KEY (`biblionumber`),
1107 KEY `blbnoidx` (`biblionumber`)
1108 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1109 /*!40101 SET character_set_client = @saved_cs_client */;
1112 -- Table structure for table `biblio_framework`
1115 DROP TABLE IF EXISTS `biblio_framework`;
1116 /*!40101 SET @saved_cs_client = @@character_set_client */;
1117 /*!40101 SET character_set_client = utf8 */;
1118 CREATE TABLE `biblio_framework` (
1119 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'the unique code assigned to the framework',
1120 `frameworktext` varchar(255) NOT NULL DEFAULT '' COMMENT 'the description/name given to the framework',
1121 PRIMARY KEY (`frameworkcode`)
1122 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1123 /*!40101 SET character_set_client = @saved_cs_client */;
1126 -- Table structure for table `record_sources`
1129 DROP TABLE IF EXISTS `record_sources`;
1130 /*!40101 SET @saved_cs_client = @@character_set_client */;
1131 /*!40101 SET character_set_client = utf8 */;
1132 CREATE TABLE `record_sources` (
1133 `record_source_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Primary key for the `record_sources` table',
1134 `name` text NOT NULL COMMENT 'User defined name for the record source',
1135 `can_be_edited` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If records from this source can be edited',
1136 PRIMARY KEY (`record_source_id`)
1137 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1138 /*!40101 SET character_set_client = @saved_cs_client */;
1141 -- Table structure for table `biblio_metadata`
1144 DROP TABLE IF EXISTS `biblio_metadata`;
1145 /*!40101 SET @saved_cs_client = @@character_set_client */;
1146 /*!40101 SET character_set_client = utf8 */;
1147 CREATE TABLE `biblio_metadata` (
1148 `id` int(11) NOT NULL AUTO_INCREMENT,
1149 `biblionumber` int(11) NOT NULL,
1150 `format` varchar(16) NOT NULL,
1151 `schema` varchar(16) NOT NULL,
1152 `metadata` longtext NOT NULL,
1153 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1154 `record_source_id` int(11) NULL DEFAULT NULL COMMENT 'The record source for the metadata',
1156 UNIQUE KEY `biblio_metadata_uniq_key` (`biblionumber`,`format`,`schema`),
1157 KEY `timestamp` (`timestamp`),
1158 CONSTRAINT `record_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1159 CONSTRAINT `record_metadata_fk_2` FOREIGN KEY (`record_source_id`) REFERENCES `record_sources` (`record_source_id`) ON DELETE CASCADE ON UPDATE CASCADE
1160 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1161 /*!40101 SET character_set_client = @saved_cs_client */;
1164 -- Table structure for table `biblioitems`
1167 DROP TABLE IF EXISTS `biblioitems`;
1168 /*!40101 SET @saved_cs_client = @@character_set_client */;
1169 /*!40101 SET character_set_client = utf8 */;
1170 CREATE TABLE `biblioitems` (
1171 `biblioitemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, unique identifier assigned by Koha',
1172 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the biblio table',
1173 `volume` longtext DEFAULT NULL,
1174 `number` longtext DEFAULT NULL,
1175 `itemtype` varchar(10) DEFAULT NULL COMMENT 'biblio level item type (MARC21 942$c)',
1176 `isbn` longtext DEFAULT NULL COMMENT 'ISBN (MARC21 020$a)',
1177 `issn` longtext DEFAULT NULL COMMENT 'ISSN (MARC21 022$a)',
1178 `ean` longtext DEFAULT NULL,
1179 `publicationyear` mediumtext DEFAULT NULL,
1180 `publishercode` text DEFAULT NULL COMMENT 'publisher (MARC21 260$b and 264$b)',
1181 `volumedate` date DEFAULT NULL,
1182 `volumedesc` mediumtext DEFAULT NULL COMMENT 'volume information (MARC21 362$a)',
1183 `collectiontitle` longtext DEFAULT NULL,
1184 `collectionissn` mediumtext DEFAULT NULL,
1185 `collectionvolume` longtext DEFAULT NULL,
1186 `editionstatement` mediumtext DEFAULT NULL,
1187 `editionresponsibility` mediumtext DEFAULT NULL,
1188 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1189 `illus` text DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)',
1190 `pages` text DEFAULT NULL COMMENT 'number of pages (MARC21 300$a)',
1191 `notes` longtext DEFAULT NULL,
1192 `size` text DEFAULT NULL COMMENT 'material size (MARC21 300$c)',
1193 `place` text DEFAULT NULL COMMENT 'publication place (MARC21 260$a and 264$a)',
1194 `lccn` longtext DEFAULT NULL COMMENT 'library of congress control number (MARC21 010$a)',
1195 `url` mediumtext DEFAULT NULL COMMENT 'url (MARC21 856$u)',
1196 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source (MARC21 942$2)',
1197 `cn_class` varchar(30) DEFAULT NULL,
1198 `cn_item` varchar(10) DEFAULT NULL,
1199 `cn_suffix` varchar(10) DEFAULT NULL,
1200 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized version of the call number used for sorting',
1201 `agerestriction` varchar(255) DEFAULT NULL COMMENT 'target audience/age restriction from the bib record (MARC21 521$a)',
1202 `totalissues` int(10) DEFAULT NULL,
1203 PRIMARY KEY (`biblioitemnumber`),
1204 KEY `bibinoidx` (`biblioitemnumber`),
1205 KEY `bibnoidx` (`biblionumber`),
1206 KEY `itemtype_idx` (`itemtype`),
1207 KEY `isbn` (`isbn`(191)),
1208 KEY `issn` (`issn`(191)),
1209 KEY `ean` (`ean`(191)),
1210 KEY `publishercode` (`publishercode`(191)),
1211 KEY `timestamp` (`timestamp`),
1212 CONSTRAINT `biblioitems_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1213 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1214 /*!40101 SET character_set_client = @saved_cs_client */;
1217 -- Table structure for table `bookings`
1220 DROP TABLE IF EXISTS `bookings`;
1221 /*!40101 SET @saved_cs_client = @@character_set_client */;
1222 /*!40101 SET character_set_client = utf8 */;
1223 CREATE TABLE `bookings` (
1224 `booking_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
1225 `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this booking is for',
1226 `biblio_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this booking is on',
1227 `item_id` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed a booking for',
1228 `pickup_library_id` varchar(10) NOT NULL COMMENT 'Identifier for booking pickup library',
1229 `start_date` datetime DEFAULT NULL COMMENT 'the start date of the booking',
1230 `end_date` datetime DEFAULT NULL COMMENT 'the end date of the booking',
1231 PRIMARY KEY (`booking_id`),
1232 KEY `patron_id` (`patron_id`),
1233 KEY `biblio_id` (`biblio_id`),
1234 KEY `item_id` (`item_id`),
1235 CONSTRAINT `bookings_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1236 CONSTRAINT `bookings_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1237 CONSTRAINT `bookings_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1238 CONSTRAINT `bookings_ibfk_4` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1239 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1240 /*!40101 SET character_set_client = @saved_cs_client */;
1243 -- Table structure for table `borrower_attribute_types`
1246 DROP TABLE IF EXISTS `borrower_attribute_types`;
1247 /*!40101 SET @saved_cs_client = @@character_set_client */;
1248 /*!40101 SET character_set_client = utf8 */;
1249 CREATE TABLE `borrower_attribute_types` (
1250 `code` varchar(10) NOT NULL COMMENT 'unique key used to identify each custom field',
1251 `description` varchar(255) NOT NULL COMMENT 'description for each custom field',
1252 `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)',
1253 `unique_id` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this value needs to be unique (1 for yes, 0 for no)',
1254 `is_date` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is displayed as a date',
1255 `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)',
1256 `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)',
1257 `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)',
1258 `searched_by_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is included in "Standard" patron searches in the staff interface (1 for yes, 0 for no)',
1259 `authorised_value_category` varchar(32) DEFAULT NULL COMMENT 'foreign key from authorised_values that links this custom field to an authorized value category',
1260 `display_checkout` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field displays in checkout screens',
1261 `category_code` varchar(10) DEFAULT NULL COMMENT 'defines a category for an attribute_type',
1262 `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1263 `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)',
1264 `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1265 PRIMARY KEY (`code`),
1266 KEY `auth_val_cat_idx` (`authorised_value_category`),
1267 KEY `category_code` (`category_code`),
1268 CONSTRAINT `borrower_attribute_types_ibfk_1` FOREIGN KEY (`category_code`) REFERENCES `categories` (`categorycode`)
1269 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1270 /*!40101 SET character_set_client = @saved_cs_client */;
1273 -- Table structure for table `borrower_attribute_types_branches`
1276 DROP TABLE IF EXISTS `borrower_attribute_types_branches`;
1277 /*!40101 SET @saved_cs_client = @@character_set_client */;
1278 /*!40101 SET character_set_client = utf8 */;
1279 CREATE TABLE `borrower_attribute_types_branches` (
1280 `bat_code` varchar(10) DEFAULT NULL,
1281 `b_branchcode` varchar(10) DEFAULT NULL,
1282 KEY `bat_code` (`bat_code`),
1283 KEY `b_branchcode` (`b_branchcode`),
1284 CONSTRAINT `borrower_attribute_types_branches_ibfk_1` FOREIGN KEY (`bat_code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE,
1285 CONSTRAINT `borrower_attribute_types_branches_ibfk_2` FOREIGN KEY (`b_branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1286 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1287 /*!40101 SET character_set_client = @saved_cs_client */;
1290 -- Table structure for table `borrower_attributes`
1293 DROP TABLE IF EXISTS `borrower_attributes`;
1294 /*!40101 SET @saved_cs_client = @@character_set_client */;
1295 /*!40101 SET character_set_client = utf8 */;
1296 CREATE TABLE `borrower_attributes` (
1297 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
1298 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines which patron/borrower has this attribute',
1299 `code` varchar(10) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
1300 `attribute` varchar(255) DEFAULT NULL COMMENT 'custom patron field value',
1302 KEY `borrowernumber` (`borrowernumber`),
1303 KEY `code_attribute` (`code`,`attribute`(191)),
1304 CONSTRAINT `borrower_attributes_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1305 CONSTRAINT `borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE
1306 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1307 /*!40101 SET character_set_client = @saved_cs_client */;
1310 -- Table structure for table `borrower_debarments`
1313 DROP TABLE IF EXISTS `borrower_debarments`;
1314 /*!40101 SET @saved_cs_client = @@character_set_client */;
1315 /*!40101 SET character_set_client = utf8 */;
1316 CREATE TABLE `borrower_debarments` (
1317 `borrower_debarment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the restriction',
1318 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key for borrowers.borrowernumber for patron who is restricted',
1319 `expiration` date DEFAULT NULL COMMENT 'expiration date of the restriction',
1320 `type` varchar(50) NOT NULL COMMENT 'type of restriction, FK to restriction_types.code',
1321 `comment` mediumtext DEFAULT NULL COMMENT 'comments about the restriction',
1322 `manager_id` int(11) DEFAULT NULL COMMENT 'foreign key for borrowers.borrowernumber for the librarian managing the restriction',
1323 `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date the restriction was added',
1324 `updated` timestamp NULL DEFAULT NULL COMMENT 'date the restriction was updated',
1325 PRIMARY KEY (`borrower_debarment_id`),
1326 KEY `borrowernumber` (`borrowernumber`),
1327 KEY `borrower_debarments_ibfk_2` (`type`),
1328 CONSTRAINT `borrower_debarments_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1329 CONSTRAINT `borrower_debarments_ibfk_2` FOREIGN KEY (`type`) REFERENCES `restriction_types` (`code`) ON DELETE NO ACTION ON UPDATE CASCADE
1330 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1331 /*!40101 SET character_set_client = @saved_cs_client */;
1334 -- Table structure for table `borrower_files`
1337 DROP TABLE IF EXISTS `borrower_files`;
1338 /*!40101 SET @saved_cs_client = @@character_set_client */;
1339 /*!40101 SET character_set_client = utf8 */;
1340 CREATE TABLE `borrower_files` (
1341 `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
1342 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking to the patron via the borrowernumber',
1343 `file_name` varchar(255) NOT NULL COMMENT 'file name',
1344 `file_type` varchar(255) NOT NULL COMMENT 'type of file',
1345 `file_description` varchar(255) DEFAULT NULL COMMENT 'description given to the file',
1346 `file_content` longblob NOT NULL COMMENT 'the file',
1347 `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
1348 PRIMARY KEY (`file_id`),
1349 KEY `borrowernumber` (`borrowernumber`),
1350 CONSTRAINT `borrower_files_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1351 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1352 /*!40101 SET character_set_client = @saved_cs_client */;
1355 -- Table structure for table `borrower_message_preferences`
1358 DROP TABLE IF EXISTS `borrower_message_preferences`;
1359 /*!40101 SET @saved_cs_client = @@character_set_client */;
1360 /*!40101 SET character_set_client = utf8 */;
1361 CREATE TABLE `borrower_message_preferences` (
1362 `borrower_message_preference_id` int(11) NOT NULL AUTO_INCREMENT,
1363 `borrowernumber` int(11) DEFAULT NULL,
1364 `categorycode` varchar(10) DEFAULT NULL,
1365 `message_attribute_id` int(11) DEFAULT 0,
1366 `days_in_advance` int(11) DEFAULT NULL,
1367 `wants_digest` tinyint(1) NOT NULL DEFAULT 0,
1368 PRIMARY KEY (`borrower_message_preference_id`),
1369 KEY `borrowernumber` (`borrowernumber`),
1370 KEY `categorycode` (`categorycode`),
1371 KEY `message_attribute_id` (`message_attribute_id`),
1372 CONSTRAINT `borrower_message_preferences_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1373 CONSTRAINT `borrower_message_preferences_ibfk_2` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1374 CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
1375 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1376 /*!40101 SET character_set_client = @saved_cs_client */;
1379 -- Table structure for table `borrower_message_transport_preferences`
1382 DROP TABLE IF EXISTS `borrower_message_transport_preferences`;
1383 /*!40101 SET @saved_cs_client = @@character_set_client */;
1384 /*!40101 SET character_set_client = utf8 */;
1385 CREATE TABLE `borrower_message_transport_preferences` (
1386 `borrower_message_preference_id` int(11) NOT NULL DEFAULT 0,
1387 `message_transport_type` varchar(20) NOT NULL DEFAULT '0',
1388 PRIMARY KEY (`borrower_message_preference_id`,`message_transport_type`),
1389 KEY `message_transport_type` (`message_transport_type`),
1390 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,
1391 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
1392 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1393 /*!40101 SET character_set_client = @saved_cs_client */;
1396 -- Table structure for table `borrower_modifications`
1399 DROP TABLE IF EXISTS `borrower_modifications`;
1400 /*!40101 SET @saved_cs_client = @@character_set_client */;
1401 /*!40101 SET character_set_client = utf8 */;
1402 CREATE TABLE `borrower_modifications` (
1403 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1404 `verification_token` varchar(255) NOT NULL DEFAULT '',
1405 `changed_fields` mediumtext DEFAULT NULL,
1406 `borrowernumber` int(11) NOT NULL DEFAULT 0,
1407 `cardnumber` varchar(32) DEFAULT NULL,
1408 `surname` longtext DEFAULT NULL,
1409 `firstname` mediumtext DEFAULT NULL,
1410 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1411 `title` longtext DEFAULT NULL,
1412 `othernames` longtext DEFAULT NULL,
1413 `initials` mediumtext DEFAULT NULL,
1414 `pronouns` longtext DEFAULT NULL,
1415 `streetnumber` varchar(10) DEFAULT NULL,
1416 `streettype` varchar(50) DEFAULT NULL,
1417 `address` longtext DEFAULT NULL,
1418 `address2` mediumtext DEFAULT NULL,
1419 `city` longtext DEFAULT NULL,
1420 `state` mediumtext DEFAULT NULL,
1421 `zipcode` varchar(25) DEFAULT NULL,
1422 `country` mediumtext DEFAULT NULL,
1423 `email` longtext DEFAULT NULL,
1424 `phone` mediumtext DEFAULT NULL,
1425 `mobile` varchar(50) DEFAULT NULL,
1426 `fax` longtext DEFAULT NULL,
1427 `emailpro` mediumtext DEFAULT NULL,
1428 `phonepro` mediumtext DEFAULT NULL,
1429 `B_streetnumber` varchar(10) DEFAULT NULL,
1430 `B_streettype` varchar(50) DEFAULT NULL,
1431 `B_address` varchar(100) DEFAULT NULL,
1432 `B_address2` mediumtext DEFAULT NULL,
1433 `B_city` longtext DEFAULT NULL,
1434 `B_state` mediumtext DEFAULT NULL,
1435 `B_zipcode` varchar(25) DEFAULT NULL,
1436 `B_country` mediumtext DEFAULT NULL,
1437 `B_email` mediumtext DEFAULT NULL,
1438 `B_phone` longtext DEFAULT NULL,
1439 `dateofbirth` date DEFAULT NULL,
1440 `branchcode` varchar(10) DEFAULT NULL,
1441 `categorycode` varchar(10) DEFAULT NULL,
1442 `dateenrolled` date DEFAULT NULL,
1443 `dateexpiry` date DEFAULT NULL,
1444 `date_renewed` date DEFAULT NULL,
1445 `gonenoaddress` tinyint(1) DEFAULT NULL,
1446 `lost` tinyint(1) DEFAULT NULL,
1447 `debarred` date DEFAULT NULL,
1448 `debarredcomment` varchar(255) DEFAULT NULL,
1449 `contactname` longtext DEFAULT NULL,
1450 `contactfirstname` mediumtext DEFAULT NULL,
1451 `contacttitle` mediumtext DEFAULT NULL,
1452 `borrowernotes` longtext DEFAULT NULL,
1453 `relationship` varchar(100) DEFAULT NULL,
1454 `sex` varchar(1) DEFAULT NULL,
1455 `password` varchar(30) DEFAULT NULL,
1456 `flags` bigint(11) DEFAULT NULL,
1457 `userid` varchar(75) DEFAULT NULL,
1458 `opacnote` longtext DEFAULT NULL,
1459 `contactnote` varchar(255) DEFAULT NULL,
1460 `sort1` varchar(80) DEFAULT NULL,
1461 `sort2` varchar(80) DEFAULT NULL,
1462 `altcontactfirstname` varchar(255) DEFAULT NULL,
1463 `altcontactsurname` varchar(255) DEFAULT NULL,
1464 `altcontactaddress1` varchar(255) DEFAULT NULL,
1465 `altcontactaddress2` varchar(255) DEFAULT NULL,
1466 `altcontactaddress3` varchar(255) DEFAULT NULL,
1467 `altcontactstate` mediumtext DEFAULT NULL,
1468 `altcontactzipcode` varchar(50) DEFAULT NULL,
1469 `altcontactcountry` mediumtext DEFAULT NULL,
1470 `altcontactphone` varchar(50) DEFAULT NULL,
1471 `smsalertnumber` varchar(50) DEFAULT NULL,
1472 `privacy` int(11) DEFAULT NULL,
1473 `extended_attributes` mediumtext DEFAULT NULL,
1474 `gdpr_proc_consent` datetime DEFAULT NULL COMMENT 'data processing consent',
1475 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1476 `lang` varchar(25) DEFAULT NULL,
1477 PRIMARY KEY (`verification_token`(191),`borrowernumber`),
1478 KEY `verification_token` (`verification_token`(191)),
1479 KEY `borrowernumber` (`borrowernumber`)
1480 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1481 /*!40101 SET character_set_client = @saved_cs_client */;
1484 -- Table structure for table `borrower_password_recovery`
1487 DROP TABLE IF EXISTS `borrower_password_recovery`;
1488 /*!40101 SET @saved_cs_client = @@character_set_client */;
1489 /*!40101 SET character_set_client = utf8 */;
1490 CREATE TABLE `borrower_password_recovery` (
1491 `borrowernumber` int(11) NOT NULL COMMENT 'the user asking a password recovery',
1492 `uuid` varchar(128) NOT NULL COMMENT 'a unique string to identify a password recovery attempt',
1493 `valid_until` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'a time limit on the password recovery attempt',
1494 PRIMARY KEY (`borrowernumber`),
1495 KEY `borrowernumber` (`borrowernumber`)
1496 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1497 /*!40101 SET character_set_client = @saved_cs_client */;
1500 -- Table structure for table `borrower_relationships`
1503 DROP TABLE IF EXISTS `borrower_relationships`;
1504 /*!40101 SET @saved_cs_client = @@character_set_client */;
1505 /*!40101 SET character_set_client = utf8 */;
1506 CREATE TABLE `borrower_relationships` (
1507 `id` int(11) NOT NULL AUTO_INCREMENT,
1508 `guarantor_id` int(11) NOT NULL,
1509 `guarantee_id` int(11) NOT NULL,
1510 `relationship` varchar(100) NOT NULL,
1512 UNIQUE KEY `guarantor_guarantee_idx` (`guarantor_id`,`guarantee_id`),
1513 KEY `r_guarantee` (`guarantee_id`),
1514 CONSTRAINT `r_guarantee` FOREIGN KEY (`guarantee_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1515 CONSTRAINT `r_guarantor` FOREIGN KEY (`guarantor_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1516 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1517 /*!40101 SET character_set_client = @saved_cs_client */;
1520 -- Table structure for table `borrowers`
1523 DROP TABLE IF EXISTS `borrowers`;
1524 /*!40101 SET @saved_cs_client = @@character_set_client */;
1525 /*!40101 SET character_set_client = utf8 */;
1526 CREATE TABLE `borrowers` (
1527 `borrowernumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, Koha assigned ID number for patrons/borrowers',
1528 `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
1529 `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1530 `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
1531 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1532 `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1533 `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
1534 `initials` mediumtext DEFAULT NULL COMMENT 'initials for your patron/borrower',
1535 `pronouns` longtext DEFAULT NULL COMMENT 'patron/borrower pronouns',
1536 `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',
1537 `streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s primary address',
1538 `address` longtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s primary address',
1539 `address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s primary address',
1540 `city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s primary address',
1541 `state` mediumtext DEFAULT NULL COMMENT 'the state or province for your patron/borrower''s primary address',
1542 `zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s primary address',
1543 `country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s primary address',
1544 `email` longtext DEFAULT NULL COMMENT 'the primary email address for your patron/borrower''s primary address',
1545 `phone` mediumtext DEFAULT NULL COMMENT 'the primary phone number for your patron/borrower''s primary address',
1546 `mobile` tinytext DEFAULT NULL COMMENT 'the other phone number for your patron/borrower''s primary address',
1547 `fax` longtext DEFAULT NULL COMMENT 'the fax number for your patron/borrower''s primary address',
1548 `emailpro` mediumtext DEFAULT NULL COMMENT 'the secondary email addres for your patron/borrower''s primary address',
1549 `phonepro` mediumtext DEFAULT NULL COMMENT 'the secondary phone number for your patron/borrower''s primary address',
1550 `B_streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address',
1551 `B_streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s alternate address',
1552 `B_address` mediumtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s alternate address',
1553 `B_address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s alternate address',
1554 `B_city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s alternate address',
1555 `B_state` mediumtext DEFAULT NULL COMMENT 'the state for your patron/borrower''s alternate address',
1556 `B_zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s alternate address',
1557 `B_country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s alternate address',
1558 `B_email` mediumtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate email address',
1559 `B_phone` longtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate phone number',
1560 `dateofbirth` date DEFAULT NULL COMMENT 'the patron/borrower''s date of birth (YYYY-MM-DD)',
1561 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table, includes the code of the patron/borrower''s home branch',
1562 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category',
1563 `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)',
1564 `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)',
1565 `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)',
1566 `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed',
1567 `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',
1568 `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',
1569 `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)',
1570 `debarredcomment` varchar(255) DEFAULT NULL COMMENT 'comment on the stop of the patron',
1571 `contactname` longtext DEFAULT NULL COMMENT 'used for children and profesionals to include surname or last name of guarantor or organization name',
1572 `contactfirstname` mediumtext DEFAULT NULL COMMENT 'used for children to include first name of guarantor',
1573 `contacttitle` mediumtext DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor',
1574 `borrowernotes` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface',
1575 `relationship` varchar(100) DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor',
1576 `sex` varchar(1) DEFAULT NULL COMMENT 'patron/borrower''s gender',
1577 `password` varchar(60) DEFAULT NULL COMMENT 'patron/borrower''s Bcrypt encrypted password',
1578 `secret` mediumtext DEFAULT NULL COMMENT 'Secret for 2FA',
1579 `auth_method` enum('password','two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method',
1580 `flags` bigint(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions',
1581 `userid` varchar(75) DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in',
1582 `opacnote` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface',
1583 `contactnote` varchar(255) DEFAULT NULL COMMENT 'a note related to the patron/borrower''s alternate address',
1584 `sort1` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
1585 `sort2` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
1586 `altcontactfirstname` mediumtext DEFAULT NULL COMMENT 'first name of alternate contact for the patron/borrower',
1587 `altcontactsurname` mediumtext DEFAULT NULL COMMENT 'surname or last name of the alternate contact for the patron/borrower',
1588 `altcontactaddress1` mediumtext DEFAULT NULL COMMENT 'the first address line for the alternate contact for the patron/borrower',
1589 `altcontactaddress2` mediumtext DEFAULT NULL COMMENT 'the second address line for the alternate contact for the patron/borrower',
1590 `altcontactaddress3` mediumtext DEFAULT NULL COMMENT 'the city for the alternate contact for the patron/borrower',
1591 `altcontactstate` mediumtext DEFAULT NULL COMMENT 'the state for the alternate contact for the patron/borrower',
1592 `altcontactzipcode` mediumtext DEFAULT NULL COMMENT 'the zipcode for the alternate contact for the patron/borrower',
1593 `altcontactcountry` mediumtext DEFAULT NULL COMMENT 'the country for the alternate contact for the patron/borrower',
1594 `altcontactphone` mediumtext DEFAULT NULL COMMENT 'the phone number for the alternate contact for the patron/borrower',
1595 `smsalertnumber` varchar(50) DEFAULT NULL COMMENT 'the mobile phone number where the patron/borrower would like to receive notices (if SMS turned on)',
1596 `sms_provider_id` int(11) DEFAULT NULL COMMENT 'the provider of the mobile phone number defined in smsalertnumber',
1597 `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history',
1598 `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines',
1599 `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
1600 `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''.',
1601 `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)',
1602 `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
1603 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
1604 `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
1605 `overdrive_auth_token` mediumtext DEFAULT NULL COMMENT 'persist OverDrive auth token',
1606 `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1607 `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1608 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1609 `protected` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to mark selected patrons as protected from deletion',
1610 PRIMARY KEY (`borrowernumber`),
1611 UNIQUE KEY `cardnumber` (`cardnumber`),
1612 UNIQUE KEY `userid` (`userid`),
1613 KEY `categorycode` (`categorycode`),
1614 KEY `branchcode` (`branchcode`),
1615 KEY `surname_idx` (`surname`(191)),
1616 KEY `firstname_idx` (`firstname`(191)),
1617 KEY `othernames_idx` (`othernames`(191)),
1618 KEY `sms_provider_id` (`sms_provider_id`),
1619 KEY `cardnumber_idx` (`cardnumber`),
1620 KEY `userid_idx` (`userid`),
1621 KEY `middle_name_idx` (`middle_name`(768)),
1622 CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
1623 CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`),
1624 CONSTRAINT `borrowers_ibfk_3` FOREIGN KEY (`sms_provider_id`) REFERENCES `sms_providers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
1625 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1626 /*!40101 SET character_set_client = @saved_cs_client */;
1629 -- Table structure for table `branch_transfer_limits`
1632 DROP TABLE IF EXISTS `branch_transfer_limits`;
1633 /*!40101 SET @saved_cs_client = @@character_set_client */;
1634 /*!40101 SET character_set_client = utf8 */;
1635 CREATE TABLE `branch_transfer_limits` (
1636 `limitId` int(8) NOT NULL AUTO_INCREMENT,
1637 `toBranch` varchar(10) NOT NULL,
1638 `fromBranch` varchar(10) NOT NULL,
1639 `itemtype` varchar(10) DEFAULT NULL,
1640 `ccode` varchar(80) DEFAULT NULL,
1641 PRIMARY KEY (`limitId`),
1642 KEY `fromBranch_idx` (`fromBranch`)
1643 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1644 /*!40101 SET character_set_client = @saved_cs_client */;
1647 -- Table structure for table `branches`
1650 DROP TABLE IF EXISTS `branches`;
1651 /*!40101 SET @saved_cs_client = @@character_set_client */;
1652 /*!40101 SET character_set_client = utf8 */;
1653 CREATE TABLE `branches` (
1654 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'a unique key assigned to each branch',
1655 `branchname` longtext NOT NULL COMMENT 'the name of your library or branch',
1656 `branchaddress1` longtext DEFAULT NULL COMMENT 'the first address line of for your library or branch',
1657 `branchaddress2` longtext DEFAULT NULL COMMENT 'the second address line of for your library or branch',
1658 `branchaddress3` longtext DEFAULT NULL COMMENT 'the third address line of for your library or branch',
1659 `branchzip` varchar(25) DEFAULT NULL COMMENT 'the zip or postal code for your library or branch',
1660 `branchcity` longtext DEFAULT NULL COMMENT 'the city or province for your library or branch',
1661 `branchstate` longtext DEFAULT NULL COMMENT 'the state for your library or branch',
1662 `branchcountry` mediumtext DEFAULT NULL COMMENT 'the county for your library or branch',
1663 `branchphone` longtext DEFAULT NULL COMMENT 'the primary phone for your library or branch',
1664 `branchfax` longtext DEFAULT NULL COMMENT 'the fax number for your library or branch',
1665 `branchemail` longtext DEFAULT NULL COMMENT 'the primary email address for your library or branch',
1666 `branchillemail` longtext DEFAULT NULL COMMENT 'the ILL staff email address for your library or branch',
1667 `branchreplyto` longtext DEFAULT NULL COMMENT 'the email to be used as a Reply-To',
1668 `branchreturnpath` longtext DEFAULT NULL COMMENT 'the email to be used as Return-Path',
1669 `branchurl` longtext DEFAULT NULL COMMENT 'the URL for your library or branch''s website',
1670 `issuing` tinyint(4) DEFAULT NULL COMMENT 'unused in Koha',
1671 `branchip` varchar(15) DEFAULT NULL COMMENT 'the IP address for your library or branch',
1672 `branchnotes` longtext DEFAULT NULL COMMENT 'notes related to your library or branch',
1673 `geolocation` varchar(255) DEFAULT NULL COMMENT 'geolocation of your library',
1674 `marcorgcode` varchar(16) DEFAULT NULL COMMENT 'MARC Organization Code, see http://www.loc.gov/marc/organizations/orgshome.html, when empty defaults to syspref MARCOrgCode',
1675 `pickup_location` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'the ability to act as a pickup location',
1676 `public` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'whether this library should show in the opac',
1677 `opacuserjs` longtext DEFAULT NULL COMMENT 'branch specific javascript for the OPAC',
1678 `opacusercss` longtext DEFAULT NULL COMMENT 'branch specific css for the OPAC',
1679 PRIMARY KEY (`branchcode`)
1680 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1681 /*!40101 SET character_set_client = @saved_cs_client */;
1684 -- Table structure for table `branches_overdrive`
1687 DROP TABLE IF EXISTS `branches_overdrive`;
1688 /*!40101 SET @saved_cs_client = @@character_set_client */;
1689 /*!40101 SET character_set_client = utf8 */;
1690 CREATE TABLE `branches_overdrive` (
1691 `branchcode` varchar(10) NOT NULL,
1692 `authname` varchar(255) NOT NULL,
1693 PRIMARY KEY (`branchcode`),
1694 CONSTRAINT `branches_overdrive_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1695 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1696 /*!40101 SET character_set_client = @saved_cs_client */;
1699 -- Table structure for table `branchtransfers`
1702 DROP TABLE IF EXISTS `branchtransfers`;
1703 /*!40101 SET @saved_cs_client = @@character_set_client */;
1704 /*!40101 SET character_set_client = utf8 */;
1705 CREATE TABLE `branchtransfers` (
1706 `branchtransfer_id` int(12) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
1707 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the itemnumber that it is in transit (items.itemnumber)',
1708 `daterequested` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date the transfer was requested',
1709 `datesent` datetime DEFAULT NULL COMMENT 'the date the transfer was initialized',
1710 `frombranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer is coming from',
1711 `datearrived` datetime DEFAULT NULL COMMENT 'the date the transfer arrived at its destination',
1712 `datecancelled` datetime DEFAULT NULL COMMENT 'the date the transfer was cancelled',
1713 `tobranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer was going to',
1714 `comments` longtext DEFAULT NULL COMMENT 'any comments related to the transfer',
1715 `reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation','Recall','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer',
1716 `cancellation_reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','ItemLost','WrongTransfer','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer cancellation',
1717 PRIMARY KEY (`branchtransfer_id`),
1718 KEY `frombranch` (`frombranch`),
1719 KEY `tobranch` (`tobranch`),
1720 KEY `itemnumber` (`itemnumber`),
1721 CONSTRAINT `branchtransfers_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1722 CONSTRAINT `branchtransfers_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1723 CONSTRAINT `branchtransfers_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1724 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1725 /*!40101 SET character_set_client = @saved_cs_client */;
1728 -- Table structure for table `browser`
1731 DROP TABLE IF EXISTS `browser`;
1732 /*!40101 SET @saved_cs_client = @@character_set_client */;
1733 /*!40101 SET character_set_client = utf8 */;
1734 CREATE TABLE `browser` (
1735 `level` int(11) NOT NULL,
1736 `classification` varchar(20) NOT NULL,
1737 `description` varchar(255) NOT NULL,
1738 `number` bigint(20) NOT NULL,
1739 `endnode` tinyint(4) NOT NULL
1740 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1741 /*!40101 SET character_set_client = @saved_cs_client */;
1744 -- Table structure for table `cash_register_actions`
1747 DROP TABLE IF EXISTS `cash_register_actions`;
1748 /*!40101 SET @saved_cs_client = @@character_set_client */;
1749 /*!40101 SET character_set_client = utf8 */;
1750 CREATE TABLE `cash_register_actions` (
1751 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each account register action',
1752 `code` varchar(24) NOT NULL COMMENT 'action code denoting the type of action recorded (enum),',
1753 `register_id` int(11) NOT NULL COMMENT 'id of cash_register this action belongs to,',
1754 `manager_id` int(11) NOT NULL COMMENT 'staff member performing the action',
1755 `amount` decimal(28,6) DEFAULT NULL COMMENT 'amount recorded in action (signed)',
1756 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1758 KEY `cash_register_actions_manager` (`manager_id`),
1759 KEY `cash_register_actions_register` (`register_id`),
1760 CONSTRAINT `cash_register_actions_manager` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1761 CONSTRAINT `cash_register_actions_register` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1762 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1763 /*!40101 SET character_set_client = @saved_cs_client */;
1766 -- Table structure for table `cash_registers`
1769 DROP TABLE IF EXISTS `cash_registers`;
1770 /*!40101 SET @saved_cs_client = @@character_set_client */;
1771 /*!40101 SET character_set_client = utf8 */;
1772 CREATE TABLE `cash_registers` (
1773 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each account register',
1774 `name` varchar(24) NOT NULL COMMENT 'the user friendly identifier for each account register',
1775 `description` longtext NOT NULL COMMENT 'the user friendly description for each account register',
1776 `branch` varchar(10) NOT NULL COMMENT 'the foreign key the library this account register belongs',
1777 `branch_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote that this till is the branch default',
1778 `starting_float` decimal(28,6) DEFAULT NULL COMMENT 'the starting float this account register should be assigned',
1779 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote if this till is archived or not',
1781 UNIQUE KEY `name` (`name`,`branch`),
1782 KEY `cash_registers_branch` (`branch`),
1783 CONSTRAINT `cash_registers_branch` FOREIGN KEY (`branch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1784 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1785 /*!40101 SET character_set_client = @saved_cs_client */;
1788 -- Table structure for table `categories`
1791 DROP TABLE IF EXISTS `categories`;
1792 /*!40101 SET @saved_cs_client = @@character_set_client */;
1793 /*!40101 SET character_set_client = utf8 */;
1794 CREATE TABLE `categories` (
1795 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'unique primary key used to idenfity the patron category',
1796 `description` longtext DEFAULT NULL COMMENT 'description of the patron category',
1797 `enrolmentperiod` smallint(6) DEFAULT NULL COMMENT 'number of months the patron is enrolled for (will be NULL if enrolmentperioddate is set)',
1798 `enrolmentperioddate` date DEFAULT NULL COMMENT 'date the patron is enrolled until (will be NULL if enrolmentperiod is set)',
1799 `password_expiry_days` smallint(6) DEFAULT NULL COMMENT 'number of days after which the patron must reset their password',
1800 `upperagelimit` smallint(6) DEFAULT NULL COMMENT 'age limit for the patron',
1801 `dateofbirthrequired` tinyint(1) DEFAULT NULL COMMENT 'the minimum age required for the patron category',
1802 `finetype` varchar(30) DEFAULT NULL COMMENT 'unused in Koha',
1803 `bulk` tinyint(1) DEFAULT NULL,
1804 `enrolmentfee` decimal(28,6) DEFAULT NULL COMMENT 'enrollment fee for the patron',
1805 `overduenoticerequired` tinyint(1) DEFAULT NULL COMMENT 'are overdue notices sent to this patron category (1 for yes, 0 for no)',
1806 `issuelimit` smallint(6) DEFAULT NULL COMMENT 'unused in Koha',
1807 `reservefee` decimal(28,6) DEFAULT NULL COMMENT 'cost to place holds',
1808 `hidelostitems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'are lost items shown to this category (1 for yes, 0 for no)',
1809 `category_type` varchar(1) NOT NULL DEFAULT 'A' COMMENT 'type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)',
1810 `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',
1811 `default_privacy` enum('default','never','forever') NOT NULL DEFAULT 'default' COMMENT 'Default privacy setting for this patron category',
1812 `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''.',
1813 `can_place_ill_in_opac` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'can this patron category place interlibrary loan requests',
1814 `can_be_guarantee` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if patrons of this category can be guarantees',
1815 `reset_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can do the password reset flow,',
1816 `change_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can change their passwords in the OAPC',
1817 `min_password_length` smallint(6) DEFAULT NULL COMMENT 'set minimum password length for patrons in this category',
1818 `require_strong_password` tinyint(1) DEFAULT NULL COMMENT 'set required password strength for patrons in this category',
1819 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude patrons of this category from local holds priority',
1820 PRIMARY KEY (`categorycode`),
1821 UNIQUE KEY `categorycode` (`categorycode`)
1822 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1823 /*!40101 SET character_set_client = @saved_cs_client */;
1826 -- Table structure for table `categories_branches`
1829 DROP TABLE IF EXISTS `categories_branches`;
1830 /*!40101 SET @saved_cs_client = @@character_set_client */;
1831 /*!40101 SET character_set_client = utf8 */;
1832 CREATE TABLE `categories_branches` (
1833 `categorycode` varchar(10) DEFAULT NULL,
1834 `branchcode` varchar(10) DEFAULT NULL,
1835 KEY `categorycode` (`categorycode`),
1836 KEY `branchcode` (`branchcode`),
1837 CONSTRAINT `categories_branches_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE,
1838 CONSTRAINT `categories_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1839 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1840 /*!40101 SET character_set_client = @saved_cs_client */;
1843 -- Table structure for table `checkout_renewals`
1846 DROP TABLE IF EXISTS `checkout_renewals`;
1847 /*!40101 SET @saved_cs_client = @@character_set_client */;
1848 /*!40101 SET character_set_client = utf8 */;
1849 CREATE TABLE `checkout_renewals` (
1850 `renewal_id` int(11) NOT NULL AUTO_INCREMENT,
1851 `checkout_id` int(11) DEFAULT NULL COMMENT 'the id of the checkout this renewal pertains to',
1852 `renewer_id` int(11) DEFAULT NULL COMMENT 'the id of the user who processed the renewal',
1853 `seen` tinyint(1) DEFAULT 0 COMMENT 'boolean denoting whether the item was present or not',
1854 `interface` varchar(16) NOT NULL COMMENT 'the interface this renewal took place on',
1855 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the renewal took place',
1856 `renewal_type` enum('Automatic','Manual') NOT NULL DEFAULT 'Manual' COMMENT 'whether the renewal was an automatic or manual renewal',
1857 PRIMARY KEY (`renewal_id`),
1858 KEY `renewer_id` (`renewer_id`),
1859 CONSTRAINT `renewals_renewer_id` FOREIGN KEY (`renewer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
1860 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1861 /*!40101 SET character_set_client = @saved_cs_client */;
1864 -- Table structure for table `circulation_rules`
1867 DROP TABLE IF EXISTS `circulation_rules`;
1868 /*!40101 SET @saved_cs_client = @@character_set_client */;
1869 /*!40101 SET character_set_client = utf8 */;
1870 CREATE TABLE `circulation_rules` (
1871 `id` int(11) NOT NULL AUTO_INCREMENT,
1872 `branchcode` varchar(10) DEFAULT NULL,
1873 `categorycode` varchar(10) DEFAULT NULL,
1874 `itemtype` varchar(10) DEFAULT NULL,
1875 `rule_name` varchar(32) NOT NULL,
1876 `rule_value` varchar(32) NOT NULL,
1878 UNIQUE KEY `branchcode` (`branchcode`,`categorycode`,`itemtype`,`rule_name`),
1879 KEY `circ_rules_ibfk_2` (`categorycode`),
1880 KEY `circ_rules_ibfk_3` (`itemtype`),
1881 KEY `rule_name` (`rule_name`),
1882 CONSTRAINT `circ_rules_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1883 CONSTRAINT `circ_rules_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
1884 CONSTRAINT `circ_rules_ibfk_3` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
1885 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1886 /*!40101 SET character_set_client = @saved_cs_client */;
1889 -- Table structure for table `cities`
1892 DROP TABLE IF EXISTS `cities`;
1893 /*!40101 SET @saved_cs_client = @@character_set_client */;
1894 /*!40101 SET character_set_client = utf8 */;
1895 CREATE TABLE `cities` (
1896 `cityid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier added by Koha',
1897 `city_name` varchar(100) NOT NULL DEFAULT '' COMMENT 'name of the city',
1898 `city_state` varchar(100) DEFAULT NULL COMMENT 'name of the state/province',
1899 `city_country` varchar(100) DEFAULT NULL COMMENT 'name of the country',
1900 `city_zipcode` varchar(20) DEFAULT NULL COMMENT 'zip or postal code',
1901 PRIMARY KEY (`cityid`)
1902 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1903 /*!40101 SET character_set_client = @saved_cs_client */;
1906 -- Table structure for table `class_sort_rules`
1909 DROP TABLE IF EXISTS `class_sort_rules`;
1910 /*!40101 SET @saved_cs_client = @@character_set_client */;
1911 /*!40101 SET character_set_client = utf8 */;
1912 CREATE TABLE `class_sort_rules` (
1913 `class_sort_rule` varchar(10) NOT NULL DEFAULT '',
1914 `description` longtext DEFAULT NULL,
1915 `sort_routine` varchar(30) NOT NULL DEFAULT '',
1916 PRIMARY KEY (`class_sort_rule`),
1917 UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
1918 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1919 /*!40101 SET character_set_client = @saved_cs_client */;
1922 -- Table structure for table `class_sources`
1925 DROP TABLE IF EXISTS `class_sources`;
1926 /*!40101 SET @saved_cs_client = @@character_set_client */;
1927 /*!40101 SET character_set_client = utf8 */;
1928 CREATE TABLE `class_sources` (
1929 `cn_source` varchar(10) NOT NULL DEFAULT '',
1930 `description` longtext DEFAULT NULL,
1931 `used` tinyint(4) NOT NULL DEFAULT 0,
1932 `class_sort_rule` varchar(10) NOT NULL DEFAULT '',
1933 `class_split_rule` varchar(10) NOT NULL DEFAULT '',
1934 PRIMARY KEY (`cn_source`),
1935 UNIQUE KEY `cn_source_idx` (`cn_source`),
1936 KEY `used_idx` (`used`),
1937 KEY `class_source_ibfk_1` (`class_sort_rule`),
1938 KEY `class_source_ibfk_2` (`class_split_rule`),
1939 CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`),
1940 CONSTRAINT `class_source_ibfk_2` FOREIGN KEY (`class_split_rule`) REFERENCES `class_split_rules` (`class_split_rule`)
1941 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1942 /*!40101 SET character_set_client = @saved_cs_client */;
1945 -- Table structure for table `class_split_rules`
1948 DROP TABLE IF EXISTS `class_split_rules`;
1949 /*!40101 SET @saved_cs_client = @@character_set_client */;
1950 /*!40101 SET character_set_client = utf8 */;
1951 CREATE TABLE `class_split_rules` (
1952 `class_split_rule` varchar(10) NOT NULL DEFAULT '',
1953 `description` longtext DEFAULT NULL,
1954 `split_routine` varchar(30) NOT NULL DEFAULT '',
1955 `split_regex` varchar(255) NOT NULL DEFAULT '',
1956 PRIMARY KEY (`class_split_rule`),
1957 UNIQUE KEY `class_split_rule_idx` (`class_split_rule`)
1958 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1959 /*!40101 SET character_set_client = @saved_cs_client */;
1962 -- Table structure for table `club_enrollment_fields`
1965 DROP TABLE IF EXISTS `club_enrollment_fields`;
1966 /*!40101 SET @saved_cs_client = @@character_set_client */;
1967 /*!40101 SET character_set_client = utf8 */;
1968 CREATE TABLE `club_enrollment_fields` (
1969 `id` int(11) NOT NULL AUTO_INCREMENT,
1970 `club_enrollment_id` int(11) NOT NULL,
1971 `club_template_enrollment_field_id` int(11) NOT NULL,
1972 `value` mediumtext NOT NULL,
1974 KEY `club_enrollment_id` (`club_enrollment_id`),
1975 KEY `club_template_enrollment_field_id` (`club_template_enrollment_field_id`),
1976 CONSTRAINT `club_enrollment_fields_ibfk_1` FOREIGN KEY (`club_enrollment_id`) REFERENCES `club_enrollments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1977 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
1978 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1979 /*!40101 SET character_set_client = @saved_cs_client */;
1982 -- Table structure for table `club_enrollments`
1985 DROP TABLE IF EXISTS `club_enrollments`;
1986 /*!40101 SET @saved_cs_client = @@character_set_client */;
1987 /*!40101 SET character_set_client = utf8 */;
1988 CREATE TABLE `club_enrollments` (
1989 `id` int(11) NOT NULL AUTO_INCREMENT,
1990 `club_id` int(11) NOT NULL,
1991 `borrowernumber` int(11) NOT NULL,
1992 `date_enrolled` timestamp NOT NULL DEFAULT current_timestamp(),
1993 `date_canceled` timestamp NULL DEFAULT NULL,
1994 `date_created` timestamp NULL DEFAULT NULL,
1995 `date_updated` timestamp NULL DEFAULT NULL,
1996 `branchcode` varchar(10) DEFAULT NULL,
1998 KEY `club_id` (`club_id`),
1999 KEY `borrowernumber` (`borrowernumber`),
2000 KEY `branchcode` (`branchcode`),
2001 CONSTRAINT `club_enrollments_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2002 CONSTRAINT `club_enrollments_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2003 CONSTRAINT `club_enrollments_ibfk_3` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
2004 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2005 /*!40101 SET character_set_client = @saved_cs_client */;
2008 -- Table structure for table `club_fields`
2011 DROP TABLE IF EXISTS `club_fields`;
2012 /*!40101 SET @saved_cs_client = @@character_set_client */;
2013 /*!40101 SET character_set_client = utf8 */;
2014 CREATE TABLE `club_fields` (
2015 `id` int(11) NOT NULL AUTO_INCREMENT,
2016 `club_template_field_id` int(11) NOT NULL,
2017 `club_id` int(11) NOT NULL,
2018 `value` mediumtext DEFAULT NULL,
2020 KEY `club_template_field_id` (`club_template_field_id`),
2021 KEY `club_id` (`club_id`),
2022 CONSTRAINT `club_fields_ibfk_3` FOREIGN KEY (`club_template_field_id`) REFERENCES `club_template_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2023 CONSTRAINT `club_fields_ibfk_4` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2024 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2025 /*!40101 SET character_set_client = @saved_cs_client */;
2028 -- Table structure for table `club_holds`
2031 DROP TABLE IF EXISTS `club_holds`;
2032 /*!40101 SET @saved_cs_client = @@character_set_client */;
2033 /*!40101 SET character_set_client = utf8 */;
2034 CREATE TABLE `club_holds` (
2035 `id` int(11) NOT NULL AUTO_INCREMENT,
2036 `club_id` int(11) NOT NULL COMMENT 'id for the club the hold was generated for',
2037 `biblio_id` int(11) NOT NULL COMMENT 'id for the bibliographic record the hold has been placed against',
2038 `item_id` int(11) DEFAULT NULL COMMENT 'If item-level, the id for the item the hold has been placed agains',
2039 `date_created` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Timestamp for the placed hold',
2041 KEY `clubs_holds_ibfk_1` (`club_id`),
2042 KEY `clubs_holds_ibfk_2` (`biblio_id`),
2043 KEY `clubs_holds_ibfk_3` (`item_id`),
2044 CONSTRAINT `clubs_holds_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2045 CONSTRAINT `clubs_holds_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2046 CONSTRAINT `clubs_holds_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
2047 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2048 /*!40101 SET character_set_client = @saved_cs_client */;
2051 -- Table structure for table `club_holds_to_patron_holds`
2054 DROP TABLE IF EXISTS `club_holds_to_patron_holds`;
2055 /*!40101 SET @saved_cs_client = @@character_set_client */;
2056 /*!40101 SET character_set_client = utf8 */;
2057 CREATE TABLE `club_holds_to_patron_holds` (
2058 `id` int(11) NOT NULL AUTO_INCREMENT,
2059 `club_hold_id` int(11) NOT NULL,
2060 `patron_id` int(11) NOT NULL,
2061 `hold_id` int(11) DEFAULT NULL,
2062 `error_code` enum('damaged','ageRestricted','itemAlreadyOnHold','tooManyHoldsForThisRecord','tooManyReservesToday','tooManyReserves','notReservable','cannotReserveFromOtherBranches','libraryNotFound','libraryNotPickupLocation','cannotBeTransferred','noReservesAllowed') DEFAULT NULL,
2063 `error_message` varchar(100) DEFAULT NULL,
2065 KEY `clubs_holds_paton_holds_ibfk_1` (`club_hold_id`),
2066 KEY `clubs_holds_paton_holds_ibfk_2` (`patron_id`),
2067 KEY `clubs_holds_paton_holds_ibfk_3` (`hold_id`),
2068 CONSTRAINT `clubs_holds_paton_holds_ibfk_1` FOREIGN KEY (`club_hold_id`) REFERENCES `club_holds` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2069 CONSTRAINT `clubs_holds_paton_holds_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2070 CONSTRAINT `clubs_holds_paton_holds_ibfk_3` FOREIGN KEY (`hold_id`) REFERENCES `reserves` (`reserve_id`) ON DELETE CASCADE ON UPDATE CASCADE
2071 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2072 /*!40101 SET character_set_client = @saved_cs_client */;
2075 -- Table structure for table `club_template_enrollment_fields`
2078 DROP TABLE IF EXISTS `club_template_enrollment_fields`;
2079 /*!40101 SET @saved_cs_client = @@character_set_client */;
2080 /*!40101 SET character_set_client = utf8 */;
2081 CREATE TABLE `club_template_enrollment_fields` (
2082 `id` int(11) NOT NULL AUTO_INCREMENT,
2083 `club_template_id` int(11) NOT NULL,
2084 `name` text NOT NULL,
2085 `description` mediumtext DEFAULT NULL,
2086 `authorised_value_category` varchar(32) DEFAULT NULL,
2088 KEY `club_template_id` (`club_template_id`),
2089 CONSTRAINT `club_template_enrollment_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2090 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2091 /*!40101 SET character_set_client = @saved_cs_client */;
2094 -- Table structure for table `club_template_fields`
2097 DROP TABLE IF EXISTS `club_template_fields`;
2098 /*!40101 SET @saved_cs_client = @@character_set_client */;
2099 /*!40101 SET character_set_client = utf8 */;
2100 CREATE TABLE `club_template_fields` (
2101 `id` int(11) NOT NULL AUTO_INCREMENT,
2102 `club_template_id` int(11) NOT NULL,
2103 `name` text NOT NULL,
2104 `description` mediumtext DEFAULT NULL,
2105 `authorised_value_category` varchar(32) DEFAULT NULL,
2107 KEY `club_template_id` (`club_template_id`),
2108 CONSTRAINT `club_template_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2109 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2110 /*!40101 SET character_set_client = @saved_cs_client */;
2113 -- Table structure for table `club_templates`
2116 DROP TABLE IF EXISTS `club_templates`;
2117 /*!40101 SET @saved_cs_client = @@character_set_client */;
2118 /*!40101 SET character_set_client = utf8 */;
2119 CREATE TABLE `club_templates` (
2120 `id` int(11) NOT NULL AUTO_INCREMENT,
2121 `name` text NOT NULL,
2122 `description` mediumtext DEFAULT NULL,
2123 `is_enrollable_from_opac` tinyint(1) NOT NULL DEFAULT 0,
2124 `is_email_required` tinyint(1) NOT NULL DEFAULT 0,
2125 `branchcode` varchar(10) DEFAULT NULL,
2126 `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
2127 `date_updated` timestamp NULL DEFAULT NULL,
2128 `is_deletable` tinyint(1) NOT NULL DEFAULT 1,
2130 KEY `ct_branchcode` (`branchcode`),
2131 CONSTRAINT `club_templates_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2132 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2133 /*!40101 SET character_set_client = @saved_cs_client */;
2136 -- Table structure for table `clubs`
2139 DROP TABLE IF EXISTS `clubs`;
2140 /*!40101 SET @saved_cs_client = @@character_set_client */;
2141 /*!40101 SET character_set_client = utf8 */;
2142 CREATE TABLE `clubs` (
2143 `id` int(11) NOT NULL AUTO_INCREMENT,
2144 `club_template_id` int(11) NOT NULL,
2145 `name` text NOT NULL,
2146 `description` mediumtext DEFAULT NULL,
2147 `date_start` date DEFAULT NULL,
2148 `date_end` date DEFAULT NULL,
2149 `branchcode` varchar(10) DEFAULT NULL,
2150 `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
2151 `date_updated` timestamp NULL DEFAULT NULL,
2153 KEY `club_template_id` (`club_template_id`),
2154 KEY `branchcode` (`branchcode`),
2155 CONSTRAINT `clubs_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2156 CONSTRAINT `clubs_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
2157 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2158 /*!40101 SET character_set_client = @saved_cs_client */;
2161 -- Table structure for table `collections`
2164 DROP TABLE IF EXISTS `collections`;
2165 /*!40101 SET @saved_cs_client = @@character_set_client */;
2166 /*!40101 SET character_set_client = utf8 */;
2167 CREATE TABLE `collections` (
2168 `colId` int(11) NOT NULL AUTO_INCREMENT,
2169 `colTitle` varchar(100) NOT NULL DEFAULT '',
2170 `colDesc` mediumtext NOT NULL,
2171 `colBranchcode` varchar(10) DEFAULT NULL COMMENT '''branchcode for branch where item should be held.''',
2172 PRIMARY KEY (`colId`),
2173 KEY `collections_ibfk_1` (`colBranchcode`),
2174 CONSTRAINT `collections_ibfk_1` FOREIGN KEY (`colBranchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2175 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2176 /*!40101 SET character_set_client = @saved_cs_client */;
2179 -- Table structure for table `collections_tracking`
2182 DROP TABLE IF EXISTS `collections_tracking`;
2183 /*!40101 SET @saved_cs_client = @@character_set_client */;
2184 /*!40101 SET character_set_client = utf8 */;
2185 CREATE TABLE `collections_tracking` (
2186 `collections_tracking_id` int(11) NOT NULL AUTO_INCREMENT,
2187 `colId` int(11) NOT NULL DEFAULT 0 COMMENT 'collections.colId',
2188 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'items.itemnumber',
2189 PRIMARY KEY (`collections_tracking_id`),
2190 KEY `collectionst_ibfk_1` (`colId`),
2191 CONSTRAINT `collectionst_ibfk_1` FOREIGN KEY (`colId`) REFERENCES `collections` (`colId`) ON DELETE CASCADE ON UPDATE CASCADE
2192 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2193 /*!40101 SET character_set_client = @saved_cs_client */;
2196 -- Table structure for table `columns_settings`
2199 DROP TABLE IF EXISTS `columns_settings`;
2200 /*!40101 SET @saved_cs_client = @@character_set_client */;
2201 /*!40101 SET character_set_client = utf8 */;
2202 CREATE TABLE `columns_settings` (
2203 `module` varchar(255) NOT NULL,
2204 `page` varchar(255) NOT NULL,
2205 `tablename` varchar(255) NOT NULL,
2206 `columnname` varchar(255) NOT NULL,
2207 `cannot_be_toggled` int(1) NOT NULL DEFAULT 0,
2208 `is_hidden` int(1) NOT NULL DEFAULT 0,
2209 PRIMARY KEY (`module`(191),`page`(191),`tablename`(191),`columnname`(191))
2210 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2211 /*!40101 SET character_set_client = @saved_cs_client */;
2214 -- Table structure for table `course_instructors`
2217 DROP TABLE IF EXISTS `course_instructors`;
2218 /*!40101 SET @saved_cs_client = @@character_set_client */;
2219 /*!40101 SET character_set_client = utf8 */;
2220 CREATE TABLE `course_instructors` (
2221 `course_id` int(11) NOT NULL COMMENT 'foreign key to link to courses.course_id',
2222 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key to link to borrowers.borrowernumber for instructor information',
2223 PRIMARY KEY (`course_id`,`borrowernumber`),
2224 KEY `borrowernumber` (`borrowernumber`),
2225 CONSTRAINT `course_instructors_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2226 CONSTRAINT `course_instructors_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`)
2227 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2228 /*!40101 SET character_set_client = @saved_cs_client */;
2231 -- Table structure for table `course_items`
2234 DROP TABLE IF EXISTS `course_items`;
2235 /*!40101 SET @saved_cs_client = @@character_set_client */;
2236 /*!40101 SET character_set_client = utf8 */;
2237 CREATE TABLE `course_items` (
2238 `ci_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'course item id',
2239 `itemnumber` int(11) DEFAULT NULL COMMENT 'items.itemnumber for the item on reserve',
2240 `biblionumber` int(11) NOT NULL COMMENT 'biblio.biblionumber for the bibliographic record on reserve',
2241 `itype` varchar(10) DEFAULT NULL COMMENT 'new itemtype for the item to have while on reserve (optional)',
2242 `itype_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2243 `itype_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the itype when item is on course reserve',
2244 `ccode` varchar(80) DEFAULT NULL COMMENT 'new category code for the item to have while on reserve (optional)',
2245 `ccode_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if ccode should be changed while on course reserve',
2246 `ccode_storage` varchar(80) DEFAULT NULL COMMENT 'a place to store the ccode when item is on course reserve',
2247 `homebranch` varchar(10) DEFAULT NULL COMMENT 'new home branch for the item to have while on reserve (optional)',
2248 `homebranch_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if homebranch should be changed while on course reserve',
2249 `homebranch_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the homebranch when item is on course reserve',
2250 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'new holding branch for the item to have while on reserve (optional)',
2251 `holdingbranch_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2252 `holdingbranch_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the holdingbranch when item is on course reserve',
2253 `location` varchar(80) DEFAULT NULL COMMENT 'new shelving location for the item to have while on reseve (optional)',
2254 `location_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2255 `location_storage` varchar(80) DEFAULT NULL COMMENT 'a place to store the location when the item is on course reserve',
2256 `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''',
2257 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2258 PRIMARY KEY (`ci_id`),
2259 UNIQUE KEY `itemnumber` (`itemnumber`),
2260 KEY `holdingbranch` (`holdingbranch`),
2261 KEY `fk_course_items_homebranch` (`homebranch`),
2262 KEY `fk_course_items_homebranch_storage` (`homebranch_storage`),
2263 KEY `fk_course_items_biblionumber` (`biblionumber`),
2264 CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2265 CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2266 CONSTRAINT `fk_course_items_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2267 CONSTRAINT `fk_course_items_homebranch` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2268 CONSTRAINT `fk_course_items_homebranch_storage` FOREIGN KEY (`homebranch_storage`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2269 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2270 /*!40101 SET character_set_client = @saved_cs_client */;
2273 -- Table structure for table `course_reserves`
2276 DROP TABLE IF EXISTS `course_reserves`;
2277 /*!40101 SET @saved_cs_client = @@character_set_client */;
2278 /*!40101 SET character_set_client = utf8 */;
2279 CREATE TABLE `course_reserves` (
2280 `cr_id` int(11) NOT NULL AUTO_INCREMENT,
2281 `course_id` int(11) NOT NULL COMMENT 'foreign key to link to courses.course_id',
2282 `ci_id` int(11) NOT NULL COMMENT 'foreign key to link to courses_items.ci_id',
2283 `staff_note` longtext DEFAULT NULL COMMENT 'staff only note',
2284 `public_note` longtext DEFAULT NULL COMMENT 'public, OPAC visible note',
2285 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2286 PRIMARY KEY (`cr_id`),
2287 UNIQUE KEY `pseudo_key` (`course_id`,`ci_id`),
2288 KEY `course_id` (`course_id`),
2289 KEY `course_reserves_ibfk_2` (`ci_id`),
2290 CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`),
2291 CONSTRAINT `course_reserves_ibfk_2` FOREIGN KEY (`ci_id`) REFERENCES `course_items` (`ci_id`) ON DELETE CASCADE ON UPDATE CASCADE
2292 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2293 /*!40101 SET character_set_client = @saved_cs_client */;
2296 -- Table structure for table `courses`
2299 DROP TABLE IF EXISTS `courses`;
2300 /*!40101 SET @saved_cs_client = @@character_set_client */;
2301 /*!40101 SET character_set_client = utf8 */;
2302 CREATE TABLE `courses` (
2303 `course_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the course',
2304 `department` varchar(80) DEFAULT NULL COMMENT 'the authorised value for the DEPARTMENT',
2305 `course_number` varchar(255) DEFAULT NULL COMMENT 'the ''course number'' assigned to a course',
2306 `section` varchar(255) DEFAULT NULL COMMENT 'the ''section'' of a course',
2307 `course_name` varchar(255) DEFAULT NULL COMMENT 'the name of the course',
2308 `term` varchar(80) DEFAULT NULL COMMENT 'the authorised value for the TERM',
2309 `staff_note` longtext DEFAULT NULL COMMENT 'the text of the staff only note',
2310 `public_note` longtext DEFAULT NULL COMMENT 'the text of the public / opac note',
2311 `students_count` varchar(20) DEFAULT NULL COMMENT 'how many students will be taking this course/section',
2312 `enabled` enum('yes','no') NOT NULL DEFAULT 'yes' COMMENT 'determines whether the course is active',
2313 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2314 PRIMARY KEY (`course_id`)
2315 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2316 /*!40101 SET character_set_client = @saved_cs_client */;
2319 -- Table structure for table `cover_images`
2322 DROP TABLE IF EXISTS `cover_images`;
2323 /*!40101 SET @saved_cs_client = @@character_set_client */;
2324 /*!40101 SET character_set_client = utf8 */;
2325 CREATE TABLE `cover_images` (
2326 `imagenumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the image',
2327 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from biblio table to link to biblionumber',
2328 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from item table to link to itemnumber',
2329 `mimetype` varchar(15) NOT NULL COMMENT 'image type',
2330 `imagefile` mediumblob NOT NULL COMMENT 'image file contents',
2331 `thumbnail` mediumblob NOT NULL COMMENT 'thumbnail file contents',
2332 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'image creation/update time',
2333 PRIMARY KEY (`imagenumber`),
2334 KEY `bibliocoverimage_fk1` (`biblionumber`),
2335 KEY `bibliocoverimage_fk2` (`itemnumber`),
2336 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2337 CONSTRAINT `bibliocoverimage_fk2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
2338 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2339 /*!40101 SET character_set_client = @saved_cs_client */;
2342 -- Table structure for table `creator_batches`
2345 DROP TABLE IF EXISTS `creator_batches`;
2346 /*!40101 SET @saved_cs_client = @@character_set_client */;
2347 /*!40101 SET character_set_client = utf8 */;
2348 CREATE TABLE `creator_batches` (
2349 `label_id` int(11) NOT NULL AUTO_INCREMENT,
2350 `batch_id` int(10) NOT NULL DEFAULT 1,
2351 `description` mediumtext DEFAULT NULL,
2352 `item_number` int(11) DEFAULT NULL,
2353 `borrower_number` int(11) DEFAULT NULL,
2354 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2355 `branch_code` varchar(10) NOT NULL DEFAULT 'NB',
2356 `creator` char(15) NOT NULL DEFAULT 'Labels',
2357 PRIMARY KEY (`label_id`),
2358 KEY `branch_fk_constraint` (`branch_code`),
2359 KEY `item_fk_constraint` (`item_number`),
2360 KEY `borrower_fk_constraint` (`borrower_number`),
2361 CONSTRAINT `creator_batches_ibfk_1` FOREIGN KEY (`borrower_number`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2362 CONSTRAINT `creator_batches_ibfk_2` FOREIGN KEY (`branch_code`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
2363 CONSTRAINT `creator_batches_ibfk_3` FOREIGN KEY (`item_number`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE
2364 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2365 /*!40101 SET character_set_client = @saved_cs_client */;
2368 -- Table structure for table `creator_images`
2371 DROP TABLE IF EXISTS `creator_images`;
2372 /*!40101 SET @saved_cs_client = @@character_set_client */;
2373 /*!40101 SET character_set_client = utf8 */;
2374 CREATE TABLE `creator_images` (
2375 `image_id` int(4) NOT NULL AUTO_INCREMENT,
2376 `imagefile` mediumblob DEFAULT NULL,
2377 `image_name` char(20) NOT NULL DEFAULT 'DEFAULT',
2378 PRIMARY KEY (`image_id`),
2379 UNIQUE KEY `image_name_index` (`image_name`)
2380 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2381 /*!40101 SET character_set_client = @saved_cs_client */;
2384 -- Table structure for table `creator_layouts`
2387 DROP TABLE IF EXISTS `creator_layouts`;
2388 /*!40101 SET @saved_cs_client = @@character_set_client */;
2389 /*!40101 SET character_set_client = utf8 */;
2390 CREATE TABLE `creator_layouts` (
2391 `layout_id` int(4) NOT NULL AUTO_INCREMENT,
2392 `barcode_type` char(100) NOT NULL DEFAULT 'CODE39',
2393 `start_label` int(2) NOT NULL DEFAULT 1,
2394 `printing_type` char(32) NOT NULL DEFAULT 'BAR',
2395 `layout_name` char(25) NOT NULL DEFAULT 'DEFAULT',
2396 `guidebox` int(1) DEFAULT 0,
2397 `oblique_title` int(1) DEFAULT 1,
2398 `font` char(10) NOT NULL DEFAULT 'TR',
2399 `font_size` int(4) NOT NULL DEFAULT 10,
2400 `scale_width` decimal(28,6) NOT NULL DEFAULT 0.080000,
2401 `scale_height` decimal(28,6) NOT NULL DEFAULT 0.010000,
2402 `units` char(20) NOT NULL DEFAULT 'POINT',
2403 `callnum_split` int(1) DEFAULT 0,
2404 `text_justify` char(1) NOT NULL DEFAULT 'L',
2405 `format_string` varchar(210) NOT NULL DEFAULT 'barcode',
2406 `layout_xml` mediumtext NOT NULL,
2407 `creator` char(15) NOT NULL DEFAULT 'Labels',
2408 PRIMARY KEY (`layout_id`)
2409 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2410 /*!40101 SET character_set_client = @saved_cs_client */;
2413 -- Table structure for table `creator_templates`
2416 DROP TABLE IF EXISTS `creator_templates`;
2417 /*!40101 SET @saved_cs_client = @@character_set_client */;
2418 /*!40101 SET character_set_client = utf8 */;
2419 CREATE TABLE `creator_templates` (
2420 `template_id` int(4) NOT NULL AUTO_INCREMENT,
2421 `profile_id` int(4) DEFAULT NULL,
2422 `template_code` char(100) NOT NULL DEFAULT 'DEFAULT TEMPLATE',
2423 `template_desc` char(100) NOT NULL DEFAULT 'Default description',
2424 `page_width` float NOT NULL DEFAULT 0,
2425 `page_height` float NOT NULL DEFAULT 0,
2426 `label_width` float NOT NULL DEFAULT 0,
2427 `label_height` float NOT NULL DEFAULT 0,
2428 `top_text_margin` float NOT NULL DEFAULT 0,
2429 `left_text_margin` float NOT NULL DEFAULT 0,
2430 `top_margin` float NOT NULL DEFAULT 0,
2431 `left_margin` float NOT NULL DEFAULT 0,
2432 `cols` int(2) NOT NULL DEFAULT 0,
2433 `rows` int(2) NOT NULL DEFAULT 0,
2434 `col_gap` float NOT NULL DEFAULT 0,
2435 `row_gap` float NOT NULL DEFAULT 0,
2436 `units` char(20) NOT NULL DEFAULT 'POINT',
2437 `creator` char(15) NOT NULL DEFAULT 'Labels',
2438 PRIMARY KEY (`template_id`),
2439 KEY `template_profile_fk_constraint` (`profile_id`)
2440 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2441 /*!40101 SET character_set_client = @saved_cs_client */;
2444 -- Table structure for table `curbside_pickup_issues`
2447 DROP TABLE IF EXISTS `curbside_pickup_issues`;
2448 /*!40101 SET @saved_cs_client = @@character_set_client */;
2449 /*!40101 SET character_set_client = utf8 */;
2450 CREATE TABLE `curbside_pickup_issues` (
2451 `id` int(11) NOT NULL AUTO_INCREMENT,
2452 `curbside_pickup_id` int(11) NOT NULL,
2453 `issue_id` int(11) NOT NULL,
2454 `reserve_id` int(11) NOT NULL,
2456 KEY `curbside_pickup_id` (`curbside_pickup_id`),
2457 CONSTRAINT `curbside_pickup_issues_ibfk_1` FOREIGN KEY (`curbside_pickup_id`) REFERENCES `curbside_pickups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2458 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2459 /*!40101 SET character_set_client = @saved_cs_client */;
2462 -- Table structure for table `curbside_pickup_opening_slots`
2465 DROP TABLE IF EXISTS `curbside_pickup_opening_slots`;
2466 /*!40101 SET @saved_cs_client = @@character_set_client */;
2467 /*!40101 SET character_set_client = utf8 */;
2468 CREATE TABLE `curbside_pickup_opening_slots` (
2469 `id` int(11) NOT NULL AUTO_INCREMENT,
2470 `curbside_pickup_policy_id` int(11) NOT NULL,
2471 `day` tinyint(1) NOT NULL,
2472 `start_hour` int(2) NOT NULL,
2473 `start_minute` int(2) NOT NULL,
2474 `end_hour` int(2) NOT NULL,
2475 `end_minute` int(2) NOT NULL,
2477 KEY `curbside_pickup_policy_id` (`curbside_pickup_policy_id`),
2478 CONSTRAINT `curbside_pickup_opening_slots_ibfk_1` FOREIGN KEY (`curbside_pickup_policy_id`) REFERENCES `curbside_pickup_policy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2479 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2480 /*!40101 SET character_set_client = @saved_cs_client */;
2483 -- Table structure for table `curbside_pickup_policy`
2486 DROP TABLE IF EXISTS `curbside_pickup_policy`;
2487 /*!40101 SET @saved_cs_client = @@character_set_client */;
2488 /*!40101 SET character_set_client = utf8 */;
2489 CREATE TABLE `curbside_pickup_policy` (
2490 `id` int(11) NOT NULL AUTO_INCREMENT,
2491 `branchcode` varchar(10) NOT NULL,
2492 `enabled` tinyint(1) NOT NULL DEFAULT 0,
2493 `enable_waiting_holds_only` tinyint(1) NOT NULL DEFAULT 0,
2494 `pickup_interval` int(2) NOT NULL DEFAULT 0,
2495 `patrons_per_interval` int(2) NOT NULL DEFAULT 0,
2496 `patron_scheduled_pickup` tinyint(1) NOT NULL DEFAULT 0,
2498 UNIQUE KEY `branchcode` (`branchcode`),
2499 CONSTRAINT `curbside_pickup_policy_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2500 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2501 /*!40101 SET character_set_client = @saved_cs_client */;
2504 -- Table structure for table `curbside_pickups`
2507 DROP TABLE IF EXISTS `curbside_pickups`;
2508 /*!40101 SET @saved_cs_client = @@character_set_client */;
2509 /*!40101 SET character_set_client = utf8 */;
2510 CREATE TABLE `curbside_pickups` (
2511 `id` int(11) NOT NULL AUTO_INCREMENT,
2512 `borrowernumber` int(11) NOT NULL,
2513 `branchcode` varchar(10) NOT NULL,
2514 `scheduled_pickup_datetime` datetime NOT NULL,
2515 `staged_datetime` datetime DEFAULT NULL,
2516 `staged_by` int(11) DEFAULT NULL,
2517 `arrival_datetime` datetime DEFAULT NULL,
2518 `delivered_datetime` datetime DEFAULT NULL,
2519 `delivered_by` int(11) DEFAULT NULL,
2520 `notes` text DEFAULT NULL,
2522 KEY `branchcode` (`branchcode`),
2523 KEY `borrowernumber` (`borrowernumber`),
2524 KEY `staged_by` (`staged_by`),
2525 CONSTRAINT `curbside_pickups_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2526 CONSTRAINT `curbside_pickups_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2527 CONSTRAINT `curbside_pickups_ibfk_3` FOREIGN KEY (`staged_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
2528 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2529 /*!40101 SET character_set_client = @saved_cs_client */;
2532 -- Table structure for table `currency`
2535 DROP TABLE IF EXISTS `currency`;
2536 /*!40101 SET @saved_cs_client = @@character_set_client */;
2537 /*!40101 SET character_set_client = utf8 */;
2538 CREATE TABLE `currency` (
2539 `currency` varchar(10) NOT NULL DEFAULT '',
2540 `symbol` varchar(5) DEFAULT NULL,
2541 `isocode` varchar(5) DEFAULT NULL,
2542 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2543 `rate` float(15,5) DEFAULT NULL,
2544 `active` tinyint(1) DEFAULT NULL,
2545 `archived` tinyint(1) DEFAULT 0,
2546 `p_sep_by_space` tinyint(1) DEFAULT 0,
2547 PRIMARY KEY (`currency`)
2548 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2549 /*!40101 SET character_set_client = @saved_cs_client */;
2552 -- Table structure for table `deletedbiblio`
2555 DROP TABLE IF EXISTS `deletedbiblio`;
2556 /*!40101 SET @saved_cs_client = @@character_set_client */;
2557 /*!40101 SET character_set_client = utf8 */;
2558 CREATE TABLE `deletedbiblio` (
2559 `biblionumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned to each bibliographic record',
2560 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'foriegn key from the biblio_framework table to identify which framework was used in cataloging this record',
2561 `author` longtext DEFAULT NULL COMMENT 'statement of responsibility from MARC record (100$a in MARC21)',
2562 `title` longtext DEFAULT NULL COMMENT 'title (without the subtitle) from the MARC record (245$a in MARC21)',
2563 `medium` longtext DEFAULT NULL COMMENT 'medium from the MARC record (245$h in MARC21)',
2564 `subtitle` longtext DEFAULT NULL COMMENT 'remainder of the title from the MARC record (245$b in MARC21)',
2565 `part_number` longtext DEFAULT NULL COMMENT 'part number from the MARC record (245$n in MARC21)',
2566 `part_name` longtext DEFAULT NULL COMMENT 'part name from the MARC record (245$p in MARC21)',
2567 `unititle` longtext DEFAULT NULL COMMENT 'uniform title (without the subtitle) from the MARC record (240$a in MARC21)',
2568 `notes` longtext DEFAULT NULL COMMENT 'values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)',
2569 `serial` tinyint(1) DEFAULT NULL COMMENT 'Boolean indicating whether biblio is for a serial',
2570 `seriestitle` longtext DEFAULT NULL,
2571 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'publication or copyright date from the MARC record',
2572 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
2573 `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
2574 `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
2575 PRIMARY KEY (`biblionumber`),
2576 KEY `blbnoidx` (`biblionumber`)
2577 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2578 /*!40101 SET character_set_client = @saved_cs_client */;
2581 -- Table structure for table `deletedbiblio_metadata`
2584 DROP TABLE IF EXISTS `deletedbiblio_metadata`;
2585 /*!40101 SET @saved_cs_client = @@character_set_client */;
2586 /*!40101 SET character_set_client = utf8 */;
2587 CREATE TABLE `deletedbiblio_metadata` (
2588 `id` int(11) NOT NULL AUTO_INCREMENT,
2589 `biblionumber` int(11) NOT NULL,
2590 `format` varchar(16) NOT NULL,
2591 `schema` varchar(16) NOT NULL,
2592 `metadata` longtext NOT NULL,
2593 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2594 `record_source_id` int(11) NULL DEFAULT NULL COMMENT 'The record source for the metadata',
2596 UNIQUE KEY `deletedbiblio_metadata_uniq_key` (`biblionumber`,`format`,`schema`),
2597 KEY `timestamp` (`timestamp`),
2598 CONSTRAINT `deletedrecord_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `deletedbiblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2599 CONSTRAINT `deletedrecord_metadata_fk_2` FOREIGN KEY (`record_source_id`) REFERENCES `record_sources` (`record_source_id`) ON DELETE CASCADE ON UPDATE CASCADE
2600 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2601 /*!40101 SET character_set_client = @saved_cs_client */;
2604 -- Table structure for table `deletedbiblioitems`
2607 DROP TABLE IF EXISTS `deletedbiblioitems`;
2608 /*!40101 SET @saved_cs_client = @@character_set_client */;
2609 /*!40101 SET character_set_client = utf8 */;
2610 CREATE TABLE `deletedbiblioitems` (
2611 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key, unique identifier assigned by Koha',
2612 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the biblio table',
2613 `volume` longtext DEFAULT NULL,
2614 `number` longtext DEFAULT NULL,
2615 `itemtype` varchar(10) DEFAULT NULL COMMENT 'biblio level item type (MARC21 942$c)',
2616 `isbn` longtext DEFAULT NULL COMMENT 'ISBN (MARC21 020$a)',
2617 `issn` longtext DEFAULT NULL COMMENT 'ISSN (MARC21 022$a)',
2618 `ean` longtext DEFAULT NULL,
2619 `publicationyear` mediumtext DEFAULT NULL,
2620 `publishercode` text DEFAULT NULL COMMENT 'publisher (MARC21 260$b and 264$b)',
2621 `volumedate` date DEFAULT NULL,
2622 `volumedesc` mediumtext DEFAULT NULL COMMENT 'volume information (MARC21 362$a)',
2623 `collectiontitle` longtext DEFAULT NULL,
2624 `collectionissn` mediumtext DEFAULT NULL,
2625 `collectionvolume` longtext DEFAULT NULL,
2626 `editionstatement` mediumtext DEFAULT NULL,
2627 `editionresponsibility` mediumtext DEFAULT NULL,
2628 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2629 `illus` text DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)',
2630 `pages` text DEFAULT NULL COMMENT 'number of pages (MARC21 300$a)',
2631 `notes` longtext DEFAULT NULL,
2632 `size` text DEFAULT NULL COMMENT 'material size (MARC21 300$c)',
2633 `place` text DEFAULT NULL COMMENT 'publication place (MARC21 260$a and 264$a)',
2634 `lccn` longtext DEFAULT NULL COMMENT 'library of congress control number (MARC21 010$a)',
2635 `url` mediumtext DEFAULT NULL COMMENT 'url (MARC21 856$u)',
2636 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source (MARC21 942$2)',
2637 `cn_class` varchar(30) DEFAULT NULL,
2638 `cn_item` varchar(10) DEFAULT NULL,
2639 `cn_suffix` varchar(10) DEFAULT NULL,
2640 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized version of the call number used for sorting',
2641 `agerestriction` varchar(255) DEFAULT NULL COMMENT 'target audience/age restriction from the bib record (MARC21 521$a)',
2642 `totalissues` int(10) DEFAULT NULL,
2643 PRIMARY KEY (`biblioitemnumber`),
2644 KEY `bibinoidx` (`biblioitemnumber`),
2645 KEY `bibnoidx` (`biblionumber`),
2646 KEY `itemtype_idx` (`itemtype`),
2647 KEY `isbn` (`isbn`(191)),
2648 KEY `ean` (`ean`(191)),
2649 KEY `publishercode` (`publishercode`(191)),
2650 KEY `timestamp` (`timestamp`)
2651 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2652 /*!40101 SET character_set_client = @saved_cs_client */;
2655 -- Table structure for table `deletedborrowers`
2658 DROP TABLE IF EXISTS `deletedborrowers`;
2659 /*!40101 SET @saved_cs_client = @@character_set_client */;
2660 /*!40101 SET character_set_client = utf8 */;
2661 CREATE TABLE `deletedborrowers` (
2662 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key, Koha assigned ID number for patrons/borrowers',
2663 `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
2664 `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2665 `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
2666 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
2667 `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2668 `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
2669 `initials` mediumtext DEFAULT NULL COMMENT 'initials for your patron/borrower',
2670 `pronouns` longtext DEFAULT NULL COMMENT 'patron/borrower pronouns',
2671 `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',
2672 `streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s primary address',
2673 `address` longtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s primary address',
2674 `address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s primary address',
2675 `city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s primary address',
2676 `state` mediumtext DEFAULT NULL COMMENT 'the state or province for your patron/borrower''s primary address',
2677 `zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s primary address',
2678 `country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s primary address',
2679 `email` longtext DEFAULT NULL COMMENT 'the primary email address for your patron/borrower''s primary address',
2680 `phone` mediumtext DEFAULT NULL COMMENT 'the primary phone number for your patron/borrower''s primary address',
2681 `mobile` tinytext DEFAULT NULL COMMENT 'the other phone number for your patron/borrower''s primary address',
2682 `fax` longtext DEFAULT NULL COMMENT 'the fax number for your patron/borrower''s primary address',
2683 `emailpro` mediumtext DEFAULT NULL COMMENT 'the secondary email addres for your patron/borrower''s primary address',
2684 `phonepro` mediumtext DEFAULT NULL COMMENT 'the secondary phone number for your patron/borrower''s primary address',
2685 `B_streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address',
2686 `B_streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s alternate address',
2687 `B_address` mediumtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s alternate address',
2688 `B_address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s alternate address',
2689 `B_city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s alternate address',
2690 `B_state` mediumtext DEFAULT NULL COMMENT 'the state for your patron/borrower''s alternate address',
2691 `B_zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s alternate address',
2692 `B_country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s alternate address',
2693 `B_email` mediumtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate email address',
2694 `B_phone` longtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate phone number',
2695 `dateofbirth` date DEFAULT NULL COMMENT 'the patron/borrower''s date of birth (YYYY-MM-DD)',
2696 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table, includes the code of the patron/borrower''s home branch',
2697 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category',
2698 `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)',
2699 `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)',
2700 `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)',
2701 `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed',
2702 `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',
2703 `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',
2704 `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)',
2705 `debarredcomment` varchar(255) DEFAULT NULL COMMENT 'comment on the stop of patron',
2706 `contactname` longtext DEFAULT NULL COMMENT 'used for children and profesionals to include surname or last name of guarantor or organization name',
2707 `contactfirstname` mediumtext DEFAULT NULL COMMENT 'used for children to include first name of guarantor',
2708 `contacttitle` mediumtext DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor',
2709 `borrowernotes` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface',
2710 `relationship` varchar(100) DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor',
2711 `sex` varchar(1) DEFAULT NULL COMMENT 'patron/borrower''s gender',
2712 `password` varchar(60) DEFAULT NULL COMMENT 'patron/borrower''s encrypted password',
2713 `secret` mediumtext DEFAULT NULL COMMENT 'Secret for 2FA',
2714 `auth_method` enum('password','two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method',
2715 `flags` bigint(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions',
2716 `userid` varchar(75) DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in',
2717 `opacnote` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface',
2718 `contactnote` varchar(255) DEFAULT NULL COMMENT 'a note related to the patron/borrower''s alternate address',
2719 `sort1` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
2720 `sort2` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
2721 `altcontactfirstname` mediumtext DEFAULT NULL COMMENT 'first name of alternate contact for the patron/borrower',
2722 `altcontactsurname` mediumtext DEFAULT NULL COMMENT 'surname or last name of the alternate contact for the patron/borrower',
2723 `altcontactaddress1` mediumtext DEFAULT NULL COMMENT 'the first address line for the alternate contact for the patron/borrower',
2724 `altcontactaddress2` mediumtext DEFAULT NULL COMMENT 'the second address line for the alternate contact for the patron/borrower',
2725 `altcontactaddress3` mediumtext DEFAULT NULL COMMENT 'the city for the alternate contact for the patron/borrower',
2726 `altcontactstate` mediumtext DEFAULT NULL COMMENT 'the state for the alternate contact for the patron/borrower',
2727 `altcontactzipcode` mediumtext DEFAULT NULL COMMENT 'the zipcode for the alternate contact for the patron/borrower',
2728 `altcontactcountry` mediumtext DEFAULT NULL COMMENT 'the country for the alternate contact for the patron/borrower',
2729 `altcontactphone` mediumtext DEFAULT NULL COMMENT 'the phone number for the alternate contact for the patron/borrower',
2730 `smsalertnumber` varchar(50) DEFAULT NULL COMMENT 'the mobile phone number where the patron/borrower would like to receive notices (if SMS turned on)',
2731 `sms_provider_id` int(11) DEFAULT NULL COMMENT 'the provider of the mobile phone number defined in smsalertnumber',
2732 `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history KEY `borrowernumber` (`borrowernumber`),',
2733 `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines',
2734 `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
2735 `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''.',
2736 `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)',
2737 `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
2738 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
2739 `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
2740 `overdrive_auth_token` mediumtext DEFAULT NULL COMMENT 'persist OverDrive auth token',
2741 `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2742 `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2743 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
2744 `protected` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to mark selected patrons as protected from deletion',
2745 KEY `borrowernumber` (`borrowernumber`),
2746 KEY `cardnumber` (`cardnumber`),
2747 KEY `sms_provider_id` (`sms_provider_id`)
2748 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2749 /*!40101 SET character_set_client = @saved_cs_client */;
2752 -- Table structure for table `deleteditems`
2755 DROP TABLE IF EXISTS `deleteditems`;
2756 /*!40101 SET @saved_cs_client = @@character_set_client */;
2757 /*!40101 SET character_set_client = utf8 */;
2758 CREATE TABLE `deleteditems` (
2759 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key and unique identifier added by Koha',
2760 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
2761 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
2762 `barcode` varchar(20) DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
2763 `bookable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean value defining whether this this item is available for bookings or not',
2764 `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
2765 `booksellerid` longtext DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
2766 `homebranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
2767 `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
2768 `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
2769 `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
2770 `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out',
2771 `datelastseen` datetime DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
2772 `stack` tinyint(1) DEFAULT NULL,
2773 `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
2774 `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
2775 `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
2776 `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
2777 `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
2778 `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
2779 `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
2780 `itemcallnumber` varchar(255) DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
2781 `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
2782 `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out',
2783 `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
2784 `localuse` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been recorded as localuse',
2785 `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
2786 `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
2787 `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
2788 `itemnotes_nonpublic` longtext DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
2789 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
2790 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
2791 `deleted_on` datetime DEFAULT NULL COMMENT 'date/time of deletion',
2792 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
2793 `permanent_location` varchar(80) DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
2794 `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
2795 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
2796 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
2797 `ccode` varchar(80) DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
2798 `materials` mediumtext DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
2799 `uri` mediumtext DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
2800 `itype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
2801 `more_subfields_xml` longtext DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
2802 `enumchron` mediumtext DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
2803 `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
2804 `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
2805 `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.',
2806 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
2807 PRIMARY KEY (`itemnumber`),
2808 KEY `delitembarcodeidx` (`barcode`),
2809 KEY `delitemstocknumberidx` (`stocknumber`),
2810 KEY `delitembinoidx` (`biblioitemnumber`),
2811 KEY `delitembibnoidx` (`biblionumber`),
2812 KEY `delhomebranch` (`homebranch`),
2813 KEY `delholdingbranch` (`holdingbranch`),
2814 KEY `itype_idx` (`itype`),
2815 KEY `timestamp` (`timestamp`)
2816 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2817 /*!40101 SET character_set_client = @saved_cs_client */;
2820 -- Table structure for table `desks`
2823 DROP TABLE IF EXISTS `desks`;
2824 /*!40101 SET @saved_cs_client = @@character_set_client */;
2825 /*!40101 SET character_set_client = utf8 */;
2826 CREATE TABLE `desks` (
2827 `desk_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
2828 `desk_name` varchar(100) NOT NULL DEFAULT '' COMMENT 'name of the desk',
2829 `branchcode` varchar(10) NOT NULL COMMENT 'library the desk is located at',
2830 PRIMARY KEY (`desk_id`),
2831 KEY `fk_desks_branchcode` (`branchcode`),
2832 CONSTRAINT `fk_desks_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2833 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2834 /*!40101 SET character_set_client = @saved_cs_client */;
2837 -- Table structure for table `discharges`
2840 DROP TABLE IF EXISTS `discharges`;
2841 /*!40101 SET @saved_cs_client = @@character_set_client */;
2842 /*!40101 SET character_set_client = utf8 */;
2843 CREATE TABLE `discharges` (
2844 `discharge_id` int(11) NOT NULL AUTO_INCREMENT,
2845 `borrower` int(11) DEFAULT NULL,
2846 `needed` timestamp NULL DEFAULT NULL,
2847 `validated` timestamp NULL DEFAULT NULL,
2848 PRIMARY KEY (`discharge_id`),
2849 KEY `borrower_discharges_ibfk1` (`borrower`),
2850 CONSTRAINT `borrower_discharges_ibfk1` FOREIGN KEY (`borrower`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2851 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2852 /*!40101 SET character_set_client = @saved_cs_client */;
2855 -- Table structure for table `edifact_ean`
2858 DROP TABLE IF EXISTS `edifact_ean`;
2859 /*!40101 SET @saved_cs_client = @@character_set_client */;
2860 /*!40101 SET character_set_client = utf8 */;
2861 CREATE TABLE `edifact_ean` (
2862 `ee_id` int(11) NOT NULL AUTO_INCREMENT,
2863 `description` varchar(128) DEFAULT NULL,
2864 `branchcode` varchar(10) DEFAULT NULL,
2865 `ean` varchar(15) NOT NULL,
2866 `id_code_qualifier` varchar(3) NOT NULL DEFAULT '14',
2867 PRIMARY KEY (`ee_id`),
2868 KEY `efk_branchcode` (`branchcode`),
2869 CONSTRAINT `efk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
2870 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2871 /*!40101 SET character_set_client = @saved_cs_client */;
2874 -- Table structure for table `edifact_messages`
2877 DROP TABLE IF EXISTS `edifact_messages`;
2878 /*!40101 SET @saved_cs_client = @@character_set_client */;
2879 /*!40101 SET character_set_client = utf8 */;
2880 CREATE TABLE `edifact_messages` (
2881 `id` int(11) NOT NULL AUTO_INCREMENT,
2882 `message_type` varchar(10) NOT NULL,
2883 `transfer_date` date DEFAULT NULL,
2884 `vendor_id` int(11) DEFAULT NULL,
2885 `edi_acct` int(11) DEFAULT NULL,
2886 `status` mediumtext DEFAULT NULL,
2887 `basketno` int(11) DEFAULT NULL,
2888 `raw_msg` longtext DEFAULT NULL,
2889 `filename` mediumtext DEFAULT NULL,
2890 `deleted` tinyint(1) NOT NULL DEFAULT 0,
2892 KEY `vendorid` (`vendor_id`),
2893 KEY `ediacct` (`edi_acct`),
2894 KEY `basketno` (`basketno`),
2895 CONSTRAINT `emfk_basketno` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2896 CONSTRAINT `emfk_edi_acct` FOREIGN KEY (`edi_acct`) REFERENCES `vendor_edi_accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2897 CONSTRAINT `emfk_vendor` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2898 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2899 /*!40101 SET character_set_client = @saved_cs_client */;
2902 -- Table structure for table `erm_agreement_licenses`
2905 DROP TABLE IF EXISTS `erm_agreement_licenses`;
2906 /*!40101 SET @saved_cs_client = @@character_set_client */;
2907 /*!40101 SET character_set_client = utf8 */;
2908 CREATE TABLE `erm_agreement_licenses` (
2909 `agreement_license_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2910 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2911 `license_id` int(11) NOT NULL COMMENT 'link to the license',
2912 `status` varchar(80) NOT NULL COMMENT 'current status of the license',
2913 `physical_location` varchar(80) DEFAULT NULL COMMENT 'physical location of the license',
2914 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this license',
2915 `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the license',
2916 PRIMARY KEY (`agreement_license_id`),
2917 UNIQUE KEY `erm_agreement_licenses_uniq` (`agreement_id`,`license_id`),
2918 KEY `erm_agreement_licenses_ibfk_2` (`license_id`),
2919 CONSTRAINT `erm_agreement_licenses_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2920 CONSTRAINT `erm_agreement_licenses_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE
2921 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2922 /*!40101 SET character_set_client = @saved_cs_client */;
2925 -- Table structure for table `erm_agreement_periods`
2928 DROP TABLE IF EXISTS `erm_agreement_periods`;
2929 /*!40101 SET @saved_cs_client = @@character_set_client */;
2930 /*!40101 SET character_set_client = utf8 */;
2931 CREATE TABLE `erm_agreement_periods` (
2932 `agreement_period_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2933 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2934 `started_on` date NOT NULL COMMENT 'start of the agreement period',
2935 `ended_on` date DEFAULT NULL COMMENT 'end of the agreement period',
2936 `cancellation_deadline` date DEFAULT NULL COMMENT 'Deadline for the cancellation',
2937 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this period',
2938 PRIMARY KEY (`agreement_period_id`),
2939 KEY `erm_agreement_periods_ibfk_1` (`agreement_id`),
2940 CONSTRAINT `erm_agreement_periods_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2941 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2942 /*!40101 SET character_set_client = @saved_cs_client */;
2945 -- Table structure for table `erm_agreement_relationships`
2948 DROP TABLE IF EXISTS `erm_agreement_relationships`;
2949 /*!40101 SET @saved_cs_client = @@character_set_client */;
2950 /*!40101 SET character_set_client = utf8 */;
2951 CREATE TABLE `erm_agreement_relationships` (
2952 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2953 `related_agreement_id` int(11) NOT NULL COMMENT 'link to the related agreement',
2954 `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',
2955 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
2956 PRIMARY KEY (`agreement_id`,`related_agreement_id`),
2957 KEY `erm_agreement_relationships_ibfk_2` (`related_agreement_id`),
2958 CONSTRAINT `erm_agreement_relationships_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2959 CONSTRAINT `erm_agreement_relationships_ibfk_2` FOREIGN KEY (`related_agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2960 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2961 /*!40101 SET character_set_client = @saved_cs_client */;
2964 -- Table structure for table `erm_agreements`
2967 DROP TABLE IF EXISTS `erm_agreements`;
2968 /*!40101 SET @saved_cs_client = @@character_set_client */;
2969 /*!40101 SET character_set_client = utf8 */;
2970 CREATE TABLE `erm_agreements` (
2971 `agreement_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2972 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2973 `name` varchar(255) NOT NULL COMMENT 'name of the agreement',
2974 `description` longtext DEFAULT NULL COMMENT 'description of the agreement',
2975 `status` varchar(80) NOT NULL COMMENT 'current status of the agreement',
2976 `closure_reason` varchar(80) DEFAULT NULL COMMENT 'reason of the closure',
2977 `is_perpetual` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the agreement perpetual',
2978 `renewal_priority` varchar(80) DEFAULT NULL COMMENT 'priority of the renewal',
2979 `license_info` varchar(80) DEFAULT NULL COMMENT 'info about the license',
2980 PRIMARY KEY (`agreement_id`),
2981 KEY `erm_agreements_ibfk_1` (`vendor_id`),
2982 CONSTRAINT `erm_agreements_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2983 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2984 /*!40101 SET character_set_client = @saved_cs_client */;
2987 -- Table structure for table `erm_counter_files`
2990 DROP TABLE IF EXISTS `erm_counter_files`;
2991 /*!40101 SET @saved_cs_client = @@character_set_client */;
2992 /*!40101 SET character_set_client = utf8 */;
2993 CREATE TABLE `erm_counter_files` (
2994 `erm_counter_files_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2995 `usage_data_provider_id` int(11) DEFAULT NULL COMMENT 'foreign key to erm_usage_data_providers',
2996 `type` varchar(80) DEFAULT NULL COMMENT 'type of counter file',
2997 `filename` varchar(80) DEFAULT NULL COMMENT 'name of the counter file',
2998 `file_content` longblob DEFAULT NULL COMMENT 'content of the counter file',
2999 `date_uploaded` timestamp NULL DEFAULT current_timestamp() COMMENT 'counter file upload date',
3000 PRIMARY KEY (`erm_counter_files_id`),
3001 KEY `erm_counter_files_ibfk_1` (`usage_data_provider_id`),
3002 CONSTRAINT `erm_counter_files_ibfk_1` FOREIGN KEY (`usage_data_provider_id`) REFERENCES `erm_usage_data_providers` (`erm_usage_data_provider_id`) ON DELETE CASCADE ON UPDATE CASCADE
3003 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3004 /*!40101 SET character_set_client = @saved_cs_client */;
3007 -- Table structure for table `erm_counter_logs`
3010 DROP TABLE IF EXISTS `erm_counter_logs`;
3011 /*!40101 SET @saved_cs_client = @@character_set_client */;
3012 /*!40101 SET character_set_client = utf8 */;
3013 CREATE TABLE `erm_counter_logs` (
3014 `erm_counter_log_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3015 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key to borrowers',
3016 `counter_files_id` int(11) DEFAULT NULL COMMENT 'foreign key to erm_counter_files',
3017 `usage_data_provider_id` int(11) DEFAULT NULL COMMENT 'foreign key to erm_usage_data_providers',
3018 `importdate` timestamp NULL DEFAULT current_timestamp() COMMENT 'counter file import date',
3019 `filename` varchar(80) DEFAULT NULL COMMENT 'name of the counter file',
3020 `logdetails` longtext DEFAULT NULL COMMENT 'details from the counter log',
3021 PRIMARY KEY (`erm_counter_log_id`),
3022 KEY `erm_counter_log_ibfk_1` (`borrowernumber`),
3023 KEY `erm_counter_log_ibfk_2` (`counter_files_id`),
3024 KEY `erm_counter_log_ibfk_3` (`usage_data_provider_id`),
3025 CONSTRAINT `erm_counter_log_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3026 CONSTRAINT `erm_counter_log_ibfk_2` FOREIGN KEY (`counter_files_id`) REFERENCES `erm_counter_files` (`erm_counter_files_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3027 CONSTRAINT `erm_counter_log_ibfk_3` FOREIGN KEY (`usage_data_provider_id`) REFERENCES `erm_usage_data_providers` (`erm_usage_data_provider_id`) ON DELETE CASCADE ON UPDATE CASCADE
3028 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3029 /*!40101 SET character_set_client = @saved_cs_client */;
3032 -- Table structure for table `erm_default_usage_reports`
3035 DROP TABLE IF EXISTS `erm_default_usage_reports`;
3036 /*!40101 SET @saved_cs_client = @@character_set_client */;
3037 /*!40101 SET character_set_client = utf8 */;
3038 CREATE TABLE `erm_default_usage_reports` (
3039 `erm_default_usage_report_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3040 `report_name` varchar(50) DEFAULT NULL COMMENT 'name of the default report',
3041 `report_url_params` longtext DEFAULT NULL COMMENT 'url params for the default report',
3042 PRIMARY KEY (`erm_default_usage_report_id`)
3043 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3044 /*!40101 SET character_set_client = @saved_cs_client */;
3047 -- Table structure for table `erm_documents`
3050 DROP TABLE IF EXISTS `erm_documents`;
3051 /*!40101 SET @saved_cs_client = @@character_set_client */;
3052 /*!40101 SET character_set_client = utf8 */;
3053 CREATE TABLE `erm_documents` (
3054 `document_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3055 `agreement_id` int(11) DEFAULT NULL COMMENT 'link to the agreement',
3056 `license_id` int(11) DEFAULT NULL COMMENT 'link to the license',
3057 `file_name` varchar(255) DEFAULT NULL COMMENT 'name of the file',
3058 `file_type` varchar(255) DEFAULT NULL COMMENT 'type of the file',
3059 `file_description` varchar(255) DEFAULT NULL COMMENT 'description of the file',
3060 `file_content` longblob DEFAULT NULL COMMENT 'the content of the file',
3061 `uploaded_on` datetime DEFAULT NULL COMMENT 'datetime when the file as attached',
3062 `physical_location` varchar(255) DEFAULT NULL COMMENT 'physical location of the document',
3063 `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the document',
3064 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
3065 PRIMARY KEY (`document_id`),
3066 KEY `erm_documents_ibfk_1` (`agreement_id`),
3067 KEY `erm_documents_ibfk_2` (`license_id`),
3068 CONSTRAINT `erm_documents_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3069 CONSTRAINT `erm_documents_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE
3070 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3071 /*!40101 SET character_set_client = @saved_cs_client */;
3074 -- Table structure for table `erm_eholdings_packages`
3077 DROP TABLE IF EXISTS `erm_eholdings_packages`;
3078 /*!40101 SET @saved_cs_client = @@character_set_client */;
3079 /*!40101 SET character_set_client = utf8 */;
3080 CREATE TABLE `erm_eholdings_packages` (
3081 `package_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3082 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
3083 `name` varchar(255) NOT NULL COMMENT 'name of the package',
3084 `external_id` varchar(255) DEFAULT NULL COMMENT 'External key',
3085 `provider` enum('ebsco') DEFAULT NULL COMMENT 'External provider',
3086 `package_type` varchar(80) DEFAULT NULL COMMENT 'type of the package',
3087 `content_type` varchar(80) DEFAULT NULL COMMENT 'type of the package',
3088 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this package',
3089 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date of creation of the package',
3090 PRIMARY KEY (`package_id`),
3091 KEY `erm_eholdings_packages_ibfk_1` (`vendor_id`),
3092 CONSTRAINT `erm_eholdings_packages_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
3093 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3094 /*!40101 SET character_set_client = @saved_cs_client */;
3097 -- Table structure for table `erm_eholdings_packages_agreements`
3100 DROP TABLE IF EXISTS `erm_eholdings_packages_agreements`;
3101 /*!40101 SET @saved_cs_client = @@character_set_client */;
3102 /*!40101 SET character_set_client = utf8 */;
3103 CREATE TABLE `erm_eholdings_packages_agreements` (
3104 `package_id` int(11) NOT NULL COMMENT 'link to the package',
3105 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
3106 PRIMARY KEY (`package_id`,`agreement_id`),
3107 KEY `erm_eholdings_packages_agreements_ibfk_2` (`agreement_id`),
3108 CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3109 CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
3110 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3111 /*!40101 SET character_set_client = @saved_cs_client */;
3114 -- Table structure for table `erm_eholdings_resources`
3117 DROP TABLE IF EXISTS `erm_eholdings_resources`;
3118 /*!40101 SET @saved_cs_client = @@character_set_client */;
3119 /*!40101 SET character_set_client = utf8 */;
3120 CREATE TABLE `erm_eholdings_resources` (
3121 `resource_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3122 `title_id` int(11) NOT NULL,
3123 `package_id` int(11) NOT NULL,
3124 `vendor_id` int(11) DEFAULT NULL,
3125 `started_on` date DEFAULT NULL,
3126 `ended_on` date DEFAULT NULL,
3127 `proxy` varchar(80) DEFAULT NULL,
3128 PRIMARY KEY (`resource_id`),
3129 UNIQUE KEY `erm_eholdings_resources_uniq` (`title_id`,`package_id`),
3130 KEY `erm_eholdings_resources_ibfk_2` (`package_id`),
3131 KEY `erm_eholdings_resources_ibfk_3` (`vendor_id`),
3132 CONSTRAINT `erm_eholdings_resources_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_eholdings_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3133 CONSTRAINT `erm_eholdings_resources_ibfk_2` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3134 CONSTRAINT `erm_eholdings_resources_ibfk_3` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
3135 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3136 /*!40101 SET character_set_client = @saved_cs_client */;
3139 -- Table structure for table `erm_eholdings_titles`
3142 DROP TABLE IF EXISTS `erm_eholdings_titles`;
3143 /*!40101 SET @saved_cs_client = @@character_set_client */;
3144 /*!40101 SET character_set_client = utf8 */;
3145 CREATE TABLE `erm_eholdings_titles` (
3146 `title_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3147 `biblio_id` int(11) DEFAULT NULL,
3148 `publication_title` mediumtext DEFAULT NULL,
3149 `external_id` varchar(255) DEFAULT NULL,
3150 `print_identifier` varchar(255) DEFAULT NULL,
3151 `online_identifier` varchar(255) DEFAULT NULL,
3152 `date_first_issue_online` varchar(255) DEFAULT NULL,
3153 `num_first_vol_online` varchar(255) DEFAULT NULL,
3154 `num_first_issue_online` varchar(255) DEFAULT NULL,
3155 `date_last_issue_online` varchar(255) DEFAULT NULL,
3156 `num_last_vol_online` varchar(255) DEFAULT NULL,
3157 `num_last_issue_online` varchar(255) DEFAULT NULL,
3158 `title_url` varchar(255) DEFAULT NULL,
3159 `first_author` varchar(255) DEFAULT NULL,
3160 `embargo_info` varchar(255) DEFAULT NULL,
3161 `coverage_depth` varchar(255) DEFAULT NULL,
3162 `notes` mediumtext DEFAULT NULL,
3163 `publisher_name` varchar(255) DEFAULT NULL,
3164 `publication_type` varchar(80) DEFAULT NULL,
3165 `date_monograph_published_print` varchar(255) DEFAULT NULL,
3166 `date_monograph_published_online` varchar(255) DEFAULT NULL,
3167 `monograph_volume` varchar(255) DEFAULT NULL,
3168 `monograph_edition` varchar(255) DEFAULT NULL,
3169 `first_editor` varchar(255) DEFAULT NULL,
3170 `parent_publication_title_id` varchar(255) DEFAULT NULL,
3171 `preceding_publication_title_id` varchar(255) DEFAULT NULL,
3172 `access_type` varchar(255) DEFAULT NULL,
3173 PRIMARY KEY (`title_id`),
3174 KEY `erm_eholdings_titles_ibfk_2` (`biblio_id`),
3175 CONSTRAINT `erm_eholdings_titles_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE
3176 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3177 /*!40101 SET character_set_client = @saved_cs_client */;
3180 -- Table structure for table `erm_licenses`
3183 DROP TABLE IF EXISTS `erm_licenses`;
3184 /*!40101 SET @saved_cs_client = @@character_set_client */;
3185 /*!40101 SET character_set_client = utf8 */;
3186 CREATE TABLE `erm_licenses` (
3187 `license_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3188 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
3189 `name` varchar(255) NOT NULL COMMENT 'name of the license',
3190 `description` longtext DEFAULT NULL COMMENT 'description of the license',
3191 `type` varchar(80) NOT NULL COMMENT 'type of the license',
3192 `status` varchar(80) NOT NULL COMMENT 'current status of the license',
3193 `started_on` date DEFAULT NULL COMMENT 'start of the license',
3194 `ended_on` date DEFAULT NULL COMMENT 'end of the license',
3195 PRIMARY KEY (`license_id`),
3196 KEY `erm_licenses_ibfk_1` (`vendor_id`),
3197 CONSTRAINT `erm_licenses_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
3198 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3199 /*!40101 SET character_set_client = @saved_cs_client */;
3202 -- Table structure for table `erm_usage_data_providers`
3205 DROP TABLE IF EXISTS `erm_usage_data_providers`;
3206 /*!40101 SET @saved_cs_client = @@character_set_client */;
3207 /*!40101 SET character_set_client = utf8 */;
3208 CREATE TABLE `erm_usage_data_providers` (
3209 `erm_usage_data_provider_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3210 `name` varchar(80) NOT NULL COMMENT 'name of the data provider',
3211 `description` longtext DEFAULT NULL COMMENT 'description of the data provider',
3212 `active` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'current status of the harvester - active/inactive',
3213 `method` varchar(80) DEFAULT NULL COMMENT 'method of the harvester',
3214 `aggregator` varchar(80) DEFAULT NULL COMMENT 'aggregator of the harvester',
3215 `service_type` varchar(80) DEFAULT NULL COMMENT 'service_type of the harvester',
3216 `service_url` varchar(80) DEFAULT NULL COMMENT 'service_url of the harvester',
3217 `report_release` varchar(80) DEFAULT NULL COMMENT 'report_release of the harvester',
3218 `customer_id` varchar(50) DEFAULT NULL COMMENT 'sushi customer id',
3219 `requestor_id` varchar(50) DEFAULT NULL COMMENT 'sushi requestor id',
3220 `api_key` varchar(80) DEFAULT NULL COMMENT 'sushi api key',
3221 `requestor_name` varchar(80) DEFAULT NULL COMMENT 'requestor name',
3222 `requestor_email` varchar(80) DEFAULT NULL COMMENT 'requestor email',
3223 `report_types` varchar(255) DEFAULT NULL COMMENT 'report types provided by the harvester',
3224 PRIMARY KEY (`erm_usage_data_provider_id`)
3225 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3226 /*!40101 SET character_set_client = @saved_cs_client */;
3229 -- Table structure for table `erm_usage_databases`
3232 DROP TABLE IF EXISTS `erm_usage_databases`;
3233 /*!40101 SET @saved_cs_client = @@character_set_client */;
3234 /*!40101 SET character_set_client = utf8 */;
3235 CREATE TABLE `erm_usage_databases` (
3236 `database_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3237 `database` varchar(255) DEFAULT NULL COMMENT 'item title',
3238 `platform` varchar(255) DEFAULT NULL COMMENT 'database platform',
3239 `publisher` varchar(255) DEFAULT NULL COMMENT 'Publisher for the database',
3240 `publisher_id` varchar(255) DEFAULT NULL COMMENT 'Publisher ID for the database',
3241 `usage_data_provider_id` int(11) NOT NULL COMMENT 'data provider the database is harvested by',
3242 PRIMARY KEY (`database_id`),
3243 KEY `erm_usage_databases_ibfk_1` (`usage_data_provider_id`),
3244 CONSTRAINT `erm_usage_databases_ibfk_1` FOREIGN KEY (`usage_data_provider_id`) REFERENCES `erm_usage_data_providers` (`erm_usage_data_provider_id`) ON DELETE CASCADE ON UPDATE CASCADE
3245 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3246 /*!40101 SET character_set_client = @saved_cs_client */;
3249 -- Table structure for table `erm_usage_items`
3252 DROP TABLE IF EXISTS `erm_usage_items`;
3253 /*!40101 SET @saved_cs_client = @@character_set_client */;
3254 /*!40101 SET character_set_client = utf8 */;
3255 CREATE TABLE `erm_usage_items` (
3256 `item_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3257 `item` varchar(500) DEFAULT NULL COMMENT 'item title',
3258 `platform` varchar(255) DEFAULT NULL COMMENT 'item platform',
3259 `publisher` varchar(255) DEFAULT NULL COMMENT 'Publisher for the item',
3260 `usage_data_provider_id` int(11) NOT NULL COMMENT 'data provider the database is harvested by',
3261 PRIMARY KEY (`item_id`),
3262 KEY `erm_usage_items_ibfk_1` (`usage_data_provider_id`),
3263 CONSTRAINT `erm_usage_items_ibfk_1` FOREIGN KEY (`usage_data_provider_id`) REFERENCES `erm_usage_data_providers` (`erm_usage_data_provider_id`) ON DELETE CASCADE ON UPDATE CASCADE
3264 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3265 /*!40101 SET character_set_client = @saved_cs_client */;
3268 -- Table structure for table `erm_usage_mus`
3271 DROP TABLE IF EXISTS `erm_usage_mus`;
3272 /*!40101 SET @saved_cs_client = @@character_set_client */;
3273 /*!40101 SET character_set_client = utf8 */;
3274 CREATE TABLE `erm_usage_mus` (
3275 `monthly_usage_summary_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3276 `title_id` int(11) DEFAULT NULL COMMENT 'item title id number',
3277 `platform_id` int(11) DEFAULT NULL COMMENT 'platform id number',
3278 `database_id` int(11) DEFAULT NULL COMMENT 'database id number',
3279 `item_id` int(11) DEFAULT NULL COMMENT 'item id number',
3280 `usage_data_provider_id` int(11) DEFAULT NULL COMMENT 'item title id number',
3281 `year` int(4) DEFAULT NULL COMMENT 'year of usage statistics',
3282 `month` int(2) DEFAULT NULL COMMENT 'month of usage statistics',
3283 `usage_count` int(11) DEFAULT NULL COMMENT 'usage count for the title',
3284 `metric_type` varchar(50) DEFAULT NULL COMMENT 'metric type for the usage statistic',
3285 `access_type` varchar(50) DEFAULT NULL COMMENT 'access type for the usage statistic',
3286 `yop` varchar(255) DEFAULT NULL COMMENT 'year of publication for the usage statistic',
3287 `report_type` varchar(50) DEFAULT NULL COMMENT 'report type for the usage statistic',
3288 PRIMARY KEY (`monthly_usage_summary_id`),
3289 KEY `erm_usage_mus_ibfk_1` (`title_id`),
3290 KEY `erm_usage_mus_ibfk_2` (`usage_data_provider_id`),
3291 KEY `erm_usage_mus_ibfk_3` (`platform_id`),
3292 KEY `erm_usage_mus_ibfk_4` (`database_id`),
3293 KEY `erm_usage_mus_ibfk_5` (`item_id`),
3294 CONSTRAINT `erm_usage_mus_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_usage_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3295 CONSTRAINT `erm_usage_mus_ibfk_2` FOREIGN KEY (`usage_data_provider_id`) REFERENCES `erm_usage_data_providers` (`erm_usage_data_provider_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3296 CONSTRAINT `erm_usage_mus_ibfk_3` FOREIGN KEY (`platform_id`) REFERENCES `erm_usage_platforms` (`platform_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3297 CONSTRAINT `erm_usage_mus_ibfk_4` FOREIGN KEY (`database_id`) REFERENCES `erm_usage_databases` (`database_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3298 CONSTRAINT `erm_usage_mus_ibfk_5` FOREIGN KEY (`item_id`) REFERENCES `erm_usage_items` (`item_id`) ON DELETE CASCADE ON UPDATE CASCADE
3299 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3300 /*!40101 SET character_set_client = @saved_cs_client */;
3303 -- Table structure for table `erm_usage_platforms`
3306 DROP TABLE IF EXISTS `erm_usage_platforms`;
3307 /*!40101 SET @saved_cs_client = @@character_set_client */;
3308 /*!40101 SET character_set_client = utf8 */;
3309 CREATE TABLE `erm_usage_platforms` (
3310 `platform_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3311 `platform` varchar(255) DEFAULT NULL COMMENT 'item title',
3312 `usage_data_provider_id` int(11) NOT NULL COMMENT 'data provider the platform is harvested by',
3313 PRIMARY KEY (`platform_id`),
3314 KEY `erm_usage_platforms_ibfk_1` (`usage_data_provider_id`),
3315 CONSTRAINT `erm_usage_platforms_ibfk_1` FOREIGN KEY (`usage_data_provider_id`) REFERENCES `erm_usage_data_providers` (`erm_usage_data_provider_id`) ON DELETE CASCADE ON UPDATE CASCADE
3316 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3317 /*!40101 SET character_set_client = @saved_cs_client */;
3320 -- Table structure for table `erm_usage_titles`
3323 DROP TABLE IF EXISTS `erm_usage_titles`;
3324 /*!40101 SET @saved_cs_client = @@character_set_client */;
3325 /*!40101 SET character_set_client = utf8 */;
3326 CREATE TABLE `erm_usage_titles` (
3327 `title_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3328 `title` mediumtext DEFAULT NULL COMMENT 'item title',
3329 `usage_data_provider_id` int(11) NOT NULL COMMENT 'platform the title is harvested by',
3330 `title_doi` varchar(255) DEFAULT NULL COMMENT 'DOI number for the title',
3331 `proprietary_id` varchar(255) DEFAULT NULL COMMENT 'Proprietary_ID for the title',
3332 `platform` varchar(255) DEFAULT NULL COMMENT 'platform for the title',
3333 `print_issn` varchar(255) DEFAULT NULL COMMENT 'Print ISSN number for the title',
3334 `online_issn` varchar(255) DEFAULT NULL COMMENT 'Online ISSN number for the title',
3335 `title_uri` varchar(255) DEFAULT NULL COMMENT 'URI number for the title',
3336 `publisher` varchar(255) DEFAULT NULL COMMENT 'Publisher for the title',
3337 `publisher_id` varchar(255) DEFAULT NULL COMMENT 'Publisher ID for the title',
3338 `isbn` varchar(255) DEFAULT NULL COMMENT 'ISBN of the title',
3339 PRIMARY KEY (`title_id`),
3340 KEY `erm_usage_titles_ibfk_1` (`usage_data_provider_id`),
3341 CONSTRAINT `erm_usage_titles_ibfk_1` FOREIGN KEY (`usage_data_provider_id`) REFERENCES `erm_usage_data_providers` (`erm_usage_data_provider_id`) ON DELETE CASCADE ON UPDATE CASCADE
3342 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3343 /*!40101 SET character_set_client = @saved_cs_client */;
3346 -- Table structure for table `erm_usage_yus`
3349 DROP TABLE IF EXISTS `erm_usage_yus`;
3350 /*!40101 SET @saved_cs_client = @@character_set_client */;
3351 /*!40101 SET character_set_client = utf8 */;
3352 CREATE TABLE `erm_usage_yus` (
3353 `yearly_usage_summary_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3354 `title_id` int(11) DEFAULT NULL COMMENT 'item title id number',
3355 `platform_id` int(11) DEFAULT NULL COMMENT 'platform id number',
3356 `database_id` int(11) DEFAULT NULL COMMENT 'database id number',
3357 `item_id` int(11) DEFAULT NULL COMMENT 'item id number',
3358 `usage_data_provider_id` int(11) DEFAULT NULL COMMENT 'item title id number',
3359 `year` int(4) DEFAULT NULL COMMENT 'year of usage statistics',
3360 `totalcount` int(11) DEFAULT NULL COMMENT 'usage count for the title',
3361 `metric_type` varchar(50) DEFAULT NULL COMMENT 'metric type for the usage statistic',
3362 `access_type` varchar(50) DEFAULT NULL COMMENT 'access type for the usage statistic',
3363 `yop` varchar(255) DEFAULT NULL COMMENT 'year of publication for the usage statistic',
3364 `report_type` varchar(50) DEFAULT NULL COMMENT 'report type for the usage statistic',
3365 PRIMARY KEY (`yearly_usage_summary_id`),
3366 KEY `erm_usage_yus_ibfk_1` (`title_id`),
3367 KEY `erm_usage_yus_ibfk_2` (`usage_data_provider_id`),
3368 KEY `erm_usage_yus_ibfk_3` (`platform_id`),
3369 KEY `erm_usage_yus_ibfk_4` (`database_id`),
3370 KEY `erm_usage_yus_ibfk_5` (`item_id`),
3371 CONSTRAINT `erm_usage_yus_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_usage_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3372 CONSTRAINT `erm_usage_yus_ibfk_2` FOREIGN KEY (`usage_data_provider_id`) REFERENCES `erm_usage_data_providers` (`erm_usage_data_provider_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3373 CONSTRAINT `erm_usage_yus_ibfk_3` FOREIGN KEY (`platform_id`) REFERENCES `erm_usage_platforms` (`platform_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3374 CONSTRAINT `erm_usage_yus_ibfk_4` FOREIGN KEY (`database_id`) REFERENCES `erm_usage_databases` (`database_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3375 CONSTRAINT `erm_usage_yus_ibfk_5` FOREIGN KEY (`item_id`) REFERENCES `erm_usage_items` (`item_id`) ON DELETE CASCADE ON UPDATE CASCADE
3376 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3377 /*!40101 SET character_set_client = @saved_cs_client */;
3380 -- Table structure for table `erm_user_roles`
3383 DROP TABLE IF EXISTS `erm_user_roles`;
3384 /*!40101 SET @saved_cs_client = @@character_set_client */;
3385 /*!40101 SET character_set_client = utf8 */;
3386 CREATE TABLE `erm_user_roles` (
3387 `user_role_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3388 `agreement_id` int(11) DEFAULT NULL COMMENT 'link to the agreement',
3389 `license_id` int(11) DEFAULT NULL COMMENT 'link to the license',
3390 `user_id` int(11) NOT NULL COMMENT 'link to the user',
3391 `role` varchar(80) NOT NULL COMMENT 'role of the user',
3392 PRIMARY KEY (`user_role_id`),
3393 KEY `erm_user_roles_ibfk_1` (`agreement_id`),
3394 KEY `erm_user_roles_ibfk_2` (`license_id`),
3395 KEY `erm_user_roles_ibfk_3` (`user_id`),
3396 CONSTRAINT `erm_user_roles_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3397 CONSTRAINT `erm_user_roles_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3398 CONSTRAINT `erm_user_roles_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3399 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3400 /*!40101 SET character_set_client = @saved_cs_client */;
3403 -- Table structure for table `export_format`
3406 DROP TABLE IF EXISTS `export_format`;
3407 /*!40101 SET @saved_cs_client = @@character_set_client */;
3408 /*!40101 SET character_set_client = utf8 */;
3409 CREATE TABLE `export_format` (
3410 `export_format_id` int(11) NOT NULL AUTO_INCREMENT,
3411 `profile` varchar(255) NOT NULL,
3412 `description` longtext NOT NULL,
3413 `content` longtext NOT NULL,
3414 `csv_separator` varchar(2) NOT NULL DEFAULT ',',
3415 `field_separator` varchar(2) DEFAULT NULL,
3416 `subfield_separator` varchar(2) DEFAULT NULL,
3417 `encoding` varchar(255) NOT NULL DEFAULT 'utf8',
3418 `type` varchar(255) DEFAULT 'marc',
3419 `used_for` varchar(255) DEFAULT 'export_records',
3420 `staff_only` tinyint(1) NOT NULL DEFAULT 0,
3421 PRIMARY KEY (`export_format_id`),
3422 KEY `used_for_idx` (`used_for`(191)),
3423 KEY `staff_only_idx` (`staff_only`)
3424 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Used for CSV export';
3425 /*!40101 SET character_set_client = @saved_cs_client */;
3428 -- Table structure for table `hold_cancellation_requests`
3431 DROP TABLE IF EXISTS `hold_cancellation_requests`;
3432 /*!40101 SET @saved_cs_client = @@character_set_client */;
3433 /*!40101 SET character_set_client = utf8 */;
3434 CREATE TABLE `hold_cancellation_requests` (
3435 `hold_cancellation_request_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the cancellation request',
3436 `hold_id` int(11) NOT NULL COMMENT 'ID of the hold',
3437 `creation_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Time and date the cancellation request was created',
3438 PRIMARY KEY (`hold_cancellation_request_id`)
3439 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3440 /*!40101 SET character_set_client = @saved_cs_client */;
3443 -- Table structure for table `hold_fill_targets`
3446 DROP TABLE IF EXISTS `hold_fill_targets`;
3447 /*!40101 SET @saved_cs_client = @@character_set_client */;
3448 /*!40101 SET character_set_client = utf8 */;
3449 CREATE TABLE `hold_fill_targets` (
3450 `borrowernumber` int(11) NOT NULL,
3451 `biblionumber` int(11) NOT NULL,
3452 `itemnumber` int(11) NOT NULL,
3453 `source_branchcode` varchar(10) DEFAULT NULL,
3454 `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
3455 `reserve_id` int(11) DEFAULT NULL,
3456 PRIMARY KEY (`itemnumber`),
3457 KEY `bib_branch` (`biblionumber`,`source_branchcode`),
3458 KEY `hold_fill_targets_ibfk_1` (`borrowernumber`),
3459 KEY `hold_fill_targets_ibfk_4` (`source_branchcode`),
3460 CONSTRAINT `hold_fill_targets_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3461 CONSTRAINT `hold_fill_targets_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3462 CONSTRAINT `hold_fill_targets_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3463 CONSTRAINT `hold_fill_targets_ibfk_4` FOREIGN KEY (`source_branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
3464 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3465 /*!40101 SET character_set_client = @saved_cs_client */;
3468 -- Table structure for table `housebound_profile`
3471 DROP TABLE IF EXISTS `housebound_profile`;
3472 /*!40101 SET @saved_cs_client = @@character_set_client */;
3473 /*!40101 SET character_set_client = utf8 */;
3474 CREATE TABLE `housebound_profile` (
3475 `borrowernumber` int(11) NOT NULL COMMENT 'Number of the borrower associated with this profile.',
3476 `day` mediumtext NOT NULL COMMENT 'The preferred day of the week for delivery.',
3477 `frequency` mediumtext NOT NULL COMMENT 'The Authorised_Value definining the pattern for delivery.',
3478 `fav_itemtypes` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred itemtypes.',
3479 `fav_subjects` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred subjects.',
3480 `fav_authors` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred authors.',
3481 `referral` mediumtext DEFAULT NULL COMMENT 'Free text indicating how the borrower was added to the service.',
3482 `notes` mediumtext DEFAULT NULL COMMENT 'Free text for additional notes.',
3483 PRIMARY KEY (`borrowernumber`),
3484 CONSTRAINT `housebound_profile_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3485 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3486 /*!40101 SET character_set_client = @saved_cs_client */;
3489 -- Table structure for table `housebound_role`
3492 DROP TABLE IF EXISTS `housebound_role`;
3493 /*!40101 SET @saved_cs_client = @@character_set_client */;
3494 /*!40101 SET character_set_client = utf8 */;
3495 CREATE TABLE `housebound_role` (
3496 `borrowernumber_id` int(11) NOT NULL COMMENT 'borrowernumber link',
3497 `housebound_chooser` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'set to 1 to indicate this patron is a housebound chooser volunteer',
3498 `housebound_deliverer` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'set to 1 to indicate this patron is a housebound deliverer volunteer',
3499 PRIMARY KEY (`borrowernumber_id`),
3500 CONSTRAINT `houseboundrole_bnfk` FOREIGN KEY (`borrowernumber_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3501 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3502 /*!40101 SET character_set_client = @saved_cs_client */;
3505 -- Table structure for table `housebound_visit`
3508 DROP TABLE IF EXISTS `housebound_visit`;
3509 /*!40101 SET @saved_cs_client = @@character_set_client */;
3510 /*!40101 SET character_set_client = utf8 */;
3511 CREATE TABLE `housebound_visit` (
3512 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the visit.',
3513 `borrowernumber` int(11) NOT NULL COMMENT 'Number of the borrower, & the profile, linked to this visit.',
3514 `appointment_date` date DEFAULT NULL COMMENT 'Date of visit.',
3515 `day_segment` varchar(10) DEFAULT NULL COMMENT 'Rough time frame: ''morning'', ''afternoon'' ''evening''',
3516 `chooser_brwnumber` int(11) DEFAULT NULL COMMENT 'Number of the borrower to choose items for delivery.',
3517 `deliverer_brwnumber` int(11) DEFAULT NULL COMMENT 'Number of the borrower to deliver items.',
3519 KEY `houseboundvisit_bnfk` (`borrowernumber`),
3520 KEY `houseboundvisit_bnfk_1` (`chooser_brwnumber`),
3521 KEY `houseboundvisit_bnfk_2` (`deliverer_brwnumber`),
3522 CONSTRAINT `houseboundvisit_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `housebound_profile` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3523 CONSTRAINT `houseboundvisit_bnfk_1` FOREIGN KEY (`chooser_brwnumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3524 CONSTRAINT `houseboundvisit_bnfk_2` FOREIGN KEY (`deliverer_brwnumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3525 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3526 /*!40101 SET character_set_client = @saved_cs_client */;
3529 -- Table structure for table `identity_provider_domains`
3532 DROP TABLE IF EXISTS `identity_provider_domains`;
3533 /*!40101 SET @saved_cs_client = @@character_set_client */;
3534 /*!40101 SET character_set_client = utf8 */;
3535 CREATE TABLE `identity_provider_domains` (
3536 `identity_provider_domain_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify providers domain',
3537 `identity_provider_id` int(11) NOT NULL COMMENT 'Reference to provider',
3538 `domain` varchar(100) DEFAULT NULL COMMENT 'Domain name. If null means all domains',
3539 `auto_register` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Allow user auto register',
3540 `update_on_auth` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Update user data on auth login',
3541 `default_library_id` varchar(10) DEFAULT NULL COMMENT 'Default library to create user if auto register is enabled',
3542 `default_category_id` varchar(10) DEFAULT NULL COMMENT 'Default category to create user if auto register is enabled',
3543 `allow_opac` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Allow provider from opac interface',
3544 `allow_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Allow provider from staff interface',
3545 PRIMARY KEY (`identity_provider_domain_id`),
3546 UNIQUE KEY `identity_provider_id` (`identity_provider_id`,`domain`),
3547 KEY `domain` (`domain`),
3548 KEY `allow_opac` (`allow_opac`),
3549 KEY `allow_staff` (`allow_staff`),
3550 KEY `identity_provider_domain_ibfk_2` (`default_library_id`),
3551 KEY `identity_provider_domain_ibfk_3` (`default_category_id`),
3552 CONSTRAINT `identity_provider_domain_ibfk_1` FOREIGN KEY (`identity_provider_id`) REFERENCES `identity_providers` (`identity_provider_id`) ON DELETE CASCADE,
3553 CONSTRAINT `identity_provider_domain_ibfk_2` FOREIGN KEY (`default_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
3554 CONSTRAINT `identity_provider_domain_ibfk_3` FOREIGN KEY (`default_category_id`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE
3555 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3556 /*!40101 SET character_set_client = @saved_cs_client */;
3559 -- Table structure for table `identity_providers`
3562 DROP TABLE IF EXISTS `identity_providers`;
3563 /*!40101 SET @saved_cs_client = @@character_set_client */;
3564 /*!40101 SET character_set_client = utf8 */;
3565 CREATE TABLE `identity_providers` (
3566 `identity_provider_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify the provider',
3567 `code` varchar(20) NOT NULL COMMENT 'Provider code',
3568 `description` varchar(255) NOT NULL COMMENT 'Description for the provider',
3569 `protocol` enum('OAuth','OIDC','LDAP','CAS') NOT NULL COMMENT 'Protocol provider speaks',
3570 `config` longtext NOT NULL COMMENT 'Configuration of the provider in JSON format',
3571 `mapping` longtext NOT NULL COMMENT 'Configuration to map provider data to Koha user',
3572 `matchpoint` enum('email','userid','cardnumber') NOT NULL COMMENT 'The patron attribute to be used as matchpoint',
3573 `icon_url` varchar(255) DEFAULT NULL COMMENT 'Provider icon URL',
3574 PRIMARY KEY (`identity_provider_id`),
3575 UNIQUE KEY `code` (`code`),
3576 KEY `protocol` (`protocol`)
3577 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3578 /*!40101 SET character_set_client = @saved_cs_client */;
3581 -- Table structure for table `illbatch_statuses`
3584 DROP TABLE IF EXISTS `illbatch_statuses`;
3585 /*!40101 SET @saved_cs_client = @@character_set_client */;
3586 /*!40101 SET character_set_client = utf8 */;
3587 CREATE TABLE `illbatch_statuses` (
3588 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Status ID',
3589 `name` varchar(100) NOT NULL COMMENT 'Name of status',
3590 `code` varchar(20) NOT NULL COMMENT 'Unique, immutable code for status',
3591 `is_system` tinyint(1) DEFAULT NULL COMMENT 'Is this status required for system operation',
3593 UNIQUE KEY `u_illbatchstatuses__code` (`code`)
3594 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3595 /*!40101 SET character_set_client = @saved_cs_client */;
3598 -- Table structure for table `illbatches`
3601 DROP TABLE IF EXISTS `illbatches`;
3602 /*!40101 SET @saved_cs_client = @@character_set_client */;
3603 /*!40101 SET character_set_client = utf8 */;
3604 CREATE TABLE `illbatches` (
3605 `ill_batch_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Batch ID',
3606 `name` varchar(100) NOT NULL COMMENT 'Unique name of batch',
3607 `backend` varchar(20) NOT NULL COMMENT 'Name of batch backend',
3608 `patron_id` int(11) DEFAULT NULL COMMENT 'Patron associated with batch',
3609 `library_id` varchar(50) DEFAULT NULL COMMENT 'Branch associated with batch',
3610 `status_code` varchar(20) DEFAULT NULL COMMENT 'Status of batch',
3611 PRIMARY KEY (`ill_batch_id`),
3612 UNIQUE KEY `u_illbatches__name` (`name`),
3613 KEY `illbatches_bnfk` (`patron_id`),
3614 KEY `illbatches_bcfk` (`library_id`),
3615 KEY `illbatches_sfk` (`status_code`),
3616 CONSTRAINT `illbatches_bcfk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
3617 CONSTRAINT `illbatches_bnfk` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
3618 CONSTRAINT `illbatches_sfk` FOREIGN KEY (`status_code`) REFERENCES `illbatch_statuses` (`code`) ON DELETE SET NULL ON UPDATE CASCADE
3619 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3620 /*!40101 SET character_set_client = @saved_cs_client */;
3623 -- Table structure for table `illcomments`
3626 DROP TABLE IF EXISTS `illcomments`;
3627 /*!40101 SET @saved_cs_client = @@character_set_client */;
3628 /*!40101 SET character_set_client = utf8 */;
3629 CREATE TABLE `illcomments` (
3630 `illcomment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the comment',
3631 `illrequest_id` bigint(20) unsigned NOT NULL COMMENT 'ILL request number',
3632 `borrowernumber` int(11) DEFAULT NULL COMMENT 'Link to the user who made the comment (could be librarian, patron or ILL partner library)',
3633 `comment` text DEFAULT NULL COMMENT 'The text of the comment',
3634 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date and time when the comment was made',
3635 PRIMARY KEY (`illcomment_id`),
3636 KEY `illcomments_bnfk` (`borrowernumber`),
3637 KEY `illcomments_ifk` (`illrequest_id`),
3638 CONSTRAINT `illcomments_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3639 CONSTRAINT `illcomments_ifk` FOREIGN KEY (`illrequest_id`) REFERENCES `illrequests` (`illrequest_id`) ON DELETE CASCADE ON UPDATE CASCADE
3640 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3641 /*!40101 SET character_set_client = @saved_cs_client */;
3644 -- Table structure for table `illrequestattributes`
3647 DROP TABLE IF EXISTS `illrequestattributes`;
3648 /*!40101 SET @saved_cs_client = @@character_set_client */;
3649 /*!40101 SET character_set_client = utf8 */;
3650 CREATE TABLE `illrequestattributes` (
3651 `illrequest_id` bigint(20) unsigned NOT NULL COMMENT 'ILL request number',
3652 `backend` varchar(80) NOT NULL COMMENT 'API ILL backend name',
3653 `type` varchar(200) NOT NULL COMMENT 'API ILL property name',
3654 `value` mediumtext NOT NULL COMMENT 'API ILL property value',
3655 `readonly` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Is this attribute read only',
3656 PRIMARY KEY (`illrequest_id`,`backend`,`type`(191)),
3657 CONSTRAINT `illrequestattributes_ifk` FOREIGN KEY (`illrequest_id`) REFERENCES `illrequests` (`illrequest_id`) ON DELETE CASCADE ON UPDATE CASCADE
3658 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3659 /*!40101 SET character_set_client = @saved_cs_client */;
3662 -- Table structure for table `illrequests`
3665 DROP TABLE IF EXISTS `illrequests`;
3666 /*!40101 SET @saved_cs_client = @@character_set_client */;
3667 /*!40101 SET character_set_client = utf8 */;
3668 CREATE TABLE `illrequests` (
3669 `illrequest_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ILL request number',
3670 `borrowernumber` int(11) DEFAULT NULL COMMENT 'Patron associated with request',
3671 `biblio_id` int(11) DEFAULT NULL COMMENT 'Potential bib linked to request',
3672 `deleted_biblio_id` int(11) DEFAULT NULL COMMENT 'Deleted bib linked to request',
3673 `due_date` datetime DEFAULT NULL COMMENT 'Custom date due specified by backend, leave NULL for default date_due calculation',
3674 `branchcode` varchar(50) NOT NULL COMMENT 'The branch associated with the request',
3675 `status` varchar(50) DEFAULT NULL COMMENT 'Current Koha status of request',
3676 `status_alias` varchar(80) DEFAULT NULL COMMENT 'Foreign key to relevant authorised_values.authorised_value',
3677 `placed` date DEFAULT NULL COMMENT 'Date the request was placed',
3678 `replied` date DEFAULT NULL COMMENT 'Last API response',
3679 `updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
3680 `completed` date DEFAULT NULL COMMENT 'Date the request was completed',
3681 `medium` varchar(30) DEFAULT NULL COMMENT 'The Koha request type',
3682 `accessurl` varchar(500) DEFAULT NULL COMMENT 'Potential URL for accessing item',
3683 `cost` varchar(20) DEFAULT NULL COMMENT 'Quotes cost of request',
3684 `price_paid` varchar(20) DEFAULT NULL COMMENT 'Final cost of request',
3685 `notesopac` mediumtext DEFAULT NULL COMMENT 'Patron notes attached to request',
3686 `notesstaff` mediumtext DEFAULT NULL COMMENT 'Staff notes attached to request',
3687 `orderid` varchar(50) DEFAULT NULL COMMENT 'Backend id attached to request',
3688 `backend` varchar(20) DEFAULT NULL COMMENT 'The backend used to create request',
3689 `batch_id` int(11) DEFAULT NULL COMMENT 'Optional ID of batch that this request belongs to',
3690 PRIMARY KEY (`illrequest_id`),
3691 KEY `illrequests_bnfk` (`borrowernumber`),
3692 KEY `illrequests_bcfk_2` (`branchcode`),
3693 KEY `illrequests_safk` (`status_alias`),
3694 KEY `illrequests_bibfk` (`biblio_id`),
3695 KEY `illrequests_ibfk` (`batch_id`),
3696 CONSTRAINT `illrequests_bcfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3697 CONSTRAINT `illrequests_bibfk` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
3698 CONSTRAINT `illrequests_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3699 CONSTRAINT `illrequests_ibfk` FOREIGN KEY (`batch_id`) REFERENCES `illbatches` (`ill_batch_id`) ON DELETE SET NULL ON UPDATE CASCADE,
3700 CONSTRAINT `illrequests_safk` FOREIGN KEY (`status_alias`) REFERENCES `authorised_values` (`authorised_value`) ON DELETE SET NULL ON UPDATE CASCADE
3701 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3702 /*!40101 SET character_set_client = @saved_cs_client */;
3705 -- Table structure for table `import_auths`
3708 DROP TABLE IF EXISTS `import_auths`;
3709 /*!40101 SET @saved_cs_client = @@character_set_client */;
3710 /*!40101 SET character_set_client = utf8 */;
3711 CREATE TABLE `import_auths` (
3712 `import_record_id` int(11) NOT NULL,
3713 `matched_authid` int(11) DEFAULT NULL,
3714 `control_number` varchar(25) DEFAULT NULL,
3715 `authorized_heading` varchar(128) DEFAULT NULL,
3716 `original_source` varchar(25) DEFAULT NULL,
3717 PRIMARY KEY (`import_record_id`),
3718 KEY `import_auths_ibfk_1` (`import_record_id`),
3719 KEY `matched_authid` (`matched_authid`),
3720 CONSTRAINT `import_auths_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3721 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3722 /*!40101 SET character_set_client = @saved_cs_client */;
3725 -- Table structure for table `import_batch_profiles`
3728 DROP TABLE IF EXISTS `import_batch_profiles`;
3729 /*!40101 SET @saved_cs_client = @@character_set_client */;
3730 /*!40101 SET character_set_client = utf8 */;
3731 CREATE TABLE `import_batch_profiles` (
3732 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3733 `name` varchar(100) NOT NULL COMMENT 'name of this profile',
3734 `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3735 `template_id` int(11) DEFAULT NULL COMMENT 'the id of the marc modification template',
3736 `overlay_action` varchar(50) DEFAULT NULL COMMENT 'how to handle duplicate records',
3737 `nomatch_action` varchar(50) DEFAULT NULL COMMENT 'how to handle records where no match is found',
3738 `item_action` varchar(50) DEFAULT NULL COMMENT 'what to do with item records',
3739 `parse_items` tinyint(1) DEFAULT NULL COMMENT 'should items be parsed',
3740 `record_type` varchar(50) DEFAULT NULL COMMENT 'type of record in the batch',
3741 `encoding` varchar(50) DEFAULT NULL COMMENT 'file encoding',
3742 `format` varchar(50) DEFAULT NULL COMMENT 'marc format',
3743 `comments` longtext DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3745 UNIQUE KEY `u_import_batch_profiles__name` (`name`)
3746 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3747 /*!40101 SET character_set_client = @saved_cs_client */;
3750 -- Table structure for table `import_batches`
3753 DROP TABLE IF EXISTS `import_batches`;
3754 /*!40101 SET @saved_cs_client = @@character_set_client */;
3755 /*!40101 SET character_set_client = utf8 */;
3756 CREATE TABLE `import_batches` (
3757 `import_batch_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3758 `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3759 `template_id` int(11) DEFAULT NULL,
3760 `branchcode` varchar(10) DEFAULT NULL,
3761 `num_records` int(11) NOT NULL DEFAULT 0 COMMENT 'number of records in the file',
3762 `num_items` int(11) NOT NULL DEFAULT 0 COMMENT 'number of items in the file',
3763 `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was uploaded',
3764 `overlay_action` enum('replace','create_new','use_template','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle duplicate records',
3765 `nomatch_action` enum('create_new','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle records where no match is found',
3766 `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',
3767 `import_status` enum('staging','staged','importing','imported','reverting','reverted','cleaned') NOT NULL DEFAULT 'staging' COMMENT 'the status of the imported file',
3768 `batch_type` enum('batch','z3950','webservice') NOT NULL DEFAULT 'batch' COMMENT 'where this batch has come from',
3769 `record_type` enum('biblio','auth','holdings') NOT NULL DEFAULT 'biblio' COMMENT 'type of record in the batch',
3770 `file_name` varchar(100) DEFAULT NULL COMMENT 'the name of the file uploaded',
3771 `comments` longtext DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3772 `profile_id` int(11) DEFAULT NULL,
3773 PRIMARY KEY (`import_batch_id`),
3774 KEY `branchcode` (`branchcode`),
3775 KEY `import_batches_ibfk_1` (`profile_id`),
3776 CONSTRAINT `import_batches_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `import_batch_profiles` (`id`) ON DELETE SET NULL ON UPDATE SET NULL
3777 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3778 /*!40101 SET character_set_client = @saved_cs_client */;
3781 -- Table structure for table `import_biblios`
3784 DROP TABLE IF EXISTS `import_biblios`;
3785 /*!40101 SET @saved_cs_client = @@character_set_client */;
3786 /*!40101 SET character_set_client = utf8 */;
3787 CREATE TABLE `import_biblios` (
3788 `import_record_id` int(11) NOT NULL,
3789 `matched_biblionumber` int(11) DEFAULT NULL,
3790 `control_number` varchar(25) DEFAULT NULL,
3791 `original_source` varchar(25) DEFAULT NULL,
3792 `title` longtext DEFAULT NULL,
3793 `author` longtext DEFAULT NULL,
3794 `isbn` longtext DEFAULT NULL,
3795 `issn` longtext DEFAULT NULL,
3796 `has_items` tinyint(1) NOT NULL DEFAULT 0,
3797 PRIMARY KEY (`import_record_id`),
3798 KEY `import_biblios_ibfk_1` (`import_record_id`),
3799 KEY `matched_biblionumber` (`matched_biblionumber`),
3800 KEY `title` (`title`(191)),
3801 KEY `isbn` (`isbn`(191)),
3802 CONSTRAINT `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3803 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3804 /*!40101 SET character_set_client = @saved_cs_client */;
3807 -- Table structure for table `import_items`
3810 DROP TABLE IF EXISTS `import_items`;
3811 /*!40101 SET @saved_cs_client = @@character_set_client */;
3812 /*!40101 SET character_set_client = utf8 */;
3813 CREATE TABLE `import_items` (
3814 `import_items_id` int(11) NOT NULL AUTO_INCREMENT,
3815 `import_record_id` int(11) NOT NULL,
3816 `itemnumber` int(11) DEFAULT NULL,
3817 `branchcode` varchar(10) DEFAULT NULL,
3818 `status` enum('error','staged','imported','reverted','ignored') NOT NULL DEFAULT 'staged',
3819 `marcxml` longtext NOT NULL,
3820 `import_error` longtext DEFAULT NULL,
3821 PRIMARY KEY (`import_items_id`),
3822 KEY `import_items_ibfk_1` (`import_record_id`),
3823 KEY `itemnumber` (`itemnumber`),
3824 KEY `branchcode` (`branchcode`),
3825 CONSTRAINT `import_items_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3826 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3827 /*!40101 SET character_set_client = @saved_cs_client */;
3830 -- Table structure for table `import_record_matches`
3833 DROP TABLE IF EXISTS `import_record_matches`;
3834 /*!40101 SET @saved_cs_client = @@character_set_client */;
3835 /*!40101 SET character_set_client = utf8 */;
3836 CREATE TABLE `import_record_matches` (
3837 `import_record_id` int(11) NOT NULL COMMENT 'the id given to the imported bib record (import_records.import_record_id)',
3838 `candidate_match_id` int(11) NOT NULL COMMENT 'the biblio the imported record matches (biblio.biblionumber)',
3839 `score` int(11) NOT NULL DEFAULT 0 COMMENT 'the match score',
3840 `chosen` tinyint(1) DEFAULT NULL COMMENT 'whether this match has been allowed or denied',
3841 PRIMARY KEY (`import_record_id`,`candidate_match_id`),
3842 KEY `record_score` (`import_record_id`,`score`),
3843 CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3844 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3845 /*!40101 SET character_set_client = @saved_cs_client */;
3848 -- Table structure for table `import_records`
3851 DROP TABLE IF EXISTS `import_records`;
3852 /*!40101 SET @saved_cs_client = @@character_set_client */;
3853 /*!40101 SET character_set_client = utf8 */;
3854 CREATE TABLE `import_records` (
3855 `import_record_id` int(11) NOT NULL AUTO_INCREMENT,
3856 `import_batch_id` int(11) NOT NULL,
3857 `branchcode` varchar(10) DEFAULT NULL,
3858 `record_sequence` int(11) NOT NULL DEFAULT 0,
3859 `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
3860 `import_date` date DEFAULT NULL,
3861 `marc` longblob NOT NULL,
3862 `marcxml` longtext NOT NULL,
3863 `marcxml_old` longtext NOT NULL,
3864 `record_type` enum('biblio','auth','holdings') NOT NULL DEFAULT 'biblio',
3865 `overlay_status` enum('no_match','auto_match','manual_match','match_applied') NOT NULL DEFAULT 'no_match',
3866 `status` enum('error','staged','imported','reverted','items_reverted','ignored') NOT NULL DEFAULT 'staged',
3867 `import_error` longtext DEFAULT NULL,
3868 `encoding` varchar(40) NOT NULL DEFAULT '',
3869 PRIMARY KEY (`import_record_id`),
3870 KEY `branchcode` (`branchcode`),
3871 KEY `batch_sequence` (`import_batch_id`,`record_sequence`),
3872 KEY `batch_id_record_type` (`import_batch_id`,`record_type`),
3873 CONSTRAINT `import_records_ifbk_1` FOREIGN KEY (`import_batch_id`) REFERENCES `import_batches` (`import_batch_id`) ON DELETE CASCADE ON UPDATE CASCADE
3874 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3875 /*!40101 SET character_set_client = @saved_cs_client */;
3878 -- Table structure for table `issues`
3881 DROP TABLE IF EXISTS `issues`;
3882 /*!40101 SET @saved_cs_client = @@character_set_client */;
3883 /*!40101 SET character_set_client = utf8 */;
3884 CREATE TABLE `issues` (
3885 `issue_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key for issues table',
3886 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
3887 `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
3888 `itemnumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
3889 `date_due` datetime DEFAULT NULL COMMENT 'datetime the item is due (yyyy-mm-dd hh:mm::ss)',
3890 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
3891 `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned, will be NULL until moved to old_issues',
3892 `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
3893 `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
3894 `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
3895 `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
3896 `auto_renew_error` varchar(32) DEFAULT NULL COMMENT 'automatic renewal error',
3897 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
3898 `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
3899 `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
3900 `note` longtext DEFAULT NULL COMMENT 'issue note text',
3901 `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
3902 `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
3903 PRIMARY KEY (`issue_id`),
3904 UNIQUE KEY `itemnumber` (`itemnumber`),
3905 KEY `issuesborridx` (`borrowernumber`),
3906 KEY `itemnumber_idx` (`itemnumber`),
3907 KEY `branchcode_idx` (`branchcode`),
3908 KEY `bordate` (`borrowernumber`,`timestamp`),
3909 KEY `issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
3910 CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE,
3911 CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE,
3912 CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3913 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3914 /*!40101 SET character_set_client = @saved_cs_client */;
3917 -- Table structure for table `item_bundles`
3920 DROP TABLE IF EXISTS `item_bundles`;
3921 /*!40101 SET @saved_cs_client = @@character_set_client */;
3922 /*!40101 SET character_set_client = utf8 */;
3923 CREATE TABLE `item_bundles` (
3924 `item` int(11) NOT NULL,
3925 `host` int(11) NOT NULL,
3926 PRIMARY KEY (`host`,`item`),
3927 UNIQUE KEY `item_bundles_uniq_1` (`item`),
3928 CONSTRAINT `item_bundles_ibfk_1` FOREIGN KEY (`item`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3929 CONSTRAINT `item_bundles_ibfk_2` FOREIGN KEY (`host`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3930 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3931 /*!40101 SET character_set_client = @saved_cs_client */;
3934 -- Table structure for table `item_circulation_alert_preferences`
3937 DROP TABLE IF EXISTS `item_circulation_alert_preferences`;
3938 /*!40101 SET @saved_cs_client = @@character_set_client */;
3939 /*!40101 SET character_set_client = utf8 */;
3940 CREATE TABLE `item_circulation_alert_preferences` (
3941 `id` int(11) NOT NULL AUTO_INCREMENT,
3942 `branchcode` varchar(10) NOT NULL,
3943 `categorycode` varchar(10) NOT NULL,
3944 `item_type` varchar(10) NOT NULL,
3945 `notification` varchar(16) NOT NULL,
3947 KEY `branchcode` (`branchcode`,`categorycode`,`item_type`,`notification`)
3948 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3949 /*!40101 SET character_set_client = @saved_cs_client */;
3952 -- Table structure for table `item_editor_templates`
3955 DROP TABLE IF EXISTS `item_editor_templates`;
3956 /*!40101 SET @saved_cs_client = @@character_set_client */;
3957 /*!40101 SET character_set_client = utf8 */;
3958 CREATE TABLE `item_editor_templates` (
3959 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the template',
3960 `patron_id` int(11) DEFAULT NULL COMMENT 'creator of this template',
3961 `name` mediumtext NOT NULL COMMENT 'template name',
3962 `is_shared` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if template is shared',
3963 `contents` longtext NOT NULL COMMENT 'json encoded template data',
3965 KEY `bn` (`patron_id`),
3966 CONSTRAINT `bn` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3967 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3968 /*!40101 SET character_set_client = @saved_cs_client */;
3971 -- Table structure for table `item_group_items`
3974 DROP TABLE IF EXISTS `item_group_items`;
3975 /*!40101 SET @saved_cs_client = @@character_set_client */;
3976 /*!40101 SET character_set_client = utf8 */;
3977 CREATE TABLE `item_group_items` (
3978 `item_group_items_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the group/item link',
3979 `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',
3980 `item_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the items table',
3981 PRIMARY KEY (`item_group_items_id`),
3982 UNIQUE KEY `item_id` (`item_id`),
3983 KEY `item_group_items_gifk_1` (`item_group_id`),
3984 CONSTRAINT `item_group_items_gifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3985 CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3986 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3987 /*!40101 SET character_set_client = @saved_cs_client */;
3990 -- Table structure for table `item_groups`
3993 DROP TABLE IF EXISTS `item_groups`;
3994 /*!40101 SET @saved_cs_client = @@character_set_client */;
3995 /*!40101 SET character_set_client = utf8 */;
3996 CREATE TABLE `item_groups` (
3997 `item_group_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the items group',
3998 `biblio_id` int(11) NOT NULL COMMENT 'id for the bibliographic record the group belongs to',
3999 `display_order` int(4) NOT NULL DEFAULT 0 COMMENT 'The ''sort order'' for item_groups',
4000 `description` mediumtext DEFAULT NULL COMMENT 'A group description',
4001 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the group was created',
4002 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the group',
4003 PRIMARY KEY (`item_group_id`),
4004 KEY `item_groups_ibfk_1` (`biblio_id`),
4005 CONSTRAINT `item_groups_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
4006 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4007 /*!40101 SET character_set_client = @saved_cs_client */;
4010 -- Table structure for table `items`
4013 DROP TABLE IF EXISTS `items`;
4014 /*!40101 SET @saved_cs_client = @@character_set_client */;
4015 /*!40101 SET character_set_client = utf8 */;
4016 CREATE TABLE `items` (
4017 `itemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier added by Koha',
4018 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
4019 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
4020 `barcode` varchar(20) DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
4021 `bookable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean value defining whether this this item is available for bookings or not',
4022 `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
4023 `booksellerid` longtext DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
4024 `homebranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
4025 `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
4026 `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
4027 `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
4028 `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out/issued',
4029 `datelastseen` datetime DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
4030 `stack` tinyint(1) DEFAULT NULL,
4031 `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
4032 `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
4033 `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
4034 `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
4035 `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
4036 `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
4037 `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
4038 `itemcallnumber` varchar(255) DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
4039 `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
4040 `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out/issued',
4041 `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
4042 `localuse` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been recorded as localuse',
4043 `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
4044 `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
4045 `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
4046 `itemnotes_nonpublic` longtext DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
4047 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
4048 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
4049 `deleted_on` datetime DEFAULT NULL COMMENT 'date/time of deletion',
4050 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
4051 `permanent_location` varchar(80) DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
4052 `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
4053 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
4054 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
4055 `ccode` varchar(80) DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
4056 `materials` mediumtext DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
4057 `uri` mediumtext DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
4058 `itype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
4059 `more_subfields_xml` longtext DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
4060 `enumchron` mediumtext DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
4061 `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
4062 `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
4063 `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.',
4064 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
4065 PRIMARY KEY (`itemnumber`),
4066 UNIQUE KEY `itembarcodeidx` (`barcode`),
4067 KEY `itemstocknumberidx` (`stocknumber`),
4068 KEY `itembinoidx` (`biblioitemnumber`),
4069 KEY `itembibnoidx` (`biblionumber`),
4070 KEY `homebranch` (`homebranch`),
4071 KEY `holdingbranch` (`holdingbranch`),
4072 KEY `itemcallnumber` (`itemcallnumber`(191)),
4073 KEY `items_location` (`location`),
4074 KEY `items_ccode` (`ccode`),
4075 KEY `itype_idx` (`itype`),
4076 KEY `timestamp` (`timestamp`),
4077 CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4078 CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
4079 CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
4080 CONSTRAINT `items_ibfk_4` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
4081 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4082 /*!40101 SET character_set_client = @saved_cs_client */;
4085 -- Table structure for table `items_last_borrower`
4088 DROP TABLE IF EXISTS `items_last_borrower`;
4089 /*!40101 SET @saved_cs_client = @@character_set_client */;
4090 /*!40101 SET character_set_client = utf8 */;
4091 CREATE TABLE `items_last_borrower` (
4092 `id` int(11) NOT NULL AUTO_INCREMENT,
4093 `itemnumber` int(11) NOT NULL,
4094 `borrowernumber` int(11) NOT NULL,
4095 `created_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
4097 UNIQUE KEY `itemnumber` (`itemnumber`),
4098 KEY `borrowernumber` (`borrowernumber`),
4099 CONSTRAINT `items_last_borrower_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4100 CONSTRAINT `items_last_borrower_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4101 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4102 /*!40101 SET character_set_client = @saved_cs_client */;
4105 -- Table structure for table `items_search_fields`
4108 DROP TABLE IF EXISTS `items_search_fields`;
4109 /*!40101 SET @saved_cs_client = @@character_set_client */;
4110 /*!40101 SET character_set_client = utf8 */;
4111 CREATE TABLE `items_search_fields` (
4112 `name` varchar(255) NOT NULL,
4113 `label` varchar(255) NOT NULL,
4114 `tagfield` char(3) NOT NULL,
4115 `tagsubfield` char(1) DEFAULT NULL,
4116 `authorised_values_category` varchar(32) DEFAULT NULL,
4117 PRIMARY KEY (`name`(191)),
4118 KEY `items_search_fields_authorised_values_category` (`authorised_values_category`),
4119 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
4120 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4121 /*!40101 SET character_set_client = @saved_cs_client */;
4124 -- Table structure for table `itemtypes`
4127 DROP TABLE IF EXISTS `itemtypes`;
4128 /*!40101 SET @saved_cs_client = @@character_set_client */;
4129 /*!40101 SET character_set_client = utf8 */;
4130 CREATE TABLE `itemtypes` (
4131 `itemtype` varchar(10) NOT NULL DEFAULT '' COMMENT 'unique key, a code associated with the item type',
4132 `parent_type` varchar(10) DEFAULT NULL COMMENT 'unique key, a code associated with the item type',
4133 `description` longtext DEFAULT NULL COMMENT 'a plain text explanation of the item type',
4134 `rentalcharge` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged when this item is checked out/issued',
4135 `rentalcharge_daily` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each day between checkout date and due date',
4136 `rentalcharge_daily_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the daily rental fee is calculated directly or using finesCalendar',
4137 `rentalcharge_hourly` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each hour between checkout date and due date',
4138 `rentalcharge_hourly_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the hourly rental fee is calculated directly or using finesCalendar',
4139 `defaultreplacecost` decimal(28,6) DEFAULT NULL COMMENT 'default replacement cost',
4140 `processfee` decimal(28,6) DEFAULT NULL COMMENT 'default text be recorded in the column note when the processing fee is applied',
4141 `notforloan` smallint(6) DEFAULT NULL COMMENT '1 if the item is not for loan, 0 if the item is available for loan',
4142 `imageurl` varchar(200) DEFAULT NULL COMMENT 'URL for the item type icon',
4143 `summary` mediumtext DEFAULT NULL COMMENT 'information from the summary field, may include HTML',
4144 `checkinmsg` varchar(255) DEFAULT NULL COMMENT 'message that is displayed when an item with the given item type is checked in',
4145 `checkinmsgtype` char(16) NOT NULL DEFAULT 'message' COMMENT 'type (CSS class) for the checkinmsg, can be ''alert'' or ''message''',
4146 `sip_media_type` varchar(3) DEFAULT NULL COMMENT 'SIP2 protocol media type for this itemtype',
4147 `hideinopac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Hide the item type from the search options in OPAC',
4148 `searchcategory` varchar(80) DEFAULT NULL COMMENT 'Group this item type with others with the same value on OPAC search options',
4149 `automatic_checkin` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If automatic checkin is enabled for items of this type',
4150 PRIMARY KEY (`itemtype`),
4151 UNIQUE KEY `itemtype` (`itemtype`),
4152 KEY `itemtypes_ibfk_1` (`parent_type`),
4153 CONSTRAINT `itemtypes_ibfk_1` FOREIGN KEY (`parent_type`) REFERENCES `itemtypes` (`itemtype`)
4154 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4155 /*!40101 SET character_set_client = @saved_cs_client */;
4158 -- Table structure for table `itemtypes_branches`
4161 DROP TABLE IF EXISTS `itemtypes_branches`;
4162 /*!40101 SET @saved_cs_client = @@character_set_client */;
4163 /*!40101 SET character_set_client = utf8 */;
4164 CREATE TABLE `itemtypes_branches` (
4165 `itemtype` varchar(10) NOT NULL,
4166 `branchcode` varchar(10) NOT NULL,
4167 KEY `itemtype` (`itemtype`),
4168 KEY `branchcode` (`branchcode`),
4169 CONSTRAINT `itemtypes_branches_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE,
4170 CONSTRAINT `itemtypes_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
4171 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4172 /*!40101 SET character_set_client = @saved_cs_client */;
4175 -- Table structure for table `keyboard_shortcuts`
4178 DROP TABLE IF EXISTS `keyboard_shortcuts`;
4179 /*!40101 SET @saved_cs_client = @@character_set_client */;
4180 /*!40101 SET character_set_client = utf8 */;
4181 CREATE TABLE `keyboard_shortcuts` (
4182 `shortcut_name` varchar(80) NOT NULL,
4183 `shortcut_keys` varchar(80) NOT NULL,
4184 PRIMARY KEY (`shortcut_name`)
4185 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4186 /*!40101 SET character_set_client = @saved_cs_client */;
4189 -- Table structure for table `language_descriptions`
4192 DROP TABLE IF EXISTS `language_descriptions`;
4193 /*!40101 SET @saved_cs_client = @@character_set_client */;
4194 /*!40101 SET character_set_client = utf8 */;
4195 CREATE TABLE `language_descriptions` (
4196 `subtag` varchar(25) DEFAULT NULL,
4197 `type` varchar(25) DEFAULT NULL,
4198 `lang` varchar(25) DEFAULT NULL,
4199 `description` varchar(255) DEFAULT NULL,
4200 `id` int(11) NOT NULL AUTO_INCREMENT,
4202 UNIQUE KEY `uniq_desc` (`subtag`,`type`,`lang`),
4204 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4205 /*!40101 SET character_set_client = @saved_cs_client */;
4208 -- Table structure for table `language_rfc4646_to_iso639`
4211 DROP TABLE IF EXISTS `language_rfc4646_to_iso639`;
4212 /*!40101 SET @saved_cs_client = @@character_set_client */;
4213 /*!40101 SET character_set_client = utf8 */;
4214 CREATE TABLE `language_rfc4646_to_iso639` (
4215 `rfc4646_subtag` varchar(25) DEFAULT NULL,
4216 `iso639_2_code` varchar(25) DEFAULT NULL,
4217 `id` int(11) NOT NULL AUTO_INCREMENT,
4219 UNIQUE KEY `uniq_code` (`rfc4646_subtag`,`iso639_2_code`),
4220 KEY `rfc4646_subtag` (`rfc4646_subtag`)
4221 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4222 /*!40101 SET character_set_client = @saved_cs_client */;
4225 -- Table structure for table `language_script_bidi`
4228 DROP TABLE IF EXISTS `language_script_bidi`;
4229 /*!40101 SET @saved_cs_client = @@character_set_client */;
4230 /*!40101 SET character_set_client = utf8 */;
4231 CREATE TABLE `language_script_bidi` (
4232 `rfc4646_subtag` varchar(25) DEFAULT NULL COMMENT 'script subtag, Arab, Hebr, etc.',
4233 `bidi` varchar(3) DEFAULT NULL COMMENT 'rtl ltr',
4234 KEY `rfc4646_subtag` (`rfc4646_subtag`)
4235 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4236 /*!40101 SET character_set_client = @saved_cs_client */;
4239 -- Table structure for table `language_script_mapping`
4242 DROP TABLE IF EXISTS `language_script_mapping`;
4243 /*!40101 SET @saved_cs_client = @@character_set_client */;
4244 /*!40101 SET character_set_client = utf8 */;
4245 CREATE TABLE `language_script_mapping` (
4246 `language_subtag` varchar(25) NOT NULL,
4247 `script_subtag` varchar(25) DEFAULT NULL,
4248 PRIMARY KEY (`language_subtag`)
4249 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4250 /*!40101 SET character_set_client = @saved_cs_client */;
4253 -- Table structure for table `language_subtag_registry`
4256 DROP TABLE IF EXISTS `language_subtag_registry`;
4257 /*!40101 SET @saved_cs_client = @@character_set_client */;
4258 /*!40101 SET character_set_client = utf8 */;
4259 CREATE TABLE `language_subtag_registry` (
4260 `subtag` varchar(25) DEFAULT NULL,
4261 `type` varchar(25) DEFAULT NULL COMMENT 'language-script-region-variant-extension-privateuse',
4262 `description` varchar(255) DEFAULT NULL COMMENT 'only one of the possible descriptions for ease of reference, see language_descriptions for the complete list',
4263 `added` date DEFAULT NULL,
4264 `id` int(11) NOT NULL AUTO_INCREMENT,
4266 UNIQUE KEY `uniq_lang` (`subtag`,`type`),
4267 KEY `subtag` (`subtag`)
4268 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4269 /*!40101 SET character_set_client = @saved_cs_client */;
4272 -- Table structure for table `letter`
4275 DROP TABLE IF EXISTS `letter`;
4276 /*!40101 SET @saved_cs_client = @@character_set_client */;
4277 /*!40101 SET character_set_client = utf8 */;
4278 CREATE TABLE `letter` (
4279 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
4280 `module` varchar(20) NOT NULL DEFAULT '' COMMENT 'Koha module that triggers this notice or slip',
4281 `code` varchar(20) NOT NULL DEFAULT '' COMMENT 'unique identifier for this notice or slip',
4282 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch this notice or slip is used at (branches.branchcode)',
4283 `name` varchar(100) NOT NULL DEFAULT '' COMMENT 'plain text name for this notice or slip',
4284 `is_html` tinyint(1) DEFAULT 0 COMMENT 'does this notice or slip use HTML (1 for yes, 0 for no)',
4285 `title` varchar(200) NOT NULL DEFAULT '' COMMENT 'subject line of the notice',
4286 `content` mediumtext DEFAULT NULL COMMENT 'body text for the notice or slip',
4287 `message_transport_type` varchar(20) NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
4288 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
4289 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
4290 `style` mediumtext DEFAULT NULL COMMENT 'custom styles for this notice',
4292 UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
4293 KEY `message_transport_type_fk` (`message_transport_type`),
4294 CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
4295 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4296 /*!40101 SET character_set_client = @saved_cs_client */;
4299 -- Table structure for table `library_hours`
4301 DROP TABLE IF EXISTS library_hours;
4302 CREATE TABLE library_hours (
4303 library_id varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
4304 day enum('0','1','2','3','4','5','6') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0',
4305 open_time time COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4306 close_time time COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4307 PRIMARY KEY (library_id, day),
4308 CONSTRAINT library_hours_ibfk_1 FOREIGN KEY (library_id) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE
4309 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4312 -- Table structure for table `library_groups`
4315 DROP TABLE IF EXISTS `library_groups`;
4316 /*!40101 SET @saved_cs_client = @@character_set_client */;
4317 /*!40101 SET character_set_client = utf8 */;
4318 CREATE TABLE `library_groups` (
4319 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for each group',
4320 `parent_id` int(11) DEFAULT NULL COMMENT 'if this is a child group, the id of the parent group',
4321 `branchcode` varchar(10) DEFAULT NULL COMMENT 'The branchcode of a branch belonging to the parent group',
4322 `title` varchar(100) DEFAULT NULL COMMENT 'Short description of the goup',
4323 `description` mediumtext DEFAULT NULL COMMENT 'Longer explanation of the group, if necessary',
4324 `ft_hide_patron_info` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Turn on the feature ''Hide patron''s info'' for this group',
4325 `ft_limit_item_editing` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Turn on the feature "Limit item editing by group" for this group',
4326 `ft_search_groups_opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for staff side search groups',
4327 `ft_search_groups_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for opac side search groups',
4328 `ft_local_hold_group` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group to identify libraries as pick up location for holds',
4329 `ft_local_float_group` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group to identify libraries as part of float group',
4330 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Date and time of creation',
4331 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time of last',
4333 UNIQUE KEY `title` (`title`),
4334 UNIQUE KEY `library_groups_uniq_2` (`parent_id`,`branchcode`),
4335 KEY `branchcode` (`branchcode`),
4336 CONSTRAINT `library_groups_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `library_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
4337 CONSTRAINT `library_groups_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4338 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4339 /*!40101 SET character_set_client = @saved_cs_client */;
4342 -- Table structure for table `library_smtp_servers`
4345 DROP TABLE IF EXISTS `library_smtp_servers`;
4346 /*!40101 SET @saved_cs_client = @@character_set_client */;
4347 /*!40101 SET character_set_client = utf8 */;
4348 CREATE TABLE `library_smtp_servers` (
4349 `id` int(11) NOT NULL AUTO_INCREMENT,
4350 `library_id` varchar(10) NOT NULL,
4351 `smtp_server_id` int(11) NOT NULL,
4353 UNIQUE KEY `library_id_idx` (`library_id`),
4354 KEY `smtp_server_id_idx` (`smtp_server_id`),
4355 CONSTRAINT `library_smtp_servers_library_fk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4356 CONSTRAINT `library_smtp_servers_smtp_servers_fk` FOREIGN KEY (`smtp_server_id`) REFERENCES `smtp_servers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4357 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4358 /*!40101 SET character_set_client = @saved_cs_client */;
4361 -- Table structure for table `linktracker`
4364 DROP TABLE IF EXISTS `linktracker`;
4365 /*!40101 SET @saved_cs_client = @@character_set_client */;
4366 /*!40101 SET character_set_client = utf8 */;
4367 CREATE TABLE `linktracker` (
4368 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
4369 `biblionumber` int(11) DEFAULT NULL COMMENT 'biblionumber of the record the link is from',
4370 `itemnumber` int(11) DEFAULT NULL COMMENT 'itemnumber if applicable that the link was from',
4371 `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrowernumber who clicked the link',
4372 `url` mediumtext DEFAULT NULL COMMENT 'the link itself',
4373 `timeclicked` datetime DEFAULT NULL COMMENT 'the date and time the link was clicked',
4375 KEY `bibidx` (`biblionumber`),
4376 KEY `itemidx` (`itemnumber`),
4377 KEY `borridx` (`borrowernumber`),
4378 KEY `dateidx` (`timeclicked`),
4379 CONSTRAINT `linktracker_biblio_ibfk` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4380 CONSTRAINT `linktracker_borrower_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4381 CONSTRAINT `linktracker_item_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL
4382 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4383 /*!40101 SET character_set_client = @saved_cs_client */;
4386 -- Table structure for table `localization`
4389 DROP TABLE IF EXISTS `localization`;
4390 /*!40101 SET @saved_cs_client = @@character_set_client */;
4391 /*!40101 SET character_set_client = utf8 */;
4392 CREATE TABLE `localization` (
4393 `localization_id` int(11) NOT NULL AUTO_INCREMENT,
4394 `entity` varchar(16) NOT NULL,
4395 `code` varchar(64) NOT NULL,
4396 `lang` varchar(25) NOT NULL COMMENT 'could be a foreign key',
4397 `translation` mediumtext DEFAULT NULL,
4398 PRIMARY KEY (`localization_id`),
4399 UNIQUE KEY `entity_code_lang` (`entity`,`code`,`lang`)
4400 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4401 /*!40101 SET character_set_client = @saved_cs_client */;
4404 -- Table structure for table `marc_matchers`
4407 DROP TABLE IF EXISTS `marc_matchers`;
4408 /*!40101 SET @saved_cs_client = @@character_set_client */;
4409 /*!40101 SET character_set_client = utf8 */;
4410 CREATE TABLE `marc_matchers` (
4411 `matcher_id` int(11) NOT NULL AUTO_INCREMENT,
4412 `code` varchar(10) NOT NULL DEFAULT '',
4413 `description` varchar(255) NOT NULL DEFAULT '',
4414 `record_type` varchar(10) NOT NULL DEFAULT 'biblio',
4415 `threshold` int(11) NOT NULL DEFAULT 0,
4416 PRIMARY KEY (`matcher_id`),
4417 KEY `code` (`code`),
4418 KEY `record_type` (`record_type`)
4419 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4420 /*!40101 SET character_set_client = @saved_cs_client */;
4423 -- Table structure for table `marc_modification_template_actions`
4426 DROP TABLE IF EXISTS `marc_modification_template_actions`;
4427 /*!40101 SET @saved_cs_client = @@character_set_client */;
4428 /*!40101 SET character_set_client = utf8 */;
4429 CREATE TABLE `marc_modification_template_actions` (
4430 `mmta_id` int(11) NOT NULL AUTO_INCREMENT,
4431 `template_id` int(11) NOT NULL,
4432 `ordering` int(3) NOT NULL,
4433 `action` enum('delete_field','add_field','update_field','move_field','copy_field','copy_and_replace_field') NOT NULL,
4434 `field_number` smallint(6) NOT NULL DEFAULT 0,
4435 `from_field` varchar(3) NOT NULL,
4436 `from_subfield` varchar(1) DEFAULT NULL,
4437 `field_value` text DEFAULT NULL,
4438 `to_field` varchar(3) DEFAULT NULL,
4439 `to_subfield` varchar(1) DEFAULT NULL,
4440 `to_regex_search` mediumtext DEFAULT NULL,
4441 `to_regex_replace` mediumtext DEFAULT NULL,
4442 `to_regex_modifiers` varchar(8) DEFAULT '',
4443 `conditional` enum('if','unless') DEFAULT NULL,
4444 `conditional_field` varchar(3) DEFAULT NULL,
4445 `conditional_subfield` varchar(1) DEFAULT NULL,
4446 `conditional_comparison` enum('exists','not_exists','equals','not_equals') DEFAULT NULL,
4447 `conditional_value` mediumtext DEFAULT NULL,
4448 `conditional_regex` tinyint(1) NOT NULL DEFAULT 0,
4449 `description` mediumtext DEFAULT NULL,
4450 PRIMARY KEY (`mmta_id`),
4451 KEY `mmta_ibfk_1` (`template_id`),
4452 CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
4453 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4454 /*!40101 SET character_set_client = @saved_cs_client */;
4457 -- Table structure for table `marc_modification_templates`
4460 DROP TABLE IF EXISTS `marc_modification_templates`;
4461 /*!40101 SET @saved_cs_client = @@character_set_client */;
4462 /*!40101 SET character_set_client = utf8 */;
4463 CREATE TABLE `marc_modification_templates` (
4464 `template_id` int(11) NOT NULL AUTO_INCREMENT,
4465 `name` mediumtext NOT NULL,
4466 PRIMARY KEY (`template_id`)
4467 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4468 /*!40101 SET character_set_client = @saved_cs_client */;
4471 -- Table structure for table `marc_overlay_rules`
4474 DROP TABLE IF EXISTS `marc_overlay_rules`;
4475 /*!40101 SET @saved_cs_client = @@character_set_client */;
4476 /*!40101 SET character_set_client = utf8 */;
4477 CREATE TABLE `marc_overlay_rules` (
4478 `id` int(11) NOT NULL AUTO_INCREMENT,
4479 `tag` varchar(255) NOT NULL,
4480 `module` varchar(127) NOT NULL,
4481 `filter` varchar(255) NOT NULL,
4482 `add` tinyint(1) NOT NULL DEFAULT 0,
4483 `append` tinyint(1) NOT NULL DEFAULT 0,
4484 `remove` tinyint(1) NOT NULL DEFAULT 0,
4485 `delete` tinyint(1) NOT NULL DEFAULT 0,
4487 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4488 /*!40101 SET character_set_client = @saved_cs_client */;
4491 -- Table structure for table `marc_subfield_structure`
4494 DROP TABLE IF EXISTS `marc_subfield_structure`;
4495 /*!40101 SET @saved_cs_client = @@character_set_client */;
4496 /*!40101 SET character_set_client = utf8 */;
4497 CREATE TABLE `marc_subfield_structure` (
4498 `tagfield` varchar(3) NOT NULL DEFAULT '',
4499 `tagsubfield` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
4500 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
4501 `libopac` varchar(255) NOT NULL DEFAULT '',
4502 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
4503 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4504 `important` tinyint(4) NOT NULL DEFAULT 0,
4505 `kohafield` varchar(40) DEFAULT NULL,
4506 `tab` tinyint(1) DEFAULT NULL,
4507 `authorised_value` varchar(32) DEFAULT NULL,
4508 `authtypecode` varchar(20) DEFAULT NULL,
4509 `value_builder` varchar(80) DEFAULT NULL,
4510 `isurl` tinyint(1) DEFAULT NULL,
4511 `hidden` tinyint(1) NOT NULL DEFAULT 8,
4512 `frameworkcode` varchar(4) NOT NULL DEFAULT '',
4513 `seealso` varchar(1100) DEFAULT NULL,
4514 `link` varchar(80) DEFAULT NULL,
4515 `defaultvalue` mediumtext DEFAULT NULL,
4516 `maxlength` int(4) NOT NULL DEFAULT 9999,
4517 `display_order` int(2) NOT NULL DEFAULT 0,
4518 PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`),
4519 KEY `kohafield_2` (`kohafield`),
4520 KEY `tab` (`frameworkcode`,`tab`),
4521 KEY `kohafield` (`frameworkcode`,`kohafield`),
4522 KEY `marc_subfield_structure_ibfk_1` (`authorised_value`),
4523 CONSTRAINT `marc_subfield_structure_ibfk_1` FOREIGN KEY (`authorised_value`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE SET NULL ON UPDATE CASCADE
4524 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4525 /*!40101 SET character_set_client = @saved_cs_client */;
4528 -- Table structure for table `marc_tag_structure`
4531 DROP TABLE IF EXISTS `marc_tag_structure`;
4532 /*!40101 SET @saved_cs_client = @@character_set_client */;
4533 /*!40101 SET character_set_client = utf8 */;
4534 CREATE TABLE `marc_tag_structure` (
4535 `tagfield` varchar(3) NOT NULL DEFAULT '',
4536 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
4537 `libopac` varchar(255) NOT NULL DEFAULT '',
4538 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
4539 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4540 `important` tinyint(4) NOT NULL DEFAULT 0,
4541 `authorised_value` varchar(32) DEFAULT NULL,
4542 `ind1_defaultvalue` varchar(1) NOT NULL DEFAULT '',
4543 `ind2_defaultvalue` varchar(1) NOT NULL DEFAULT '',
4544 `frameworkcode` varchar(4) NOT NULL DEFAULT '',
4545 PRIMARY KEY (`frameworkcode`,`tagfield`)
4546 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4547 /*!40101 SET character_set_client = @saved_cs_client */;
4550 -- Table structure for table `matchchecks`
4553 DROP TABLE IF EXISTS `matchchecks`;
4554 /*!40101 SET @saved_cs_client = @@character_set_client */;
4555 /*!40101 SET character_set_client = utf8 */;
4556 CREATE TABLE `matchchecks` (
4557 `matcher_id` int(11) NOT NULL,
4558 `matchcheck_id` int(11) NOT NULL AUTO_INCREMENT,
4559 `source_matchpoint_id` int(11) NOT NULL,
4560 `target_matchpoint_id` int(11) NOT NULL,
4561 PRIMARY KEY (`matchcheck_id`),
4562 KEY `matcher_matchchecks_ifbk_1` (`matcher_id`),
4563 KEY `matcher_matchchecks_ifbk_2` (`source_matchpoint_id`),
4564 KEY `matcher_matchchecks_ifbk_3` (`target_matchpoint_id`),
4565 CONSTRAINT `matcher_matchchecks_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4566 CONSTRAINT `matcher_matchchecks_ifbk_2` FOREIGN KEY (`source_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4567 CONSTRAINT `matcher_matchchecks_ifbk_3` FOREIGN KEY (`target_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4568 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4569 /*!40101 SET character_set_client = @saved_cs_client */;
4572 -- Table structure for table `matcher_matchpoints`
4575 DROP TABLE IF EXISTS `matcher_matchpoints`;
4576 /*!40101 SET @saved_cs_client = @@character_set_client */;
4577 /*!40101 SET character_set_client = utf8 */;
4578 CREATE TABLE `matcher_matchpoints` (
4579 `matcher_id` int(11) NOT NULL,
4580 `matchpoint_id` int(11) NOT NULL,
4581 KEY `matcher_matchpoints_ifbk_1` (`matcher_id`),
4582 KEY `matcher_matchpoints_ifbk_2` (`matchpoint_id`),
4583 CONSTRAINT `matcher_matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4584 CONSTRAINT `matcher_matchpoints_ifbk_2` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4585 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4586 /*!40101 SET character_set_client = @saved_cs_client */;
4589 -- Table structure for table `matchpoint_component_norms`
4592 DROP TABLE IF EXISTS `matchpoint_component_norms`;
4593 /*!40101 SET @saved_cs_client = @@character_set_client */;
4594 /*!40101 SET character_set_client = utf8 */;
4595 CREATE TABLE `matchpoint_component_norms` (
4596 `matchpoint_component_id` int(11) NOT NULL,
4597 `sequence` int(11) NOT NULL DEFAULT 0,
4598 `norm_routine` varchar(50) NOT NULL DEFAULT '',
4599 KEY `matchpoint_component_norms` (`matchpoint_component_id`,`sequence`),
4600 CONSTRAINT `matchpoint_component_norms_ifbk_1` FOREIGN KEY (`matchpoint_component_id`) REFERENCES `matchpoint_components` (`matchpoint_component_id`) ON DELETE CASCADE ON UPDATE CASCADE
4601 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4602 /*!40101 SET character_set_client = @saved_cs_client */;
4605 -- Table structure for table `matchpoint_components`
4608 DROP TABLE IF EXISTS `matchpoint_components`;
4609 /*!40101 SET @saved_cs_client = @@character_set_client */;
4610 /*!40101 SET character_set_client = utf8 */;
4611 CREATE TABLE `matchpoint_components` (
4612 `matchpoint_id` int(11) NOT NULL,
4613 `matchpoint_component_id` int(11) NOT NULL AUTO_INCREMENT,
4614 `sequence` int(11) NOT NULL DEFAULT 0,
4615 `tag` varchar(3) NOT NULL DEFAULT '',
4616 `subfields` varchar(40) NOT NULL DEFAULT '',
4617 `offset` int(4) NOT NULL DEFAULT 0,
4618 `length` int(4) NOT NULL DEFAULT 0,
4619 PRIMARY KEY (`matchpoint_component_id`),
4620 KEY `by_sequence` (`matchpoint_id`,`sequence`),
4621 CONSTRAINT `matchpoint_components_ifbk_1` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4622 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4623 /*!40101 SET character_set_client = @saved_cs_client */;
4626 -- Table structure for table `matchpoints`
4629 DROP TABLE IF EXISTS `matchpoints`;
4630 /*!40101 SET @saved_cs_client = @@character_set_client */;
4631 /*!40101 SET character_set_client = utf8 */;
4632 CREATE TABLE `matchpoints` (
4633 `matcher_id` int(11) NOT NULL,
4634 `matchpoint_id` int(11) NOT NULL AUTO_INCREMENT,
4635 `search_index` varchar(30) NOT NULL DEFAULT '',
4636 `score` int(11) NOT NULL DEFAULT 0,
4637 PRIMARY KEY (`matchpoint_id`),
4638 KEY `matchpoints_ifbk_1` (`matcher_id`),
4639 CONSTRAINT `matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE
4640 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4641 /*!40101 SET character_set_client = @saved_cs_client */;
4644 -- Table structure for table `message_attributes`
4647 DROP TABLE IF EXISTS `message_attributes`;
4648 /*!40101 SET @saved_cs_client = @@character_set_client */;
4649 /*!40101 SET character_set_client = utf8 */;
4650 CREATE TABLE `message_attributes` (
4651 `message_attribute_id` int(11) NOT NULL AUTO_INCREMENT,
4652 `message_name` varchar(40) NOT NULL DEFAULT '',
4653 `takes_days` tinyint(1) NOT NULL DEFAULT 0,
4654 PRIMARY KEY (`message_attribute_id`),
4655 UNIQUE KEY `message_name` (`message_name`)
4656 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4657 /*!40101 SET character_set_client = @saved_cs_client */;
4660 -- Table structure for table `message_queue`
4663 DROP TABLE IF EXISTS `message_queue`;
4664 /*!40101 SET @saved_cs_client = @@character_set_client */;
4665 /*!40101 SET character_set_client = utf8 */;
4666 CREATE TABLE `message_queue` (
4667 `message_id` int(11) NOT NULL AUTO_INCREMENT,
4668 `letter_id` int(11) DEFAULT NULL COMMENT 'Foreign key to the letters table',
4669 `borrowernumber` int(11) DEFAULT NULL,
4670 `subject` mediumtext DEFAULT NULL,
4671 `content` mediumtext DEFAULT NULL,
4672 `metadata` mediumtext DEFAULT NULL,
4673 `letter_code` varchar(64) DEFAULT NULL,
4674 `message_transport_type` varchar(20) NOT NULL,
4675 `status` enum('sent','pending','failed','deleted') NOT NULL DEFAULT 'pending',
4676 `time_queued` timestamp NULL DEFAULT NULL,
4677 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
4678 `to_address` longtext DEFAULT NULL,
4679 `cc_address` longtext DEFAULT NULL,
4680 `from_address` longtext DEFAULT NULL,
4681 `reply_address` longtext DEFAULT NULL,
4682 `content_type` mediumtext DEFAULT NULL,
4683 `failure_code` mediumtext DEFAULT NULL,
4684 PRIMARY KEY (`message_id`),
4685 KEY `borrowernumber` (`borrowernumber`),
4686 KEY `message_transport_type` (`message_transport_type`),
4687 KEY `letter_fk` (`letter_id`),
4688 CONSTRAINT `letter_fk` FOREIGN KEY (`letter_id`) REFERENCES `letter` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
4689 CONSTRAINT `messageq_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4690 CONSTRAINT `messageq_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON UPDATE CASCADE
4691 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4692 /*!40101 SET character_set_client = @saved_cs_client */;
4695 -- Table structure for table `message_transport_types`
4698 DROP TABLE IF EXISTS `message_transport_types`;
4699 /*!40101 SET @saved_cs_client = @@character_set_client */;
4700 /*!40101 SET character_set_client = utf8 */;
4701 CREATE TABLE `message_transport_types` (
4702 `message_transport_type` varchar(20) NOT NULL,
4703 PRIMARY KEY (`message_transport_type`)
4704 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4705 /*!40101 SET character_set_client = @saved_cs_client */;
4708 -- Table structure for table `message_transports`
4711 DROP TABLE IF EXISTS `message_transports`;
4712 /*!40101 SET @saved_cs_client = @@character_set_client */;
4713 /*!40101 SET character_set_client = utf8 */;
4714 CREATE TABLE `message_transports` (
4715 `message_attribute_id` int(11) NOT NULL,
4716 `message_transport_type` varchar(20) NOT NULL,
4717 `is_digest` tinyint(1) NOT NULL DEFAULT 0,
4718 `letter_module` varchar(20) NOT NULL DEFAULT '',
4719 `letter_code` varchar(20) NOT NULL DEFAULT '',
4720 `branchcode` varchar(10) NOT NULL DEFAULT '',
4721 PRIMARY KEY (`message_attribute_id`,`message_transport_type`,`is_digest`),
4722 KEY `message_transport_type` (`message_transport_type`),
4723 KEY `letter_module` (`letter_module`,`letter_code`),
4724 CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4725 CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
4726 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4727 /*!40101 SET character_set_client = @saved_cs_client */;
4730 -- Table structure for table `messages`
4733 DROP TABLE IF EXISTS `messages`;
4734 /*!40101 SET @saved_cs_client = @@character_set_client */;
4735 /*!40101 SET character_set_client = utf8 */;
4736 CREATE TABLE `messages` (
4737 `message_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4738 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking this message to the borrowers table',
4739 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key linking the message to the branches table',
4740 `message_type` varchar(1) NOT NULL COMMENT 'whether the message is for the librarians (L) or the patron (B)',
4741 `message` mediumtext NOT NULL COMMENT 'the text of the message',
4742 `message_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the message was written',
4743 `manager_id` int(11) DEFAULT NULL COMMENT 'creator of message',
4744 `patron_read_date` timestamp NULL DEFAULT NULL COMMENT 'the date and time the patron dismissed the message',
4745 PRIMARY KEY (`message_id`),
4746 KEY `messages_ibfk_1` (`manager_id`),
4747 KEY `messages_borrowernumber` (`borrowernumber`),
4748 CONSTRAINT `messages_borrowernumber` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4749 CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL
4750 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4751 /*!40101 SET character_set_client = @saved_cs_client */;
4754 -- Table structure for table `misc_files`
4757 DROP TABLE IF EXISTS `misc_files`;
4758 /*!40101 SET @saved_cs_client = @@character_set_client */;
4759 /*!40101 SET character_set_client = utf8 */;
4760 CREATE TABLE `misc_files` (
4761 `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the file record',
4762 `table_tag` varchar(255) NOT NULL COMMENT 'usually table name, or arbitrary unique tag',
4763 `record_id` int(11) NOT NULL COMMENT 'record id from the table this file is associated to',
4764 `file_name` varchar(255) NOT NULL COMMENT 'file name',
4765 `file_type` varchar(255) NOT NULL COMMENT 'MIME type of the file',
4766 `file_description` varchar(255) DEFAULT NULL COMMENT 'description given to the file',
4767 `file_content` longblob NOT NULL COMMENT 'file content',
4768 `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
4769 PRIMARY KEY (`file_id`),
4770 KEY `table_tag` (`table_tag`(191)),
4771 KEY `record_id` (`record_id`)
4772 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4773 /*!40101 SET character_set_client = @saved_cs_client */;
4776 -- Table structure for table `need_merge_authorities`
4779 DROP TABLE IF EXISTS `need_merge_authorities`;
4780 /*!40101 SET @saved_cs_client = @@character_set_client */;
4781 /*!40101 SET character_set_client = utf8 */;
4782 CREATE TABLE `need_merge_authorities` (
4783 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id',
4784 `authid` bigint(20) NOT NULL COMMENT 'reference to original authority record',
4785 `authid_new` bigint(20) DEFAULT NULL COMMENT 'reference to optional new authority record',
4786 `reportxml` mediumtext DEFAULT NULL COMMENT 'xml showing original reporting tag',
4787 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time last modified',
4788 `done` tinyint(4) DEFAULT 0,
4790 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4791 /*!40101 SET character_set_client = @saved_cs_client */;
4794 -- Table structure for table `oai_sets`
4797 DROP TABLE IF EXISTS `oai_sets`;
4798 /*!40101 SET @saved_cs_client = @@character_set_client */;
4799 /*!40101 SET character_set_client = utf8 */;
4800 CREATE TABLE `oai_sets` (
4801 `id` int(11) NOT NULL AUTO_INCREMENT,
4802 `spec` varchar(80) NOT NULL,
4803 `name` varchar(80) NOT NULL,
4805 UNIQUE KEY `spec` (`spec`)
4806 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4807 /*!40101 SET character_set_client = @saved_cs_client */;
4810 -- Table structure for table `oai_sets_biblios`
4813 DROP TABLE IF EXISTS `oai_sets_biblios`;
4814 /*!40101 SET @saved_cs_client = @@character_set_client */;
4815 /*!40101 SET character_set_client = utf8 */;
4816 CREATE TABLE `oai_sets_biblios` (
4817 `biblionumber` int(11) NOT NULL,
4818 `set_id` int(11) NOT NULL,
4819 PRIMARY KEY (`biblionumber`,`set_id`),
4820 KEY `oai_sets_biblios_ibfk_2` (`set_id`),
4821 CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4822 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4823 /*!40101 SET character_set_client = @saved_cs_client */;
4826 -- Table structure for table `oai_sets_descriptions`
4829 DROP TABLE IF EXISTS `oai_sets_descriptions`;
4830 /*!40101 SET @saved_cs_client = @@character_set_client */;
4831 /*!40101 SET character_set_client = utf8 */;
4832 CREATE TABLE `oai_sets_descriptions` (
4833 `set_id` int(11) NOT NULL,
4834 `description` varchar(255) NOT NULL,
4835 KEY `oai_sets_descriptions_ibfk_1` (`set_id`),
4836 CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4837 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4838 /*!40101 SET character_set_client = @saved_cs_client */;
4841 -- Table structure for table `oai_sets_mappings`
4844 DROP TABLE IF EXISTS `oai_sets_mappings`;
4845 /*!40101 SET @saved_cs_client = @@character_set_client */;
4846 /*!40101 SET character_set_client = utf8 */;
4847 CREATE TABLE `oai_sets_mappings` (
4848 `set_id` int(11) NOT NULL,
4849 `rule_order` int(11) DEFAULT NULL,
4850 `rule_operator` varchar(3) DEFAULT NULL,
4851 `marcfield` char(3) NOT NULL,
4852 `marcsubfield` char(1) NOT NULL,
4853 `operator` varchar(8) NOT NULL DEFAULT 'equal',
4854 `marcvalue` varchar(80) NOT NULL,
4855 KEY `oai_sets_mappings_ibfk_1` (`set_id`),
4856 CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4857 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4858 /*!40101 SET character_set_client = @saved_cs_client */;
4861 -- Table structure for table `oauth_access_tokens`
4864 DROP TABLE IF EXISTS `oauth_access_tokens`;
4865 /*!40101 SET @saved_cs_client = @@character_set_client */;
4866 /*!40101 SET character_set_client = utf8 */;
4867 CREATE TABLE `oauth_access_tokens` (
4868 `access_token` varchar(191) NOT NULL COMMENT 'generarated access token',
4869 `client_id` varchar(191) NOT NULL COMMENT 'the client id the access token belongs to',
4870 `expires` int(11) NOT NULL COMMENT 'expiration time in seconds',
4871 PRIMARY KEY (`access_token`)
4872 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4873 /*!40101 SET character_set_client = @saved_cs_client */;
4876 -- Table structure for table `old_issues`
4879 DROP TABLE IF EXISTS `old_issues`;
4880 /*!40101 SET @saved_cs_client = @@character_set_client */;
4881 /*!40101 SET character_set_client = utf8 */;
4882 CREATE TABLE `old_issues` (
4883 `issue_id` int(11) NOT NULL COMMENT 'primary key for issues table',
4884 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
4885 `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
4886 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
4887 `date_due` datetime DEFAULT NULL COMMENT 'date the item is due (yyyy-mm-dd)',
4888 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
4889 `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned',
4890 `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
4891 `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
4892 `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
4893 `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
4894 `auto_renew_error` varchar(32) DEFAULT NULL COMMENT 'automatic renewal error',
4895 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
4896 `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
4897 `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
4898 `note` longtext DEFAULT NULL COMMENT 'issue note text',
4899 `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
4900 `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
4901 PRIMARY KEY (`issue_id`),
4902 KEY `old_issuesborridx` (`borrowernumber`),
4903 KEY `old_issuesitemidx` (`itemnumber`),
4904 KEY `branchcode_idx` (`branchcode`),
4905 KEY `old_bordate` (`borrowernumber`,`timestamp`),
4906 KEY `old_issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
4907 CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4908 CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4909 CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
4910 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4911 /*!40101 SET character_set_client = @saved_cs_client */;
4914 -- Table structure for table `old_reserves`
4917 DROP TABLE IF EXISTS `old_reserves`;
4918 /*!40101 SET @saved_cs_client = @@character_set_client */;
4919 /*!40101 SET character_set_client = utf8 */;
4920 CREATE TABLE `old_reserves` (
4921 `reserve_id` int(11) NOT NULL COMMENT 'primary key',
4922 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4923 `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places',
4924 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4925 `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
4926 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
4927 `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4928 `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4929 `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4930 `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4931 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4932 `reservenotes` longtext DEFAULT NULL COMMENT 'notes related to this hold',
4933 `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4934 `found` varchar(1) DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
4935 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4936 `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',
4937 `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4938 `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)',
4939 `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',
4940 `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)',
4941 `suspend` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'in this hold suspended (1 for yes, 0 for no)',
4942 `suspend_until` datetime DEFAULT NULL COMMENT 'the date this hold is suspended until (NULL for infinitely)',
4943 `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4944 `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
4945 `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4946 PRIMARY KEY (`reserve_id`),
4947 KEY `old_reserves_borrowernumber` (`borrowernumber`),
4948 KEY `old_reserves_biblionumber` (`biblionumber`),
4949 KEY `old_reserves_itemnumber` (`itemnumber`),
4950 KEY `old_reserves_branchcode` (`branchcode`),
4951 KEY `old_reserves_itemtype` (`itemtype`),
4952 KEY `old_reserves_ibfk_ig` (`item_group_id`),
4953 CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4954 CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4955 CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4956 CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
4957 CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL,
4958 CONSTRAINT `old_reserves_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
4959 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4960 /*!40101 SET character_set_client = @saved_cs_client */;
4963 -- Table structure for table `overduerules`
4966 DROP TABLE IF EXISTS `overduerules`;
4967 /*!40101 SET @saved_cs_client = @@character_set_client */;
4968 /*!40101 SET character_set_client = utf8 */;
4969 CREATE TABLE `overduerules` (
4970 `overduerules_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the overduerules',
4971 `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)',
4972 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table to define which patron category this rule is for',
4973 `delay1` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the first notice is sent',
4974 `letter1` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the first notice',
4975 `debarred1` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the first notice is sent (1 for yes, 0 for no)',
4976 `delay2` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the second notice is sent',
4977 `debarred2` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the second notice is sent (1 for yes, 0 for no)',
4978 `letter2` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the second notice',
4979 `delay3` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the third notice is sent',
4980 `letter3` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the third notice',
4981 `debarred3` int(1) DEFAULT 0 COMMENT 'is the patron restricted when the third notice is sent (1 for yes, 0 for no)',
4982 PRIMARY KEY (`overduerules_id`),
4983 UNIQUE KEY `overduerules_branch_cat` (`branchcode`,`categorycode`)
4984 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4985 /*!40101 SET character_set_client = @saved_cs_client */;
4988 -- Table structure for table `overduerules_transport_types`
4991 DROP TABLE IF EXISTS `overduerules_transport_types`;
4992 /*!40101 SET @saved_cs_client = @@character_set_client */;
4993 /*!40101 SET character_set_client = utf8 */;
4994 CREATE TABLE `overduerules_transport_types` (
4995 `id` int(11) NOT NULL AUTO_INCREMENT,
4996 `letternumber` int(1) NOT NULL DEFAULT 1,
4997 `message_transport_type` varchar(20) NOT NULL DEFAULT 'email',
4998 `overduerules_id` int(11) NOT NULL,
5000 KEY `overduerules_fk` (`overduerules_id`),
5001 KEY `mtt_fk` (`message_transport_type`),
5002 CONSTRAINT `mtt_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
5003 CONSTRAINT `overduerules_fk` FOREIGN KEY (`overduerules_id`) REFERENCES `overduerules` (`overduerules_id`) ON DELETE CASCADE ON UPDATE CASCADE
5004 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5005 /*!40101 SET character_set_client = @saved_cs_client */;
5008 -- Table structure for table `patron_consent`
5011 DROP TABLE IF EXISTS `patron_consent`;
5012 /*!40101 SET @saved_cs_client = @@character_set_client */;
5013 /*!40101 SET character_set_client = utf8 */;
5014 CREATE TABLE `patron_consent` (
5015 `id` int(11) NOT NULL AUTO_INCREMENT,
5016 `borrowernumber` int(11) NOT NULL,
5017 `type` tinytext DEFAULT NULL COMMENT 'consent type, could be custom type',
5018 `given_on` datetime DEFAULT NULL,
5019 `refused_on` datetime DEFAULT NULL,
5021 KEY `borrowernumber` (`borrowernumber`),
5022 CONSTRAINT `patron_consent_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
5023 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5024 /*!40101 SET character_set_client = @saved_cs_client */;
5027 -- Table structure for table `patron_list_patrons`
5030 DROP TABLE IF EXISTS `patron_list_patrons`;
5031 /*!40101 SET @saved_cs_client = @@character_set_client */;
5032 /*!40101 SET character_set_client = utf8 */;
5033 CREATE TABLE `patron_list_patrons` (
5034 `patron_list_patron_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
5035 `patron_list_id` int(11) NOT NULL COMMENT 'the list this entry is part of',
5036 `borrowernumber` int(11) NOT NULL COMMENT 'the borrower that is part of this list',
5037 PRIMARY KEY (`patron_list_patron_id`),
5038 KEY `patron_list_id` (`patron_list_id`),
5039 KEY `borrowernumber` (`borrowernumber`),
5040 CONSTRAINT `patron_list_patrons_ibfk_1` FOREIGN KEY (`patron_list_id`) REFERENCES `patron_lists` (`patron_list_id`) ON DELETE CASCADE ON UPDATE CASCADE,
5041 CONSTRAINT `patron_list_patrons_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
5042 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5043 /*!40101 SET character_set_client = @saved_cs_client */;
5046 -- Table structure for table `patron_lists`
5049 DROP TABLE IF EXISTS `patron_lists`;
5050 /*!40101 SET @saved_cs_client = @@character_set_client */;
5051 /*!40101 SET character_set_client = utf8 */;
5052 CREATE TABLE `patron_lists` (
5053 `patron_list_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
5054 `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'the list''s name',
5055 `owner` int(11) NOT NULL COMMENT 'borrowernumber of the list creator',
5056 `shared` tinyint(1) DEFAULT 0,
5057 PRIMARY KEY (`patron_list_id`),
5058 KEY `owner` (`owner`),
5059 CONSTRAINT `patron_lists_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
5060 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5061 /*!40101 SET character_set_client = @saved_cs_client */;
5064 -- Table structure for table `patronimage`
5067 DROP TABLE IF EXISTS `patronimage`;
5068 /*!40101 SET @saved_cs_client = @@character_set_client */;
5069 /*!40101 SET character_set_client = utf8 */;
5070 CREATE TABLE `patronimage` (
5071 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron this image is attached to (borrowers.borrowernumber)',
5072 `mimetype` varchar(15) NOT NULL COMMENT 'the format of the image (png, jpg, etc)',
5073 `imagefile` mediumblob NOT NULL COMMENT 'the image',
5074 PRIMARY KEY (`borrowernumber`),
5075 CONSTRAINT `patronimage_fk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
5076 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5077 /*!40101 SET character_set_client = @saved_cs_client */;
5080 -- Table structure for table `pending_offline_operations`
5083 DROP TABLE IF EXISTS `pending_offline_operations`;
5084 /*!40101 SET @saved_cs_client = @@character_set_client */;
5085 /*!40101 SET character_set_client = utf8 */;
5086 CREATE TABLE `pending_offline_operations` (
5087 `operationid` int(11) NOT NULL AUTO_INCREMENT,
5088 `userid` varchar(30) NOT NULL,
5089 `branchcode` varchar(10) NOT NULL,
5090 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
5091 `action` varchar(10) NOT NULL,
5092 `barcode` varchar(20) DEFAULT NULL,
5093 `cardnumber` varchar(32) DEFAULT NULL,
5094 `amount` decimal(28,6) DEFAULT NULL,
5095 PRIMARY KEY (`operationid`)
5096 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5097 /*!40101 SET character_set_client = @saved_cs_client */;
5100 -- Table structure for table `permissions`
5103 DROP TABLE IF EXISTS `permissions`;
5104 /*!40101 SET @saved_cs_client = @@character_set_client */;
5105 /*!40101 SET character_set_client = utf8 */;
5106 CREATE TABLE `permissions` (
5107 `module_bit` int(11) NOT NULL DEFAULT 0,
5108 `code` varchar(64) NOT NULL DEFAULT '',
5109 `description` varchar(255) DEFAULT NULL,
5110 PRIMARY KEY (`module_bit`,`code`),
5111 CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`) ON DELETE CASCADE ON UPDATE CASCADE
5112 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5113 /*!40101 SET character_set_client = @saved_cs_client */;
5116 -- Table structure for table `plugin_data`
5119 DROP TABLE IF EXISTS `plugin_data`;
5120 /*!40101 SET @saved_cs_client = @@character_set_client */;
5121 /*!40101 SET character_set_client = utf8 */;
5122 CREATE TABLE `plugin_data` (
5123 `plugin_class` varchar(255) NOT NULL,
5124 `plugin_key` varchar(255) NOT NULL,
5125 `plugin_value` mediumtext DEFAULT NULL,
5126 PRIMARY KEY (`plugin_class`(191),`plugin_key`(191))
5127 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5128 /*!40101 SET character_set_client = @saved_cs_client */;
5131 -- Table structure for table `plugin_methods`
5134 DROP TABLE IF EXISTS `plugin_methods`;
5135 /*!40101 SET @saved_cs_client = @@character_set_client */;
5136 /*!40101 SET character_set_client = utf8 */;
5137 CREATE TABLE `plugin_methods` (
5138 `plugin_class` varchar(255) NOT NULL,
5139 `plugin_method` varchar(255) NOT NULL,
5140 PRIMARY KEY (`plugin_class`(191),`plugin_method`(191))
5141 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5142 /*!40101 SET character_set_client = @saved_cs_client */;
5145 -- Table structure for table `preservation_processing_attributes`
5148 DROP TABLE IF EXISTS `preservation_processing_attributes`;
5149 /*!40101 SET @saved_cs_client = @@character_set_client */;
5150 /*!40101 SET character_set_client = utf8 */;
5151 CREATE TABLE `preservation_processing_attributes` (
5152 `processing_attribute_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
5153 `processing_id` int(11) NOT NULL COMMENT 'link to the processing',
5154 `name` varchar(80) NOT NULL COMMENT 'name of the processing attribute',
5155 `type` enum('authorised_value','free_text','db_column') NOT NULL COMMENT 'Type of the processing attribute',
5156 `option_source` varchar(80) DEFAULT NULL COMMENT 'source of the possible options for this attribute',
5157 PRIMARY KEY (`processing_attribute_id`),
5158 KEY `preservation_processing_attributes_ibfk_1` (`processing_id`),
5159 CONSTRAINT `preservation_processing_attributes_ibfk_1` FOREIGN KEY (`processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE CASCADE ON UPDATE CASCADE
5160 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5161 /*!40101 SET character_set_client = @saved_cs_client */;
5164 -- Table structure for table `preservation_processing_attributes_items`
5167 DROP TABLE IF EXISTS `preservation_processing_attributes_items`;
5168 /*!40101 SET @saved_cs_client = @@character_set_client */;
5169 /*!40101 SET character_set_client = utf8 */;
5170 CREATE TABLE `preservation_processing_attributes_items` (
5171 `processing_attribute_item_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
5172 `processing_attribute_id` int(11) NOT NULL COMMENT 'link with preservation_processing_attributes',
5173 `train_item_id` int(11) NOT NULL COMMENT 'link with preservation_trains_items',
5174 `value` varchar(255) DEFAULT NULL COMMENT 'value for this attribute',
5175 PRIMARY KEY (`processing_attribute_item_id`),
5176 KEY `preservation_processing_attributes_items_ibfk_1` (`processing_attribute_id`),
5177 KEY `preservation_processing_attributes_items_ibfk_2` (`train_item_id`),
5178 CONSTRAINT `preservation_processing_attributes_items_ibfk_1` FOREIGN KEY (`processing_attribute_id`) REFERENCES `preservation_processing_attributes` (`processing_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
5179 CONSTRAINT `preservation_processing_attributes_items_ibfk_2` FOREIGN KEY (`train_item_id`) REFERENCES `preservation_trains_items` (`train_item_id`) ON DELETE CASCADE ON UPDATE CASCADE
5180 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5181 /*!40101 SET character_set_client = @saved_cs_client */;
5184 -- Table structure for table `preservation_processings`
5187 DROP TABLE IF EXISTS `preservation_processings`;
5188 /*!40101 SET @saved_cs_client = @@character_set_client */;
5189 /*!40101 SET character_set_client = utf8 */;
5190 CREATE TABLE `preservation_processings` (
5191 `processing_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
5192 `name` varchar(80) NOT NULL COMMENT 'name of the processing',
5193 `letter_code` varchar(20) DEFAULT NULL COMMENT 'Foreign key to the letters table',
5194 PRIMARY KEY (`processing_id`)
5195 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5196 /*!40101 SET character_set_client = @saved_cs_client */;
5199 -- Table structure for table `preservation_trains`
5202 DROP TABLE IF EXISTS `preservation_trains`;
5203 /*!40101 SET @saved_cs_client = @@character_set_client */;
5204 /*!40101 SET character_set_client = utf8 */;
5205 CREATE TABLE `preservation_trains` (
5206 `train_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
5207 `name` varchar(80) NOT NULL COMMENT 'name of the train',
5208 `description` varchar(255) DEFAULT NULL COMMENT 'description of the train',
5209 `default_processing_id` int(11) DEFAULT NULL COMMENT 'default processing, link to preservation_processings.processing_id',
5210 `not_for_loan` varchar(80) NOT NULL DEFAULT '0' COMMENT 'NOT_LOAN authorised value to apply toitem added to this train',
5211 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'creation date',
5212 `closed_on` datetime DEFAULT NULL COMMENT 'closing date',
5213 `sent_on` datetime DEFAULT NULL COMMENT 'sending date',
5214 `received_on` datetime DEFAULT NULL COMMENT 'receiving date',
5215 PRIMARY KEY (`train_id`),
5216 KEY `preservation_trains_ibfk_1` (`default_processing_id`),
5217 CONSTRAINT `preservation_trains_ibfk_1` FOREIGN KEY (`default_processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE SET NULL ON UPDATE CASCADE
5218 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5219 /*!40101 SET character_set_client = @saved_cs_client */;
5222 -- Table structure for table `preservation_trains_items`
5225 DROP TABLE IF EXISTS `preservation_trains_items`;
5226 /*!40101 SET @saved_cs_client = @@character_set_client */;
5227 /*!40101 SET character_set_client = utf8 */;
5228 CREATE TABLE `preservation_trains_items` (
5229 `train_item_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
5230 `train_id` int(11) NOT NULL COMMENT 'link with preservation_train',
5231 `item_id` int(11) NOT NULL COMMENT 'link with items',
5232 `processing_id` int(11) DEFAULT NULL COMMENT 'specific processing for this item',
5233 `user_train_item_id` int(11) NOT NULL COMMENT 'train item id for this train, starts from 1',
5234 `added_on` datetime DEFAULT NULL COMMENT 'added date',
5235 PRIMARY KEY (`train_item_id`),
5236 UNIQUE KEY `train_id` (`train_id`,`item_id`),
5237 KEY `preservation_item_ibfk_2` (`item_id`),
5238 KEY `preservation_item_ibfk_3` (`processing_id`),
5239 CONSTRAINT `preservation_item_ibfk_1` FOREIGN KEY (`train_id`) REFERENCES `preservation_trains` (`train_id`) ON DELETE CASCADE ON UPDATE CASCADE,
5240 CONSTRAINT `preservation_item_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5241 CONSTRAINT `preservation_item_ibfk_3` FOREIGN KEY (`processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE SET NULL ON UPDATE CASCADE
5242 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5243 /*!40101 SET character_set_client = @saved_cs_client */;
5246 -- Table structure for table `printers_profile`
5249 DROP TABLE IF EXISTS `printers_profile`;
5250 /*!40101 SET @saved_cs_client = @@character_set_client */;
5251 /*!40101 SET character_set_client = utf8 */;
5252 CREATE TABLE `printers_profile` (
5253 `profile_id` int(4) NOT NULL AUTO_INCREMENT,
5254 `printer_name` varchar(40) NOT NULL DEFAULT 'Default Printer',
5255 `template_id` int(4) NOT NULL DEFAULT 0,
5256 `paper_bin` varchar(20) NOT NULL DEFAULT 'Bypass',
5257 `offset_horz` float NOT NULL DEFAULT 0,
5258 `offset_vert` float NOT NULL DEFAULT 0,
5259 `creep_horz` float NOT NULL DEFAULT 0,
5260 `creep_vert` float NOT NULL DEFAULT 0,
5261 `units` char(20) NOT NULL DEFAULT 'POINT',
5262 `creator` char(15) NOT NULL DEFAULT 'Labels',
5263 PRIMARY KEY (`profile_id`),
5264 UNIQUE KEY `printername` (`printer_name`,`template_id`,`paper_bin`,`creator`)
5265 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5266 /*!40101 SET character_set_client = @saved_cs_client */;
5269 -- Table structure for table `problem_reports`
5272 DROP TABLE IF EXISTS `problem_reports`;
5273 /*!40101 SET @saved_cs_client = @@character_set_client */;
5274 /*!40101 SET character_set_client = utf8 */;
5275 CREATE TABLE `problem_reports` (
5276 `reportid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5277 `title` varchar(40) NOT NULL DEFAULT '' COMMENT 'report subject line',
5278 `content` text NOT NULL COMMENT 'report message content',
5279 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the user who created the problem report',
5280 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'borrower''s branch',
5281 `username` varchar(75) DEFAULT NULL COMMENT 'OPAC username',
5282 `problempage` text DEFAULT NULL COMMENT 'page the user triggered the problem report form from',
5283 `recipient` enum('admin','library') NOT NULL DEFAULT 'library' COMMENT 'the ''to-address'' of the problem report',
5284 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'timestamp of report submission',
5285 `status` varchar(6) NOT NULL DEFAULT 'New' COMMENT 'status of the report. New, Viewed, Closed',
5286 PRIMARY KEY (`reportid`),
5287 KEY `problem_reports_ibfk1` (`borrowernumber`),
5288 KEY `problem_reports_ibfk2` (`branchcode`),
5289 CONSTRAINT `problem_reports_ibfk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5290 CONSTRAINT `problem_reports_ibfk2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5291 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5292 /*!40101 SET character_set_client = @saved_cs_client */;
5295 -- Table structure for table `pseudonymized_borrower_attributes`
5298 DROP TABLE IF EXISTS `pseudonymized_borrower_attributes`;
5299 /*!40101 SET @saved_cs_client = @@character_set_client */;
5300 /*!40101 SET character_set_client = utf8 */;
5301 CREATE TABLE `pseudonymized_borrower_attributes` (
5302 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
5303 `transaction_id` int(11) NOT NULL,
5304 `code` varchar(10) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
5305 `attribute` varchar(255) DEFAULT NULL COMMENT 'custom patron field value',
5307 KEY `pseudonymized_borrower_attributes_ibfk_1` (`transaction_id`),
5308 KEY `anonymized_borrower_attributes_ibfk_2` (`code`),
5309 CONSTRAINT `anonymized_borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
5310 CONSTRAINT `pseudonymized_borrower_attributes_ibfk_1` FOREIGN KEY (`transaction_id`) REFERENCES `pseudonymized_transactions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
5311 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5312 /*!40101 SET character_set_client = @saved_cs_client */;
5315 -- Table structure for table `pseudonymized_transactions`
5318 DROP TABLE IF EXISTS `pseudonymized_transactions`;
5319 /*!40101 SET @saved_cs_client = @@character_set_client */;
5320 /*!40101 SET character_set_client = utf8 */;
5321 CREATE TABLE `pseudonymized_transactions` (
5322 `id` int(11) NOT NULL AUTO_INCREMENT,
5323 `hashed_borrowernumber` varchar(60) NOT NULL,
5324 `has_cardnumber` tinyint(1) NOT NULL DEFAULT 0,
5325 `title` longtext DEFAULT NULL,
5326 `city` longtext DEFAULT NULL,
5327 `state` mediumtext DEFAULT NULL,
5328 `zipcode` varchar(25) DEFAULT NULL,
5329 `country` mediumtext DEFAULT NULL,
5330 `branchcode` varchar(10) NOT NULL DEFAULT '',
5331 `categorycode` varchar(10) NOT NULL DEFAULT '',
5332 `dateenrolled` date DEFAULT NULL,
5333 `sex` varchar(1) DEFAULT NULL,
5334 `sort1` varchar(80) DEFAULT NULL,
5335 `sort2` varchar(80) DEFAULT NULL,
5336 `datetime` datetime DEFAULT NULL,
5337 `transaction_branchcode` varchar(10) DEFAULT NULL,
5338 `transaction_type` varchar(16) DEFAULT NULL,
5339 `itemnumber` int(11) DEFAULT NULL,
5340 `itemtype` varchar(10) DEFAULT NULL,
5341 `holdingbranch` varchar(10) DEFAULT NULL,
5342 `homebranch` varchar(10) DEFAULT NULL,
5343 `location` varchar(80) DEFAULT NULL,
5344 `itemcallnumber` varchar(255) DEFAULT NULL,
5345 `ccode` varchar(80) DEFAULT NULL,
5347 KEY `pseudonymized_transactions_ibfk_1` (`categorycode`),
5348 KEY `pseudonymized_transactions_borrowers_ibfk_2` (`branchcode`),
5349 KEY `pseudonymized_transactions_borrowers_ibfk_3` (`transaction_branchcode`),
5350 KEY `pseudonymized_transactions_items_ibfk_4` (`itemnumber`),
5351 KEY `pseudonymized_transactions_ibfk_5` (`transaction_type`),
5352 KEY `pseudonymized_transactions_ibfk_6` (`datetime`)
5353 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5354 /*!40101 SET character_set_client = @saved_cs_client */;
5357 -- Table structure for table `quotes`
5360 DROP TABLE IF EXISTS `quotes`;
5361 /*!40101 SET @saved_cs_client = @@character_set_client */;
5362 /*!40101 SET character_set_client = utf8 */;
5363 CREATE TABLE `quotes` (
5364 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the quote',
5365 `source` mediumtext DEFAULT NULL COMMENT 'source/credit for the quote',
5366 `text` longtext NOT NULL COMMENT 'text of the quote',
5367 `timestamp` datetime DEFAULT NULL COMMENT 'date and time that the quote last appeared in the opac',
5369 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5370 /*!40101 SET character_set_client = @saved_cs_client */;
5373 -- Table structure for table `ratings`
5376 DROP TABLE IF EXISTS `ratings`;
5377 /*!40101 SET @saved_cs_client = @@character_set_client */;
5378 /*!40101 SET character_set_client = utf8 */;
5379 CREATE TABLE `ratings` (
5380 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron who left this rating (borrowers.borrowernumber)',
5381 `biblionumber` int(11) NOT NULL COMMENT 'the biblio this rating is for (biblio.biblionumber)',
5382 `rating_value` tinyint(1) NOT NULL COMMENT 'the rating, from 1 to 5',
5383 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
5384 PRIMARY KEY (`borrowernumber`,`biblionumber`),
5385 KEY `ratings_ibfk_2` (`biblionumber`),
5386 CONSTRAINT `ratings_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5387 CONSTRAINT `ratings_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5388 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5389 /*!40101 SET character_set_client = @saved_cs_client */;
5392 -- Table structure for table `recalls`
5395 DROP TABLE IF EXISTS `recalls`;
5396 /*!40101 SET @saved_cs_client = @@character_set_client */;
5397 /*!40101 SET character_set_client = utf8 */;
5398 CREATE TABLE `recalls` (
5399 `recall_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier for this recall',
5400 `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Identifier for patron who requested recall',
5401 `created_date` datetime DEFAULT NULL COMMENT 'Date the recall was requested',
5402 `biblio_id` int(11) NOT NULL COMMENT 'Identifier for bibliographic record that has been recalled',
5403 `pickup_library_id` varchar(10) DEFAULT NULL COMMENT 'Identifier for recall pickup library',
5404 `completed_date` datetime DEFAULT NULL COMMENT 'Date the recall is completed (fulfilled, cancelled or expired)',
5405 `notes` mediumtext DEFAULT NULL COMMENT 'Notes related to the recall',
5406 `priority` smallint(6) DEFAULT NULL COMMENT 'Where in the queue the patron sits',
5407 `status` enum('requested','overdue','waiting','in_transit','cancelled','expired','fulfilled') DEFAULT 'requested' COMMENT 'Status of recall',
5408 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time the recall was last updated',
5409 `item_id` int(11) DEFAULT NULL COMMENT 'Identifier for item record that was recalled, if an item-level recall',
5410 `waiting_date` datetime DEFAULT NULL COMMENT 'Date an item was marked as waiting for the patron at the library',
5411 `expiration_date` datetime DEFAULT NULL COMMENT 'Date recall is no longer required, or date recall will expire after waiting on shelf for pickup',
5412 `completed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is old and no longer active, i.e. expired, cancelled or completed',
5413 `item_level` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is for a specific item',
5414 PRIMARY KEY (`recall_id`),
5415 KEY `recalls_ibfk_1` (`patron_id`),
5416 KEY `recalls_ibfk_2` (`biblio_id`),
5417 KEY `recalls_ibfk_3` (`item_id`),
5418 KEY `recalls_ibfk_4` (`pickup_library_id`),
5419 CONSTRAINT `recalls_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5420 CONSTRAINT `recalls_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5421 CONSTRAINT `recalls_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5422 CONSTRAINT `recalls_ibfk_4` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5423 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Information related to recalls in Koha';
5424 /*!40101 SET character_set_client = @saved_cs_client */;
5427 -- Table structure for table `repeatable_holidays`
5430 DROP TABLE IF EXISTS `repeatable_holidays`;
5431 /*!40101 SET @saved_cs_client = @@character_set_client */;
5432 /*!40101 SET character_set_client = utf8 */;
5433 CREATE TABLE `repeatable_holidays` (
5434 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5435 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
5436 `weekday` smallint(6) DEFAULT NULL COMMENT 'day of the week (0=Sunday, 1=Monday, etc) this closing is repeated on',
5437 `day` smallint(6) DEFAULT NULL COMMENT 'day of the month this closing is on',
5438 `month` smallint(6) DEFAULT NULL COMMENT 'month this closing is in',
5439 `title` varchar(50) NOT NULL DEFAULT '' COMMENT 'title of this closing',
5440 `description` mediumtext NOT NULL COMMENT 'description for this closing',
5442 KEY `repeatable_holidays_ibfk_1` (`branchcode`),
5443 CONSTRAINT `repeatable_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5444 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5445 /*!40101 SET character_set_client = @saved_cs_client */;
5448 -- Table structure for table `reports_dictionary`
5451 DROP TABLE IF EXISTS `reports_dictionary`;
5452 /*!40101 SET @saved_cs_client = @@character_set_client */;
5453 /*!40101 SET character_set_client = utf8 */;
5454 CREATE TABLE `reports_dictionary` (
5455 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5456 `name` varchar(255) DEFAULT NULL COMMENT 'name for this definition',
5457 `description` mediumtext DEFAULT NULL COMMENT 'description for this definition',
5458 `date_created` datetime DEFAULT NULL COMMENT 'date and time this definition was created',
5459 `date_modified` datetime DEFAULT NULL COMMENT 'date and time this definition was last modified',
5460 `saved_sql` mediumtext DEFAULT NULL COMMENT 'SQL snippet for us in reports',
5461 `report_area` varchar(6) DEFAULT NULL COMMENT 'Koha module this definition is for Circulation, Catalog, Patrons, Acquistions, Accounts)',
5463 KEY `dictionary_area_idx` (`report_area`)
5464 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5465 /*!40101 SET character_set_client = @saved_cs_client */;
5468 -- Table structure for table `reserves`
5471 DROP TABLE IF EXISTS `reserves`;
5472 /*!40101 SET @saved_cs_client = @@character_set_client */;
5473 /*!40101 SET character_set_client = utf8 */;
5474 CREATE TABLE `reserves` (
5475 `reserve_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
5476 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
5477 `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
5478 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
5479 `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
5480 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
5481 `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
5482 `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
5483 `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
5484 `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
5485 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
5486 `reservenotes` longtext DEFAULT NULL COMMENT 'notes related to this hold',
5487 `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
5488 `found` varchar(1) DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
5489 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
5490 `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',
5491 `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
5492 `expirationdate` date DEFAULT NULL COMMENT 'the date the hold expires (calculated value)',
5493 `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',
5494 `lowestPriority` tinyint(1) NOT NULL DEFAULT 0,
5495 `suspend` tinyint(1) NOT NULL DEFAULT 0,
5496 `suspend_until` datetime DEFAULT NULL,
5497 `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
5498 `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
5499 `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
5500 PRIMARY KEY (`reserve_id`),
5501 KEY `priorityfoundidx` (`priority`,`found`),
5502 KEY `borrowernumber` (`borrowernumber`),
5503 KEY `biblionumber` (`biblionumber`),
5504 KEY `itemnumber` (`itemnumber`),
5505 KEY `branchcode` (`branchcode`),
5506 KEY `desk_id` (`desk_id`),
5507 KEY `itemtype` (`itemtype`),
5508 KEY `reserves_ibfk_ig` (`item_group_id`),
5509 CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5510 CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5511 CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5512 CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5513 CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
5514 CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5515 CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE
5516 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5517 /*!40101 SET character_set_client = @saved_cs_client */;
5520 -- Table structure for table `restriction_types`
5523 DROP TABLE IF EXISTS `restriction_types`;
5524 /*!40101 SET @saved_cs_client = @@character_set_client */;
5525 /*!40101 SET character_set_client = utf8 */;
5526 CREATE TABLE `restriction_types` (
5527 `code` varchar(50) NOT NULL,
5528 `display_text` text NOT NULL,
5529 `is_system` tinyint(1) NOT NULL DEFAULT 0,
5530 `is_default` tinyint(1) NOT NULL DEFAULT 0,
5531 `lift_after_payment` tinyint(1) NOT NULL DEFAULT 0,
5532 `fee_limit` decimal(28,6) DEFAULT NULL,
5533 PRIMARY KEY (`code`)
5534 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5535 /*!40101 SET character_set_client = @saved_cs_client */;
5538 -- Table structure for table `return_claims`
5541 DROP TABLE IF EXISTS `return_claims`;
5542 /*!40101 SET @saved_cs_client = @@character_set_client */;
5543 /*!40101 SET character_set_client = utf8 */;
5544 CREATE TABLE `return_claims` (
5545 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the return claim',
5546 `itemnumber` int(11) NOT NULL COMMENT 'ID of the item',
5547 `issue_id` int(11) DEFAULT NULL COMMENT 'ID of the checkout that triggered the claim',
5548 `borrowernumber` int(11) NOT NULL COMMENT 'ID of the patron',
5549 `notes` mediumtext DEFAULT NULL COMMENT 'Notes about the claim',
5550 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was created',
5551 `created_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that registered the claim',
5552 `updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the claim (notes)',
5553 `updated_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that updated the claim',
5554 `resolution` varchar(80) DEFAULT NULL COMMENT 'Resolution code (RETURN_CLAIM_RESOLUTION AVs)',
5555 `resolved_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was resolved',
5556 `resolved_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that resolved the claim',
5558 UNIQUE KEY `item_issue` (`itemnumber`,`issue_id`),
5559 KEY `itemnumber` (`itemnumber`),
5560 KEY `rc_borrowers_ibfk` (`borrowernumber`),
5561 KEY `rc_created_by_ibfk` (`created_by`),
5562 KEY `rc_updated_by_ibfk` (`updated_by`),
5563 KEY `rc_resolved_by_ibfk` (`resolved_by`),
5564 CONSTRAINT `rc_borrowers_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5565 CONSTRAINT `rc_created_by_ibfk` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5566 CONSTRAINT `rc_items_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5567 CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5568 CONSTRAINT `rc_updated_by_ibfk` FOREIGN KEY (`updated_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5569 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5570 /*!40101 SET character_set_client = @saved_cs_client */;
5573 -- Table structure for table `reviews`
5576 DROP TABLE IF EXISTS `reviews`;
5577 /*!40101 SET @saved_cs_client = @@character_set_client */;
5578 /*!40101 SET character_set_client = utf8 */;
5579 CREATE TABLE `reviews` (
5580 `reviewid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for this comment',
5581 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron left this comment',
5582 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bibliographic record this comment is for',
5583 `review` mediumtext DEFAULT NULL COMMENT 'the body of the comment',
5584 `approved` tinyint(4) DEFAULT 0 COMMENT 'whether this comment has been approved by a librarian (1 for yes, 0 for no)',
5585 `datereviewed` datetime DEFAULT NULL COMMENT 'the date the comment was left',
5586 PRIMARY KEY (`reviewid`),
5587 KEY `reviews_ibfk_1` (`borrowernumber`),
5588 KEY `reviews_ibfk_2` (`biblionumber`),
5589 CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5590 CONSTRAINT `reviews_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5591 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5592 /*!40101 SET character_set_client = @saved_cs_client */;
5595 -- Table structure for table `saved_reports`
5598 DROP TABLE IF EXISTS `saved_reports`;
5599 /*!40101 SET @saved_cs_client = @@character_set_client */;
5600 /*!40101 SET character_set_client = utf8 */;
5601 CREATE TABLE `saved_reports` (
5602 `id` int(11) NOT NULL AUTO_INCREMENT,
5603 `report_id` int(11) DEFAULT NULL,
5604 `report` longtext DEFAULT NULL,
5605 `date_run` datetime DEFAULT NULL,
5607 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5608 /*!40101 SET character_set_client = @saved_cs_client */;
5611 -- Table structure for table `saved_sql`
5614 DROP TABLE IF EXISTS `saved_sql`;
5615 /*!40101 SET @saved_cs_client = @@character_set_client */;
5616 /*!40101 SET character_set_client = utf8 */;
5617 CREATE TABLE `saved_sql` (
5618 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key assigned by Koha',
5619 `borrowernumber` int(11) DEFAULT NULL COMMENT 'the staff member who created this report (borrowers.borrowernumber)',
5620 `date_created` datetime DEFAULT NULL COMMENT 'the date this report was created',
5621 `last_modified` datetime DEFAULT NULL COMMENT 'the date this report was last edited',
5622 `savedsql` mediumtext DEFAULT NULL COMMENT 'the SQL for this report',
5623 `last_run` datetime DEFAULT NULL,
5624 `report_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'the name of this report',
5625 `type` varchar(255) DEFAULT NULL COMMENT 'always 1 for tabular',
5626 `notes` mediumtext DEFAULT NULL COMMENT 'the notes or description given to this report',
5627 `cache_expiry` int(11) NOT NULL DEFAULT 300,
5628 `public` tinyint(1) NOT NULL DEFAULT 0,
5629 `report_area` varchar(6) DEFAULT NULL,
5630 `report_group` varchar(80) DEFAULT NULL,
5631 `report_subgroup` varchar(80) DEFAULT NULL,
5632 `mana_id` int(11) DEFAULT NULL,
5634 KEY `sql_area_group_idx` (`report_group`,`report_subgroup`),
5635 KEY `boridx` (`borrowernumber`)
5636 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5637 /*!40101 SET character_set_client = @saved_cs_client */;
5640 -- Table structure for table `search_field`
5643 DROP TABLE IF EXISTS `search_field`;
5644 /*!40101 SET @saved_cs_client = @@character_set_client */;
5645 /*!40101 SET character_set_client = utf8 */;
5646 CREATE TABLE `search_field` (
5647 `id` int(11) NOT NULL AUTO_INCREMENT,
5648 `name` varchar(255) NOT NULL COMMENT 'the name of the field as it will be stored in the search engine',
5649 `label` varchar(255) NOT NULL COMMENT 'the human readable name of the field, for display',
5650 `type` enum('','string','date','number','boolean','sum','isbn','stdno','year','callnumber','geo_point') NOT NULL COMMENT 'what type of data this holds, relevant when storing it in the search engine',
5651 `weight` decimal(5,2) DEFAULT NULL,
5652 `facet_order` tinyint(4) DEFAULT NULL COMMENT 'the order place of the field in facet list if faceted',
5653 `staff_client` tinyint(1) NOT NULL DEFAULT 1,
5654 `opac` tinyint(1) NOT NULL DEFAULT 1,
5655 `mandatory` tinyint(1) DEFAULT NULL COMMENT 'if marked this field is not editable or removable',
5657 UNIQUE KEY `name` (`name`(191))
5658 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5659 /*!40101 SET character_set_client = @saved_cs_client */;
5662 -- Table structure for table `search_filters`
5665 DROP TABLE IF EXISTS `search_filters`;
5666 /*!40101 SET @saved_cs_client = @@character_set_client */;
5667 /*!40101 SET character_set_client = utf8 */;
5668 CREATE TABLE `search_filters` (
5669 `search_filter_id` int(11) NOT NULL AUTO_INCREMENT,
5670 `name` varchar(255) NOT NULL COMMENT 'filter name',
5671 `query` mediumtext DEFAULT NULL COMMENT 'filter query part',
5672 `limits` mediumtext DEFAULT NULL COMMENT 'filter limits part',
5673 `opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown on OPAC',
5674 `staff_client` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown in staff client',
5675 PRIMARY KEY (`search_filter_id`)
5676 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5677 /*!40101 SET character_set_client = @saved_cs_client */;
5680 -- Table structure for table `search_history`
5683 DROP TABLE IF EXISTS `search_history`;
5684 /*!40101 SET @saved_cs_client = @@character_set_client */;
5685 /*!40101 SET character_set_client = utf8 */;
5686 CREATE TABLE `search_history` (
5687 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'search history id',
5688 `userid` int(11) NOT NULL COMMENT 'the patron who performed the search (borrowers.borrowernumber)',
5689 `sessionid` varchar(32) NOT NULL COMMENT 'a system generated session id',
5690 `query_desc` varchar(255) NOT NULL COMMENT 'the search that was performed',
5691 `query_cgi` mediumtext NOT NULL COMMENT 'the string to append to the search url to rerun the search',
5692 `type` varchar(16) NOT NULL DEFAULT 'biblio' COMMENT 'search type, must be ''biblio'' or ''authority''',
5693 `total` int(11) NOT NULL COMMENT 'the total of results found',
5694 `time` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the search was run',
5696 KEY `userid` (`userid`),
5697 KEY `sessionid` (`sessionid`)
5698 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Opac search history results';
5699 /*!40101 SET character_set_client = @saved_cs_client */;
5702 -- Table structure for table `search_marc_map`
5705 DROP TABLE IF EXISTS `search_marc_map`;
5706 /*!40101 SET @saved_cs_client = @@character_set_client */;
5707 /*!40101 SET character_set_client = utf8 */;
5708 CREATE TABLE `search_marc_map` (
5709 `id` int(11) NOT NULL AUTO_INCREMENT,
5710 `index_name` enum('biblios','authorities') NOT NULL COMMENT 'what storage index this map is for',
5711 `marc_type` enum('marc21','unimarc') NOT NULL COMMENT 'what MARC type this map is for',
5712 `marc_field` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the MARC specifier for this field',
5714 UNIQUE KEY `index_name` (`index_name`,`marc_field`(191),`marc_type`),
5715 KEY `index_name_2` (`index_name`)
5716 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5717 /*!40101 SET character_set_client = @saved_cs_client */;
5720 -- Table structure for table `search_marc_to_field`
5723 DROP TABLE IF EXISTS `search_marc_to_field`;
5724 /*!40101 SET @saved_cs_client = @@character_set_client */;
5725 /*!40101 SET character_set_client = utf8 */;
5726 CREATE TABLE `search_marc_to_field` (
5727 `search` tinyint(1) NOT NULL DEFAULT 1,
5728 `filter` varchar(100) NOT NULL DEFAULT '' COMMENT 'specify a filter to be applied to field',
5729 `search_marc_map_id` int(11) NOT NULL,
5730 `search_field_id` int(11) NOT NULL,
5731 `facet` tinyint(1) DEFAULT 0 COMMENT 'true if a facet field should be generated for this',
5732 `suggestible` tinyint(1) DEFAULT 0 COMMENT 'true if this field can be used to generate suggestions for browse',
5733 `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',
5734 PRIMARY KEY (`search_marc_map_id`,`search_field_id`,`filter`),
5735 KEY `search_field_id` (`search_field_id`),
5736 CONSTRAINT `search_marc_to_field_ibfk_1` FOREIGN KEY (`search_marc_map_id`) REFERENCES `search_marc_map` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
5737 CONSTRAINT `search_marc_to_field_ibfk_2` FOREIGN KEY (`search_field_id`) REFERENCES `search_field` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
5738 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5739 /*!40101 SET character_set_client = @saved_cs_client */;
5742 -- Table structure for table `serial`
5745 DROP TABLE IF EXISTS `serial`;
5746 /*!40101 SET @saved_cs_client = @@character_set_client */;
5747 /*!40101 SET character_set_client = utf8 */;
5748 CREATE TABLE `serial` (
5749 `serialid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the issue',
5750 `biblionumber` int(11) NOT NULL COMMENT 'foreign key for the biblio.biblionumber that this issue is attached to',
5751 `subscriptionid` int(11) NOT NULL COMMENT 'foreign key to the subscription.subscriptionid that this issue is part of',
5752 `serialseq` varchar(100) NOT NULL DEFAULT '' COMMENT 'issue information (volume, number, etc)',
5753 `serialseq_x` varchar(100) DEFAULT NULL COMMENT 'first part of issue information',
5754 `serialseq_y` varchar(100) DEFAULT NULL COMMENT 'second part of issue information',
5755 `serialseq_z` varchar(100) DEFAULT NULL COMMENT 'third part of issue information',
5756 `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'status code for this issue (see manual for full descriptions)',
5757 `planneddate` date DEFAULT NULL COMMENT 'date expected',
5758 `notes` mediumtext DEFAULT NULL COMMENT 'notes',
5759 `publisheddate` date DEFAULT NULL COMMENT 'date published',
5760 `publisheddatetext` varchar(100) DEFAULT NULL COMMENT 'date published (descriptive)',
5761 `claimdate` date DEFAULT NULL COMMENT 'date claimed',
5762 `claims_count` int(11) DEFAULT 0 COMMENT 'number of claims made related to this issue',
5763 `routingnotes` mediumtext DEFAULT NULL COMMENT 'notes from the routing list',
5764 PRIMARY KEY (`serialid`),
5765 KEY `serial_ibfk_1` (`biblionumber`),
5766 KEY `serial_ibfk_2` (`subscriptionid`),
5767 CONSTRAINT `serial_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5768 CONSTRAINT `serial_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5769 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5770 /*!40101 SET character_set_client = @saved_cs_client */;
5773 -- Table structure for table `serialitems`
5776 DROP TABLE IF EXISTS `serialitems`;
5777 /*!40101 SET @saved_cs_client = @@character_set_client */;
5778 /*!40101 SET character_set_client = utf8 */;
5779 CREATE TABLE `serialitems` (
5780 `itemnumber` int(11) NOT NULL,
5781 `serialid` int(11) NOT NULL,
5782 PRIMARY KEY (`itemnumber`),
5783 KEY `serialitems_sfk_1` (`serialid`),
5784 CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE,
5785 CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
5786 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5787 /*!40101 SET character_set_client = @saved_cs_client */;
5790 -- Table structure for table `sessions`
5793 DROP TABLE IF EXISTS `sessions`;
5794 /*!40101 SET @saved_cs_client = @@character_set_client */;
5795 /*!40101 SET character_set_client = utf8 */;
5796 CREATE TABLE `sessions` (
5797 `id` varchar(32) NOT NULL,
5798 `a_session` longblob NOT NULL,
5800 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5801 /*!40101 SET character_set_client = @saved_cs_client */;
5804 -- Table structure for table `sms_providers`
5807 DROP TABLE IF EXISTS `sms_providers`;
5808 /*!40101 SET @saved_cs_client = @@character_set_client */;
5809 /*!40101 SET character_set_client = utf8 */;
5810 CREATE TABLE `sms_providers` (
5811 `id` int(11) NOT NULL AUTO_INCREMENT,
5812 `name` varchar(255) NOT NULL,
5813 `domain` varchar(255) NOT NULL,
5815 UNIQUE KEY `name` (`name`(191))
5816 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5817 /*!40101 SET character_set_client = @saved_cs_client */;
5820 -- Table structure for table `smtp_servers`
5823 DROP TABLE IF EXISTS `smtp_servers`;
5824 /*!40101 SET @saved_cs_client = @@character_set_client */;
5825 /*!40101 SET character_set_client = utf8 */;
5826 CREATE TABLE `smtp_servers` (
5827 `id` int(11) NOT NULL AUTO_INCREMENT,
5828 `name` varchar(80) NOT NULL,
5829 `host` varchar(80) NOT NULL DEFAULT 'localhost',
5830 `port` int(11) NOT NULL DEFAULT 25,
5831 `timeout` int(11) NOT NULL DEFAULT 120,
5832 `ssl_mode` enum('disabled','ssl','starttls') NOT NULL,
5833 `user_name` varchar(80) DEFAULT NULL,
5834 `password` varchar(80) DEFAULT NULL,
5835 `debug` tinyint(1) NOT NULL DEFAULT 0,
5836 `is_default` tinyint(1) NOT NULL DEFAULT 0,
5838 KEY `host_idx` (`host`)
5839 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5840 /*!40101 SET character_set_client = @saved_cs_client */;
5843 -- Table structure for table `social_data`
5846 DROP TABLE IF EXISTS `social_data`;
5847 /*!40101 SET @saved_cs_client = @@character_set_client */;
5848 /*!40101 SET character_set_client = utf8 */;
5849 CREATE TABLE `social_data` (
5850 `isbn` varchar(30) NOT NULL DEFAULT '',
5851 `num_critics` int(11) DEFAULT NULL,
5852 `num_critics_pro` int(11) DEFAULT NULL,
5853 `num_quotations` int(11) DEFAULT NULL,
5854 `num_videos` int(11) DEFAULT NULL,
5855 `score_avg` decimal(5,2) DEFAULT NULL,
5856 `num_scores` int(11) DEFAULT NULL,
5857 PRIMARY KEY (`isbn`)
5858 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5859 /*!40101 SET character_set_client = @saved_cs_client */;
5862 -- Table structure for table `special_holidays`
5865 DROP TABLE IF EXISTS `special_holidays`;
5866 /*!40101 SET @saved_cs_client = @@character_set_client */;
5867 /*!40101 SET character_set_client = utf8 */;
5868 CREATE TABLE `special_holidays` (
5869 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5870 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
5871 `day` smallint(6) NOT NULL DEFAULT 0 COMMENT 'day of the month this closing is on',
5872 `month` smallint(6) NOT NULL DEFAULT 0 COMMENT 'month this closing is in',
5873 `year` smallint(6) NOT NULL DEFAULT 0 COMMENT 'year this closing is in',
5874 `isexception` smallint(1) NOT NULL DEFAULT 1 COMMENT 'is this a holiday exception to a repeatable holiday (1 for yes, 0 for no)',
5875 `title` varchar(50) NOT NULL DEFAULT '' COMMENT 'title for this closing',
5876 `description` mediumtext NOT NULL COMMENT 'description of this closing',
5878 KEY `special_holidays_ibfk_1` (`branchcode`),
5879 CONSTRAINT `special_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5880 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5881 /*!40101 SET character_set_client = @saved_cs_client */;
5884 -- Table structure for table `statistics`
5887 DROP TABLE IF EXISTS `statistics`;
5888 /*!40101 SET @saved_cs_client = @@character_set_client */;
5889 /*!40101 SET character_set_client = utf8 */;
5890 CREATE TABLE `statistics` (
5891 `datetime` datetime DEFAULT NULL COMMENT 'date and time of the transaction',
5892 `branch` varchar(10) DEFAULT NULL COMMENT 'foreign key, branch where the transaction occurred',
5893 `value` double(16,4) DEFAULT NULL COMMENT 'monetary value associated with the transaction',
5894 `type` varchar(16) DEFAULT NULL COMMENT 'transaction type (localuse, issue, return, renew, writeoff, payment)',
5895 `other` longtext DEFAULT NULL COMMENT 'used by SIP',
5896 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific item',
5897 `itemtype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table, links transaction to a specific item type',
5898 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
5899 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower',
5900 `ccode` varchar(80) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific collection code',
5901 `categorycode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower category',
5902 `interface` varchar(30) DEFAULT NULL COMMENT 'the context this action was taken in',
5903 KEY `timeidx` (`datetime`),
5904 KEY `branch_idx` (`branch`),
5905 KEY `type_idx` (`type`),
5906 KEY `itemnumber_idx` (`itemnumber`),
5907 KEY `itemtype_idx` (`itemtype`),
5908 KEY `borrowernumber_idx` (`borrowernumber`),
5909 KEY `ccode_idx` (`ccode`)
5910 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5911 /*!40101 SET character_set_client = @saved_cs_client */;
5914 -- Table structure for table `stockrotationitems`
5917 DROP TABLE IF EXISTS `stockrotationitems`;
5918 /*!40101 SET @saved_cs_client = @@character_set_client */;
5919 /*!40101 SET character_set_client = utf8 */;
5920 CREATE TABLE `stockrotationitems` (
5921 `itemnumber_id` int(11) NOT NULL COMMENT 'Itemnumber to link to a stage & rota',
5922 `stage_id` int(11) NOT NULL COMMENT 'stage ID to link the item to',
5923 `indemand` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should this item be skipped for rotation?',
5924 `fresh` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag showing item is only just added to rota',
5925 PRIMARY KEY (`itemnumber_id`),
5926 KEY `stockrotationitems_sifk` (`stage_id`),
5927 CONSTRAINT `stockrotationitems_iifk` FOREIGN KEY (`itemnumber_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5928 CONSTRAINT `stockrotationitems_sifk` FOREIGN KEY (`stage_id`) REFERENCES `stockrotationstages` (`stage_id`) ON DELETE CASCADE ON UPDATE CASCADE
5929 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5930 /*!40101 SET character_set_client = @saved_cs_client */;
5933 -- Table structure for table `stockrotationrotas`
5936 DROP TABLE IF EXISTS `stockrotationrotas`;
5937 /*!40101 SET @saved_cs_client = @@character_set_client */;
5938 /*!40101 SET character_set_client = utf8 */;
5939 CREATE TABLE `stockrotationrotas` (
5940 `rota_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Stockrotation rota ID',
5941 `title` varchar(100) NOT NULL COMMENT 'Title for this rota',
5942 `description` text NOT NULL COMMENT 'Description for this rota',
5943 `cyclical` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should items on this rota keep cycling?',
5944 `active` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this rota currently active?',
5945 PRIMARY KEY (`rota_id`),
5946 UNIQUE KEY `stockrotationrotas_title` (`title`)
5947 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5948 /*!40101 SET character_set_client = @saved_cs_client */;
5951 -- Table structure for table `stockrotationstages`
5954 DROP TABLE IF EXISTS `stockrotationstages`;
5955 /*!40101 SET @saved_cs_client = @@character_set_client */;
5956 /*!40101 SET character_set_client = utf8 */;
5957 CREATE TABLE `stockrotationstages` (
5958 `stage_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique stage ID',
5959 `position` int(11) NOT NULL COMMENT 'The position of this stage within its rota',
5960 `rota_id` int(11) NOT NULL COMMENT 'The rota this stage belongs to',
5961 `branchcode_id` varchar(10) NOT NULL COMMENT 'Branch this stage relates to',
5962 `duration` int(11) NOT NULL DEFAULT 4 COMMENT 'The number of days items shoud occupy this stage',
5963 PRIMARY KEY (`stage_id`),
5964 KEY `stockrotationstages_rifk` (`rota_id`),
5965 KEY `stockrotationstages_bifk` (`branchcode_id`),
5966 CONSTRAINT `stockrotationstages_bifk` FOREIGN KEY (`branchcode_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5967 CONSTRAINT `stockrotationstages_rifk` FOREIGN KEY (`rota_id`) REFERENCES `stockrotationrotas` (`rota_id`) ON DELETE CASCADE ON UPDATE CASCADE
5968 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5969 /*!40101 SET character_set_client = @saved_cs_client */;
5972 -- Table structure for table `subscription`
5975 DROP TABLE IF EXISTS `subscription`;
5976 /*!40101 SET @saved_cs_client = @@character_set_client */;
5977 /*!40101 SET character_set_client = utf8 */;
5978 CREATE TABLE `subscription` (
5979 `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
5980 `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
5981 `librarian` varchar(100) DEFAULT '' COMMENT 'the librarian''s username from borrowers.userid',
5982 `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
5983 `aqbooksellerid` int(11) DEFAULT 0 COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
5984 `cost` int(11) DEFAULT 0,
5985 `aqbudgetid` int(11) DEFAULT 0,
5986 `weeklength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or numberlength is set)',
5987 `monthlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if weeklength or numberlength is set)',
5988 `numberlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or weeklength is set)',
5989 `periodicity` int(11) DEFAULT NULL COMMENT 'frequency type links to subscription_frequencies.id',
5990 `countissuesperunit` int(11) NOT NULL DEFAULT 1,
5991 `notes` longtext DEFAULT NULL COMMENT 'notes',
5992 `status` varchar(100) NOT NULL DEFAULT '' COMMENT 'status of this subscription',
5993 `lastvalue1` int(11) DEFAULT NULL,
5994 `innerloop1` int(11) DEFAULT 0,
5995 `lastvalue2` int(11) DEFAULT NULL,
5996 `innerloop2` int(11) DEFAULT 0,
5997 `lastvalue3` int(11) DEFAULT NULL,
5998 `innerloop3` int(11) DEFAULT 0,
5999 `firstacquidate` date DEFAULT NULL COMMENT 'first issue received date',
6000 `manualhistory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes or no to managing the history manually',
6001 `irregularity` mediumtext DEFAULT NULL COMMENT 'any irregularities in the subscription',
6002 `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
6003 `letter` varchar(20) DEFAULT NULL,
6004 `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
6005 `locale` varchar(80) DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
6006 `distributedto` mediumtext DEFAULT NULL,
6007 `internalnotes` longtext DEFAULT NULL,
6008 `callnumber` mediumtext DEFAULT NULL COMMENT 'default call number',
6009 `location` varchar(80) DEFAULT '' COMMENT 'default shelving location (items.location)',
6010 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'default branches (items.homebranch)',
6011 `lastbranch` varchar(10) DEFAULT NULL,
6012 `serialsadditems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'does receiving this serial create an item record',
6013 `staffdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the staff',
6014 `opacdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the public',
6015 `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
6016 `enddate` date DEFAULT NULL COMMENT 'subscription end date',
6017 `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
6018 `reneweddate` date DEFAULT NULL COMMENT 'date of last renewal for the subscription',
6019 `itemtype` varchar(10) DEFAULT NULL,
6020 `previousitemtype` varchar(10) DEFAULT NULL,
6021 `mana_id` int(11) DEFAULT NULL,
6022 `ccode` varchar(80) DEFAULT NULL COMMENT 'collection code to assign to serial items',
6023 `published_on_template` text DEFAULT NULL COMMENT 'Template Toolkit syntax to generate the default "Published on (text)" field when receiving an issue this serial',
6024 PRIMARY KEY (`subscriptionid`),
6025 KEY `subscription_ibfk_1` (`periodicity`),
6026 KEY `subscription_ibfk_2` (`numberpattern`),
6027 KEY `subscription_ibfk_3` (`biblionumber`),
6028 CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
6029 CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
6030 CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
6031 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6032 /*!40101 SET character_set_client = @saved_cs_client */;
6035 -- Table structure for table `subscription_frequencies`
6038 DROP TABLE IF EXISTS `subscription_frequencies`;
6039 /*!40101 SET @saved_cs_client = @@character_set_client */;
6040 /*!40101 SET character_set_client = utf8 */;
6041 CREATE TABLE `subscription_frequencies` (
6042 `id` int(11) NOT NULL AUTO_INCREMENT,
6043 `description` mediumtext NOT NULL,
6044 `displayorder` int(11) DEFAULT NULL,
6045 `unit` enum('day','week','month','year') DEFAULT NULL,
6046 `unitsperissue` int(11) NOT NULL DEFAULT 1,
6047 `issuesperunit` int(11) NOT NULL DEFAULT 1,
6049 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6050 /*!40101 SET character_set_client = @saved_cs_client */;
6053 -- Table structure for table `subscription_numberpatterns`
6056 DROP TABLE IF EXISTS `subscription_numberpatterns`;
6057 /*!40101 SET @saved_cs_client = @@character_set_client */;
6058 /*!40101 SET character_set_client = utf8 */;
6059 CREATE TABLE `subscription_numberpatterns` (
6060 `id` int(11) NOT NULL AUTO_INCREMENT,
6061 `label` varchar(255) NOT NULL,
6062 `displayorder` int(11) DEFAULT NULL,
6063 `description` mediumtext DEFAULT NULL,
6064 `numberingmethod` varchar(255) NOT NULL,
6065 `label1` varchar(255) DEFAULT NULL,
6066 `add1` int(11) DEFAULT NULL,
6067 `every1` int(11) DEFAULT NULL,
6068 `whenmorethan1` int(11) DEFAULT NULL,
6069 `setto1` int(11) DEFAULT NULL,
6070 `numbering1` varchar(255) DEFAULT NULL,
6071 `label2` varchar(255) DEFAULT NULL,
6072 `add2` int(11) DEFAULT NULL,
6073 `every2` int(11) DEFAULT NULL,
6074 `whenmorethan2` int(11) DEFAULT NULL,
6075 `setto2` int(11) DEFAULT NULL,
6076 `numbering2` varchar(255) DEFAULT NULL,
6077 `label3` varchar(255) DEFAULT NULL,
6078 `add3` int(11) DEFAULT NULL,
6079 `every3` int(11) DEFAULT NULL,
6080 `whenmorethan3` int(11) DEFAULT NULL,
6081 `setto3` int(11) DEFAULT NULL,
6082 `numbering3` varchar(255) DEFAULT NULL,
6084 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6085 /*!40101 SET character_set_client = @saved_cs_client */;
6088 -- Table structure for table `subscriptionhistory`
6091 DROP TABLE IF EXISTS `subscriptionhistory`;
6092 /*!40101 SET @saved_cs_client = @@character_set_client */;
6093 /*!40101 SET character_set_client = utf8 */;
6094 CREATE TABLE `subscriptionhistory` (
6095 `biblionumber` int(11) NOT NULL,
6096 `subscriptionid` int(11) NOT NULL,
6097 `histstartdate` date DEFAULT NULL,
6098 `histenddate` date DEFAULT NULL,
6099 `missinglist` longtext NOT NULL,
6100 `recievedlist` longtext NOT NULL,
6101 `opacnote` longtext DEFAULT NULL,
6102 `librariannote` longtext DEFAULT NULL,
6103 PRIMARY KEY (`subscriptionid`),
6104 KEY `subscription_history_ibfk_1` (`biblionumber`),
6105 CONSTRAINT `subscription_history_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6106 CONSTRAINT `subscription_history_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
6107 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6108 /*!40101 SET character_set_client = @saved_cs_client */;
6111 -- Table structure for table `subscriptionroutinglist`
6114 DROP TABLE IF EXISTS `subscriptionroutinglist`;
6115 /*!40101 SET @saved_cs_client = @@character_set_client */;
6116 /*!40101 SET character_set_client = utf8 */;
6117 CREATE TABLE `subscriptionroutinglist` (
6118 `routingid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
6119 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines with patron is on the routing list',
6120 `ranking` int(11) DEFAULT NULL COMMENT 'where the patron stands in line to receive the serial',
6121 `subscriptionid` int(11) NOT NULL COMMENT 'foreign key from the subscription table, defines which subscription this routing list is for',
6122 PRIMARY KEY (`routingid`),
6123 UNIQUE KEY `subscriptionid` (`subscriptionid`,`borrowernumber`),
6124 KEY `subscriptionroutinglist_ibfk_1` (`borrowernumber`),
6125 CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6126 CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
6127 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6128 /*!40101 SET character_set_client = @saved_cs_client */;
6131 -- Table structure for table `suggestions`
6134 DROP TABLE IF EXISTS `suggestions`;
6135 /*!40101 SET @saved_cs_client = @@character_set_client */;
6136 /*!40101 SET character_set_client = utf8 */;
6137 CREATE TABLE `suggestions` (
6138 `suggestionid` int(8) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned automatically by Koha',
6139 `suggestedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the person making the suggestion, foreign key linking to the borrowers table',
6140 `suggesteddate` date NOT NULL COMMENT 'date the suggestion was submitted',
6141 `managedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian managing the suggestion, foreign key linking to the borrowers table',
6142 `manageddate` date DEFAULT NULL COMMENT 'date the suggestion was updated',
6143 `acceptedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who accepted the suggestion, foreign key linking to the borrowers table',
6144 `accepteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as accepted',
6145 `rejectedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table',
6146 `rejecteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as rejected',
6147 `lastmodificationby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who edit the suggestion for the last time',
6148 `lastmodificationdate` date DEFAULT NULL COMMENT 'date of the last modification',
6149 `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)',
6150 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the suggestion archived?',
6151 `note` longtext DEFAULT NULL COMMENT 'note entered on the suggestion',
6152 `staff_note` longtext DEFAULT NULL COMMENT 'non-public note entered on the suggestion',
6153 `author` varchar(80) DEFAULT NULL COMMENT 'author of the suggested item',
6154 `title` varchar(255) DEFAULT NULL COMMENT 'title of the suggested item',
6155 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'copyright date of the suggested item',
6156 `publishercode` varchar(255) DEFAULT NULL COMMENT 'publisher of the suggested item',
6157 `date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the suggestion was updated',
6158 `volumedesc` varchar(255) DEFAULT NULL,
6159 `publicationyear` smallint(6) DEFAULT 0,
6160 `place` varchar(255) DEFAULT NULL COMMENT 'publication place of the suggested item',
6161 `isbn` varchar(30) DEFAULT NULL COMMENT 'isbn of the suggested item',
6162 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggestion to the biblio table after the suggestion has been ordered',
6163 `reason` mediumtext DEFAULT NULL COMMENT 'reason for accepting or rejecting the suggestion',
6164 `patronreason` mediumtext DEFAULT NULL COMMENT 'reason for making the suggestion',
6165 `budgetid` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggested budget to the aqbudgets table',
6166 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key linking the suggested branch to the branches table',
6167 `collectiontitle` mediumtext DEFAULT NULL COMMENT 'collection name for the suggested item',
6168 `itemtype` varchar(30) DEFAULT NULL COMMENT 'suggested item type',
6169 `quantity` smallint(6) DEFAULT NULL COMMENT 'suggested quantity to be purchased',
6170 `currency` varchar(10) DEFAULT NULL COMMENT 'suggested currency for the suggested price',
6171 `price` decimal(28,6) DEFAULT NULL COMMENT 'suggested price',
6172 `total` decimal(28,6) DEFAULT NULL COMMENT 'suggested total cost (price*quantity updated for currency)',
6173 PRIMARY KEY (`suggestionid`),
6174 KEY `suggestedby` (`suggestedby`),
6175 KEY `managedby` (`managedby`),
6176 KEY `acceptedby` (`acceptedby`),
6177 KEY `rejectedby` (`rejectedby`),
6178 KEY `biblionumber` (`biblionumber`),
6179 KEY `budgetid` (`budgetid`),
6180 KEY `branchcode` (`branchcode`),
6181 KEY `status` (`STATUS`),
6182 KEY `suggestions_ibfk_lastmodificationby` (`lastmodificationby`),
6183 CONSTRAINT `suggestions_budget_id_fk` FOREIGN KEY (`budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
6184 CONSTRAINT `suggestions_ibfk_acceptedby` FOREIGN KEY (`acceptedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
6185 CONSTRAINT `suggestions_ibfk_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
6186 CONSTRAINT `suggestions_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
6187 CONSTRAINT `suggestions_ibfk_lastmodificationby` FOREIGN KEY (`lastmodificationby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
6188 CONSTRAINT `suggestions_ibfk_managedby` FOREIGN KEY (`managedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
6189 CONSTRAINT `suggestions_ibfk_rejectedby` FOREIGN KEY (`rejectedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
6190 CONSTRAINT `suggestions_ibfk_suggestedby` FOREIGN KEY (`suggestedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
6191 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6192 /*!40101 SET character_set_client = @saved_cs_client */;
6195 -- Table structure for table `systempreferences`
6198 DROP TABLE IF EXISTS `systempreferences`;
6199 /*!40101 SET @saved_cs_client = @@character_set_client */;
6200 /*!40101 SET character_set_client = utf8 */;
6201 CREATE TABLE `systempreferences` (
6202 `variable` varchar(50) NOT NULL DEFAULT '' COMMENT 'system preference name',
6203 `value` mediumtext DEFAULT NULL COMMENT 'system preference values',
6204 `options` longtext DEFAULT NULL COMMENT 'options for multiple choice system preferences',
6205 `explanation` mediumtext DEFAULT NULL COMMENT 'descriptive text for the system preference',
6206 `type` varchar(20) DEFAULT NULL COMMENT 'type of question this preference asks (multiple choice, plain text, yes or no, etc)',
6207 PRIMARY KEY (`variable`)
6208 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6209 /*!40101 SET character_set_client = @saved_cs_client */;
6212 -- Table structure for table `tables_settings`
6215 DROP TABLE IF EXISTS `tables_settings`;
6216 /*!40101 SET @saved_cs_client = @@character_set_client */;
6217 /*!40101 SET character_set_client = utf8 */;
6218 CREATE TABLE `tables_settings` (
6219 `module` varchar(255) NOT NULL,
6220 `page` varchar(255) NOT NULL,
6221 `tablename` varchar(255) NOT NULL,
6222 `default_display_length` smallint(6) DEFAULT NULL,
6223 `default_sort_order` varchar(255) DEFAULT NULL,
6224 PRIMARY KEY (`module`(191),`page`(191),`tablename`(191))
6225 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6226 /*!40101 SET character_set_client = @saved_cs_client */;
6229 -- Table structure for table `tags`
6232 DROP TABLE IF EXISTS `tags`;
6233 /*!40101 SET @saved_cs_client = @@character_set_client */;
6234 /*!40101 SET character_set_client = utf8 */;
6235 CREATE TABLE `tags` (
6236 `entry` varchar(255) NOT NULL DEFAULT '',
6237 `weight` bigint(20) NOT NULL DEFAULT 0,
6238 PRIMARY KEY (`entry`(191))
6239 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6240 /*!40101 SET character_set_client = @saved_cs_client */;
6243 -- Table structure for table `tags_all`
6246 DROP TABLE IF EXISTS `tags_all`;
6247 /*!40101 SET @saved_cs_client = @@character_set_client */;
6248 /*!40101 SET character_set_client = utf8 */;
6249 CREATE TABLE `tags_all` (
6250 `tag_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key',
6251 `borrowernumber` int(11) DEFAULT NULL COMMENT 'the patron who added the tag (borrowers.borrowernumber)',
6252 `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was left on (biblio.biblionumber)',
6253 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
6254 `language` int(4) DEFAULT NULL COMMENT 'the language the tag was left in',
6255 `date_created` datetime NOT NULL COMMENT 'the date the tag was added',
6256 PRIMARY KEY (`tag_id`),
6257 KEY `tags_borrowers_fk_1` (`borrowernumber`),
6258 KEY `tags_biblionumber_fk_1` (`biblionumber`),
6259 CONSTRAINT `tags_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6260 CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
6261 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6262 /*!40101 SET character_set_client = @saved_cs_client */;
6265 -- Table structure for table `tags_approval`
6268 DROP TABLE IF EXISTS `tags_approval`;
6269 /*!40101 SET @saved_cs_client = @@character_set_client */;
6270 /*!40101 SET character_set_client = utf8 */;
6271 CREATE TABLE `tags_approval` (
6272 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
6273 `approved` int(1) NOT NULL DEFAULT 0 COMMENT 'whether the tag is approved or not (1=yes, 0=pending, -1=rejected)',
6274 `date_approved` datetime DEFAULT NULL COMMENT 'the date this tag was approved',
6275 `approved_by` int(11) DEFAULT NULL COMMENT 'the librarian who approved the tag (borrowers.borrowernumber)',
6276 `weight_total` int(9) NOT NULL DEFAULT 1 COMMENT 'the total number of times this tag was used',
6277 PRIMARY KEY (`term`),
6278 KEY `tags_approval_borrowers_fk_1` (`approved_by`),
6279 CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
6280 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6281 /*!40101 SET character_set_client = @saved_cs_client */;
6284 -- Table structure for table `tags_index`
6287 DROP TABLE IF EXISTS `tags_index`;
6288 /*!40101 SET @saved_cs_client = @@character_set_client */;
6289 /*!40101 SET character_set_client = utf8 */;
6290 CREATE TABLE `tags_index` (
6291 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
6292 `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was used on (biblio.biblionumber)',
6293 `weight` int(9) NOT NULL DEFAULT 1 COMMENT 'the number of times this term was used on this bib record',
6294 PRIMARY KEY (`term`,`biblionumber`),
6295 KEY `tags_index_biblionumber_fk_1` (`biblionumber`),
6296 CONSTRAINT `tags_index_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6297 CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`) REFERENCES `tags_approval` (`term`) ON DELETE CASCADE ON UPDATE CASCADE
6298 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6299 /*!40101 SET character_set_client = @saved_cs_client */;
6302 -- Table structure for table `ticket_updates`
6305 DROP TABLE IF EXISTS `ticket_updates`;
6306 /*!40101 SET @saved_cs_client = @@character_set_client */;
6307 /*!40101 SET character_set_client = utf8 */;
6308 CREATE TABLE `ticket_updates` (
6309 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
6310 `ticket_id` int(11) NOT NULL COMMENT 'id of catalog ticket the update relates to',
6311 `user_id` int(11) NOT NULL DEFAULT 0 COMMENT 'id of the user who logged the update',
6312 `assignee_id` int(11) DEFAULT NULL COMMENT 'id of the user who this ticket was assigned to at this update',
6313 `public` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote whether this update is public',
6314 `date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time this update was logged',
6315 `message` text NOT NULL COMMENT 'update message content',
6316 `status` varchar(80) DEFAULT NULL COMMENT 'status of ticket at this update',
6318 KEY `ticket_updates_ibfk_1` (`ticket_id`),
6319 KEY `ticket_updates_ibfk_2` (`user_id`),
6320 KEY `ticket_updates_ibfk_3` (`assignee_id`),
6321 CONSTRAINT `ticket_updates_ibfk_1` FOREIGN KEY (`ticket_id`) REFERENCES `tickets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
6322 CONSTRAINT `ticket_updates_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6323 CONSTRAINT `ticket_updates_ibfk_3` FOREIGN KEY (`assignee_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
6324 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6325 /*!40101 SET character_set_client = @saved_cs_client */;
6328 -- Table structure for table `tickets`
6331 DROP TABLE IF EXISTS `tickets`;
6332 /*!40101 SET @saved_cs_client = @@character_set_client */;
6333 /*!40101 SET character_set_client = utf8 */;
6334 CREATE TABLE `tickets` (
6335 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
6336 `source` enum('catalog') NOT NULL DEFAULT 'catalog' COMMENT 'source of ticket',
6337 `reporter_id` int(11) NOT NULL DEFAULT 0 COMMENT 'id of the patron who reported the ticket',
6338 `reported_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time this ticket was reported',
6339 `title` text NOT NULL COMMENT 'ticket title',
6340 `body` text NOT NULL COMMENT 'ticket details',
6341 `status` varchar(80) DEFAULT NULL COMMENT 'current status of the ticket',
6342 `assignee_id` int(11) DEFAULT NULL COMMENT 'id of the user who this ticket is assigned to',
6343 `resolver_id` int(11) DEFAULT NULL COMMENT 'id of the user who resolved the ticket',
6344 `resolved_date` datetime DEFAULT NULL COMMENT 'date and time this ticket was resolved',
6345 `biblio_id` int(11) DEFAULT NULL COMMENT 'id of biblio linked',
6347 KEY `tickets_ibfk_1` (`reporter_id`),
6348 KEY `tickets_ibfk_2` (`resolver_id`),
6349 KEY `tickets_ibfk_3` (`biblio_id`),
6350 KEY `tickets_ibfk_4` (`assignee_id`),
6351 CONSTRAINT `tickets_ibfk_1` FOREIGN KEY (`reporter_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6352 CONSTRAINT `tickets_ibfk_2` FOREIGN KEY (`resolver_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6353 CONSTRAINT `tickets_ibfk_3` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6354 CONSTRAINT `tickets_ibfk_4` FOREIGN KEY (`assignee_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
6355 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6356 /*!40101 SET character_set_client = @saved_cs_client */;
6359 -- Table structure for table `tmp_holdsqueue`
6362 DROP TABLE IF EXISTS `tmp_holdsqueue`;
6363 /*!40101 SET @saved_cs_client = @@character_set_client */;
6364 /*!40101 SET character_set_client = utf8 */;
6365 CREATE TABLE `tmp_holdsqueue` (
6366 `biblionumber` int(11) DEFAULT NULL,
6367 `itemnumber` int(11) NOT NULL,
6368 `barcode` varchar(20) DEFAULT NULL,
6369 `surname` longtext NOT NULL,
6370 `firstname` mediumtext DEFAULT NULL,
6371 `phone` mediumtext DEFAULT NULL,
6372 `borrowernumber` int(11) NOT NULL,
6373 `cardnumber` varchar(32) DEFAULT NULL,
6374 `reservedate` date DEFAULT NULL,
6375 `title` longtext DEFAULT NULL,
6376 `itemcallnumber` varchar(255) DEFAULT NULL,
6377 `holdingbranch` varchar(10) DEFAULT NULL,
6378 `pickbranch` varchar(10) DEFAULT NULL,
6379 `notes` mediumtext DEFAULT NULL,
6380 `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
6381 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this entry as added/last updated',
6382 PRIMARY KEY (`itemnumber`),
6383 KEY `tmp_holdsqueue_ibfk_1` (`itemnumber`),
6384 KEY `tmp_holdsqueue_ibfk_2` (`biblionumber`),
6385 KEY `tmp_holdsqueue_ibfk_3` (`borrowernumber`),
6386 CONSTRAINT `tmp_holdsqueue_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6387 CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6388 CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
6389 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6390 /*!40101 SET character_set_client = @saved_cs_client */;
6393 -- Table structure for table `transport_cost`
6396 DROP TABLE IF EXISTS `transport_cost`;
6397 /*!40101 SET @saved_cs_client = @@character_set_client */;
6398 /*!40101 SET character_set_client = utf8 */;
6399 CREATE TABLE `transport_cost` (
6400 `frombranch` varchar(10) NOT NULL,
6401 `tobranch` varchar(10) NOT NULL,
6402 `cost` decimal(6,2) NOT NULL,
6403 `disable_transfer` tinyint(1) NOT NULL DEFAULT 0,
6404 PRIMARY KEY (`frombranch`,`tobranch`),
6405 KEY `transport_cost_ibfk_2` (`tobranch`),
6406 CONSTRAINT `transport_cost_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
6407 CONSTRAINT `transport_cost_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
6408 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6409 /*!40101 SET character_set_client = @saved_cs_client */;
6412 -- Table structure for table `uploaded_files`
6415 DROP TABLE IF EXISTS `uploaded_files`;
6416 /*!40101 SET @saved_cs_client = @@character_set_client */;
6417 /*!40101 SET character_set_client = utf8 */;
6418 CREATE TABLE `uploaded_files` (
6419 `id` int(11) NOT NULL AUTO_INCREMENT,
6420 `hashvalue` char(40) NOT NULL,
6421 `filename` mediumtext NOT NULL,
6422 `dir` mediumtext NOT NULL,
6423 `filesize` int(11) DEFAULT NULL,
6424 `dtcreated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
6425 `uploadcategorycode` text DEFAULT NULL,
6426 `owner` int(11) DEFAULT NULL,
6427 `public` tinyint(4) DEFAULT NULL,
6428 `permanent` tinyint(4) DEFAULT NULL,
6430 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6431 /*!40101 SET character_set_client = @saved_cs_client */;
6434 -- Table structure for table `user_permissions`
6437 DROP TABLE IF EXISTS `user_permissions`;
6438 /*!40101 SET @saved_cs_client = @@character_set_client */;
6439 /*!40101 SET character_set_client = utf8 */;
6440 CREATE TABLE `user_permissions` (
6441 `borrowernumber` int(11) NOT NULL DEFAULT 0,
6442 `module_bit` int(11) NOT NULL DEFAULT 0,
6443 `code` varchar(64) NOT NULL,
6444 PRIMARY KEY (`borrowernumber`,`module_bit`,`code`),
6445 KEY `user_permissions_ibfk_1` (`borrowernumber`),
6446 KEY `user_permissions_ibfk_2` (`module_bit`,`code`),
6447 CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6448 CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`) ON DELETE CASCADE ON UPDATE CASCADE
6449 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6450 /*!40101 SET character_set_client = @saved_cs_client */;
6453 -- Table structure for table `userflags`
6456 DROP TABLE IF EXISTS `userflags`;
6457 /*!40101 SET @saved_cs_client = @@character_set_client */;
6458 /*!40101 SET character_set_client = utf8 */;
6459 CREATE TABLE `userflags` (
6460 `bit` int(11) NOT NULL DEFAULT 0,
6461 `flag` varchar(30) DEFAULT NULL,
6462 `flagdesc` varchar(255) DEFAULT NULL,
6463 `defaulton` int(11) DEFAULT NULL,
6465 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6466 /*!40101 SET character_set_client = @saved_cs_client */;
6469 -- Table structure for table `vendor_edi_accounts`
6472 DROP TABLE IF EXISTS `vendor_edi_accounts`;
6473 /*!40101 SET @saved_cs_client = @@character_set_client */;
6474 /*!40101 SET character_set_client = utf8 */;
6475 CREATE TABLE `vendor_edi_accounts` (
6476 `id` int(11) NOT NULL AUTO_INCREMENT,
6477 `description` mediumtext NOT NULL,
6478 `host` varchar(40) DEFAULT NULL,
6479 `username` varchar(40) DEFAULT NULL,
6480 `password` mediumtext DEFAULT NULL,
6481 `upload_port` int(11) DEFAULT NULL,
6482 `download_port` int(11) DEFAULT NULL,
6483 `last_activity` date DEFAULT NULL,
6484 `vendor_id` int(11) DEFAULT NULL,
6485 `download_directory` mediumtext DEFAULT NULL,
6486 `upload_directory` mediumtext DEFAULT NULL,
6487 `san` varchar(20) DEFAULT NULL,
6488 `standard` varchar(3) DEFAULT 'EUR',
6489 `id_code_qualifier` varchar(3) DEFAULT '14',
6490 `transport` varchar(6) DEFAULT 'FTP',
6491 `quotes_enabled` tinyint(1) NOT NULL DEFAULT 0,
6492 `invoices_enabled` tinyint(1) NOT NULL DEFAULT 0,
6493 `orders_enabled` tinyint(1) NOT NULL DEFAULT 0,
6494 `responses_enabled` tinyint(1) NOT NULL DEFAULT 0,
6495 `auto_orders` tinyint(1) NOT NULL DEFAULT 0,
6496 `shipment_budget` int(11) DEFAULT NULL,
6497 `plugin` varchar(256) NOT NULL DEFAULT '',
6499 KEY `vendorid` (`vendor_id`),
6500 KEY `shipmentbudget` (`shipment_budget`),
6501 CONSTRAINT `vfk_shipment_budget` FOREIGN KEY (`shipment_budget`) REFERENCES `aqbudgets` (`budget_id`),
6502 CONSTRAINT `vfk_vendor_id` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`)
6503 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6504 /*!40101 SET character_set_client = @saved_cs_client */;
6507 -- Table structure for table `virtualshelfcontents`
6510 DROP TABLE IF EXISTS `virtualshelfcontents`;
6511 /*!40101 SET @saved_cs_client = @@character_set_client */;
6512 /*!40101 SET character_set_client = utf8 */;
6513 CREATE TABLE `virtualshelfcontents` (
6514 `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',
6515 `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',
6516 `dateadded` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this bib record was added to the list',
6517 `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)',
6518 KEY `shelfnumber` (`shelfnumber`),
6519 KEY `biblionumber` (`biblionumber`),
6520 KEY `shelfcontents_ibfk_3` (`borrowernumber`),
6521 CONSTRAINT `shelfcontents_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6522 CONSTRAINT `shelfcontents_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
6523 CONSTRAINT `virtualshelfcontents_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE
6524 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6525 /*!40101 SET character_set_client = @saved_cs_client */;
6528 -- Table structure for table `virtualshelfshares`
6531 DROP TABLE IF EXISTS `virtualshelfshares`;
6532 /*!40101 SET @saved_cs_client = @@character_set_client */;
6533 /*!40101 SET character_set_client = utf8 */;
6534 CREATE TABLE `virtualshelfshares` (
6535 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
6536 `shelfnumber` int(11) NOT NULL COMMENT 'foreign key for virtualshelves',
6537 `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrower that accepted access to this list',
6538 `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',
6539 `sharedate` datetime DEFAULT NULL COMMENT 'date of invitation or acceptance of invitation',
6541 KEY `virtualshelfshares_ibfk_1` (`shelfnumber`),
6542 KEY `virtualshelfshares_ibfk_2` (`borrowernumber`),
6543 CONSTRAINT `virtualshelfshares_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6544 CONSTRAINT `virtualshelfshares_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
6545 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6546 /*!40101 SET character_set_client = @saved_cs_client */;
6549 -- Table structure for table `virtualshelves`
6552 DROP TABLE IF EXISTS `virtualshelves`;
6553 /*!40101 SET @saved_cs_client = @@character_set_client */;
6554 /*!40101 SET character_set_client = utf8 */;
6555 CREATE TABLE `virtualshelves` (
6556 `shelfnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
6557 `shelfname` varchar(255) DEFAULT NULL COMMENT 'name of the list',
6558 `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)',
6559 `public` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If the list is public',
6560 `sortfield` varchar(16) DEFAULT 'title' COMMENT 'the field this list is sorted on',
6561 `lastmodified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the list was last modified',
6562 `created_on` datetime NOT NULL COMMENT 'creation time',
6563 `allow_change_from_owner` tinyint(1) DEFAULT 1 COMMENT 'can owner change contents?',
6564 `allow_change_from_others` tinyint(1) DEFAULT 0 COMMENT 'can others change contents?',
6565 `allow_change_from_staff` tinyint(1) DEFAULT 0 COMMENT 'can staff change contents?',
6566 `allow_change_from_permitted_staff` tinyint(1) DEFAULT 0 COMMENT 'can staff with edit_public_list_contents permission change contents?',
6567 PRIMARY KEY (`shelfnumber`),
6568 KEY `virtualshelves_ibfk_1` (`owner`),
6569 CONSTRAINT `virtualshelves_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
6570 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6571 /*!40101 SET character_set_client = @saved_cs_client */;
6574 -- Table structure for table `z3950servers`
6577 DROP TABLE IF EXISTS `z3950servers`;
6578 /*!40101 SET @saved_cs_client = @@character_set_client */;
6579 /*!40101 SET character_set_client = utf8 */;
6580 CREATE TABLE `z3950servers` (
6581 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
6582 `host` varchar(255) NOT NULL COMMENT 'target''s host name',
6583 `port` int(11) DEFAULT NULL COMMENT 'port number used to connect to target',
6584 `db` varchar(255) DEFAULT NULL COMMENT 'target''s database name',
6585 `userid` varchar(255) DEFAULT NULL COMMENT 'username needed to log in to target',
6586 `password` varchar(255) DEFAULT NULL COMMENT 'password needed to log in to target',
6587 `servername` longtext NOT NULL COMMENT 'name given to the target by the library',
6588 `checked` smallint(6) DEFAULT NULL COMMENT 'whether this target is checked by default (1 for yes, 0 for no)',
6589 `rank` int(11) DEFAULT NULL COMMENT 'where this target appears in the list of targets',
6590 `syntax` varchar(80) NOT NULL COMMENT 'MARC format provided by this target',
6591 `timeout` int(11) NOT NULL DEFAULT 0 COMMENT 'number of seconds before Koha stops trying to access this server',
6592 `servertype` enum('zed','sru') NOT NULL DEFAULT 'zed' COMMENT 'zed means z39.50 server',
6593 `encoding` mediumtext NOT NULL COMMENT 'characters encoding provided by this target',
6594 `recordtype` enum('authority','biblio') NOT NULL DEFAULT 'biblio' COMMENT 'server contains bibliographic or authority records',
6595 `sru_options` varchar(255) DEFAULT NULL COMMENT 'options like sru=get, sru_version=1.1; will be passed to the server via ZOOM',
6596 `sru_fields` longtext DEFAULT NULL COMMENT 'contains the mapping between the Z3950 search fields and the specific SRU server indexes',
6597 `add_xslt` longtext DEFAULT NULL COMMENT 'zero or more paths to XSLT files to be processed on the search results',
6598 `attributes` varchar(255) DEFAULT NULL COMMENT 'additional attributes passed to PQF queries',
6600 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6601 /*!40101 SET character_set_client = @saved_cs_client */;
6604 -- Table structure for table `zebraqueue`
6607 DROP TABLE IF EXISTS `zebraqueue`;
6608 /*!40101 SET @saved_cs_client = @@character_set_client */;
6609 /*!40101 SET character_set_client = utf8 */;
6610 CREATE TABLE `zebraqueue` (
6611 `id` int(11) NOT NULL AUTO_INCREMENT,
6612 `biblio_auth_number` bigint(20) unsigned NOT NULL DEFAULT 0,
6613 `operation` char(20) NOT NULL DEFAULT '',
6614 `server` char(20) NOT NULL DEFAULT '',
6615 `done` int(11) NOT NULL DEFAULT 0,
6616 `time` timestamp NOT NULL DEFAULT current_timestamp(),
6618 KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
6619 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6620 /*!40101 SET character_set_client = @saved_cs_client */;
6621 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
6623 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
6624 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
6625 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
6626 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
6627 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
6628 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
6629 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
6631 -- Dump completed on 2023-11-30 17:38:08