1 -- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64)
3 -- Host: db Database: koha_kohadev
4 -- ------------------------------------------------------
5 -- Server version 10.11.3-MariaDB-1:10.11.3+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 PRIMARY KEY (`action_id`),
177 KEY `timestamp_idx` (`timestamp`),
178 KEY `user_idx` (`user`),
179 KEY `module_idx` (`module`(191)),
180 KEY `action_idx` (`action`(191)),
181 KEY `object_idx` (`object`),
182 KEY `info_idx` (`info`(191)),
183 KEY `interface` (`interface`)
184 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
185 /*!40101 SET character_set_client = @saved_cs_client */;
188 -- Table structure for table `additional_contents`
191 DROP TABLE IF EXISTS `additional_contents`;
192 /*!40101 SET @saved_cs_client = @@character_set_client */;
193 /*!40101 SET character_set_client = utf8 */;
194 CREATE TABLE `additional_contents` (
195 `idnew` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the additional content',
196 `category` varchar(20) NOT NULL COMMENT 'category for the additional content',
197 `code` varchar(100) NOT NULL COMMENT 'code to group content per lang',
198 `location` varchar(255) NOT NULL COMMENT 'location of the additional content',
199 `branchcode` varchar(10) DEFAULT NULL COMMENT 'branch code users to create branch specific additional content, NULL is every branch.',
200 `title` varchar(250) NOT NULL DEFAULT '' COMMENT 'title of the additional content',
201 `content` mediumtext NOT NULL COMMENT 'the body of your additional content',
202 `lang` varchar(50) NOT NULL DEFAULT '' COMMENT 'location for the additional content(koha is the staff interface, slip is the circulation receipt and language codes are for the opac)',
203 `published_on` date DEFAULT NULL COMMENT 'publication date',
204 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
205 `expirationdate` date DEFAULT NULL COMMENT 'date the additional content is set to expire or no longer be visible',
206 `number` int(11) DEFAULT NULL COMMENT 'the order in which this additional content appears in that specific location',
207 `borrowernumber` int(11) DEFAULT NULL COMMENT 'The user who created the additional content',
208 PRIMARY KEY (`idnew`),
209 UNIQUE KEY `additional_contents_uniq` (`category`,`code`,`branchcode`,`lang`),
210 KEY `additional_contents_borrowernumber_fk` (`borrowernumber`),
211 KEY `additional_contents_branchcode_ibfk` (`branchcode`),
212 CONSTRAINT `additional_contents_branchcode_ibfk` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
213 CONSTRAINT `borrowernumber_fk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
214 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
215 /*!40101 SET character_set_client = @saved_cs_client */;
218 -- Table structure for table `additional_field_values`
221 DROP TABLE IF EXISTS `additional_field_values`;
222 /*!40101 SET @saved_cs_client = @@character_set_client */;
223 /*!40101 SET character_set_client = utf8 */;
224 CREATE TABLE `additional_field_values` (
225 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
226 `field_id` int(11) NOT NULL COMMENT 'foreign key references additional_fields(id)',
227 `record_id` int(11) NOT NULL COMMENT 'record_id',
228 `value` varchar(255) NOT NULL DEFAULT '' COMMENT 'value for this field',
230 UNIQUE KEY `field_record` (`field_id`,`record_id`),
231 CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`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_fields`
239 DROP TABLE IF EXISTS `additional_fields`;
240 /*!40101 SET @saved_cs_client = @@character_set_client */;
241 /*!40101 SET character_set_client = utf8 */;
242 CREATE TABLE `additional_fields` (
243 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
244 `tablename` varchar(255) NOT NULL DEFAULT '' COMMENT 'tablename of the new field',
245 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the field',
246 `authorised_value_category` varchar(32) NOT NULL DEFAULT '' COMMENT 'is an authorised value category',
247 `marcfield` varchar(16) NOT NULL DEFAULT '' COMMENT 'contains the marc field to copied into the record',
248 `marcfield_mode` enum('get','set') NOT NULL DEFAULT 'get' COMMENT 'mode of operation (get or set) for marcfield',
249 `searchable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the field searchable?',
251 UNIQUE KEY `fields_uniq` (`tablename`(191),`name`(191))
252 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
253 /*!40101 SET character_set_client = @saved_cs_client */;
256 -- Table structure for table `advanced_editor_macros`
259 DROP TABLE IF EXISTS `advanced_editor_macros`;
260 /*!40101 SET @saved_cs_client = @@character_set_client */;
261 /*!40101 SET character_set_client = utf8 */;
262 CREATE TABLE `advanced_editor_macros` (
263 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the macro',
264 `name` varchar(80) NOT NULL COMMENT 'Name of the macro',
265 `macro` longtext DEFAULT NULL COMMENT 'The macro code itself',
266 `borrowernumber` int(11) DEFAULT NULL COMMENT 'ID of the borrower who created this macro',
267 `shared` tinyint(1) DEFAULT 0 COMMENT 'Bit to define if shared or private macro',
269 KEY `borrower_macro_fk` (`borrowernumber`),
270 CONSTRAINT `borrower_macro_fk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
271 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
272 /*!40101 SET character_set_client = @saved_cs_client */;
275 -- Table structure for table `alert`
278 DROP TABLE IF EXISTS `alert`;
279 /*!40101 SET @saved_cs_client = @@character_set_client */;
280 /*!40101 SET character_set_client = utf8 */;
281 CREATE TABLE `alert` (
282 `alertid` int(11) NOT NULL AUTO_INCREMENT,
283 `borrowernumber` int(11) NOT NULL DEFAULT 0,
284 `type` varchar(10) NOT NULL DEFAULT '',
285 `externalid` varchar(20) NOT NULL DEFAULT '',
286 PRIMARY KEY (`alertid`),
287 KEY `borrowernumber` (`borrowernumber`),
288 KEY `type` (`type`,`externalid`),
289 CONSTRAINT `alert_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
290 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
291 /*!40101 SET character_set_client = @saved_cs_client */;
294 -- Table structure for table `api_keys`
297 DROP TABLE IF EXISTS `api_keys`;
298 /*!40101 SET @saved_cs_client = @@character_set_client */;
299 /*!40101 SET character_set_client = utf8 */;
300 CREATE TABLE `api_keys` (
301 `client_id` varchar(191) NOT NULL COMMENT 'API client ID',
302 `secret` varchar(191) NOT NULL COMMENT 'API client secret used for API authentication',
303 `description` varchar(255) NOT NULL COMMENT 'API client description',
304 `patron_id` int(11) NOT NULL COMMENT 'Foreign key to the borrowers table',
305 `active` tinyint(1) NOT NULL DEFAULT 1 COMMENT '0 means this API key is revoked',
306 PRIMARY KEY (`client_id`),
307 UNIQUE KEY `secret` (`secret`),
308 KEY `patron_id` (`patron_id`),
309 CONSTRAINT `api_keys_fk_patron_id` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
310 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
311 /*!40101 SET character_set_client = @saved_cs_client */;
314 -- Table structure for table `aqbasket`
317 DROP TABLE IF EXISTS `aqbasket`;
318 /*!40101 SET @saved_cs_client = @@character_set_client */;
319 /*!40101 SET character_set_client = utf8 */;
320 CREATE TABLE `aqbasket` (
321 `basketno` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, Koha defined number',
322 `basketname` varchar(50) DEFAULT NULL COMMENT 'name given to the basket at creation',
323 `note` longtext DEFAULT NULL COMMENT 'the internal note added at basket creation',
324 `booksellernote` longtext DEFAULT NULL COMMENT 'the vendor note added at basket creation',
325 `contractnumber` int(11) DEFAULT NULL COMMENT 'links this basket to the aqcontract table (aqcontract.contractnumber)',
326 `creationdate` date DEFAULT NULL COMMENT 'the date the basket was created',
327 `closedate` date DEFAULT NULL COMMENT 'the date the basket was closed',
328 `booksellerid` int(11) NOT NULL DEFAULT 1 COMMENT 'the Koha assigned ID for the vendor (aqbooksellers.id)',
329 `authorisedby` varchar(10) DEFAULT NULL COMMENT 'the borrowernumber of the person who created the basket',
330 `booksellerinvoicenumber` longtext DEFAULT NULL COMMENT 'appears to always be NULL',
331 `basketgroupid` int(11) DEFAULT NULL COMMENT 'links this basket to its group (aqbasketgroups.id)',
332 `deliveryplace` varchar(10) DEFAULT NULL COMMENT 'basket delivery place',
333 `billingplace` varchar(10) DEFAULT NULL COMMENT 'basket billing place',
334 `branch` varchar(10) DEFAULT NULL COMMENT 'basket branch',
335 `is_standing` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'orders in this basket are standing',
336 `create_items` enum('ordering','receiving','cataloguing') DEFAULT NULL COMMENT 'when items should be created for orders in this basket',
337 PRIMARY KEY (`basketno`),
338 KEY `booksellerid` (`booksellerid`),
339 KEY `basketgroupid` (`basketgroupid`),
340 KEY `contractnumber` (`contractnumber`),
341 KEY `authorisedby` (`authorisedby`),
342 KEY `aqbasket_ibfk_4` (`branch`),
343 CONSTRAINT `aqbasket_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE,
344 CONSTRAINT `aqbasket_ibfk_2` FOREIGN KEY (`contractnumber`) REFERENCES `aqcontract` (`contractnumber`),
345 CONSTRAINT `aqbasket_ibfk_3` FOREIGN KEY (`basketgroupid`) REFERENCES `aqbasketgroups` (`id`) ON UPDATE CASCADE,
346 CONSTRAINT `aqbasket_ibfk_4` FOREIGN KEY (`branch`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
347 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
348 /*!40101 SET character_set_client = @saved_cs_client */;
351 -- Table structure for table `aqbasketgroups`
354 DROP TABLE IF EXISTS `aqbasketgroups`;
355 /*!40101 SET @saved_cs_client = @@character_set_client */;
356 /*!40101 SET character_set_client = utf8 */;
357 CREATE TABLE `aqbasketgroups` (
358 `id` int(11) NOT NULL AUTO_INCREMENT,
359 `name` varchar(50) DEFAULT NULL,
360 `closed` tinyint(1) DEFAULT NULL,
361 `booksellerid` int(11) NOT NULL,
362 `deliveryplace` varchar(10) DEFAULT NULL,
363 `freedeliveryplace` mediumtext DEFAULT NULL,
364 `deliverycomment` varchar(255) DEFAULT NULL,
365 `billingplace` varchar(10) DEFAULT NULL,
367 KEY `booksellerid` (`booksellerid`),
368 CONSTRAINT `aqbasketgroups_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
369 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
370 /*!40101 SET character_set_client = @saved_cs_client */;
373 -- Table structure for table `aqbasketusers`
376 DROP TABLE IF EXISTS `aqbasketusers`;
377 /*!40101 SET @saved_cs_client = @@character_set_client */;
378 /*!40101 SET character_set_client = utf8 */;
379 CREATE TABLE `aqbasketusers` (
380 `basketno` int(11) NOT NULL,
381 `borrowernumber` int(11) NOT NULL,
382 PRIMARY KEY (`basketno`,`borrowernumber`),
383 KEY `aqbasketusers_ibfk_2` (`borrowernumber`),
384 CONSTRAINT `aqbasketusers_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
385 CONSTRAINT `aqbasketusers_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
386 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
387 /*!40101 SET character_set_client = @saved_cs_client */;
390 -- Table structure for table `aqbookseller_aliases`
393 DROP TABLE IF EXISTS `aqbookseller_aliases`;
394 /*!40101 SET @saved_cs_client = @@character_set_client */;
395 /*!40101 SET character_set_client = utf8 */;
396 CREATE TABLE `aqbookseller_aliases` (
397 `alias_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha',
398 `vendor_id` int(11) NOT NULL COMMENT 'link to the vendor',
399 `alias` varchar(255) NOT NULL COMMENT 'the alias',
400 PRIMARY KEY (`alias_id`),
401 KEY `aqbookseller_aliases_ibfk_1` (`vendor_id`),
402 CONSTRAINT `aqbookseller_aliases_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
403 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
404 /*!40101 SET character_set_client = @saved_cs_client */;
407 -- Table structure for table `aqbookseller_interfaces`
410 DROP TABLE IF EXISTS `aqbookseller_interfaces`;
411 /*!40101 SET @saved_cs_client = @@character_set_client */;
412 /*!40101 SET character_set_client = utf8 */;
413 CREATE TABLE `aqbookseller_interfaces` (
414 `interface_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha',
415 `vendor_id` int(11) NOT NULL COMMENT 'link to the vendor',
416 `type` varchar(80) DEFAULT NULL COMMENT 'type of the interface, authorised value VENDOR_INTERFACE_TYPE',
417 `name` varchar(255) NOT NULL COMMENT 'name of the interface',
418 `uri` mediumtext DEFAULT NULL COMMENT 'uri of the interface',
419 `login` varchar(255) DEFAULT NULL COMMENT 'login',
420 `password` mediumtext DEFAULT NULL COMMENT 'hashed password',
421 `account_email` mediumtext DEFAULT NULL COMMENT 'account email',
422 `notes` longtext DEFAULT NULL COMMENT 'notes',
423 PRIMARY KEY (`interface_id`),
424 KEY `aqbookseller_interfaces_ibfk_1` (`vendor_id`),
425 CONSTRAINT `aqbookseller_interfaces_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
426 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
427 /*!40101 SET character_set_client = @saved_cs_client */;
430 -- Table structure for table `aqbooksellers`
433 DROP TABLE IF EXISTS `aqbooksellers`;
434 /*!40101 SET @saved_cs_client = @@character_set_client */;
435 /*!40101 SET character_set_client = utf8 */;
436 CREATE TABLE `aqbooksellers` (
437 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha',
438 `name` longtext NOT NULL COMMENT 'vendor name',
439 `address1` longtext DEFAULT NULL COMMENT 'first line of vendor physical address',
440 `address2` longtext DEFAULT NULL COMMENT 'second line of vendor physical address',
441 `address3` longtext DEFAULT NULL COMMENT 'third line of vendor physical address',
442 `address4` longtext DEFAULT NULL COMMENT 'fourth line of vendor physical address',
443 `phone` varchar(30) DEFAULT NULL COMMENT 'vendor phone number',
444 `accountnumber` longtext DEFAULT NULL COMMENT 'vendor account number',
445 `type` varchar(255) DEFAULT NULL,
446 `notes` longtext DEFAULT NULL COMMENT 'order notes',
447 `postal` longtext DEFAULT NULL COMMENT 'vendor postal address (all lines)',
448 `url` varchar(255) DEFAULT NULL COMMENT 'vendor web address',
449 `active` tinyint(4) DEFAULT NULL COMMENT 'is this vendor active (1 for yes, 0 for no)',
450 `listprice` varchar(10) DEFAULT NULL COMMENT 'currency code for list prices',
451 `invoiceprice` varchar(10) DEFAULT NULL COMMENT 'currency code for invoice prices',
452 `gstreg` tinyint(4) DEFAULT NULL COMMENT 'is your library charged tax (1 for yes, 0 for no)',
453 `listincgst` tinyint(4) DEFAULT NULL COMMENT 'is tax included in list prices (1 for yes, 0 for no)',
454 `invoiceincgst` tinyint(4) DEFAULT NULL COMMENT 'is tax included in invoice prices (1 for yes, 0 for no)',
455 `tax_rate` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate the library is charged',
456 `discount` float(6,4) DEFAULT NULL COMMENT 'discount offered on all items ordered from this vendor',
457 `fax` varchar(50) DEFAULT NULL COMMENT 'vendor fax number',
458 `deliverytime` int(11) DEFAULT NULL COMMENT 'vendor delivery time',
459 `external_id` varchar(255) DEFAULT NULL COMMENT 'external id of the vendor',
461 KEY `listprice` (`listprice`),
462 KEY `invoiceprice` (`invoiceprice`),
463 KEY `name` (`name`(191)),
464 CONSTRAINT `aqbooksellers_ibfk_1` FOREIGN KEY (`listprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE,
465 CONSTRAINT `aqbooksellers_ibfk_2` FOREIGN KEY (`invoiceprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE
466 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
467 /*!40101 SET character_set_client = @saved_cs_client */;
470 -- Table structure for table `aqbookseller_issues`
473 DROP TABLE IF EXISTS `aqbookseller_issues`;
474 /*!40101 SET @saved_cs_client = @@character_set_client */;
475 /*!40101 SET character_set_client = utf8 */;
476 CREATE TABLE `aqbookseller_issues` (
477 `issue_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha',
478 `vendor_id` int(11) NOT NULL COMMENT 'link to the vendor',
479 `type` varchar(80) DEFAULT NULL COMMENT 'type of the issue, authorised value VENDOR_ISSUE_TYPE',
480 `started_on` date DEFAULT NULL COMMENT 'start of the issue',
481 `ended_on` date DEFAULT NULL COMMENT 'end of the issue',
482 `notes` longtext DEFAULT NULL COMMENT 'notes',
483 PRIMARY KEY (`issue_id`),
484 CONSTRAINT `aqbookseller_issues_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
485 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
486 /*!40101 SET character_set_client = @saved_cs_client */;
489 -- Table structure for table `aqbudgetborrowers`
492 DROP TABLE IF EXISTS `aqbudgetborrowers`;
493 /*!40101 SET @saved_cs_client = @@character_set_client */;
494 /*!40101 SET character_set_client = utf8 */;
495 CREATE TABLE `aqbudgetborrowers` (
496 `budget_id` int(11) NOT NULL,
497 `borrowernumber` int(11) NOT NULL,
498 PRIMARY KEY (`budget_id`,`borrowernumber`),
499 KEY `aqbudgetborrowers_ibfk_2` (`borrowernumber`),
500 CONSTRAINT `aqbudgetborrowers_ibfk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
501 CONSTRAINT `aqbudgetborrowers_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
502 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
503 /*!40101 SET character_set_client = @saved_cs_client */;
506 -- Table structure for table `aqbudgetperiods`
509 DROP TABLE IF EXISTS `aqbudgetperiods`;
510 /*!40101 SET @saved_cs_client = @@character_set_client */;
511 /*!40101 SET character_set_client = utf8 */;
512 CREATE TABLE `aqbudgetperiods` (
513 `budget_period_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned by Koha',
514 `budget_period_startdate` date NOT NULL COMMENT 'date when the budget starts',
515 `budget_period_enddate` date NOT NULL COMMENT 'date when the budget ends',
516 `budget_period_active` tinyint(1) DEFAULT 0 COMMENT 'whether this budget is active or not (1 for yes, 0 for no)',
517 `budget_period_description` longtext DEFAULT NULL COMMENT 'description assigned to this budget',
518 `budget_period_total` decimal(28,6) DEFAULT NULL COMMENT 'total amount available in this budget',
519 `budget_period_locked` tinyint(1) DEFAULT NULL COMMENT 'whether this budget is locked or not (1 for yes, 0 for no)',
520 `sort1_authcat` varchar(10) DEFAULT NULL COMMENT 'statistical category for this budget',
521 `sort2_authcat` varchar(10) DEFAULT NULL COMMENT 'second statistical category for this budget',
522 PRIMARY KEY (`budget_period_id`)
523 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
524 /*!40101 SET character_set_client = @saved_cs_client */;
527 -- Table structure for table `aqbudgets`
530 DROP TABLE IF EXISTS `aqbudgets`;
531 /*!40101 SET @saved_cs_client = @@character_set_client */;
532 /*!40101 SET character_set_client = utf8 */;
533 CREATE TABLE `aqbudgets` (
534 `budget_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned to each fund by Koha',
535 `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)',
536 `budget_code` varchar(30) DEFAULT NULL COMMENT 'code assigned to the fund by the user',
537 `budget_name` varchar(80) DEFAULT NULL COMMENT 'name assigned to the fund by the user',
538 `budget_branchcode` varchar(10) DEFAULT NULL COMMENT 'branch that this fund belongs to (branches.branchcode)',
539 `budget_amount` decimal(28,6) DEFAULT 0.000000 COMMENT 'total amount for this fund',
540 `budget_encumb` decimal(28,6) DEFAULT 0.000000 COMMENT 'budget warning at percentage',
541 `budget_expend` decimal(28,6) DEFAULT 0.000000 COMMENT 'budget warning at amount',
542 `budget_notes` longtext DEFAULT NULL COMMENT 'notes related to this fund',
543 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this fund was last touched (created or modified)',
544 `budget_period_id` int(11) DEFAULT NULL COMMENT 'id of the budget that this fund belongs to (aqbudgetperiods.budget_period_id)',
545 `sort1_authcat` varchar(80) DEFAULT NULL COMMENT 'statistical category for this fund',
546 `sort2_authcat` varchar(80) DEFAULT NULL COMMENT 'second statistical category for this fund',
547 `budget_owner_id` int(11) DEFAULT NULL COMMENT 'borrowernumber of the person who owns this fund (borrowers.borrowernumber)',
548 `budget_permission` int(1) DEFAULT 0 COMMENT 'level of permission for this fund (used only by the owner, only by the library, or anyone)',
549 PRIMARY KEY (`budget_id`),
550 KEY `budget_parent_id` (`budget_parent_id`),
551 KEY `budget_code` (`budget_code`),
552 KEY `budget_branchcode` (`budget_branchcode`),
553 KEY `budget_period_id` (`budget_period_id`),
554 KEY `budget_owner_id` (`budget_owner_id`),
555 CONSTRAINT `aqbudgetperiods_ibfk_1` FOREIGN KEY (`budget_period_id`) REFERENCES `aqbudgetperiods` (`budget_period_id`) ON DELETE CASCADE ON UPDATE CASCADE
556 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
557 /*!40101 SET character_set_client = @saved_cs_client */;
560 -- Table structure for table `aqbudgets_planning`
563 DROP TABLE IF EXISTS `aqbudgets_planning`;
564 /*!40101 SET @saved_cs_client = @@character_set_client */;
565 /*!40101 SET character_set_client = utf8 */;
566 CREATE TABLE `aqbudgets_planning` (
567 `plan_id` int(11) NOT NULL AUTO_INCREMENT,
568 `budget_id` int(11) NOT NULL,
569 `budget_period_id` int(11) NOT NULL,
570 `estimated_amount` decimal(28,6) DEFAULT NULL,
571 `authcat` varchar(30) NOT NULL,
572 `authvalue` varchar(30) NOT NULL,
573 `display` tinyint(1) DEFAULT 1,
574 PRIMARY KEY (`plan_id`),
575 KEY `budget_period_id` (`budget_period_id`),
576 KEY `aqbudgets_planning_ifbk_1` (`budget_id`),
577 CONSTRAINT `aqbudgets_planning_ifbk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE
578 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
579 /*!40101 SET character_set_client = @saved_cs_client */;
582 -- Table structure for table `aqcontacts`
585 DROP TABLE IF EXISTS `aqcontacts`;
586 /*!40101 SET @saved_cs_client = @@character_set_client */;
587 /*!40101 SET character_set_client = utf8 */;
588 CREATE TABLE `aqcontacts` (
589 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned by Koha',
590 `name` varchar(100) DEFAULT NULL COMMENT 'name of contact at vendor',
591 `position` varchar(100) DEFAULT NULL COMMENT 'contact person''s position',
592 `phone` varchar(100) DEFAULT NULL COMMENT 'contact''s phone number',
593 `altphone` varchar(100) DEFAULT NULL COMMENT 'contact''s alternate phone number',
594 `fax` varchar(100) DEFAULT NULL COMMENT 'contact''s fax number',
595 `email` varchar(100) DEFAULT NULL COMMENT 'contact''s email address',
596 `notes` longtext DEFAULT NULL COMMENT 'notes related to the contact',
597 `orderacquisition` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive acquisition orders',
598 `claimacquisition` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive acquisitions claims',
599 `claimissues` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive serial claims',
600 `acqprimary` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is this the primary contact for acquisitions messages',
601 `serialsprimary` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is this the primary contact for serials messages',
602 `booksellerid` int(11) NOT NULL,
604 KEY `booksellerid_aqcontacts_fk` (`booksellerid`),
605 CONSTRAINT `booksellerid_aqcontacts_fk` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
606 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
607 /*!40101 SET character_set_client = @saved_cs_client */;
610 -- Table structure for table `aqcontract`
613 DROP TABLE IF EXISTS `aqcontract`;
614 /*!40101 SET @saved_cs_client = @@character_set_client */;
615 /*!40101 SET character_set_client = utf8 */;
616 CREATE TABLE `aqcontract` (
617 `contractnumber` int(11) NOT NULL AUTO_INCREMENT,
618 `contractstartdate` date DEFAULT NULL,
619 `contractenddate` date DEFAULT NULL,
620 `contractname` varchar(50) DEFAULT NULL,
621 `contractdescription` longtext DEFAULT NULL,
622 `booksellerid` int(11) NOT NULL,
623 PRIMARY KEY (`contractnumber`),
624 KEY `booksellerid_fk1` (`booksellerid`),
625 CONSTRAINT `booksellerid_fk1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
626 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
627 /*!40101 SET character_set_client = @saved_cs_client */;
630 -- Table structure for table `aqinvoice_adjustments`
633 DROP TABLE IF EXISTS `aqinvoice_adjustments`;
634 /*!40101 SET @saved_cs_client = @@character_set_client */;
635 /*!40101 SET character_set_client = utf8 */;
636 CREATE TABLE `aqinvoice_adjustments` (
637 `adjustment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key for adjustments',
638 `invoiceid` int(11) NOT NULL COMMENT 'foreign key to link an adjustment to an invoice',
639 `adjustment` decimal(28,6) DEFAULT NULL COMMENT 'amount of adjustment',
640 `reason` varchar(80) DEFAULT NULL COMMENT 'reason for adjustment defined by authorised values in ADJ_REASON category',
641 `note` mediumtext DEFAULT NULL COMMENT 'text to explain adjustment',
642 `budget_id` int(11) DEFAULT NULL COMMENT 'optional link to budget to apply adjustment to',
643 `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',
644 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'timestamp of last adjustment to adjustment',
645 PRIMARY KEY (`adjustment_id`),
646 KEY `aqinvoice_adjustments_fk_invoiceid` (`invoiceid`),
647 KEY `aqinvoice_adjustments_fk_budget_id` (`budget_id`),
648 CONSTRAINT `aqinvoice_adjustments_fk_budget_id` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
649 CONSTRAINT `aqinvoice_adjustments_fk_invoiceid` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE CASCADE ON UPDATE CASCADE
650 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
651 /*!40101 SET character_set_client = @saved_cs_client */;
654 -- Table structure for table `aqinvoices`
657 DROP TABLE IF EXISTS `aqinvoices`;
658 /*!40101 SET @saved_cs_client = @@character_set_client */;
659 /*!40101 SET character_set_client = utf8 */;
660 CREATE TABLE `aqinvoices` (
661 `invoiceid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the invoice, primary key',
662 `invoicenumber` longtext NOT NULL COMMENT 'Name of invoice',
663 `booksellerid` int(11) NOT NULL COMMENT 'foreign key to aqbooksellers',
664 `shipmentdate` date DEFAULT NULL COMMENT 'date of shipment',
665 `billingdate` date DEFAULT NULL COMMENT 'date of billing',
666 `closedate` date DEFAULT NULL COMMENT 'invoice close date, NULL means the invoice is open',
667 `shipmentcost` decimal(28,6) DEFAULT NULL COMMENT 'shipment cost',
668 `shipmentcost_budgetid` int(11) DEFAULT NULL COMMENT 'foreign key to aqbudgets, link the shipment cost to a budget',
669 `message_id` int(11) DEFAULT NULL COMMENT 'foreign key to edifact invoice message',
670 PRIMARY KEY (`invoiceid`),
671 KEY `aqinvoices_fk_aqbooksellerid` (`booksellerid`),
672 KEY `edifact_msg_fk` (`message_id`),
673 KEY `aqinvoices_fk_shipmentcost_budgetid` (`shipmentcost_budgetid`),
674 CONSTRAINT `aqinvoices_fk_aqbooksellerid` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
675 CONSTRAINT `aqinvoices_fk_shipmentcost_budgetid` FOREIGN KEY (`shipmentcost_budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
676 CONSTRAINT `edifact_msg_fk` FOREIGN KEY (`message_id`) REFERENCES `edifact_messages` (`id`) ON DELETE SET NULL
677 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
678 /*!40101 SET character_set_client = @saved_cs_client */;
681 -- Table structure for table `aqorder_users`
684 DROP TABLE IF EXISTS `aqorder_users`;
685 /*!40101 SET @saved_cs_client = @@character_set_client */;
686 /*!40101 SET character_set_client = utf8 */;
687 CREATE TABLE `aqorder_users` (
688 `ordernumber` int(11) NOT NULL COMMENT 'the order this patrons receive notifications from (aqorders.ordernumber)',
689 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber for the patron receiving notifications for this order (borrowers.borrowernumber)',
690 PRIMARY KEY (`ordernumber`,`borrowernumber`),
691 KEY `aqorder_users_ibfk_2` (`borrowernumber`),
692 CONSTRAINT `aqorder_users_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
693 CONSTRAINT `aqorder_users_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
694 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
695 /*!40101 SET character_set_client = @saved_cs_client */;
698 -- Table structure for table `aqorders`
701 DROP TABLE IF EXISTS `aqorders`;
702 /*!40101 SET @saved_cs_client = @@character_set_client */;
703 /*!40101 SET character_set_client = utf8 */;
704 CREATE TABLE `aqorders` (
705 `ordernumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha to each line',
706 `biblionumber` int(11) DEFAULT NULL COMMENT 'links the order to the biblio being ordered (biblio.biblionumber)',
707 `deleted_biblionumber` int(11) DEFAULT NULL COMMENT 'links the order to the deleted bibliographic record (deletedbiblio.biblionumber)',
708 `entrydate` date DEFAULT NULL COMMENT 'the date the bib was added to the basket',
709 `quantity` smallint(6) DEFAULT NULL COMMENT 'the quantity ordered',
710 `currency` varchar(10) DEFAULT NULL COMMENT 'the currency used for the purchase',
711 `listprice` decimal(28,6) DEFAULT NULL COMMENT 'the vendor price for this line item',
712 `datereceived` date DEFAULT NULL COMMENT 'the date this order was received',
713 `invoiceid` int(11) DEFAULT NULL COMMENT 'id of invoice',
714 `freight` decimal(28,6) DEFAULT NULL COMMENT 'shipping costs (not used)',
715 `unitprice` decimal(28,6) DEFAULT NULL COMMENT 'the actual cost entered when receiving this line item',
716 `unitprice_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the unit price excluding tax (on receiving)',
717 `unitprice_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the unit price including tax (on receiving)',
718 `quantityreceived` smallint(6) NOT NULL DEFAULT 0 COMMENT 'the quantity that have been received so far',
719 `created_by` int(11) DEFAULT NULL COMMENT 'the borrowernumber of order line''s creator',
720 `datecancellationprinted` date DEFAULT NULL COMMENT 'the date the line item was deleted',
721 `cancellationreason` mediumtext DEFAULT NULL COMMENT 'reason of cancellation',
722 `order_internalnote` longtext DEFAULT NULL COMMENT 'notes related to this order line, made for staff',
723 `order_vendornote` longtext DEFAULT NULL COMMENT 'notes related to this order line, made for vendor',
724 `purchaseordernumber` longtext DEFAULT NULL COMMENT 'not used? always NULL',
725 `basketno` int(11) DEFAULT NULL COMMENT 'links this order line to a specific basket (aqbasket.basketno)',
726 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this order line was last modified',
727 `rrp` decimal(13,2) DEFAULT NULL COMMENT 'the retail cost for this line item',
728 `replacementprice` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost for this line item',
729 `rrp_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost excluding tax',
730 `rrp_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost including tax',
731 `ecost` decimal(13,2) DEFAULT NULL COMMENT 'the replacement cost for this line item',
732 `ecost_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the estimated cost excluding tax',
733 `ecost_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the estimated cost including tax',
734 `tax_rate_bak` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate for this line item (%)',
735 `tax_rate_on_ordering` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate on ordering for this line item (%)',
736 `tax_rate_on_receiving` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate on receiving for this line item (%)',
737 `tax_value_bak` decimal(28,6) DEFAULT NULL COMMENT 'the tax value for this line item',
738 `tax_value_on_ordering` decimal(28,6) DEFAULT NULL COMMENT 'the tax value on ordering for this line item',
739 `tax_value_on_receiving` decimal(28,6) DEFAULT NULL COMMENT 'the tax value on receiving for this line item',
740 `discount` float(6,4) DEFAULT NULL COMMENT 'the discount for this line item (%)',
741 `budget_id` int(11) NOT NULL COMMENT 'the fund this order goes against (aqbudgets.budget_id)',
742 `budgetdate` date DEFAULT NULL COMMENT 'not used? always NULL',
743 `sort1` varchar(80) DEFAULT NULL COMMENT 'statistical field',
744 `sort2` varchar(80) DEFAULT NULL COMMENT 'second statistical field',
745 `sort1_authcat` varchar(10) DEFAULT NULL,
746 `sort2_authcat` varchar(10) DEFAULT NULL,
747 `uncertainprice` tinyint(1) DEFAULT NULL COMMENT 'was this price uncertain (1 for yes, 0 for no)',
748 `subscriptionid` int(11) DEFAULT NULL COMMENT 'links this order line to a subscription (subscription.subscriptionid)',
749 `parent_ordernumber` int(11) DEFAULT NULL COMMENT 'ordernumber of parent order line, or same as ordernumber if no parent',
750 `orderstatus` varchar(16) DEFAULT 'new' COMMENT 'the current status for this line item. Can be ''new'', ''ordered'', ''partial'', ''complete'' or ''cancelled''',
751 `line_item_id` varchar(35) DEFAULT NULL COMMENT 'Supplier''s article id for Edifact orderline',
752 `suppliers_reference_number` varchar(35) DEFAULT NULL COMMENT 'Suppliers unique edifact quote ref',
753 `suppliers_reference_qualifier` varchar(3) DEFAULT NULL COMMENT 'Type of number above usually ''QLI''',
754 `suppliers_report` mediumtext DEFAULT NULL COMMENT 'reports received from suppliers',
755 `estimated_delivery_date` date DEFAULT NULL COMMENT 'Estimated delivery date',
756 `invoice_unitprice` decimal(28,6) DEFAULT NULL COMMENT 'the unit price in foreign currency',
757 `invoice_currency` varchar(10) DEFAULT NULL COMMENT 'the currency of the invoice_unitprice',
758 PRIMARY KEY (`ordernumber`),
759 KEY `basketno` (`basketno`),
760 KEY `biblionumber` (`biblionumber`),
761 KEY `budget_id` (`budget_id`),
762 KEY `parent_ordernumber` (`parent_ordernumber`),
763 KEY `orderstatus` (`orderstatus`),
764 KEY `aqorders_created_by` (`created_by`),
765 KEY `aqorders_ibfk_3` (`invoiceid`),
766 KEY `aqorders_subscriptionid` (`subscriptionid`),
767 KEY `aqorders_currency` (`currency`),
768 KEY `aqorders_invoice_currency` (`invoice_currency`),
769 CONSTRAINT `aqorders_budget_id_fk` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
770 CONSTRAINT `aqorders_created_by` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
771 CONSTRAINT `aqorders_currency` FOREIGN KEY (`currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
772 CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
773 CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
774 CONSTRAINT `aqorders_ibfk_3` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE SET NULL ON UPDATE CASCADE,
775 CONSTRAINT `aqorders_invoice_currency` FOREIGN KEY (`invoice_currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
776 CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE SET NULL ON UPDATE CASCADE
777 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
778 /*!40101 SET character_set_client = @saved_cs_client */;
781 -- Table structure for table `aqorders_claims`
784 DROP TABLE IF EXISTS `aqorders_claims`;
785 /*!40101 SET @saved_cs_client = @@character_set_client */;
786 /*!40101 SET character_set_client = utf8 */;
787 CREATE TABLE `aqorders_claims` (
788 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the claims',
789 `ordernumber` int(11) NOT NULL COMMENT 'order linked to this claim',
790 `claimed_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date of the claims',
792 KEY `aqorders_claims_ibfk_1` (`ordernumber`),
793 CONSTRAINT `aqorders_claims_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE
794 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
795 /*!40101 SET character_set_client = @saved_cs_client */;
798 -- Table structure for table `aqorders_items`
801 DROP TABLE IF EXISTS `aqorders_items`;
802 /*!40101 SET @saved_cs_client = @@character_set_client */;
803 /*!40101 SET character_set_client = utf8 */;
804 CREATE TABLE `aqorders_items` (
805 `ordernumber` int(11) NOT NULL COMMENT 'the order this item is attached to (aqorders.ordernumber)',
806 `itemnumber` int(11) NOT NULL COMMENT 'the item number for this item (items.itemnumber)',
807 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this order item was last touched',
808 PRIMARY KEY (`itemnumber`),
809 KEY `ordernumber` (`ordernumber`),
810 CONSTRAINT `aqorders_items_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE
811 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
812 /*!40101 SET character_set_client = @saved_cs_client */;
815 -- Table structure for table `aqorders_transfers`
818 DROP TABLE IF EXISTS `aqorders_transfers`;
819 /*!40101 SET @saved_cs_client = @@character_set_client */;
820 /*!40101 SET character_set_client = utf8 */;
821 CREATE TABLE `aqorders_transfers` (
822 `ordernumber_from` int(11) DEFAULT NULL,
823 `ordernumber_to` int(11) DEFAULT NULL,
824 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
825 UNIQUE KEY `ordernumber_from` (`ordernumber_from`),
826 UNIQUE KEY `ordernumber_to` (`ordernumber_to`),
827 CONSTRAINT `aqorders_transfers_ordernumber_from` FOREIGN KEY (`ordernumber_from`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
828 CONSTRAINT `aqorders_transfers_ordernumber_to` FOREIGN KEY (`ordernumber_to`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL 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 `article_requests`
836 DROP TABLE IF EXISTS `article_requests`;
837 /*!40101 SET @saved_cs_client = @@character_set_client */;
838 /*!40101 SET character_set_client = utf8 */;
839 CREATE TABLE `article_requests` (
840 `id` int(11) NOT NULL AUTO_INCREMENT,
841 `borrowernumber` int(11) NOT NULL,
842 `biblionumber` int(11) NOT NULL,
843 `itemnumber` int(11) DEFAULT NULL,
844 `branchcode` varchar(10) DEFAULT NULL,
845 `title` mediumtext DEFAULT NULL,
846 `author` mediumtext DEFAULT NULL,
847 `volume` mediumtext DEFAULT NULL,
848 `issue` mediumtext DEFAULT NULL,
849 `date` mediumtext DEFAULT NULL,
850 `pages` mediumtext DEFAULT NULL,
851 `chapters` mediumtext DEFAULT NULL,
852 `patron_notes` mediumtext DEFAULT NULL,
853 `status` enum('REQUESTED','PENDING','PROCESSING','COMPLETED','CANCELED') NOT NULL DEFAULT 'REQUESTED',
854 `notes` mediumtext DEFAULT NULL,
855 `format` enum('PHOTOCOPY','SCAN') NOT NULL DEFAULT 'PHOTOCOPY',
856 `urls` mediumtext DEFAULT NULL,
857 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value AR_CANCELLATION',
858 `debit_id` int(11) DEFAULT NULL COMMENT 'Debit line with cost for article scan request',
859 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Be careful with two timestamps in one table not allowing NULL',
860 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
861 `toc_request` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'borrower requested table of contents',
863 KEY `borrowernumber` (`borrowernumber`),
864 KEY `biblionumber` (`biblionumber`),
865 KEY `itemnumber` (`itemnumber`),
866 KEY `branchcode` (`branchcode`),
867 KEY `debit_id` (`debit_id`),
868 CONSTRAINT `article_requests_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
869 CONSTRAINT `article_requests_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
870 CONSTRAINT `article_requests_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
871 CONSTRAINT `article_requests_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
872 CONSTRAINT `article_requests_ibfk_5` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE SET NULL ON UPDATE CASCADE
873 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
874 /*!40101 SET character_set_client = @saved_cs_client */;
877 -- Table structure for table `audio_alerts`
880 DROP TABLE IF EXISTS `audio_alerts`;
881 /*!40101 SET @saved_cs_client = @@character_set_client */;
882 /*!40101 SET character_set_client = utf8 */;
883 CREATE TABLE `audio_alerts` (
884 `id` int(11) NOT NULL AUTO_INCREMENT,
885 `precedence` smallint(5) unsigned NOT NULL,
886 `selector` varchar(255) NOT NULL,
887 `sound` varchar(255) NOT NULL,
889 KEY `precedence` (`precedence`)
890 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
891 /*!40101 SET character_set_client = @saved_cs_client */;
894 -- Table structure for table `auth_header`
897 DROP TABLE IF EXISTS `auth_header`;
898 /*!40101 SET @saved_cs_client = @@character_set_client */;
899 /*!40101 SET character_set_client = utf8 */;
900 CREATE TABLE `auth_header` (
901 `authid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
902 `authtypecode` varchar(10) NOT NULL DEFAULT '',
903 `datecreated` date DEFAULT NULL,
904 `modification_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
905 `origincode` varchar(20) DEFAULT NULL,
906 `authtrees` longtext DEFAULT NULL,
907 `marc` blob DEFAULT NULL,
908 `linkid` bigint(20) DEFAULT NULL,
909 `marcxml` longtext NOT NULL,
910 PRIMARY KEY (`authid`),
911 KEY `origincode` (`origincode`)
912 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
913 /*!40101 SET character_set_client = @saved_cs_client */;
916 -- Table structure for table `auth_subfield_structure`
919 DROP TABLE IF EXISTS `auth_subfield_structure`;
920 /*!40101 SET @saved_cs_client = @@character_set_client */;
921 /*!40101 SET character_set_client = utf8 */;
922 CREATE TABLE `auth_subfield_structure` (
923 `authtypecode` varchar(10) NOT NULL DEFAULT '',
924 `tagfield` varchar(3) NOT NULL DEFAULT '',
925 `tagsubfield` varchar(1) NOT NULL DEFAULT '',
926 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
927 `libopac` varchar(255) NOT NULL DEFAULT '',
928 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
929 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
930 `tab` tinyint(1) DEFAULT NULL,
931 `authorised_value` varchar(32) DEFAULT NULL,
932 `value_builder` varchar(80) DEFAULT NULL,
933 `seealso` varchar(255) DEFAULT NULL,
934 `isurl` tinyint(1) DEFAULT NULL,
935 `hidden` tinyint(3) NOT NULL DEFAULT 0,
936 `linkid` tinyint(1) NOT NULL DEFAULT 0,
937 `kohafield` varchar(45) DEFAULT '',
938 `frameworkcode` varchar(10) NOT NULL DEFAULT '',
939 `defaultvalue` mediumtext DEFAULT NULL,
940 `display_order` int(2) NOT NULL DEFAULT 0,
941 PRIMARY KEY (`authtypecode`,`tagfield`,`tagsubfield`),
942 KEY `tab` (`authtypecode`,`tab`),
943 CONSTRAINT `auth_subfield_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
944 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
945 /*!40101 SET character_set_client = @saved_cs_client */;
948 -- Table structure for table `auth_tag_structure`
951 DROP TABLE IF EXISTS `auth_tag_structure`;
952 /*!40101 SET @saved_cs_client = @@character_set_client */;
953 /*!40101 SET character_set_client = utf8 */;
954 CREATE TABLE `auth_tag_structure` (
955 `authtypecode` varchar(10) NOT NULL DEFAULT '',
956 `tagfield` varchar(3) NOT NULL DEFAULT '',
957 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
958 `libopac` varchar(255) NOT NULL DEFAULT '',
959 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
960 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
961 `authorised_value` varchar(32) DEFAULT NULL,
962 PRIMARY KEY (`authtypecode`,`tagfield`),
963 CONSTRAINT `auth_tag_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
964 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
965 /*!40101 SET character_set_client = @saved_cs_client */;
968 -- Table structure for table `auth_types`
971 DROP TABLE IF EXISTS `auth_types`;
972 /*!40101 SET @saved_cs_client = @@character_set_client */;
973 /*!40101 SET character_set_client = utf8 */;
974 CREATE TABLE `auth_types` (
975 `authtypecode` varchar(10) NOT NULL DEFAULT '',
976 `authtypetext` varchar(255) NOT NULL DEFAULT '',
977 `auth_tag_to_report` varchar(3) NOT NULL DEFAULT '',
978 `summary` longtext NOT NULL,
979 PRIMARY KEY (`authtypecode`)
980 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
981 /*!40101 SET character_set_client = @saved_cs_client */;
984 -- Table structure for table `authorised_value_categories`
987 DROP TABLE IF EXISTS `authorised_value_categories`;
988 /*!40101 SET @saved_cs_client = @@character_set_client */;
989 /*!40101 SET character_set_client = utf8 */;
990 CREATE TABLE `authorised_value_categories` (
991 `category_name` varchar(32) NOT NULL DEFAULT '',
992 `is_system` tinyint(1) DEFAULT 0,
993 PRIMARY KEY (`category_name`)
994 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
995 /*!40101 SET character_set_client = @saved_cs_client */;
998 -- Table structure for table `authorised_values`
1001 DROP TABLE IF EXISTS `authorised_values`;
1002 /*!40101 SET @saved_cs_client = @@character_set_client */;
1003 /*!40101 SET character_set_client = utf8 */;
1004 CREATE TABLE `authorised_values` (
1005 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify the authorized value',
1006 `category` varchar(32) NOT NULL DEFAULT '' COMMENT 'key used to identify the authorized value category',
1007 `authorised_value` varchar(80) NOT NULL DEFAULT '' COMMENT 'code use to identify the authorized value',
1008 `lib` varchar(200) DEFAULT NULL COMMENT 'authorized value description as printed in the staff interface',
1009 `lib_opac` varchar(200) DEFAULT NULL COMMENT 'authorized value description as printed in the OPAC',
1010 `imageurl` varchar(200) DEFAULT NULL COMMENT 'authorized value URL',
1012 UNIQUE KEY `av_uniq` (`category`,`authorised_value`),
1013 KEY `name` (`category`),
1014 KEY `lib` (`lib`(191)),
1015 KEY `auth_value_idx` (`authorised_value`),
1016 CONSTRAINT `authorised_values_authorised_values_category` FOREIGN KEY (`category`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE CASCADE ON UPDATE CASCADE
1017 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1018 /*!40101 SET character_set_client = @saved_cs_client */;
1021 -- Table structure for table `authorised_values_branches`
1024 DROP TABLE IF EXISTS `authorised_values_branches`;
1025 /*!40101 SET @saved_cs_client = @@character_set_client */;
1026 /*!40101 SET character_set_client = utf8 */;
1027 CREATE TABLE `authorised_values_branches` (
1028 `av_id` int(11) NOT NULL,
1029 `branchcode` varchar(10) NOT NULL,
1030 KEY `av_id` (`av_id`),
1031 KEY `branchcode` (`branchcode`),
1032 CONSTRAINT `authorised_values_branches_ibfk_1` FOREIGN KEY (`av_id`) REFERENCES `authorised_values` (`id`) ON DELETE CASCADE,
1033 CONSTRAINT `authorised_values_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1034 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1035 /*!40101 SET character_set_client = @saved_cs_client */;
1038 -- Table structure for table `background_jobs`
1041 DROP TABLE IF EXISTS `background_jobs`;
1042 /*!40101 SET @saved_cs_client = @@character_set_client */;
1043 /*!40101 SET character_set_client = utf8 */;
1044 CREATE TABLE `background_jobs` (
1045 `id` int(11) NOT NULL AUTO_INCREMENT,
1046 `status` varchar(32) DEFAULT NULL,
1047 `progress` int(11) DEFAULT NULL,
1048 `size` int(11) DEFAULT NULL,
1049 `borrowernumber` int(11) DEFAULT NULL,
1050 `type` varchar(64) DEFAULT NULL,
1051 `queue` varchar(191) NOT NULL DEFAULT 'default' COMMENT 'Name of the queue the job is sent to',
1052 `data` longtext DEFAULT NULL,
1053 `context` longtext DEFAULT NULL COMMENT 'JSON-serialized context information for the job',
1054 `enqueued_on` datetime DEFAULT NULL,
1055 `started_on` datetime DEFAULT NULL,
1056 `ended_on` datetime DEFAULT NULL,
1058 KEY `borrowernumber` (`borrowernumber`),
1059 KEY `queue` (`queue`),
1060 KEY `status` (`status`)
1061 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1062 /*!40101 SET character_set_client = @saved_cs_client */;
1065 -- Table structure for table `biblio`
1068 DROP TABLE IF EXISTS `biblio`;
1069 /*!40101 SET @saved_cs_client = @@character_set_client */;
1070 /*!40101 SET character_set_client = utf8 */;
1071 CREATE TABLE `biblio` (
1072 `biblionumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned to each bibliographic record',
1073 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'foreign key from the biblio_framework table to identify which framework was used in cataloging this record',
1074 `author` longtext DEFAULT NULL COMMENT 'statement of responsibility from MARC record (100$a in MARC21)',
1075 `title` longtext DEFAULT NULL COMMENT 'title (without the subtitle) from the MARC record (245$a in MARC21)',
1076 `medium` longtext DEFAULT NULL COMMENT 'medium from the MARC record (245$h in MARC21)',
1077 `subtitle` longtext DEFAULT NULL COMMENT 'remainder of the title from the MARC record (245$b in MARC21)',
1078 `part_number` longtext DEFAULT NULL COMMENT 'part number from the MARC record (245$n in MARC21)',
1079 `part_name` longtext DEFAULT NULL COMMENT 'part name from the MARC record (245$p in MARC21)',
1080 `unititle` longtext DEFAULT NULL COMMENT 'uniform title (without the subtitle) from the MARC record (240$a in MARC21)',
1081 `notes` longtext DEFAULT NULL COMMENT 'values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)',
1082 `serial` tinyint(1) DEFAULT NULL COMMENT 'Boolean indicating whether biblio is for a serial',
1083 `seriestitle` longtext DEFAULT NULL,
1084 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'publication or copyright date from the MARC record',
1085 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
1086 `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
1087 `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
1088 PRIMARY KEY (`biblionumber`),
1089 KEY `blbnoidx` (`biblionumber`)
1090 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1091 /*!40101 SET character_set_client = @saved_cs_client */;
1094 -- Table structure for table `biblio_framework`
1097 DROP TABLE IF EXISTS `biblio_framework`;
1098 /*!40101 SET @saved_cs_client = @@character_set_client */;
1099 /*!40101 SET character_set_client = utf8 */;
1100 CREATE TABLE `biblio_framework` (
1101 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'the unique code assigned to the framework',
1102 `frameworktext` varchar(255) NOT NULL DEFAULT '' COMMENT 'the description/name given to the framework',
1103 PRIMARY KEY (`frameworkcode`)
1104 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1105 /*!40101 SET character_set_client = @saved_cs_client */;
1108 -- Table structure for table `biblio_metadata`
1111 DROP TABLE IF EXISTS `biblio_metadata`;
1112 /*!40101 SET @saved_cs_client = @@character_set_client */;
1113 /*!40101 SET character_set_client = utf8 */;
1114 CREATE TABLE `biblio_metadata` (
1115 `id` int(11) NOT NULL AUTO_INCREMENT,
1116 `biblionumber` int(11) NOT NULL,
1117 `format` varchar(16) NOT NULL,
1118 `schema` varchar(16) NOT NULL,
1119 `metadata` longtext NOT NULL,
1120 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1122 UNIQUE KEY `biblio_metadata_uniq_key` (`biblionumber`,`format`,`schema`),
1123 KEY `timestamp` (`timestamp`),
1124 CONSTRAINT `record_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1125 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1126 /*!40101 SET character_set_client = @saved_cs_client */;
1129 -- Table structure for table `biblioitems`
1132 DROP TABLE IF EXISTS `biblioitems`;
1133 /*!40101 SET @saved_cs_client = @@character_set_client */;
1134 /*!40101 SET character_set_client = utf8 */;
1135 CREATE TABLE `biblioitems` (
1136 `biblioitemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, unique identifier assigned by Koha',
1137 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the biblio table',
1138 `volume` longtext DEFAULT NULL,
1139 `number` longtext DEFAULT NULL,
1140 `itemtype` varchar(10) DEFAULT NULL COMMENT 'biblio level item type (MARC21 942$c)',
1141 `isbn` longtext DEFAULT NULL COMMENT 'ISBN (MARC21 020$a)',
1142 `issn` longtext DEFAULT NULL COMMENT 'ISSN (MARC21 022$a)',
1143 `ean` longtext DEFAULT NULL,
1144 `publicationyear` mediumtext DEFAULT NULL,
1145 `publishercode` text DEFAULT NULL COMMENT 'publisher (MARC21 260$b and 246$b)',
1146 `volumedate` date DEFAULT NULL,
1147 `volumedesc` mediumtext DEFAULT NULL COMMENT 'volume information (MARC21 362$a)',
1148 `collectiontitle` longtext DEFAULT NULL,
1149 `collectionissn` mediumtext DEFAULT NULL,
1150 `collectionvolume` longtext DEFAULT NULL,
1151 `editionstatement` mediumtext DEFAULT NULL,
1152 `editionresponsibility` mediumtext DEFAULT NULL,
1153 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1154 `illus` text DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)',
1155 `pages` text DEFAULT NULL COMMENT 'number of pages (MARC21 300$a)',
1156 `notes` longtext DEFAULT NULL,
1157 `size` text DEFAULT NULL COMMENT 'material size (MARC21 300$c)',
1158 `place` text DEFAULT NULL COMMENT 'publication place (MARC21 260$a and 264$a)',
1159 `lccn` longtext DEFAULT NULL COMMENT 'library of congress control number (MARC21 010$a)',
1160 `url` mediumtext DEFAULT NULL COMMENT 'url (MARC21 856$u)',
1161 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source (MARC21 942$2)',
1162 `cn_class` varchar(30) DEFAULT NULL,
1163 `cn_item` varchar(10) DEFAULT NULL,
1164 `cn_suffix` varchar(10) DEFAULT NULL,
1165 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized version of the call number used for sorting',
1166 `agerestriction` varchar(255) DEFAULT NULL COMMENT 'target audience/age restriction from the bib record (MARC21 521$a)',
1167 `totalissues` int(10) DEFAULT NULL,
1168 PRIMARY KEY (`biblioitemnumber`),
1169 KEY `bibinoidx` (`biblioitemnumber`),
1170 KEY `bibnoidx` (`biblionumber`),
1171 KEY `itemtype_idx` (`itemtype`),
1172 KEY `isbn` (`isbn`(191)),
1173 KEY `issn` (`issn`(191)),
1174 KEY `ean` (`ean`(191)),
1175 KEY `publishercode` (`publishercode`(191)),
1176 KEY `timestamp` (`timestamp`),
1177 CONSTRAINT `biblioitems_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1178 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1179 /*!40101 SET character_set_client = @saved_cs_client */;
1182 -- Table structure for table `borrower_attribute_types`
1185 DROP TABLE IF EXISTS `borrower_attribute_types`;
1186 /*!40101 SET @saved_cs_client = @@character_set_client */;
1187 /*!40101 SET character_set_client = utf8 */;
1188 CREATE TABLE `borrower_attribute_types` (
1189 `code` varchar(10) NOT NULL COMMENT 'unique key used to identify each custom field',
1190 `description` varchar(255) NOT NULL COMMENT 'description for each custom field',
1191 `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)',
1192 `unique_id` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this value needs to be unique (1 for yes, 0 for no)',
1193 `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)',
1194 `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)',
1195 `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)',
1196 `authorised_value_category` varchar(32) DEFAULT NULL COMMENT 'foreign key from authorised_values that links this custom field to an authorized value category',
1197 `display_checkout` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field displays in checkout screens',
1198 `category_code` varchar(10) DEFAULT NULL COMMENT 'defines a category for an attribute_type',
1199 `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1200 `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)',
1201 `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1202 PRIMARY KEY (`code`),
1203 KEY `auth_val_cat_idx` (`authorised_value_category`),
1204 KEY `category_code` (`category_code`),
1205 CONSTRAINT `borrower_attribute_types_ibfk_1` FOREIGN KEY (`category_code`) REFERENCES `categories` (`categorycode`)
1206 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1207 /*!40101 SET character_set_client = @saved_cs_client */;
1210 -- Table structure for table `borrower_attribute_types_branches`
1213 DROP TABLE IF EXISTS `borrower_attribute_types_branches`;
1214 /*!40101 SET @saved_cs_client = @@character_set_client */;
1215 /*!40101 SET character_set_client = utf8 */;
1216 CREATE TABLE `borrower_attribute_types_branches` (
1217 `bat_code` varchar(10) DEFAULT NULL,
1218 `b_branchcode` varchar(10) DEFAULT NULL,
1219 KEY `bat_code` (`bat_code`),
1220 KEY `b_branchcode` (`b_branchcode`),
1221 CONSTRAINT `borrower_attribute_types_branches_ibfk_1` FOREIGN KEY (`bat_code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE,
1222 CONSTRAINT `borrower_attribute_types_branches_ibfk_2` FOREIGN KEY (`b_branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1223 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1224 /*!40101 SET character_set_client = @saved_cs_client */;
1227 -- Table structure for table `borrower_attributes`
1230 DROP TABLE IF EXISTS `borrower_attributes`;
1231 /*!40101 SET @saved_cs_client = @@character_set_client */;
1232 /*!40101 SET character_set_client = utf8 */;
1233 CREATE TABLE `borrower_attributes` (
1234 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
1235 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines which patron/borrower has this attribute',
1236 `code` varchar(10) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
1237 `attribute` varchar(255) DEFAULT NULL COMMENT 'custom patron field value',
1239 KEY `borrowernumber` (`borrowernumber`),
1240 KEY `code_attribute` (`code`,`attribute`(191)),
1241 CONSTRAINT `borrower_attributes_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1242 CONSTRAINT `borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE
1243 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1244 /*!40101 SET character_set_client = @saved_cs_client */;
1247 -- Table structure for table `borrower_debarments`
1250 DROP TABLE IF EXISTS `borrower_debarments`;
1251 /*!40101 SET @saved_cs_client = @@character_set_client */;
1252 /*!40101 SET character_set_client = utf8 */;
1253 CREATE TABLE `borrower_debarments` (
1254 `borrower_debarment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the restriction',
1255 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key for borrowers.borrowernumber for patron who is restricted',
1256 `expiration` date DEFAULT NULL COMMENT 'expiration date of the restriction',
1257 `type` varchar(50) NOT NULL COMMENT 'type of restriction, FK to restriction_types.code',
1258 `comment` mediumtext DEFAULT NULL COMMENT 'comments about the restriction',
1259 `manager_id` int(11) DEFAULT NULL COMMENT 'foreign key for borrowers.borrowernumber for the librarian managing the restriction',
1260 `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date the restriction was added',
1261 `updated` timestamp NULL DEFAULT NULL COMMENT 'date the restriction was updated',
1262 PRIMARY KEY (`borrower_debarment_id`),
1263 KEY `borrowernumber` (`borrowernumber`),
1264 KEY `borrower_debarments_ibfk_2` (`type`),
1265 CONSTRAINT `borrower_debarments_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1266 CONSTRAINT `borrower_debarments_ibfk_2` FOREIGN KEY (`type`) REFERENCES `restriction_types` (`code`) ON DELETE NO ACTION ON UPDATE CASCADE
1267 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1268 /*!40101 SET character_set_client = @saved_cs_client */;
1271 -- Table structure for table `borrower_files`
1274 DROP TABLE IF EXISTS `borrower_files`;
1275 /*!40101 SET @saved_cs_client = @@character_set_client */;
1276 /*!40101 SET character_set_client = utf8 */;
1277 CREATE TABLE `borrower_files` (
1278 `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
1279 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking to the patron via the borrowernumber',
1280 `file_name` varchar(255) NOT NULL COMMENT 'file name',
1281 `file_type` varchar(255) NOT NULL COMMENT 'type of file',
1282 `file_description` varchar(255) DEFAULT NULL COMMENT 'description given to the file',
1283 `file_content` longblob NOT NULL COMMENT 'the file',
1284 `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
1285 PRIMARY KEY (`file_id`),
1286 KEY `borrowernumber` (`borrowernumber`),
1287 CONSTRAINT `borrower_files_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1288 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1289 /*!40101 SET character_set_client = @saved_cs_client */;
1292 -- Table structure for table `borrower_message_preferences`
1295 DROP TABLE IF EXISTS `borrower_message_preferences`;
1296 /*!40101 SET @saved_cs_client = @@character_set_client */;
1297 /*!40101 SET character_set_client = utf8 */;
1298 CREATE TABLE `borrower_message_preferences` (
1299 `borrower_message_preference_id` int(11) NOT NULL AUTO_INCREMENT,
1300 `borrowernumber` int(11) DEFAULT NULL,
1301 `categorycode` varchar(10) DEFAULT NULL,
1302 `message_attribute_id` int(11) DEFAULT 0,
1303 `days_in_advance` int(11) DEFAULT NULL,
1304 `wants_digest` tinyint(1) NOT NULL DEFAULT 0,
1305 PRIMARY KEY (`borrower_message_preference_id`),
1306 KEY `borrowernumber` (`borrowernumber`),
1307 KEY `categorycode` (`categorycode`),
1308 KEY `message_attribute_id` (`message_attribute_id`),
1309 CONSTRAINT `borrower_message_preferences_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1310 CONSTRAINT `borrower_message_preferences_ibfk_2` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1311 CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
1312 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1313 /*!40101 SET character_set_client = @saved_cs_client */;
1316 -- Table structure for table `borrower_message_transport_preferences`
1319 DROP TABLE IF EXISTS `borrower_message_transport_preferences`;
1320 /*!40101 SET @saved_cs_client = @@character_set_client */;
1321 /*!40101 SET character_set_client = utf8 */;
1322 CREATE TABLE `borrower_message_transport_preferences` (
1323 `borrower_message_preference_id` int(11) NOT NULL DEFAULT 0,
1324 `message_transport_type` varchar(20) NOT NULL DEFAULT '0',
1325 PRIMARY KEY (`borrower_message_preference_id`,`message_transport_type`),
1326 KEY `message_transport_type` (`message_transport_type`),
1327 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,
1328 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
1329 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1330 /*!40101 SET character_set_client = @saved_cs_client */;
1333 -- Table structure for table `borrower_modifications`
1336 DROP TABLE IF EXISTS `borrower_modifications`;
1337 /*!40101 SET @saved_cs_client = @@character_set_client */;
1338 /*!40101 SET character_set_client = utf8 */;
1339 CREATE TABLE `borrower_modifications` (
1340 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1341 `verification_token` varchar(255) NOT NULL DEFAULT '',
1342 `changed_fields` mediumtext DEFAULT NULL,
1343 `borrowernumber` int(11) NOT NULL DEFAULT 0,
1344 `cardnumber` varchar(32) DEFAULT NULL,
1345 `surname` longtext DEFAULT NULL,
1346 `firstname` mediumtext DEFAULT NULL,
1347 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1348 `title` longtext DEFAULT NULL,
1349 `othernames` longtext DEFAULT NULL,
1350 `initials` mediumtext DEFAULT NULL,
1351 `pronouns` longtext DEFAULT NULL,
1352 `streetnumber` varchar(10) DEFAULT NULL,
1353 `streettype` varchar(50) DEFAULT NULL,
1354 `address` longtext DEFAULT NULL,
1355 `address2` mediumtext DEFAULT NULL,
1356 `city` longtext DEFAULT NULL,
1357 `state` mediumtext DEFAULT NULL,
1358 `zipcode` varchar(25) DEFAULT NULL,
1359 `country` mediumtext DEFAULT NULL,
1360 `email` longtext DEFAULT NULL,
1361 `phone` mediumtext DEFAULT NULL,
1362 `mobile` varchar(50) DEFAULT NULL,
1363 `fax` longtext DEFAULT NULL,
1364 `emailpro` mediumtext DEFAULT NULL,
1365 `phonepro` mediumtext DEFAULT NULL,
1366 `B_streetnumber` varchar(10) DEFAULT NULL,
1367 `B_streettype` varchar(50) DEFAULT NULL,
1368 `B_address` varchar(100) DEFAULT NULL,
1369 `B_address2` mediumtext DEFAULT NULL,
1370 `B_city` longtext DEFAULT NULL,
1371 `B_state` mediumtext DEFAULT NULL,
1372 `B_zipcode` varchar(25) DEFAULT NULL,
1373 `B_country` mediumtext DEFAULT NULL,
1374 `B_email` mediumtext DEFAULT NULL,
1375 `B_phone` longtext DEFAULT NULL,
1376 `dateofbirth` date DEFAULT NULL,
1377 `branchcode` varchar(10) DEFAULT NULL,
1378 `categorycode` varchar(10) DEFAULT NULL,
1379 `dateenrolled` date DEFAULT NULL,
1380 `dateexpiry` date DEFAULT NULL,
1381 `date_renewed` date DEFAULT NULL,
1382 `gonenoaddress` tinyint(1) DEFAULT NULL,
1383 `lost` tinyint(1) DEFAULT NULL,
1384 `debarred` date DEFAULT NULL,
1385 `debarredcomment` varchar(255) DEFAULT NULL,
1386 `contactname` longtext DEFAULT NULL,
1387 `contactfirstname` mediumtext DEFAULT NULL,
1388 `contacttitle` mediumtext DEFAULT NULL,
1389 `borrowernotes` longtext DEFAULT NULL,
1390 `relationship` varchar(100) DEFAULT NULL,
1391 `sex` varchar(1) DEFAULT NULL,
1392 `password` varchar(30) DEFAULT NULL,
1393 `flags` bigint(11) DEFAULT NULL,
1394 `userid` varchar(75) DEFAULT NULL,
1395 `opacnote` longtext DEFAULT NULL,
1396 `contactnote` varchar(255) DEFAULT NULL,
1397 `sort1` varchar(80) DEFAULT NULL,
1398 `sort2` varchar(80) DEFAULT NULL,
1399 `altcontactfirstname` varchar(255) DEFAULT NULL,
1400 `altcontactsurname` varchar(255) DEFAULT NULL,
1401 `altcontactaddress1` varchar(255) DEFAULT NULL,
1402 `altcontactaddress2` varchar(255) DEFAULT NULL,
1403 `altcontactaddress3` varchar(255) DEFAULT NULL,
1404 `altcontactstate` mediumtext DEFAULT NULL,
1405 `altcontactzipcode` varchar(50) DEFAULT NULL,
1406 `altcontactcountry` mediumtext DEFAULT NULL,
1407 `altcontactphone` varchar(50) DEFAULT NULL,
1408 `smsalertnumber` varchar(50) DEFAULT NULL,
1409 `privacy` int(11) DEFAULT NULL,
1410 `extended_attributes` mediumtext DEFAULT NULL,
1411 `gdpr_proc_consent` datetime DEFAULT NULL COMMENT 'data processing consent',
1412 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1413 PRIMARY KEY (`verification_token`(191),`borrowernumber`),
1414 KEY `verification_token` (`verification_token`(191)),
1415 KEY `borrowernumber` (`borrowernumber`)
1416 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1417 /*!40101 SET character_set_client = @saved_cs_client */;
1420 -- Table structure for table `borrower_password_recovery`
1423 DROP TABLE IF EXISTS `borrower_password_recovery`;
1424 /*!40101 SET @saved_cs_client = @@character_set_client */;
1425 /*!40101 SET character_set_client = utf8 */;
1426 CREATE TABLE `borrower_password_recovery` (
1427 `borrowernumber` int(11) NOT NULL COMMENT 'the user asking a password recovery',
1428 `uuid` varchar(128) NOT NULL COMMENT 'a unique string to identify a password recovery attempt',
1429 `valid_until` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'a time limit on the password recovery attempt',
1430 PRIMARY KEY (`borrowernumber`),
1431 KEY `borrowernumber` (`borrowernumber`)
1432 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1433 /*!40101 SET character_set_client = @saved_cs_client */;
1436 -- Table structure for table `borrower_relationships`
1439 DROP TABLE IF EXISTS `borrower_relationships`;
1440 /*!40101 SET @saved_cs_client = @@character_set_client */;
1441 /*!40101 SET character_set_client = utf8 */;
1442 CREATE TABLE `borrower_relationships` (
1443 `id` int(11) NOT NULL AUTO_INCREMENT,
1444 `guarantor_id` int(11) NOT NULL,
1445 `guarantee_id` int(11) NOT NULL,
1446 `relationship` varchar(100) NOT NULL,
1448 UNIQUE KEY `guarantor_guarantee_idx` (`guarantor_id`,`guarantee_id`),
1449 KEY `r_guarantee` (`guarantee_id`),
1450 CONSTRAINT `r_guarantee` FOREIGN KEY (`guarantee_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1451 CONSTRAINT `r_guarantor` FOREIGN KEY (`guarantor_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1452 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1453 /*!40101 SET character_set_client = @saved_cs_client */;
1456 -- Table structure for table `borrowers`
1459 DROP TABLE IF EXISTS `borrowers`;
1460 /*!40101 SET @saved_cs_client = @@character_set_client */;
1461 /*!40101 SET character_set_client = utf8 */;
1462 CREATE TABLE `borrowers` (
1463 `borrowernumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, Koha assigned ID number for patrons/borrowers',
1464 `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
1465 `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1466 `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
1467 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1468 `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1469 `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
1470 `initials` mediumtext DEFAULT NULL COMMENT 'initials for your patron/borrower',
1471 `pronouns` longtext DEFAULT NULL COMMENT 'patron/borrower pronouns',
1472 `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',
1473 `streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s primary address',
1474 `address` longtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s primary address',
1475 `address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s primary address',
1476 `city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s primary address',
1477 `state` mediumtext DEFAULT NULL COMMENT 'the state or province for your patron/borrower''s primary address',
1478 `zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s primary address',
1479 `country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s primary address',
1480 `email` longtext DEFAULT NULL COMMENT 'the primary email address for your patron/borrower''s primary address',
1481 `phone` mediumtext DEFAULT NULL COMMENT 'the primary phone number for your patron/borrower''s primary address',
1482 `mobile` tinytext DEFAULT NULL COMMENT 'the other phone number for your patron/borrower''s primary address',
1483 `fax` longtext DEFAULT NULL COMMENT 'the fax number for your patron/borrower''s primary address',
1484 `emailpro` mediumtext DEFAULT NULL COMMENT 'the secondary email addres for your patron/borrower''s primary address',
1485 `phonepro` mediumtext DEFAULT NULL COMMENT 'the secondary phone number for your patron/borrower''s primary address',
1486 `B_streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address',
1487 `B_streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s alternate address',
1488 `B_address` mediumtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s alternate address',
1489 `B_address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s alternate address',
1490 `B_city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s alternate address',
1491 `B_state` mediumtext DEFAULT NULL COMMENT 'the state for your patron/borrower''s alternate address',
1492 `B_zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s alternate address',
1493 `B_country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s alternate address',
1494 `B_email` mediumtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate email address',
1495 `B_phone` longtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate phone number',
1496 `dateofbirth` date DEFAULT NULL COMMENT 'the patron/borrower''s date of birth (YYYY-MM-DD)',
1497 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table, includes the code of the patron/borrower''s home branch',
1498 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category',
1499 `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)',
1500 `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)',
1501 `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)',
1502 `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed',
1503 `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',
1504 `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',
1505 `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)',
1506 `debarredcomment` varchar(255) DEFAULT NULL COMMENT 'comment on the stop of the patron',
1507 `contactname` longtext DEFAULT NULL COMMENT 'used for children and profesionals to include surname or last name of guarantor or organization name',
1508 `contactfirstname` mediumtext DEFAULT NULL COMMENT 'used for children to include first name of guarantor',
1509 `contacttitle` mediumtext DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor',
1510 `borrowernotes` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface',
1511 `relationship` varchar(100) DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor',
1512 `sex` varchar(1) DEFAULT NULL COMMENT 'patron/borrower''s gender',
1513 `password` varchar(60) DEFAULT NULL COMMENT 'patron/borrower''s Bcrypt encrypted password',
1514 `secret` mediumtext DEFAULT NULL COMMENT 'Secret for 2FA',
1515 `auth_method` enum('password','two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method',
1516 `flags` bigint(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions',
1517 `userid` varchar(75) DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in',
1518 `opacnote` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface',
1519 `contactnote` varchar(255) DEFAULT NULL COMMENT 'a note related to the patron/borrower''s alternate address',
1520 `sort1` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
1521 `sort2` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
1522 `altcontactfirstname` mediumtext DEFAULT NULL COMMENT 'first name of alternate contact for the patron/borrower',
1523 `altcontactsurname` mediumtext DEFAULT NULL COMMENT 'surname or last name of the alternate contact for the patron/borrower',
1524 `altcontactaddress1` mediumtext DEFAULT NULL COMMENT 'the first address line for the alternate contact for the patron/borrower',
1525 `altcontactaddress2` mediumtext DEFAULT NULL COMMENT 'the second address line for the alternate contact for the patron/borrower',
1526 `altcontactaddress3` mediumtext DEFAULT NULL COMMENT 'the city for the alternate contact for the patron/borrower',
1527 `altcontactstate` mediumtext DEFAULT NULL COMMENT 'the state for the alternate contact for the patron/borrower',
1528 `altcontactzipcode` mediumtext DEFAULT NULL COMMENT 'the zipcode for the alternate contact for the patron/borrower',
1529 `altcontactcountry` mediumtext DEFAULT NULL COMMENT 'the country for the alternate contact for the patron/borrower',
1530 `altcontactphone` mediumtext DEFAULT NULL COMMENT 'the phone number for the alternate contact for the patron/borrower',
1531 `smsalertnumber` varchar(50) DEFAULT NULL COMMENT 'the mobile phone number where the patron/borrower would like to receive notices (if SMS turned on)',
1532 `sms_provider_id` int(11) DEFAULT NULL COMMENT 'the provider of the mobile phone number defined in smsalertnumber',
1533 `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history',
1534 `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines',
1535 `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
1536 `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''.',
1537 `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)',
1538 `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
1539 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
1540 `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
1541 `overdrive_auth_token` mediumtext DEFAULT NULL COMMENT 'persist OverDrive auth token',
1542 `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1543 `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1544 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1545 PRIMARY KEY (`borrowernumber`),
1546 UNIQUE KEY `cardnumber` (`cardnumber`),
1547 UNIQUE KEY `userid` (`userid`),
1548 KEY `categorycode` (`categorycode`),
1549 KEY `branchcode` (`branchcode`),
1550 KEY `surname_idx` (`surname`(191)),
1551 KEY `firstname_idx` (`firstname`(191)),
1552 KEY `othernames_idx` (`othernames`(191)),
1553 KEY `sms_provider_id` (`sms_provider_id`),
1554 KEY `cardnumber_idx` (`cardnumber`),
1555 KEY `userid_idx` (`userid`),
1556 KEY `middle_name_idx` (`middle_name`(768)),
1557 CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
1558 CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`),
1559 CONSTRAINT `borrowers_ibfk_3` FOREIGN KEY (`sms_provider_id`) REFERENCES `sms_providers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
1560 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1561 /*!40101 SET character_set_client = @saved_cs_client */;
1564 -- Table structure for table `branch_transfer_limits`
1567 DROP TABLE IF EXISTS `branch_transfer_limits`;
1568 /*!40101 SET @saved_cs_client = @@character_set_client */;
1569 /*!40101 SET character_set_client = utf8 */;
1570 CREATE TABLE `branch_transfer_limits` (
1571 `limitId` int(8) NOT NULL AUTO_INCREMENT,
1572 `toBranch` varchar(10) NOT NULL,
1573 `fromBranch` varchar(10) NOT NULL,
1574 `itemtype` varchar(10) DEFAULT NULL,
1575 `ccode` varchar(80) DEFAULT NULL,
1576 PRIMARY KEY (`limitId`),
1577 KEY `fromBranch_idx` (`fromBranch`)
1578 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1579 /*!40101 SET character_set_client = @saved_cs_client */;
1582 -- Table structure for table `branches`
1585 DROP TABLE IF EXISTS `branches`;
1586 /*!40101 SET @saved_cs_client = @@character_set_client */;
1587 /*!40101 SET character_set_client = utf8 */;
1588 CREATE TABLE `branches` (
1589 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'a unique key assigned to each branch',
1590 `branchname` longtext NOT NULL COMMENT 'the name of your library or branch',
1591 `branchaddress1` longtext DEFAULT NULL COMMENT 'the first address line of for your library or branch',
1592 `branchaddress2` longtext DEFAULT NULL COMMENT 'the second address line of for your library or branch',
1593 `branchaddress3` longtext DEFAULT NULL COMMENT 'the third address line of for your library or branch',
1594 `branchzip` varchar(25) DEFAULT NULL COMMENT 'the zip or postal code for your library or branch',
1595 `branchcity` longtext DEFAULT NULL COMMENT 'the city or province for your library or branch',
1596 `branchstate` longtext DEFAULT NULL COMMENT 'the state for your library or branch',
1597 `branchcountry` mediumtext DEFAULT NULL COMMENT 'the county for your library or branch',
1598 `branchphone` longtext DEFAULT NULL COMMENT 'the primary phone for your library or branch',
1599 `branchfax` longtext DEFAULT NULL COMMENT 'the fax number for your library or branch',
1600 `branchemail` longtext DEFAULT NULL COMMENT 'the primary email address for your library or branch',
1601 `branchillemail` longtext DEFAULT NULL COMMENT 'the ILL staff email address for your library or branch',
1602 `branchreplyto` longtext DEFAULT NULL COMMENT 'the email to be used as a Reply-To',
1603 `branchreturnpath` longtext DEFAULT NULL COMMENT 'the email to be used as Return-Path',
1604 `branchurl` longtext DEFAULT NULL COMMENT 'the URL for your library or branch''s website',
1605 `issuing` tinyint(4) DEFAULT NULL COMMENT 'unused in Koha',
1606 `branchip` varchar(15) DEFAULT NULL COMMENT 'the IP address for your library or branch',
1607 `branchnotes` longtext DEFAULT NULL COMMENT 'notes related to your library or branch',
1608 `geolocation` varchar(255) DEFAULT NULL COMMENT 'geolocation of your library',
1609 `marcorgcode` varchar(16) DEFAULT NULL COMMENT 'MARC Organization Code, see http://www.loc.gov/marc/organizations/orgshome.html, when empty defaults to syspref MARCOrgCode',
1610 `pickup_location` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'the ability to act as a pickup location',
1611 `public` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'whether this library should show in the opac',
1612 PRIMARY KEY (`branchcode`)
1613 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1614 /*!40101 SET character_set_client = @saved_cs_client */;
1617 -- Table structure for table `branches_overdrive`
1620 DROP TABLE IF EXISTS `branches_overdrive`;
1621 /*!40101 SET @saved_cs_client = @@character_set_client */;
1622 /*!40101 SET character_set_client = utf8 */;
1623 CREATE TABLE `branches_overdrive` (
1624 `branchcode` varchar(10) NOT NULL,
1625 `authname` varchar(255) NOT NULL,
1626 PRIMARY KEY (`branchcode`),
1627 CONSTRAINT `branches_overdrive_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1628 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1629 /*!40101 SET character_set_client = @saved_cs_client */;
1632 -- Table structure for table `branchtransfers`
1635 DROP TABLE IF EXISTS `branchtransfers`;
1636 /*!40101 SET @saved_cs_client = @@character_set_client */;
1637 /*!40101 SET character_set_client = utf8 */;
1638 CREATE TABLE `branchtransfers` (
1639 `branchtransfer_id` int(12) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
1640 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the itemnumber that it is in transit (items.itemnumber)',
1641 `daterequested` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date the transfer was requested',
1642 `datesent` datetime DEFAULT NULL COMMENT 'the date the transfer was initialized',
1643 `frombranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer is coming from',
1644 `datearrived` datetime DEFAULT NULL COMMENT 'the date the transfer arrived at its destination',
1645 `datecancelled` datetime DEFAULT NULL COMMENT 'the date the transfer was cancelled',
1646 `tobranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer was going to',
1647 `comments` longtext DEFAULT NULL COMMENT 'any comments related to the transfer',
1648 `reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation','Recall','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer',
1649 `cancellation_reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','ItemLost','WrongTransfer','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer cancellation',
1650 PRIMARY KEY (`branchtransfer_id`),
1651 KEY `frombranch` (`frombranch`),
1652 KEY `tobranch` (`tobranch`),
1653 KEY `itemnumber` (`itemnumber`),
1654 CONSTRAINT `branchtransfers_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1655 CONSTRAINT `branchtransfers_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1656 CONSTRAINT `branchtransfers_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1657 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1658 /*!40101 SET character_set_client = @saved_cs_client */;
1661 -- Table structure for table `browser`
1664 DROP TABLE IF EXISTS `browser`;
1665 /*!40101 SET @saved_cs_client = @@character_set_client */;
1666 /*!40101 SET character_set_client = utf8 */;
1667 CREATE TABLE `browser` (
1668 `level` int(11) NOT NULL,
1669 `classification` varchar(20) NOT NULL,
1670 `description` varchar(255) NOT NULL,
1671 `number` bigint(20) NOT NULL,
1672 `endnode` tinyint(4) NOT NULL
1673 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1674 /*!40101 SET character_set_client = @saved_cs_client */;
1677 -- Table structure for table `cash_register_actions`
1680 DROP TABLE IF EXISTS `cash_register_actions`;
1681 /*!40101 SET @saved_cs_client = @@character_set_client */;
1682 /*!40101 SET character_set_client = utf8 */;
1683 CREATE TABLE `cash_register_actions` (
1684 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each account register action',
1685 `code` varchar(24) NOT NULL COMMENT 'action code denoting the type of action recorded (enum),',
1686 `register_id` int(11) NOT NULL COMMENT 'id of cash_register this action belongs to,',
1687 `manager_id` int(11) NOT NULL COMMENT 'staff member performing the action',
1688 `amount` decimal(28,6) DEFAULT NULL COMMENT 'amount recorded in action (signed)',
1689 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1691 KEY `cash_register_actions_manager` (`manager_id`),
1692 KEY `cash_register_actions_register` (`register_id`),
1693 CONSTRAINT `cash_register_actions_manager` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1694 CONSTRAINT `cash_register_actions_register` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) 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 `cash_registers`
1702 DROP TABLE IF EXISTS `cash_registers`;
1703 /*!40101 SET @saved_cs_client = @@character_set_client */;
1704 /*!40101 SET character_set_client = utf8 */;
1705 CREATE TABLE `cash_registers` (
1706 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each account register',
1707 `name` varchar(24) NOT NULL COMMENT 'the user friendly identifier for each account register',
1708 `description` longtext NOT NULL COMMENT 'the user friendly description for each account register',
1709 `branch` varchar(10) NOT NULL COMMENT 'the foreign key the library this account register belongs',
1710 `branch_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote that this till is the branch default',
1711 `starting_float` decimal(28,6) DEFAULT NULL COMMENT 'the starting float this account register should be assigned',
1712 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote if this till is archived or not',
1714 UNIQUE KEY `name` (`name`,`branch`),
1715 KEY `cash_registers_branch` (`branch`),
1716 CONSTRAINT `cash_registers_branch` FOREIGN KEY (`branch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1717 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1718 /*!40101 SET character_set_client = @saved_cs_client */;
1721 -- Table structure for table `categories`
1724 DROP TABLE IF EXISTS `categories`;
1725 /*!40101 SET @saved_cs_client = @@character_set_client */;
1726 /*!40101 SET character_set_client = utf8 */;
1727 CREATE TABLE `categories` (
1728 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'unique primary key used to idenfity the patron category',
1729 `description` longtext DEFAULT NULL COMMENT 'description of the patron category',
1730 `enrolmentperiod` smallint(6) DEFAULT NULL COMMENT 'number of months the patron is enrolled for (will be NULL if enrolmentperioddate is set)',
1731 `enrolmentperioddate` date DEFAULT NULL COMMENT 'date the patron is enrolled until (will be NULL if enrolmentperiod is set)',
1732 `password_expiry_days` smallint(6) DEFAULT NULL COMMENT 'number of days after which the patron must reset their password',
1733 `upperagelimit` smallint(6) DEFAULT NULL COMMENT 'age limit for the patron',
1734 `dateofbirthrequired` tinyint(1) DEFAULT NULL COMMENT 'the minimum age required for the patron category',
1735 `finetype` varchar(30) DEFAULT NULL COMMENT 'unused in Koha',
1736 `bulk` tinyint(1) DEFAULT NULL,
1737 `enrolmentfee` decimal(28,6) DEFAULT NULL COMMENT 'enrollment fee for the patron',
1738 `overduenoticerequired` tinyint(1) DEFAULT NULL COMMENT 'are overdue notices sent to this patron category (1 for yes, 0 for no)',
1739 `issuelimit` smallint(6) DEFAULT NULL COMMENT 'unused in Koha',
1740 `reservefee` decimal(28,6) DEFAULT NULL COMMENT 'cost to place holds',
1741 `hidelostitems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'are lost items shown to this category (1 for yes, 0 for no)',
1742 `category_type` varchar(1) NOT NULL DEFAULT 'A' COMMENT 'type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)',
1743 `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',
1744 `default_privacy` enum('default','never','forever') NOT NULL DEFAULT 'default' COMMENT 'Default privacy setting for this patron category',
1745 `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''.',
1746 `can_be_guarantee` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if patrons of this category can be guarantees',
1747 `reset_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can do the password reset flow,',
1748 `change_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can change their passwords in the OAPC',
1749 `min_password_length` smallint(6) DEFAULT NULL COMMENT 'set minimum password length for patrons in this category',
1750 `require_strong_password` tinyint(1) DEFAULT NULL COMMENT 'set required password strength for patrons in this category',
1751 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude patrons of this category from local holds priority',
1752 PRIMARY KEY (`categorycode`),
1753 UNIQUE KEY `categorycode` (`categorycode`)
1754 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1755 /*!40101 SET character_set_client = @saved_cs_client */;
1758 -- Table structure for table `categories_branches`
1761 DROP TABLE IF EXISTS `categories_branches`;
1762 /*!40101 SET @saved_cs_client = @@character_set_client */;
1763 /*!40101 SET character_set_client = utf8 */;
1764 CREATE TABLE `categories_branches` (
1765 `categorycode` varchar(10) DEFAULT NULL,
1766 `branchcode` varchar(10) DEFAULT NULL,
1767 KEY `categorycode` (`categorycode`),
1768 KEY `branchcode` (`branchcode`),
1769 CONSTRAINT `categories_branches_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE,
1770 CONSTRAINT `categories_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1771 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1772 /*!40101 SET character_set_client = @saved_cs_client */;
1775 -- Table structure for table `checkout_renewals`
1778 DROP TABLE IF EXISTS `checkout_renewals`;
1779 /*!40101 SET @saved_cs_client = @@character_set_client */;
1780 /*!40101 SET character_set_client = utf8 */;
1781 CREATE TABLE `checkout_renewals` (
1782 `renewal_id` int(11) NOT NULL AUTO_INCREMENT,
1783 `checkout_id` int(11) DEFAULT NULL COMMENT 'the id of the checkout this renewal pertains to',
1784 `renewer_id` int(11) DEFAULT NULL COMMENT 'the id of the user who processed the renewal',
1785 `seen` tinyint(1) DEFAULT 0 COMMENT 'boolean denoting whether the item was present or not',
1786 `interface` varchar(16) NOT NULL COMMENT 'the interface this renewal took place on',
1787 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the renewal took place',
1788 `renewal_type` enum('Automatic','Manual') NOT NULL DEFAULT 'Manual' COMMENT 'whether the renewal was an automatic or manual renewal',
1789 PRIMARY KEY (`renewal_id`),
1790 KEY `renewer_id` (`renewer_id`),
1791 CONSTRAINT `renewals_renewer_id` FOREIGN KEY (`renewer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
1792 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1793 /*!40101 SET character_set_client = @saved_cs_client */;
1796 -- Table structure for table `circulation_rules`
1799 DROP TABLE IF EXISTS `circulation_rules`;
1800 /*!40101 SET @saved_cs_client = @@character_set_client */;
1801 /*!40101 SET character_set_client = utf8 */;
1802 CREATE TABLE `circulation_rules` (
1803 `id` int(11) NOT NULL AUTO_INCREMENT,
1804 `branchcode` varchar(10) DEFAULT NULL,
1805 `categorycode` varchar(10) DEFAULT NULL,
1806 `itemtype` varchar(10) DEFAULT NULL,
1807 `rule_name` varchar(32) NOT NULL,
1808 `rule_value` varchar(32) NOT NULL,
1810 UNIQUE KEY `branchcode` (`branchcode`,`categorycode`,`itemtype`,`rule_name`),
1811 KEY `circ_rules_ibfk_2` (`categorycode`),
1812 KEY `circ_rules_ibfk_3` (`itemtype`),
1813 KEY `rule_name` (`rule_name`),
1814 CONSTRAINT `circ_rules_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1815 CONSTRAINT `circ_rules_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
1816 CONSTRAINT `circ_rules_ibfk_3` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
1817 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1818 /*!40101 SET character_set_client = @saved_cs_client */;
1821 -- Table structure for table `cities`
1824 DROP TABLE IF EXISTS `cities`;
1825 /*!40101 SET @saved_cs_client = @@character_set_client */;
1826 /*!40101 SET character_set_client = utf8 */;
1827 CREATE TABLE `cities` (
1828 `cityid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier added by Koha',
1829 `city_name` varchar(100) NOT NULL DEFAULT '' COMMENT 'name of the city',
1830 `city_state` varchar(100) DEFAULT NULL COMMENT 'name of the state/province',
1831 `city_country` varchar(100) DEFAULT NULL COMMENT 'name of the country',
1832 `city_zipcode` varchar(20) DEFAULT NULL COMMENT 'zip or postal code',
1833 PRIMARY KEY (`cityid`)
1834 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1835 /*!40101 SET character_set_client = @saved_cs_client */;
1838 -- Table structure for table `class_sort_rules`
1841 DROP TABLE IF EXISTS `class_sort_rules`;
1842 /*!40101 SET @saved_cs_client = @@character_set_client */;
1843 /*!40101 SET character_set_client = utf8 */;
1844 CREATE TABLE `class_sort_rules` (
1845 `class_sort_rule` varchar(10) NOT NULL DEFAULT '',
1846 `description` longtext DEFAULT NULL,
1847 `sort_routine` varchar(30) NOT NULL DEFAULT '',
1848 PRIMARY KEY (`class_sort_rule`),
1849 UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
1850 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1851 /*!40101 SET character_set_client = @saved_cs_client */;
1854 -- Table structure for table `class_sources`
1857 DROP TABLE IF EXISTS `class_sources`;
1858 /*!40101 SET @saved_cs_client = @@character_set_client */;
1859 /*!40101 SET character_set_client = utf8 */;
1860 CREATE TABLE `class_sources` (
1861 `cn_source` varchar(10) NOT NULL DEFAULT '',
1862 `description` longtext DEFAULT NULL,
1863 `used` tinyint(4) NOT NULL DEFAULT 0,
1864 `class_sort_rule` varchar(10) NOT NULL DEFAULT '',
1865 `class_split_rule` varchar(10) NOT NULL DEFAULT '',
1866 PRIMARY KEY (`cn_source`),
1867 UNIQUE KEY `cn_source_idx` (`cn_source`),
1868 KEY `used_idx` (`used`),
1869 KEY `class_source_ibfk_1` (`class_sort_rule`),
1870 KEY `class_source_ibfk_2` (`class_split_rule`),
1871 CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`),
1872 CONSTRAINT `class_source_ibfk_2` FOREIGN KEY (`class_split_rule`) REFERENCES `class_split_rules` (`class_split_rule`)
1873 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1874 /*!40101 SET character_set_client = @saved_cs_client */;
1877 -- Table structure for table `class_split_rules`
1880 DROP TABLE IF EXISTS `class_split_rules`;
1881 /*!40101 SET @saved_cs_client = @@character_set_client */;
1882 /*!40101 SET character_set_client = utf8 */;
1883 CREATE TABLE `class_split_rules` (
1884 `class_split_rule` varchar(10) NOT NULL DEFAULT '',
1885 `description` longtext DEFAULT NULL,
1886 `split_routine` varchar(30) NOT NULL DEFAULT '',
1887 `split_regex` varchar(255) NOT NULL DEFAULT '',
1888 PRIMARY KEY (`class_split_rule`),
1889 UNIQUE KEY `class_split_rule_idx` (`class_split_rule`)
1890 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1891 /*!40101 SET character_set_client = @saved_cs_client */;
1894 -- Table structure for table `club_enrollment_fields`
1897 DROP TABLE IF EXISTS `club_enrollment_fields`;
1898 /*!40101 SET @saved_cs_client = @@character_set_client */;
1899 /*!40101 SET character_set_client = utf8 */;
1900 CREATE TABLE `club_enrollment_fields` (
1901 `id` int(11) NOT NULL AUTO_INCREMENT,
1902 `club_enrollment_id` int(11) NOT NULL,
1903 `club_template_enrollment_field_id` int(11) NOT NULL,
1904 `value` mediumtext NOT NULL,
1906 KEY `club_enrollment_id` (`club_enrollment_id`),
1907 KEY `club_template_enrollment_field_id` (`club_template_enrollment_field_id`),
1908 CONSTRAINT `club_enrollment_fields_ibfk_1` FOREIGN KEY (`club_enrollment_id`) REFERENCES `club_enrollments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1909 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
1910 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1911 /*!40101 SET character_set_client = @saved_cs_client */;
1914 -- Table structure for table `club_enrollments`
1917 DROP TABLE IF EXISTS `club_enrollments`;
1918 /*!40101 SET @saved_cs_client = @@character_set_client */;
1919 /*!40101 SET character_set_client = utf8 */;
1920 CREATE TABLE `club_enrollments` (
1921 `id` int(11) NOT NULL AUTO_INCREMENT,
1922 `club_id` int(11) NOT NULL,
1923 `borrowernumber` int(11) NOT NULL,
1924 `date_enrolled` timestamp NOT NULL DEFAULT current_timestamp(),
1925 `date_canceled` timestamp NULL DEFAULT NULL,
1926 `date_created` timestamp NULL DEFAULT NULL,
1927 `date_updated` timestamp NULL DEFAULT NULL,
1928 `branchcode` varchar(10) DEFAULT NULL,
1930 KEY `club_id` (`club_id`),
1931 KEY `borrowernumber` (`borrowernumber`),
1932 KEY `branchcode` (`branchcode`),
1933 CONSTRAINT `club_enrollments_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1934 CONSTRAINT `club_enrollments_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1935 CONSTRAINT `club_enrollments_ibfk_3` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
1936 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1937 /*!40101 SET character_set_client = @saved_cs_client */;
1940 -- Table structure for table `club_fields`
1943 DROP TABLE IF EXISTS `club_fields`;
1944 /*!40101 SET @saved_cs_client = @@character_set_client */;
1945 /*!40101 SET character_set_client = utf8 */;
1946 CREATE TABLE `club_fields` (
1947 `id` int(11) NOT NULL AUTO_INCREMENT,
1948 `club_template_field_id` int(11) NOT NULL,
1949 `club_id` int(11) NOT NULL,
1950 `value` mediumtext DEFAULT NULL,
1952 KEY `club_template_field_id` (`club_template_field_id`),
1953 KEY `club_id` (`club_id`),
1954 CONSTRAINT `club_fields_ibfk_3` FOREIGN KEY (`club_template_field_id`) REFERENCES `club_template_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1955 CONSTRAINT `club_fields_ibfk_4` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1956 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1957 /*!40101 SET character_set_client = @saved_cs_client */;
1960 -- Table structure for table `club_holds`
1963 DROP TABLE IF EXISTS `club_holds`;
1964 /*!40101 SET @saved_cs_client = @@character_set_client */;
1965 /*!40101 SET character_set_client = utf8 */;
1966 CREATE TABLE `club_holds` (
1967 `id` int(11) NOT NULL AUTO_INCREMENT,
1968 `club_id` int(11) NOT NULL COMMENT 'id for the club the hold was generated for',
1969 `biblio_id` int(11) NOT NULL COMMENT 'id for the bibliographic record the hold has been placed against',
1970 `item_id` int(11) DEFAULT NULL COMMENT 'If item-level, the id for the item the hold has been placed agains',
1971 `date_created` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Timestamp for the placed hold',
1973 KEY `clubs_holds_ibfk_1` (`club_id`),
1974 KEY `clubs_holds_ibfk_2` (`biblio_id`),
1975 KEY `clubs_holds_ibfk_3` (`item_id`),
1976 CONSTRAINT `clubs_holds_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1977 CONSTRAINT `clubs_holds_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1978 CONSTRAINT `clubs_holds_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1979 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1980 /*!40101 SET character_set_client = @saved_cs_client */;
1983 -- Table structure for table `club_holds_to_patron_holds`
1986 DROP TABLE IF EXISTS `club_holds_to_patron_holds`;
1987 /*!40101 SET @saved_cs_client = @@character_set_client */;
1988 /*!40101 SET character_set_client = utf8 */;
1989 CREATE TABLE `club_holds_to_patron_holds` (
1990 `id` int(11) NOT NULL AUTO_INCREMENT,
1991 `club_hold_id` int(11) NOT NULL,
1992 `patron_id` int(11) NOT NULL,
1993 `hold_id` int(11) DEFAULT NULL,
1994 `error_code` enum('damaged','ageRestricted','itemAlreadyOnHold','tooManyHoldsForThisRecord','tooManyReservesToday','tooManyReserves','notReservable','cannotReserveFromOtherBranches','libraryNotFound','libraryNotPickupLocation','cannotBeTransferred','noReservesAllowed') DEFAULT NULL,
1995 `error_message` varchar(100) DEFAULT NULL,
1997 KEY `clubs_holds_paton_holds_ibfk_1` (`club_hold_id`),
1998 KEY `clubs_holds_paton_holds_ibfk_2` (`patron_id`),
1999 KEY `clubs_holds_paton_holds_ibfk_3` (`hold_id`),
2000 CONSTRAINT `clubs_holds_paton_holds_ibfk_1` FOREIGN KEY (`club_hold_id`) REFERENCES `club_holds` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2001 CONSTRAINT `clubs_holds_paton_holds_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2002 CONSTRAINT `clubs_holds_paton_holds_ibfk_3` FOREIGN KEY (`hold_id`) REFERENCES `reserves` (`reserve_id`) ON DELETE CASCADE ON UPDATE CASCADE
2003 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2004 /*!40101 SET character_set_client = @saved_cs_client */;
2007 -- Table structure for table `club_template_enrollment_fields`
2010 DROP TABLE IF EXISTS `club_template_enrollment_fields`;
2011 /*!40101 SET @saved_cs_client = @@character_set_client */;
2012 /*!40101 SET character_set_client = utf8 */;
2013 CREATE TABLE `club_template_enrollment_fields` (
2014 `id` int(11) NOT NULL AUTO_INCREMENT,
2015 `club_template_id` int(11) NOT NULL,
2016 `name` text NOT NULL,
2017 `description` mediumtext DEFAULT NULL,
2018 `authorised_value_category` varchar(32) DEFAULT NULL,
2020 KEY `club_template_id` (`club_template_id`),
2021 CONSTRAINT `club_template_enrollment_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2022 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2023 /*!40101 SET character_set_client = @saved_cs_client */;
2026 -- Table structure for table `club_template_fields`
2029 DROP TABLE IF EXISTS `club_template_fields`;
2030 /*!40101 SET @saved_cs_client = @@character_set_client */;
2031 /*!40101 SET character_set_client = utf8 */;
2032 CREATE TABLE `club_template_fields` (
2033 `id` int(11) NOT NULL AUTO_INCREMENT,
2034 `club_template_id` int(11) NOT NULL,
2035 `name` text NOT NULL,
2036 `description` mediumtext DEFAULT NULL,
2037 `authorised_value_category` varchar(32) DEFAULT NULL,
2039 KEY `club_template_id` (`club_template_id`),
2040 CONSTRAINT `club_template_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2041 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2042 /*!40101 SET character_set_client = @saved_cs_client */;
2045 -- Table structure for table `club_templates`
2048 DROP TABLE IF EXISTS `club_templates`;
2049 /*!40101 SET @saved_cs_client = @@character_set_client */;
2050 /*!40101 SET character_set_client = utf8 */;
2051 CREATE TABLE `club_templates` (
2052 `id` int(11) NOT NULL AUTO_INCREMENT,
2053 `name` text NOT NULL,
2054 `description` mediumtext DEFAULT NULL,
2055 `is_enrollable_from_opac` tinyint(1) NOT NULL DEFAULT 0,
2056 `is_email_required` tinyint(1) NOT NULL DEFAULT 0,
2057 `branchcode` varchar(10) DEFAULT NULL,
2058 `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
2059 `date_updated` timestamp NULL DEFAULT NULL,
2060 `is_deletable` tinyint(1) NOT NULL DEFAULT 1,
2062 KEY `ct_branchcode` (`branchcode`),
2063 CONSTRAINT `club_templates_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2064 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2065 /*!40101 SET character_set_client = @saved_cs_client */;
2068 -- Table structure for table `clubs`
2071 DROP TABLE IF EXISTS `clubs`;
2072 /*!40101 SET @saved_cs_client = @@character_set_client */;
2073 /*!40101 SET character_set_client = utf8 */;
2074 CREATE TABLE `clubs` (
2075 `id` int(11) NOT NULL AUTO_INCREMENT,
2076 `club_template_id` int(11) NOT NULL,
2077 `name` text NOT NULL,
2078 `description` mediumtext DEFAULT NULL,
2079 `date_start` date DEFAULT NULL,
2080 `date_end` date DEFAULT NULL,
2081 `branchcode` varchar(10) DEFAULT NULL,
2082 `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
2083 `date_updated` timestamp NULL DEFAULT NULL,
2085 KEY `club_template_id` (`club_template_id`),
2086 KEY `branchcode` (`branchcode`),
2087 CONSTRAINT `clubs_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2088 CONSTRAINT `clubs_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
2089 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2090 /*!40101 SET character_set_client = @saved_cs_client */;
2093 -- Table structure for table `collections`
2096 DROP TABLE IF EXISTS `collections`;
2097 /*!40101 SET @saved_cs_client = @@character_set_client */;
2098 /*!40101 SET character_set_client = utf8 */;
2099 CREATE TABLE `collections` (
2100 `colId` int(11) NOT NULL AUTO_INCREMENT,
2101 `colTitle` varchar(100) NOT NULL DEFAULT '',
2102 `colDesc` mediumtext NOT NULL,
2103 `colBranchcode` varchar(10) DEFAULT NULL COMMENT '''branchcode for branch where item should be held.''',
2104 PRIMARY KEY (`colId`),
2105 KEY `collections_ibfk_1` (`colBranchcode`),
2106 CONSTRAINT `collections_ibfk_1` FOREIGN KEY (`colBranchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2107 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2108 /*!40101 SET character_set_client = @saved_cs_client */;
2111 -- Table structure for table `collections_tracking`
2114 DROP TABLE IF EXISTS `collections_tracking`;
2115 /*!40101 SET @saved_cs_client = @@character_set_client */;
2116 /*!40101 SET character_set_client = utf8 */;
2117 CREATE TABLE `collections_tracking` (
2118 `collections_tracking_id` int(11) NOT NULL AUTO_INCREMENT,
2119 `colId` int(11) NOT NULL DEFAULT 0 COMMENT 'collections.colId',
2120 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'items.itemnumber',
2121 PRIMARY KEY (`collections_tracking_id`),
2122 KEY `collectionst_ibfk_1` (`colId`),
2123 CONSTRAINT `collectionst_ibfk_1` FOREIGN KEY (`colId`) REFERENCES `collections` (`colId`) ON DELETE CASCADE ON UPDATE CASCADE
2124 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2125 /*!40101 SET character_set_client = @saved_cs_client */;
2128 -- Table structure for table `columns_settings`
2131 DROP TABLE IF EXISTS `columns_settings`;
2132 /*!40101 SET @saved_cs_client = @@character_set_client */;
2133 /*!40101 SET character_set_client = utf8 */;
2134 CREATE TABLE `columns_settings` (
2135 `module` varchar(255) NOT NULL,
2136 `page` varchar(255) NOT NULL,
2137 `tablename` varchar(255) NOT NULL,
2138 `columnname` varchar(255) NOT NULL,
2139 `cannot_be_toggled` int(1) NOT NULL DEFAULT 0,
2140 `is_hidden` int(1) NOT NULL DEFAULT 0,
2141 PRIMARY KEY (`module`(191),`page`(191),`tablename`(191),`columnname`(191))
2142 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2143 /*!40101 SET character_set_client = @saved_cs_client */;
2146 -- Table structure for table `course_instructors`
2149 DROP TABLE IF EXISTS `course_instructors`;
2150 /*!40101 SET @saved_cs_client = @@character_set_client */;
2151 /*!40101 SET character_set_client = utf8 */;
2152 CREATE TABLE `course_instructors` (
2153 `course_id` int(11) NOT NULL COMMENT 'foreign key to link to courses.course_id',
2154 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key to link to borrowers.borrowernumber for instructor information',
2155 PRIMARY KEY (`course_id`,`borrowernumber`),
2156 KEY `borrowernumber` (`borrowernumber`),
2157 CONSTRAINT `course_instructors_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2158 CONSTRAINT `course_instructors_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`)
2159 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2160 /*!40101 SET character_set_client = @saved_cs_client */;
2163 -- Table structure for table `course_items`
2166 DROP TABLE IF EXISTS `course_items`;
2167 /*!40101 SET @saved_cs_client = @@character_set_client */;
2168 /*!40101 SET character_set_client = utf8 */;
2169 CREATE TABLE `course_items` (
2170 `ci_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'course item id',
2171 `itemnumber` int(11) DEFAULT NULL COMMENT 'items.itemnumber for the item on reserve',
2172 `biblionumber` int(11) NOT NULL COMMENT 'biblio.biblionumber for the bibliographic record on reserve',
2173 `itype` varchar(10) DEFAULT NULL COMMENT 'new itemtype for the item to have while on reserve (optional)',
2174 `itype_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2175 `itype_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the itype when item is on course reserve',
2176 `ccode` varchar(80) DEFAULT NULL COMMENT 'new category code for the item to have while on reserve (optional)',
2177 `ccode_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if ccode should be changed while on course reserve',
2178 `ccode_storage` varchar(80) DEFAULT NULL COMMENT 'a place to store the ccode when item is on course reserve',
2179 `homebranch` varchar(10) DEFAULT NULL COMMENT 'new home branch for the item to have while on reserve (optional)',
2180 `homebranch_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if homebranch should be changed while on course reserve',
2181 `homebranch_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the homebranch when item is on course reserve',
2182 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'new holding branch for the item to have while on reserve (optional)',
2183 `holdingbranch_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2184 `holdingbranch_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the holdingbranch when item is on course reserve',
2185 `location` varchar(80) DEFAULT NULL COMMENT 'new shelving location for the item to have while on reseve (optional)',
2186 `location_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2187 `location_storage` varchar(80) DEFAULT NULL COMMENT 'a place to store the location when the item is on course reserve',
2188 `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''',
2189 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2190 PRIMARY KEY (`ci_id`),
2191 UNIQUE KEY `itemnumber` (`itemnumber`),
2192 KEY `holdingbranch` (`holdingbranch`),
2193 KEY `fk_course_items_homebranch` (`homebranch`),
2194 KEY `fk_course_items_homebranch_storage` (`homebranch_storage`),
2195 KEY `fk_course_items_biblionumber` (`biblionumber`),
2196 CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2197 CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2198 CONSTRAINT `fk_course_items_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2199 CONSTRAINT `fk_course_items_homebranch` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2200 CONSTRAINT `fk_course_items_homebranch_storage` FOREIGN KEY (`homebranch_storage`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2201 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2202 /*!40101 SET character_set_client = @saved_cs_client */;
2205 -- Table structure for table `course_reserves`
2208 DROP TABLE IF EXISTS `course_reserves`;
2209 /*!40101 SET @saved_cs_client = @@character_set_client */;
2210 /*!40101 SET character_set_client = utf8 */;
2211 CREATE TABLE `course_reserves` (
2212 `cr_id` int(11) NOT NULL AUTO_INCREMENT,
2213 `course_id` int(11) NOT NULL COMMENT 'foreign key to link to courses.course_id',
2214 `ci_id` int(11) NOT NULL COMMENT 'foreign key to link to courses_items.ci_id',
2215 `staff_note` longtext DEFAULT NULL COMMENT 'staff only note',
2216 `public_note` longtext DEFAULT NULL COMMENT 'public, OPAC visible note',
2217 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2218 PRIMARY KEY (`cr_id`),
2219 UNIQUE KEY `pseudo_key` (`course_id`,`ci_id`),
2220 KEY `course_id` (`course_id`),
2221 KEY `course_reserves_ibfk_2` (`ci_id`),
2222 CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`),
2223 CONSTRAINT `course_reserves_ibfk_2` FOREIGN KEY (`ci_id`) REFERENCES `course_items` (`ci_id`) ON DELETE CASCADE ON UPDATE CASCADE
2224 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2225 /*!40101 SET character_set_client = @saved_cs_client */;
2228 -- Table structure for table `courses`
2231 DROP TABLE IF EXISTS `courses`;
2232 /*!40101 SET @saved_cs_client = @@character_set_client */;
2233 /*!40101 SET character_set_client = utf8 */;
2234 CREATE TABLE `courses` (
2235 `course_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the course',
2236 `department` varchar(80) DEFAULT NULL COMMENT 'the authorised value for the DEPARTMENT',
2237 `course_number` varchar(255) DEFAULT NULL COMMENT 'the ''course number'' assigned to a course',
2238 `section` varchar(255) DEFAULT NULL COMMENT 'the ''section'' of a course',
2239 `course_name` varchar(255) DEFAULT NULL COMMENT 'the name of the course',
2240 `term` varchar(80) DEFAULT NULL COMMENT 'the authorised value for the TERM',
2241 `staff_note` longtext DEFAULT NULL COMMENT 'the text of the staff only note',
2242 `public_note` longtext DEFAULT NULL COMMENT 'the text of the public / opac note',
2243 `students_count` varchar(20) DEFAULT NULL COMMENT 'how many students will be taking this course/section',
2244 `enabled` enum('yes','no') NOT NULL DEFAULT 'yes' COMMENT 'determines whether the course is active',
2245 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2246 PRIMARY KEY (`course_id`)
2247 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2248 /*!40101 SET character_set_client = @saved_cs_client */;
2251 -- Table structure for table `cover_images`
2254 DROP TABLE IF EXISTS `cover_images`;
2255 /*!40101 SET @saved_cs_client = @@character_set_client */;
2256 /*!40101 SET character_set_client = utf8 */;
2257 CREATE TABLE `cover_images` (
2258 `imagenumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the image',
2259 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from biblio table to link to biblionumber',
2260 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from item table to link to itemnumber',
2261 `mimetype` varchar(15) NOT NULL COMMENT 'image type',
2262 `imagefile` mediumblob NOT NULL COMMENT 'image file contents',
2263 `thumbnail` mediumblob NOT NULL COMMENT 'thumbnail file contents',
2264 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'image creation/update time',
2265 PRIMARY KEY (`imagenumber`),
2266 KEY `bibliocoverimage_fk1` (`biblionumber`),
2267 KEY `bibliocoverimage_fk2` (`itemnumber`),
2268 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2269 CONSTRAINT `bibliocoverimage_fk2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
2270 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2271 /*!40101 SET character_set_client = @saved_cs_client */;
2274 -- Table structure for table `creator_batches`
2277 DROP TABLE IF EXISTS `creator_batches`;
2278 /*!40101 SET @saved_cs_client = @@character_set_client */;
2279 /*!40101 SET character_set_client = utf8 */;
2280 CREATE TABLE `creator_batches` (
2281 `label_id` int(11) NOT NULL AUTO_INCREMENT,
2282 `batch_id` int(10) NOT NULL DEFAULT 1,
2283 `description` mediumtext DEFAULT NULL,
2284 `item_number` int(11) DEFAULT NULL,
2285 `borrower_number` int(11) DEFAULT NULL,
2286 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2287 `branch_code` varchar(10) NOT NULL DEFAULT 'NB',
2288 `creator` char(15) NOT NULL DEFAULT 'Labels',
2289 PRIMARY KEY (`label_id`),
2290 KEY `branch_fk_constraint` (`branch_code`),
2291 KEY `item_fk_constraint` (`item_number`),
2292 KEY `borrower_fk_constraint` (`borrower_number`),
2293 CONSTRAINT `creator_batches_ibfk_1` FOREIGN KEY (`borrower_number`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2294 CONSTRAINT `creator_batches_ibfk_2` FOREIGN KEY (`branch_code`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
2295 CONSTRAINT `creator_batches_ibfk_3` FOREIGN KEY (`item_number`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE
2296 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2297 /*!40101 SET character_set_client = @saved_cs_client */;
2300 -- Table structure for table `creator_images`
2303 DROP TABLE IF EXISTS `creator_images`;
2304 /*!40101 SET @saved_cs_client = @@character_set_client */;
2305 /*!40101 SET character_set_client = utf8 */;
2306 CREATE TABLE `creator_images` (
2307 `image_id` int(4) NOT NULL AUTO_INCREMENT,
2308 `imagefile` mediumblob DEFAULT NULL,
2309 `image_name` char(20) NOT NULL DEFAULT 'DEFAULT',
2310 PRIMARY KEY (`image_id`),
2311 UNIQUE KEY `image_name_index` (`image_name`)
2312 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2313 /*!40101 SET character_set_client = @saved_cs_client */;
2316 -- Table structure for table `creator_layouts`
2319 DROP TABLE IF EXISTS `creator_layouts`;
2320 /*!40101 SET @saved_cs_client = @@character_set_client */;
2321 /*!40101 SET character_set_client = utf8 */;
2322 CREATE TABLE `creator_layouts` (
2323 `layout_id` int(4) NOT NULL AUTO_INCREMENT,
2324 `barcode_type` char(100) NOT NULL DEFAULT 'CODE39',
2325 `start_label` int(2) NOT NULL DEFAULT 1,
2326 `printing_type` char(32) NOT NULL DEFAULT 'BAR',
2327 `layout_name` char(25) NOT NULL DEFAULT 'DEFAULT',
2328 `guidebox` int(1) DEFAULT 0,
2329 `oblique_title` int(1) DEFAULT 1,
2330 `font` char(10) NOT NULL DEFAULT 'TR',
2331 `font_size` int(4) NOT NULL DEFAULT 10,
2332 `units` char(20) NOT NULL DEFAULT 'POINT',
2333 `callnum_split` int(1) DEFAULT 0,
2334 `text_justify` char(1) NOT NULL DEFAULT 'L',
2335 `format_string` varchar(210) NOT NULL DEFAULT 'barcode',
2336 `layout_xml` mediumtext NOT NULL,
2337 `creator` char(15) NOT NULL DEFAULT 'Labels',
2338 PRIMARY KEY (`layout_id`)
2339 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2340 /*!40101 SET character_set_client = @saved_cs_client */;
2343 -- Table structure for table `creator_templates`
2346 DROP TABLE IF EXISTS `creator_templates`;
2347 /*!40101 SET @saved_cs_client = @@character_set_client */;
2348 /*!40101 SET character_set_client = utf8 */;
2349 CREATE TABLE `creator_templates` (
2350 `template_id` int(4) NOT NULL AUTO_INCREMENT,
2351 `profile_id` int(4) DEFAULT NULL,
2352 `template_code` char(100) NOT NULL DEFAULT 'DEFAULT TEMPLATE',
2353 `template_desc` char(100) NOT NULL DEFAULT 'Default description',
2354 `page_width` float NOT NULL DEFAULT 0,
2355 `page_height` float NOT NULL DEFAULT 0,
2356 `label_width` float NOT NULL DEFAULT 0,
2357 `label_height` float NOT NULL DEFAULT 0,
2358 `top_text_margin` float NOT NULL DEFAULT 0,
2359 `left_text_margin` float NOT NULL DEFAULT 0,
2360 `top_margin` float NOT NULL DEFAULT 0,
2361 `left_margin` float NOT NULL DEFAULT 0,
2362 `cols` int(2) NOT NULL DEFAULT 0,
2363 `rows` int(2) NOT NULL DEFAULT 0,
2364 `col_gap` float NOT NULL DEFAULT 0,
2365 `row_gap` float NOT NULL DEFAULT 0,
2366 `units` char(20) NOT NULL DEFAULT 'POINT',
2367 `creator` char(15) NOT NULL DEFAULT 'Labels',
2368 PRIMARY KEY (`template_id`),
2369 KEY `template_profile_fk_constraint` (`profile_id`)
2370 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2371 /*!40101 SET character_set_client = @saved_cs_client */;
2374 -- Table structure for table `curbside_pickup_issues`
2377 DROP TABLE IF EXISTS `curbside_pickup_issues`;
2378 /*!40101 SET @saved_cs_client = @@character_set_client */;
2379 /*!40101 SET character_set_client = utf8 */;
2380 CREATE TABLE `curbside_pickup_issues` (
2381 `id` int(11) NOT NULL AUTO_INCREMENT,
2382 `curbside_pickup_id` int(11) NOT NULL,
2383 `issue_id` int(11) NOT NULL,
2384 `reserve_id` int(11) NOT NULL,
2386 KEY `curbside_pickup_id` (`curbside_pickup_id`),
2387 CONSTRAINT `curbside_pickup_issues_ibfk_1` FOREIGN KEY (`curbside_pickup_id`) REFERENCES `curbside_pickups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2388 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2389 /*!40101 SET character_set_client = @saved_cs_client */;
2392 -- Table structure for table `curbside_pickup_opening_slots`
2395 DROP TABLE IF EXISTS `curbside_pickup_opening_slots`;
2396 /*!40101 SET @saved_cs_client = @@character_set_client */;
2397 /*!40101 SET character_set_client = utf8 */;
2398 CREATE TABLE `curbside_pickup_opening_slots` (
2399 `id` int(11) NOT NULL AUTO_INCREMENT,
2400 `curbside_pickup_policy_id` int(11) NOT NULL,
2401 `day` tinyint(1) NOT NULL,
2402 `start_hour` int(2) NOT NULL,
2403 `start_minute` int(2) NOT NULL,
2404 `end_hour` int(2) NOT NULL,
2405 `end_minute` int(2) NOT NULL,
2407 KEY `curbside_pickup_policy_id` (`curbside_pickup_policy_id`),
2408 CONSTRAINT `curbside_pickup_opening_slots_ibfk_1` FOREIGN KEY (`curbside_pickup_policy_id`) REFERENCES `curbside_pickup_policy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2409 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2410 /*!40101 SET character_set_client = @saved_cs_client */;
2413 -- Table structure for table `curbside_pickup_policy`
2416 DROP TABLE IF EXISTS `curbside_pickup_policy`;
2417 /*!40101 SET @saved_cs_client = @@character_set_client */;
2418 /*!40101 SET character_set_client = utf8 */;
2419 CREATE TABLE `curbside_pickup_policy` (
2420 `id` int(11) NOT NULL AUTO_INCREMENT,
2421 `branchcode` varchar(10) NOT NULL,
2422 `enabled` tinyint(1) NOT NULL DEFAULT 0,
2423 `enable_waiting_holds_only` tinyint(1) NOT NULL DEFAULT 0,
2424 `pickup_interval` int(2) NOT NULL DEFAULT 0,
2425 `patrons_per_interval` int(2) NOT NULL DEFAULT 0,
2426 `patron_scheduled_pickup` tinyint(1) NOT NULL DEFAULT 0,
2428 UNIQUE KEY `branchcode` (`branchcode`),
2429 CONSTRAINT `curbside_pickup_policy_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2430 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2431 /*!40101 SET character_set_client = @saved_cs_client */;
2434 -- Table structure for table `curbside_pickups`
2437 DROP TABLE IF EXISTS `curbside_pickups`;
2438 /*!40101 SET @saved_cs_client = @@character_set_client */;
2439 /*!40101 SET character_set_client = utf8 */;
2440 CREATE TABLE `curbside_pickups` (
2441 `id` int(11) NOT NULL AUTO_INCREMENT,
2442 `borrowernumber` int(11) NOT NULL,
2443 `branchcode` varchar(10) NOT NULL,
2444 `scheduled_pickup_datetime` datetime NOT NULL,
2445 `staged_datetime` datetime DEFAULT NULL,
2446 `staged_by` int(11) DEFAULT NULL,
2447 `arrival_datetime` datetime DEFAULT NULL,
2448 `delivered_datetime` datetime DEFAULT NULL,
2449 `delivered_by` int(11) DEFAULT NULL,
2450 `notes` text DEFAULT NULL,
2452 KEY `branchcode` (`branchcode`),
2453 KEY `borrowernumber` (`borrowernumber`),
2454 KEY `staged_by` (`staged_by`),
2455 CONSTRAINT `curbside_pickups_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2456 CONSTRAINT `curbside_pickups_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2457 CONSTRAINT `curbside_pickups_ibfk_3` FOREIGN KEY (`staged_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL 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 `currency`
2465 DROP TABLE IF EXISTS `currency`;
2466 /*!40101 SET @saved_cs_client = @@character_set_client */;
2467 /*!40101 SET character_set_client = utf8 */;
2468 CREATE TABLE `currency` (
2469 `currency` varchar(10) NOT NULL DEFAULT '',
2470 `symbol` varchar(5) DEFAULT NULL,
2471 `isocode` varchar(5) DEFAULT NULL,
2472 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2473 `rate` float(15,5) DEFAULT NULL,
2474 `active` tinyint(1) DEFAULT NULL,
2475 `archived` tinyint(1) DEFAULT 0,
2476 `p_sep_by_space` tinyint(1) DEFAULT 0,
2477 PRIMARY KEY (`currency`)
2478 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2479 /*!40101 SET character_set_client = @saved_cs_client */;
2482 -- Table structure for table `deletedbiblio`
2485 DROP TABLE IF EXISTS `deletedbiblio`;
2486 /*!40101 SET @saved_cs_client = @@character_set_client */;
2487 /*!40101 SET character_set_client = utf8 */;
2488 CREATE TABLE `deletedbiblio` (
2489 `biblionumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned to each bibliographic record',
2490 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'foriegn key from the biblio_framework table to identify which framework was used in cataloging this record',
2491 `author` longtext DEFAULT NULL COMMENT 'statement of responsibility from MARC record (100$a in MARC21)',
2492 `title` longtext DEFAULT NULL COMMENT 'title (without the subtitle) from the MARC record (245$a in MARC21)',
2493 `medium` longtext DEFAULT NULL COMMENT 'medium from the MARC record (245$h in MARC21)',
2494 `subtitle` longtext DEFAULT NULL COMMENT 'remainder of the title from the MARC record (245$b in MARC21)',
2495 `part_number` longtext DEFAULT NULL COMMENT 'part number from the MARC record (245$n in MARC21)',
2496 `part_name` longtext DEFAULT NULL COMMENT 'part name from the MARC record (245$p in MARC21)',
2497 `unititle` longtext DEFAULT NULL COMMENT 'uniform title (without the subtitle) from the MARC record (240$a in MARC21)',
2498 `notes` longtext DEFAULT NULL COMMENT 'values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)',
2499 `serial` tinyint(1) DEFAULT NULL COMMENT 'Boolean indicating whether biblio is for a serial',
2500 `seriestitle` longtext DEFAULT NULL,
2501 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'publication or copyright date from the MARC record',
2502 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
2503 `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
2504 `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
2505 PRIMARY KEY (`biblionumber`),
2506 KEY `blbnoidx` (`biblionumber`)
2507 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2508 /*!40101 SET character_set_client = @saved_cs_client */;
2511 -- Table structure for table `deletedbiblio_metadata`
2514 DROP TABLE IF EXISTS `deletedbiblio_metadata`;
2515 /*!40101 SET @saved_cs_client = @@character_set_client */;
2516 /*!40101 SET character_set_client = utf8 */;
2517 CREATE TABLE `deletedbiblio_metadata` (
2518 `id` int(11) NOT NULL AUTO_INCREMENT,
2519 `biblionumber` int(11) NOT NULL,
2520 `format` varchar(16) NOT NULL,
2521 `schema` varchar(16) NOT NULL,
2522 `metadata` longtext NOT NULL,
2523 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2525 UNIQUE KEY `deletedbiblio_metadata_uniq_key` (`biblionumber`,`format`,`schema`),
2526 KEY `timestamp` (`timestamp`),
2527 CONSTRAINT `deletedrecord_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `deletedbiblio` (`biblionumber`) ON DELETE CASCADE 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 `deletedbiblioitems`
2535 DROP TABLE IF EXISTS `deletedbiblioitems`;
2536 /*!40101 SET @saved_cs_client = @@character_set_client */;
2537 /*!40101 SET character_set_client = utf8 */;
2538 CREATE TABLE `deletedbiblioitems` (
2539 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key, unique identifier assigned by Koha',
2540 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the biblio table',
2541 `volume` longtext DEFAULT NULL,
2542 `number` longtext DEFAULT NULL,
2543 `itemtype` varchar(10) DEFAULT NULL COMMENT 'biblio level item type (MARC21 942$c)',
2544 `isbn` longtext DEFAULT NULL COMMENT 'ISBN (MARC21 020$a)',
2545 `issn` longtext DEFAULT NULL COMMENT 'ISSN (MARC21 022$a)',
2546 `ean` longtext DEFAULT NULL,
2547 `publicationyear` mediumtext DEFAULT NULL,
2548 `publishercode` text DEFAULT NULL COMMENT 'publisher (MARC21 260$b and 264$b)',
2549 `volumedate` date DEFAULT NULL,
2550 `volumedesc` mediumtext DEFAULT NULL COMMENT 'volume information (MARC21 362$a)',
2551 `collectiontitle` longtext DEFAULT NULL,
2552 `collectionissn` mediumtext DEFAULT NULL,
2553 `collectionvolume` longtext DEFAULT NULL,
2554 `editionstatement` mediumtext DEFAULT NULL,
2555 `editionresponsibility` mediumtext DEFAULT NULL,
2556 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2557 `illus` text DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)',
2558 `pages` text DEFAULT NULL COMMENT 'number of pages (MARC21 300$a)',
2559 `notes` longtext DEFAULT NULL,
2560 `size` text DEFAULT NULL COMMENT 'material size (MARC21 300$c)',
2561 `place` text DEFAULT NULL COMMENT 'publication place (MARC21 260$a and 264$a)',
2562 `lccn` longtext DEFAULT NULL COMMENT 'library of congress control number (MARC21 010$a)',
2563 `url` mediumtext DEFAULT NULL COMMENT 'url (MARC21 856$u)',
2564 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source (MARC21 942$2)',
2565 `cn_class` varchar(30) DEFAULT NULL,
2566 `cn_item` varchar(10) DEFAULT NULL,
2567 `cn_suffix` varchar(10) DEFAULT NULL,
2568 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized version of the call number used for sorting',
2569 `agerestriction` varchar(255) DEFAULT NULL COMMENT 'target audience/age restriction from the bib record (MARC21 521$a)',
2570 `totalissues` int(10) DEFAULT NULL,
2571 PRIMARY KEY (`biblioitemnumber`),
2572 KEY `bibinoidx` (`biblioitemnumber`),
2573 KEY `bibnoidx` (`biblionumber`),
2574 KEY `itemtype_idx` (`itemtype`),
2575 KEY `isbn` (`isbn`(191)),
2576 KEY `ean` (`ean`(191)),
2577 KEY `publishercode` (`publishercode`(191)),
2578 KEY `timestamp` (`timestamp`)
2579 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2580 /*!40101 SET character_set_client = @saved_cs_client */;
2583 -- Table structure for table `deletedborrowers`
2586 DROP TABLE IF EXISTS `deletedborrowers`;
2587 /*!40101 SET @saved_cs_client = @@character_set_client */;
2588 /*!40101 SET character_set_client = utf8 */;
2589 CREATE TABLE `deletedborrowers` (
2590 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key, Koha assigned ID number for patrons/borrowers',
2591 `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
2592 `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2593 `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
2594 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
2595 `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2596 `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
2597 `initials` mediumtext DEFAULT NULL COMMENT 'initials for your patron/borrower',
2598 `pronouns` longtext DEFAULT NULL COMMENT 'patron/borrower pronouns',
2599 `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',
2600 `streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s primary address',
2601 `address` longtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s primary address',
2602 `address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s primary address',
2603 `city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s primary address',
2604 `state` mediumtext DEFAULT NULL COMMENT 'the state or province for your patron/borrower''s primary address',
2605 `zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s primary address',
2606 `country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s primary address',
2607 `email` longtext DEFAULT NULL COMMENT 'the primary email address for your patron/borrower''s primary address',
2608 `phone` mediumtext DEFAULT NULL COMMENT 'the primary phone number for your patron/borrower''s primary address',
2609 `mobile` tinytext DEFAULT NULL COMMENT 'the other phone number for your patron/borrower''s primary address',
2610 `fax` longtext DEFAULT NULL COMMENT 'the fax number for your patron/borrower''s primary address',
2611 `emailpro` mediumtext DEFAULT NULL COMMENT 'the secondary email addres for your patron/borrower''s primary address',
2612 `phonepro` mediumtext DEFAULT NULL COMMENT 'the secondary phone number for your patron/borrower''s primary address',
2613 `B_streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address',
2614 `B_streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s alternate address',
2615 `B_address` mediumtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s alternate address',
2616 `B_address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s alternate address',
2617 `B_city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s alternate address',
2618 `B_state` mediumtext DEFAULT NULL COMMENT 'the state for your patron/borrower''s alternate address',
2619 `B_zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s alternate address',
2620 `B_country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s alternate address',
2621 `B_email` mediumtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate email address',
2622 `B_phone` longtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate phone number',
2623 `dateofbirth` date DEFAULT NULL COMMENT 'the patron/borrower''s date of birth (YYYY-MM-DD)',
2624 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table, includes the code of the patron/borrower''s home branch',
2625 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category',
2626 `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)',
2627 `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)',
2628 `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)',
2629 `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed',
2630 `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',
2631 `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',
2632 `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)',
2633 `debarredcomment` varchar(255) DEFAULT NULL COMMENT 'comment on the stop of patron',
2634 `contactname` longtext DEFAULT NULL COMMENT 'used for children and profesionals to include surname or last name of guarantor or organization name',
2635 `contactfirstname` mediumtext DEFAULT NULL COMMENT 'used for children to include first name of guarantor',
2636 `contacttitle` mediumtext DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor',
2637 `borrowernotes` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface',
2638 `relationship` varchar(100) DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor',
2639 `sex` varchar(1) DEFAULT NULL COMMENT 'patron/borrower''s gender',
2640 `password` varchar(60) DEFAULT NULL COMMENT 'patron/borrower''s encrypted password',
2641 `secret` mediumtext DEFAULT NULL COMMENT 'Secret for 2FA',
2642 `auth_method` enum('password','two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method',
2643 `flags` bigint(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions',
2644 `userid` varchar(75) DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in',
2645 `opacnote` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface',
2646 `contactnote` varchar(255) DEFAULT NULL COMMENT 'a note related to the patron/borrower''s alternate address',
2647 `sort1` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
2648 `sort2` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
2649 `altcontactfirstname` mediumtext DEFAULT NULL COMMENT 'first name of alternate contact for the patron/borrower',
2650 `altcontactsurname` mediumtext DEFAULT NULL COMMENT 'surname or last name of the alternate contact for the patron/borrower',
2651 `altcontactaddress1` mediumtext DEFAULT NULL COMMENT 'the first address line for the alternate contact for the patron/borrower',
2652 `altcontactaddress2` mediumtext DEFAULT NULL COMMENT 'the second address line for the alternate contact for the patron/borrower',
2653 `altcontactaddress3` mediumtext DEFAULT NULL COMMENT 'the city for the alternate contact for the patron/borrower',
2654 `altcontactstate` mediumtext DEFAULT NULL COMMENT 'the state for the alternate contact for the patron/borrower',
2655 `altcontactzipcode` mediumtext DEFAULT NULL COMMENT 'the zipcode for the alternate contact for the patron/borrower',
2656 `altcontactcountry` mediumtext DEFAULT NULL COMMENT 'the country for the alternate contact for the patron/borrower',
2657 `altcontactphone` mediumtext DEFAULT NULL COMMENT 'the phone number for the alternate contact for the patron/borrower',
2658 `smsalertnumber` varchar(50) DEFAULT NULL COMMENT 'the mobile phone number where the patron/borrower would like to receive notices (if SMS turned on)',
2659 `sms_provider_id` int(11) DEFAULT NULL COMMENT 'the provider of the mobile phone number defined in smsalertnumber',
2660 `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history KEY `borrowernumber` (`borrowernumber`),',
2661 `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines',
2662 `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
2663 `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''.',
2664 `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)',
2665 `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
2666 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
2667 `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
2668 `overdrive_auth_token` mediumtext DEFAULT NULL COMMENT 'persist OverDrive auth token',
2669 `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2670 `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2671 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
2672 KEY `borrowernumber` (`borrowernumber`),
2673 KEY `cardnumber` (`cardnumber`),
2674 KEY `sms_provider_id` (`sms_provider_id`)
2675 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2676 /*!40101 SET character_set_client = @saved_cs_client */;
2679 -- Table structure for table `deleteditems`
2682 DROP TABLE IF EXISTS `deleteditems`;
2683 /*!40101 SET @saved_cs_client = @@character_set_client */;
2684 /*!40101 SET character_set_client = utf8 */;
2685 CREATE TABLE `deleteditems` (
2686 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key and unique identifier added by Koha',
2687 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
2688 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
2689 `barcode` varchar(20) DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
2690 `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
2691 `booksellerid` longtext DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
2692 `homebranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
2693 `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
2694 `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
2695 `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
2696 `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out',
2697 `datelastseen` datetime DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
2698 `stack` tinyint(1) DEFAULT NULL,
2699 `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
2700 `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
2701 `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
2702 `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
2703 `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
2704 `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
2705 `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
2706 `itemcallnumber` varchar(255) DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
2707 `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
2708 `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out',
2709 `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
2710 `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
2711 `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
2712 `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
2713 `itemnotes_nonpublic` longtext DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
2714 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
2715 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
2716 `deleted_on` datetime DEFAULT NULL COMMENT 'date/time of deletion',
2717 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
2718 `permanent_location` varchar(80) DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
2719 `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
2720 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
2721 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
2722 `ccode` varchar(80) DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
2723 `materials` mediumtext DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
2724 `uri` mediumtext DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
2725 `itype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
2726 `more_subfields_xml` longtext DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
2727 `enumchron` mediumtext DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
2728 `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
2729 `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
2730 `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.',
2731 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
2732 PRIMARY KEY (`itemnumber`),
2733 KEY `delitembarcodeidx` (`barcode`),
2734 KEY `delitemstocknumberidx` (`stocknumber`),
2735 KEY `delitembinoidx` (`biblioitemnumber`),
2736 KEY `delitembibnoidx` (`biblionumber`),
2737 KEY `delhomebranch` (`homebranch`),
2738 KEY `delholdingbranch` (`holdingbranch`),
2739 KEY `itype_idx` (`itype`),
2740 KEY `timestamp` (`timestamp`)
2741 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2742 /*!40101 SET character_set_client = @saved_cs_client */;
2745 -- Table structure for table `desks`
2748 DROP TABLE IF EXISTS `desks`;
2749 /*!40101 SET @saved_cs_client = @@character_set_client */;
2750 /*!40101 SET character_set_client = utf8 */;
2751 CREATE TABLE `desks` (
2752 `desk_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
2753 `desk_name` varchar(100) NOT NULL DEFAULT '' COMMENT 'name of the desk',
2754 `branchcode` varchar(10) NOT NULL COMMENT 'library the desk is located at',
2755 PRIMARY KEY (`desk_id`),
2756 KEY `fk_desks_branchcode` (`branchcode`),
2757 CONSTRAINT `fk_desks_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2758 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2759 /*!40101 SET character_set_client = @saved_cs_client */;
2762 -- Table structure for table `discharges`
2765 DROP TABLE IF EXISTS `discharges`;
2766 /*!40101 SET @saved_cs_client = @@character_set_client */;
2767 /*!40101 SET character_set_client = utf8 */;
2768 CREATE TABLE `discharges` (
2769 `discharge_id` int(11) NOT NULL AUTO_INCREMENT,
2770 `borrower` int(11) DEFAULT NULL,
2771 `needed` timestamp NULL DEFAULT NULL,
2772 `validated` timestamp NULL DEFAULT NULL,
2773 PRIMARY KEY (`discharge_id`),
2774 KEY `borrower_discharges_ibfk1` (`borrower`),
2775 CONSTRAINT `borrower_discharges_ibfk1` FOREIGN KEY (`borrower`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2776 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2777 /*!40101 SET character_set_client = @saved_cs_client */;
2780 -- Table structure for table `edifact_ean`
2783 DROP TABLE IF EXISTS `edifact_ean`;
2784 /*!40101 SET @saved_cs_client = @@character_set_client */;
2785 /*!40101 SET character_set_client = utf8 */;
2786 CREATE TABLE `edifact_ean` (
2787 `ee_id` int(11) NOT NULL AUTO_INCREMENT,
2788 `description` varchar(128) DEFAULT NULL,
2789 `branchcode` varchar(10) DEFAULT NULL,
2790 `ean` varchar(15) NOT NULL,
2791 `id_code_qualifier` varchar(3) NOT NULL DEFAULT '14',
2792 PRIMARY KEY (`ee_id`),
2793 KEY `efk_branchcode` (`branchcode`),
2794 CONSTRAINT `efk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
2795 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2796 /*!40101 SET character_set_client = @saved_cs_client */;
2799 -- Table structure for table `edifact_messages`
2802 DROP TABLE IF EXISTS `edifact_messages`;
2803 /*!40101 SET @saved_cs_client = @@character_set_client */;
2804 /*!40101 SET character_set_client = utf8 */;
2805 CREATE TABLE `edifact_messages` (
2806 `id` int(11) NOT NULL AUTO_INCREMENT,
2807 `message_type` varchar(10) NOT NULL,
2808 `transfer_date` date DEFAULT NULL,
2809 `vendor_id` int(11) DEFAULT NULL,
2810 `edi_acct` int(11) DEFAULT NULL,
2811 `status` mediumtext DEFAULT NULL,
2812 `basketno` int(11) DEFAULT NULL,
2813 `raw_msg` longtext DEFAULT NULL,
2814 `filename` mediumtext DEFAULT NULL,
2815 `deleted` tinyint(1) NOT NULL DEFAULT 0,
2817 KEY `vendorid` (`vendor_id`),
2818 KEY `ediacct` (`edi_acct`),
2819 KEY `basketno` (`basketno`),
2820 CONSTRAINT `emfk_basketno` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2821 CONSTRAINT `emfk_edi_acct` FOREIGN KEY (`edi_acct`) REFERENCES `vendor_edi_accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2822 CONSTRAINT `emfk_vendor` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2823 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2824 /*!40101 SET character_set_client = @saved_cs_client */;
2827 -- Table structure for table `erm_agreement_licenses`
2830 DROP TABLE IF EXISTS `erm_agreement_licenses`;
2831 /*!40101 SET @saved_cs_client = @@character_set_client */;
2832 /*!40101 SET character_set_client = utf8 */;
2833 CREATE TABLE `erm_agreement_licenses` (
2834 `agreement_license_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2835 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2836 `license_id` int(11) NOT NULL COMMENT 'link to the license',
2837 `status` varchar(80) NOT NULL COMMENT 'current status of the license',
2838 `physical_location` varchar(80) DEFAULT NULL COMMENT 'physical location of the license',
2839 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this license',
2840 `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the license',
2841 PRIMARY KEY (`agreement_license_id`),
2842 UNIQUE KEY `erm_agreement_licenses_uniq` (`agreement_id`,`license_id`),
2843 KEY `erm_agreement_licenses_ibfk_2` (`license_id`),
2844 CONSTRAINT `erm_agreement_licenses_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2845 CONSTRAINT `erm_agreement_licenses_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE
2846 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2847 /*!40101 SET character_set_client = @saved_cs_client */;
2850 -- Table structure for table `erm_agreement_periods`
2853 DROP TABLE IF EXISTS `erm_agreement_periods`;
2854 /*!40101 SET @saved_cs_client = @@character_set_client */;
2855 /*!40101 SET character_set_client = utf8 */;
2856 CREATE TABLE `erm_agreement_periods` (
2857 `agreement_period_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2858 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2859 `started_on` date NOT NULL COMMENT 'start of the agreement period',
2860 `ended_on` date DEFAULT NULL COMMENT 'end of the agreement period',
2861 `cancellation_deadline` date DEFAULT NULL COMMENT 'Deadline for the cancellation',
2862 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this period',
2863 PRIMARY KEY (`agreement_period_id`),
2864 KEY `erm_agreement_periods_ibfk_1` (`agreement_id`),
2865 CONSTRAINT `erm_agreement_periods_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2866 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2867 /*!40101 SET character_set_client = @saved_cs_client */;
2870 -- Table structure for table `erm_agreement_relationships`
2873 DROP TABLE IF EXISTS `erm_agreement_relationships`;
2874 /*!40101 SET @saved_cs_client = @@character_set_client */;
2875 /*!40101 SET character_set_client = utf8 */;
2876 CREATE TABLE `erm_agreement_relationships` (
2877 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2878 `related_agreement_id` int(11) NOT NULL COMMENT 'link to the related agreement',
2879 `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',
2880 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
2881 PRIMARY KEY (`agreement_id`,`related_agreement_id`),
2882 KEY `erm_agreement_relationships_ibfk_2` (`related_agreement_id`),
2883 CONSTRAINT `erm_agreement_relationships_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2884 CONSTRAINT `erm_agreement_relationships_ibfk_2` FOREIGN KEY (`related_agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2885 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2886 /*!40101 SET character_set_client = @saved_cs_client */;
2889 -- Table structure for table `erm_agreements`
2892 DROP TABLE IF EXISTS `erm_agreements`;
2893 /*!40101 SET @saved_cs_client = @@character_set_client */;
2894 /*!40101 SET character_set_client = utf8 */;
2895 CREATE TABLE `erm_agreements` (
2896 `agreement_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2897 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2898 `name` varchar(255) NOT NULL COMMENT 'name of the agreement',
2899 `description` longtext DEFAULT NULL COMMENT 'description of the agreement',
2900 `status` varchar(80) NOT NULL COMMENT 'current status of the agreement',
2901 `closure_reason` varchar(80) DEFAULT NULL COMMENT 'reason of the closure',
2902 `is_perpetual` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the agreement perpetual',
2903 `renewal_priority` varchar(80) DEFAULT NULL COMMENT 'priority of the renewal',
2904 `license_info` varchar(80) DEFAULT NULL COMMENT 'info about the license',
2905 PRIMARY KEY (`agreement_id`),
2906 KEY `erm_agreements_ibfk_1` (`vendor_id`),
2907 CONSTRAINT `erm_agreements_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2908 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2909 /*!40101 SET character_set_client = @saved_cs_client */;
2912 -- Table structure for table `erm_documents`
2915 DROP TABLE IF EXISTS `erm_documents`;
2916 /*!40101 SET @saved_cs_client = @@character_set_client */;
2917 /*!40101 SET character_set_client = utf8 */;
2918 CREATE TABLE `erm_documents` (
2919 `document_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2920 `agreement_id` int(11) DEFAULT NULL COMMENT 'link to the agreement',
2921 `license_id` int(11) DEFAULT NULL COMMENT 'link to the license',
2922 `file_name` varchar(255) DEFAULT NULL COMMENT 'name of the file',
2923 `file_type` varchar(255) DEFAULT NULL COMMENT 'type of the file',
2924 `file_description` varchar(255) DEFAULT NULL COMMENT 'description of the file',
2925 `file_content` longblob DEFAULT NULL COMMENT 'the content of the file',
2926 `uploaded_on` datetime DEFAULT NULL COMMENT 'datetime when the file as attached',
2927 `physical_location` varchar(255) DEFAULT NULL COMMENT 'physical location of the document',
2928 `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the document',
2929 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
2930 PRIMARY KEY (`document_id`),
2931 KEY `erm_documents_ibfk_1` (`agreement_id`),
2932 KEY `erm_documents_ibfk_2` (`license_id`),
2933 CONSTRAINT `erm_documents_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2934 CONSTRAINT `erm_documents_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE
2935 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2936 /*!40101 SET character_set_client = @saved_cs_client */;
2939 -- Table structure for table `erm_eholdings_packages`
2942 DROP TABLE IF EXISTS `erm_eholdings_packages`;
2943 /*!40101 SET @saved_cs_client = @@character_set_client */;
2944 /*!40101 SET character_set_client = utf8 */;
2945 CREATE TABLE `erm_eholdings_packages` (
2946 `package_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2947 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2948 `name` varchar(255) NOT NULL COMMENT 'name of the package',
2949 `external_id` varchar(255) DEFAULT NULL COMMENT 'External key',
2950 `provider` enum('ebsco') DEFAULT NULL COMMENT 'External provider',
2951 `package_type` varchar(80) DEFAULT NULL COMMENT 'type of the package',
2952 `content_type` varchar(80) DEFAULT NULL COMMENT 'type of the package',
2953 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this package',
2954 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date of creation of the package',
2955 PRIMARY KEY (`package_id`),
2956 KEY `erm_eholdings_packages_ibfk_1` (`vendor_id`),
2957 CONSTRAINT `erm_eholdings_packages_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2958 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2959 /*!40101 SET character_set_client = @saved_cs_client */;
2962 -- Table structure for table `erm_eholdings_packages_agreements`
2965 DROP TABLE IF EXISTS `erm_eholdings_packages_agreements`;
2966 /*!40101 SET @saved_cs_client = @@character_set_client */;
2967 /*!40101 SET character_set_client = utf8 */;
2968 CREATE TABLE `erm_eholdings_packages_agreements` (
2969 `package_id` int(11) NOT NULL COMMENT 'link to the package',
2970 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2971 PRIMARY KEY (`package_id`,`agreement_id`),
2972 KEY `erm_eholdings_packages_agreements_ibfk_2` (`agreement_id`),
2973 CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2974 CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2975 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2976 /*!40101 SET character_set_client = @saved_cs_client */;
2979 -- Table structure for table `erm_eholdings_resources`
2982 DROP TABLE IF EXISTS `erm_eholdings_resources`;
2983 /*!40101 SET @saved_cs_client = @@character_set_client */;
2984 /*!40101 SET character_set_client = utf8 */;
2985 CREATE TABLE `erm_eholdings_resources` (
2986 `resource_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2987 `title_id` int(11) NOT NULL,
2988 `package_id` int(11) NOT NULL,
2989 `vendor_id` int(11) DEFAULT NULL,
2990 `started_on` date DEFAULT NULL,
2991 `ended_on` date DEFAULT NULL,
2992 `proxy` varchar(80) DEFAULT NULL,
2993 PRIMARY KEY (`resource_id`),
2994 UNIQUE KEY `erm_eholdings_resources_uniq` (`title_id`,`package_id`),
2995 KEY `erm_eholdings_resources_ibfk_2` (`package_id`),
2996 KEY `erm_eholdings_resources_ibfk_3` (`vendor_id`),
2997 CONSTRAINT `erm_eholdings_resources_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_eholdings_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2998 CONSTRAINT `erm_eholdings_resources_ibfk_2` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2999 CONSTRAINT `erm_eholdings_resources_ibfk_3` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
3000 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3001 /*!40101 SET character_set_client = @saved_cs_client */;
3004 -- Table structure for table `erm_eholdings_titles`
3007 DROP TABLE IF EXISTS `erm_eholdings_titles`;
3008 /*!40101 SET @saved_cs_client = @@character_set_client */;
3009 /*!40101 SET character_set_client = utf8 */;
3010 CREATE TABLE `erm_eholdings_titles` (
3011 `title_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3012 `biblio_id` int(11) DEFAULT NULL,
3013 `publication_title` mediumtext DEFAULT NULL,
3014 `external_id` varchar(255) DEFAULT NULL,
3015 `print_identifier` varchar(255) DEFAULT NULL,
3016 `online_identifier` varchar(255) DEFAULT NULL,
3017 `date_first_issue_online` varchar(255) DEFAULT NULL,
3018 `num_first_vol_online` varchar(255) DEFAULT NULL,
3019 `num_first_issue_online` varchar(255) DEFAULT NULL,
3020 `date_last_issue_online` varchar(255) DEFAULT NULL,
3021 `num_last_vol_online` varchar(255) DEFAULT NULL,
3022 `num_last_issue_online` varchar(255) DEFAULT NULL,
3023 `title_url` varchar(255) DEFAULT NULL,
3024 `first_author` varchar(255) DEFAULT NULL,
3025 `embargo_info` varchar(255) DEFAULT NULL,
3026 `coverage_depth` varchar(255) DEFAULT NULL,
3027 `notes` mediumtext DEFAULT NULL,
3028 `publisher_name` varchar(255) DEFAULT NULL,
3029 `publication_type` varchar(80) DEFAULT NULL,
3030 `date_monograph_published_print` varchar(255) DEFAULT NULL,
3031 `date_monograph_published_online` varchar(255) DEFAULT NULL,
3032 `monograph_volume` varchar(255) DEFAULT NULL,
3033 `monograph_edition` varchar(255) DEFAULT NULL,
3034 `first_editor` varchar(255) DEFAULT NULL,
3035 `parent_publication_title_id` varchar(255) DEFAULT NULL,
3036 `preceding_publication_title_id` varchar(255) DEFAULT NULL,
3037 `access_type` varchar(255) DEFAULT NULL,
3038 PRIMARY KEY (`title_id`),
3039 KEY `erm_eholdings_titles_ibfk_2` (`biblio_id`),
3040 CONSTRAINT `erm_eholdings_titles_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE
3041 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3042 /*!40101 SET character_set_client = @saved_cs_client */;
3045 -- Table structure for table `erm_licenses`
3048 DROP TABLE IF EXISTS `erm_licenses`;
3049 /*!40101 SET @saved_cs_client = @@character_set_client */;
3050 /*!40101 SET character_set_client = utf8 */;
3051 CREATE TABLE `erm_licenses` (
3052 `license_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3053 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
3054 `name` varchar(255) NOT NULL COMMENT 'name of the license',
3055 `description` longtext DEFAULT NULL COMMENT 'description of the license',
3056 `type` varchar(80) NOT NULL COMMENT 'type of the license',
3057 `status` varchar(80) NOT NULL COMMENT 'current status of the license',
3058 `started_on` date DEFAULT NULL COMMENT 'start of the license',
3059 `ended_on` date DEFAULT NULL COMMENT 'end of the license',
3060 PRIMARY KEY (`license_id`),
3061 KEY `erm_licenses_ibfk_1` (`vendor_id`),
3062 CONSTRAINT `erm_licenses_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
3063 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3064 /*!40101 SET character_set_client = @saved_cs_client */;
3067 -- Table structure for table `erm_user_roles`
3070 DROP TABLE IF EXISTS `erm_user_roles`;
3071 /*!40101 SET @saved_cs_client = @@character_set_client */;
3072 /*!40101 SET character_set_client = utf8 */;
3073 CREATE TABLE `erm_user_roles` (
3074 `user_role_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3075 `agreement_id` int(11) DEFAULT NULL COMMENT 'link to the agreement',
3076 `license_id` int(11) DEFAULT NULL COMMENT 'link to the license',
3077 `user_id` int(11) NOT NULL COMMENT 'link to the user',
3078 `role` varchar(80) NOT NULL COMMENT 'role of the user',
3079 PRIMARY KEY (`user_role_id`),
3080 KEY `erm_user_roles_ibfk_1` (`agreement_id`),
3081 KEY `erm_user_roles_ibfk_2` (`license_id`),
3082 KEY `erm_user_roles_ibfk_3` (`user_id`),
3083 CONSTRAINT `erm_user_roles_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3084 CONSTRAINT `erm_user_roles_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3085 CONSTRAINT `erm_user_roles_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3086 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3087 /*!40101 SET character_set_client = @saved_cs_client */;
3090 -- Table structure for table `export_format`
3093 DROP TABLE IF EXISTS `export_format`;
3094 /*!40101 SET @saved_cs_client = @@character_set_client */;
3095 /*!40101 SET character_set_client = utf8 */;
3096 CREATE TABLE `export_format` (
3097 `export_format_id` int(11) NOT NULL AUTO_INCREMENT,
3098 `profile` varchar(255) NOT NULL,
3099 `description` longtext NOT NULL,
3100 `content` longtext NOT NULL,
3101 `csv_separator` varchar(2) NOT NULL DEFAULT ',',
3102 `field_separator` varchar(2) DEFAULT NULL,
3103 `subfield_separator` varchar(2) DEFAULT NULL,
3104 `encoding` varchar(255) NOT NULL DEFAULT 'utf8',
3105 `type` varchar(255) DEFAULT 'marc',
3106 `used_for` varchar(255) DEFAULT 'export_records',
3107 `staff_only` tinyint(1) NOT NULL DEFAULT 0,
3108 PRIMARY KEY (`export_format_id`),
3109 KEY `used_for_idx` (`used_for`(191)),
3110 KEY `staff_only_idx` (`staff_only`)
3111 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Used for CSV export';
3112 /*!40101 SET character_set_client = @saved_cs_client */;
3115 -- Table structure for table `hold_cancellation_requests`
3118 DROP TABLE IF EXISTS `hold_cancellation_requests`;
3119 /*!40101 SET @saved_cs_client = @@character_set_client */;
3120 /*!40101 SET character_set_client = utf8 */;
3121 CREATE TABLE `hold_cancellation_requests` (
3122 `hold_cancellation_request_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the cancellation request',
3123 `hold_id` int(11) NOT NULL COMMENT 'ID of the hold',
3124 `creation_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Time and date the cancellation request was created',
3125 PRIMARY KEY (`hold_cancellation_request_id`)
3126 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3127 /*!40101 SET character_set_client = @saved_cs_client */;
3130 -- Table structure for table `hold_fill_targets`
3133 DROP TABLE IF EXISTS `hold_fill_targets`;
3134 /*!40101 SET @saved_cs_client = @@character_set_client */;
3135 /*!40101 SET character_set_client = utf8 */;
3136 CREATE TABLE `hold_fill_targets` (
3137 `borrowernumber` int(11) NOT NULL,
3138 `biblionumber` int(11) NOT NULL,
3139 `itemnumber` int(11) NOT NULL,
3140 `source_branchcode` varchar(10) DEFAULT NULL,
3141 `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
3142 `reserve_id` int(11) DEFAULT NULL,
3143 PRIMARY KEY (`itemnumber`),
3144 KEY `bib_branch` (`biblionumber`,`source_branchcode`),
3145 KEY `hold_fill_targets_ibfk_1` (`borrowernumber`),
3146 KEY `hold_fill_targets_ibfk_4` (`source_branchcode`),
3147 CONSTRAINT `hold_fill_targets_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3148 CONSTRAINT `hold_fill_targets_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3149 CONSTRAINT `hold_fill_targets_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3150 CONSTRAINT `hold_fill_targets_ibfk_4` FOREIGN KEY (`source_branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
3151 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3152 /*!40101 SET character_set_client = @saved_cs_client */;
3155 -- Table structure for table `housebound_profile`
3158 DROP TABLE IF EXISTS `housebound_profile`;
3159 /*!40101 SET @saved_cs_client = @@character_set_client */;
3160 /*!40101 SET character_set_client = utf8 */;
3161 CREATE TABLE `housebound_profile` (
3162 `borrowernumber` int(11) NOT NULL COMMENT 'Number of the borrower associated with this profile.',
3163 `day` mediumtext NOT NULL COMMENT 'The preferred day of the week for delivery.',
3164 `frequency` mediumtext NOT NULL COMMENT 'The Authorised_Value definining the pattern for delivery.',
3165 `fav_itemtypes` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred itemtypes.',
3166 `fav_subjects` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred subjects.',
3167 `fav_authors` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred authors.',
3168 `referral` mediumtext DEFAULT NULL COMMENT 'Free text indicating how the borrower was added to the service.',
3169 `notes` mediumtext DEFAULT NULL COMMENT 'Free text for additional notes.',
3170 PRIMARY KEY (`borrowernumber`),
3171 CONSTRAINT `housebound_profile_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3172 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3173 /*!40101 SET character_set_client = @saved_cs_client */;
3176 -- Table structure for table `housebound_role`
3179 DROP TABLE IF EXISTS `housebound_role`;
3180 /*!40101 SET @saved_cs_client = @@character_set_client */;
3181 /*!40101 SET character_set_client = utf8 */;
3182 CREATE TABLE `housebound_role` (
3183 `borrowernumber_id` int(11) NOT NULL COMMENT 'borrowernumber link',
3184 `housebound_chooser` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'set to 1 to indicate this patron is a housebound chooser volunteer',
3185 `housebound_deliverer` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'set to 1 to indicate this patron is a housebound deliverer volunteer',
3186 PRIMARY KEY (`borrowernumber_id`),
3187 CONSTRAINT `houseboundrole_bnfk` FOREIGN KEY (`borrowernumber_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3188 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3189 /*!40101 SET character_set_client = @saved_cs_client */;
3192 -- Table structure for table `housebound_visit`
3195 DROP TABLE IF EXISTS `housebound_visit`;
3196 /*!40101 SET @saved_cs_client = @@character_set_client */;
3197 /*!40101 SET character_set_client = utf8 */;
3198 CREATE TABLE `housebound_visit` (
3199 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the visit.',
3200 `borrowernumber` int(11) NOT NULL COMMENT 'Number of the borrower, & the profile, linked to this visit.',
3201 `appointment_date` date DEFAULT NULL COMMENT 'Date of visit.',
3202 `day_segment` varchar(10) DEFAULT NULL COMMENT 'Rough time frame: ''morning'', ''afternoon'' ''evening''',
3203 `chooser_brwnumber` int(11) DEFAULT NULL COMMENT 'Number of the borrower to choose items for delivery.',
3204 `deliverer_brwnumber` int(11) DEFAULT NULL COMMENT 'Number of the borrower to deliver items.',
3206 KEY `houseboundvisit_bnfk` (`borrowernumber`),
3207 KEY `houseboundvisit_bnfk_1` (`chooser_brwnumber`),
3208 KEY `houseboundvisit_bnfk_2` (`deliverer_brwnumber`),
3209 CONSTRAINT `houseboundvisit_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `housebound_profile` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3210 CONSTRAINT `houseboundvisit_bnfk_1` FOREIGN KEY (`chooser_brwnumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3211 CONSTRAINT `houseboundvisit_bnfk_2` FOREIGN KEY (`deliverer_brwnumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3212 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3213 /*!40101 SET character_set_client = @saved_cs_client */;
3216 -- Table structure for table `identity_provider_domains`
3219 DROP TABLE IF EXISTS `identity_provider_domains`;
3220 /*!40101 SET @saved_cs_client = @@character_set_client */;
3221 /*!40101 SET character_set_client = utf8 */;
3222 CREATE TABLE `identity_provider_domains` (
3223 `identity_provider_domain_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify providers domain',
3224 `identity_provider_id` int(11) NOT NULL COMMENT 'Reference to provider',
3225 `domain` varchar(100) DEFAULT NULL COMMENT 'Domain name. If null means all domains',
3226 `auto_register` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Allow user auto register',
3227 `update_on_auth` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Update user data on auth login',
3228 `default_library_id` varchar(10) DEFAULT NULL COMMENT 'Default library to create user if auto register is enabled',
3229 `default_category_id` varchar(10) DEFAULT NULL COMMENT 'Default category to create user if auto register is enabled',
3230 `allow_opac` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Allow provider from opac interface',
3231 `allow_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Allow provider from staff interface',
3232 PRIMARY KEY (`identity_provider_domain_id`),
3233 UNIQUE KEY `identity_provider_id` (`identity_provider_id`,`domain`),
3234 KEY `domain` (`domain`),
3235 KEY `allow_opac` (`allow_opac`),
3236 KEY `allow_staff` (`allow_staff`),
3237 KEY `identity_provider_domain_ibfk_2` (`default_library_id`),
3238 KEY `identity_provider_domain_ibfk_3` (`default_category_id`),
3239 CONSTRAINT `identity_provider_domain_ibfk_1` FOREIGN KEY (`identity_provider_id`) REFERENCES `identity_providers` (`identity_provider_id`) ON DELETE CASCADE,
3240 CONSTRAINT `identity_provider_domain_ibfk_2` FOREIGN KEY (`default_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
3241 CONSTRAINT `identity_provider_domain_ibfk_3` FOREIGN KEY (`default_category_id`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE
3242 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3243 /*!40101 SET character_set_client = @saved_cs_client */;
3246 -- Table structure for table `identity_providers`
3249 DROP TABLE IF EXISTS `identity_providers`;
3250 /*!40101 SET @saved_cs_client = @@character_set_client */;
3251 /*!40101 SET character_set_client = utf8 */;
3252 CREATE TABLE `identity_providers` (
3253 `identity_provider_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify the provider',
3254 `code` varchar(20) NOT NULL COMMENT 'Provider code',
3255 `description` varchar(255) NOT NULL COMMENT 'Description for the provider',
3256 `protocol` enum('OAuth','OIDC','LDAP','CAS') NOT NULL COMMENT 'Protocol provider speaks',
3257 `config` longtext NOT NULL COMMENT 'Configuration of the provider in JSON format',
3258 `mapping` longtext NOT NULL COMMENT 'Configuration to map provider data to Koha user',
3259 `matchpoint` enum('email','userid','cardnumber') NOT NULL COMMENT 'The patron attribute to be used as matchpoint',
3260 `icon_url` varchar(255) DEFAULT NULL COMMENT 'Provider icon URL',
3261 PRIMARY KEY (`identity_provider_id`),
3262 UNIQUE KEY `code` (`code`),
3263 KEY `protocol` (`protocol`)
3264 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3265 /*!40101 SET character_set_client = @saved_cs_client */;
3268 -- Table structure for table `illcomments`
3271 DROP TABLE IF EXISTS `illcomments`;
3272 /*!40101 SET @saved_cs_client = @@character_set_client */;
3273 /*!40101 SET character_set_client = utf8 */;
3274 CREATE TABLE `illcomments` (
3275 `illcomment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the comment',
3276 `illrequest_id` bigint(20) unsigned NOT NULL COMMENT 'ILL request number',
3277 `borrowernumber` int(11) DEFAULT NULL COMMENT 'Link to the user who made the comment (could be librarian, patron or ILL partner library)',
3278 `comment` text DEFAULT NULL COMMENT 'The text of the comment',
3279 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date and time when the comment was made',
3280 PRIMARY KEY (`illcomment_id`),
3281 KEY `illcomments_bnfk` (`borrowernumber`),
3282 KEY `illcomments_ifk` (`illrequest_id`),
3283 CONSTRAINT `illcomments_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3284 CONSTRAINT `illcomments_ifk` FOREIGN KEY (`illrequest_id`) REFERENCES `illrequests` (`illrequest_id`) ON DELETE CASCADE ON UPDATE CASCADE
3285 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3286 /*!40101 SET character_set_client = @saved_cs_client */;
3289 -- Table structure for table `illrequestattributes`
3292 DROP TABLE IF EXISTS `illrequestattributes`;
3293 /*!40101 SET @saved_cs_client = @@character_set_client */;
3294 /*!40101 SET character_set_client = utf8 */;
3295 CREATE TABLE `illrequestattributes` (
3296 `illrequest_id` bigint(20) unsigned NOT NULL COMMENT 'ILL request number',
3297 `type` varchar(200) NOT NULL COMMENT 'API ILL property name',
3298 `value` mediumtext NOT NULL COMMENT 'API ILL property value',
3299 `readonly` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Is this attribute read only',
3300 PRIMARY KEY (`illrequest_id`,`type`(191)),
3301 CONSTRAINT `illrequestattributes_ifk` FOREIGN KEY (`illrequest_id`) REFERENCES `illrequests` (`illrequest_id`) ON DELETE CASCADE ON UPDATE CASCADE
3302 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3303 /*!40101 SET character_set_client = @saved_cs_client */;
3305 -- Table structure for table `illbatch_statuses`
3307 DROP TABLE IF EXISTS `illbatch_statuses`;
3308 CREATE TABLE `illbatch_statuses` (
3309 `id` int(11) NOT NULL auto_increment COMMENT "Status ID",
3310 `name` varchar(100) NOT NULL COMMENT "Name of status",
3311 `code` varchar(20) NOT NULL COMMENT "Unique, immutable code for status",
3312 `is_system` tinyint(1) COMMENT "Is this status required for system operation",
3314 UNIQUE KEY `u_illbatchstatuses__code` (`code`)
3315 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3318 -- Table structure for table `illbatches`
3320 DROP TABLE IF EXISTS `illbatches`;
3321 CREATE TABLE `illbatches` (
3322 `ill_batch_id` int(11) NOT NULL auto_increment COMMENT "Batch ID",
3323 `name` varchar(100) NOT NULL COMMENT "Unique name of batch",
3324 `backend` varchar(20) NOT NULL COMMENT "Name of batch backend",
3325 `patron_id` int(11) NULL DEFAULT NULL COMMENT "Patron associated with batch",
3326 `library_id` varchar(50) NULL DEFAULT NULL COMMENT "Branch associated with batch",
3327 `status_code` varchar(20) NULL DEFAULT NULL COMMENT "Status of batch",
3328 PRIMARY KEY (`ill_batch_id`),
3329 UNIQUE KEY `u_illbatches__name` (`name`),
3330 CONSTRAINT `illbatches_bnfk` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
3331 CONSTRAINT `illbatches_bcfk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
3332 CONSTRAINT `illbatches_sfk` FOREIGN KEY (`status_code`) REFERENCES `illbatch_statuses` (`code`) ON DELETE SET NULL ON UPDATE CASCADE
3333 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3336 -- Table structure for table `illrequests`
3339 DROP TABLE IF EXISTS `illrequests`;
3340 /*!40101 SET @saved_cs_client = @@character_set_client */;
3341 /*!40101 SET character_set_client = utf8 */;
3342 CREATE TABLE `illrequests` (
3343 `illrequest_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ILL request number',
3344 `borrowernumber` int(11) DEFAULT NULL COMMENT 'Patron associated with request',
3345 `biblio_id` int(11) DEFAULT NULL COMMENT 'Potential bib linked to request',
3346 `deleted_biblio_id` int(11) DEFAULT NULL COMMENT 'Deleted bib linked to request',
3347 `due_date` datetime DEFAULT NULL COMMENT 'Custom date due specified by backend, leave NULL for default date_due calculation',
3348 `branchcode` varchar(50) NOT NULL COMMENT 'The branch associated with the request',
3349 `status` varchar(50) DEFAULT NULL COMMENT 'Current Koha status of request',
3350 `status_alias` varchar(80) DEFAULT NULL COMMENT 'Foreign key to relevant authorised_values.authorised_value',
3351 `placed` date DEFAULT NULL COMMENT 'Date the request was placed',
3352 `replied` date DEFAULT NULL COMMENT 'Last API response',
3353 `updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
3354 `completed` date DEFAULT NULL COMMENT 'Date the request was completed',
3355 `medium` varchar(30) DEFAULT NULL COMMENT 'The Koha request type',
3356 `accessurl` varchar(500) DEFAULT NULL COMMENT 'Potential URL for accessing item',
3357 `cost` varchar(20) DEFAULT NULL COMMENT 'Quotes cost of request',
3358 `price_paid` varchar(20) DEFAULT NULL COMMENT 'Final cost of request',
3359 `notesopac` mediumtext DEFAULT NULL COMMENT 'Patron notes attached to request',
3360 `notesstaff` mediumtext DEFAULT NULL COMMENT 'Staff notes attached to request',
3361 `orderid` varchar(50) DEFAULT NULL COMMENT 'Backend id attached to request',
3362 `backend` varchar(20) DEFAULT NULL COMMENT 'The backend used to create request',
3363 `batch_id` int(11) COMMENT 'Optional ID of batch that this request belongs to',
3364 PRIMARY KEY (`illrequest_id`),
3365 KEY `illrequests_bnfk` (`borrowernumber`),
3366 KEY `illrequests_bcfk_2` (`branchcode`),
3367 KEY `illrequests_safk` (`status_alias`),
3368 KEY `illrequests_bibfk` (`biblio_id`),
3369 KEY `illrequests_ibfk` (`batch_id`),
3370 CONSTRAINT `illrequests_bcfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3371 CONSTRAINT `illrequests_bibfk` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
3372 CONSTRAINT `illrequests_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3373 CONSTRAINT `illrequests_safk` FOREIGN KEY (`status_alias`) REFERENCES `authorised_values` (`authorised_value`) ON DELETE SET NULL ON UPDATE CASCADE,
3374 CONSTRAINT `illrequests_ibfk` FOREIGN KEY (`batch_id`) REFERENCES `illbatches` (`ill_batch_id`) ON DELETE SET NULL ON UPDATE CASCADE
3375 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3376 /*!40101 SET character_set_client = @saved_cs_client */;
3379 -- Table structure for table `import_auths`
3382 DROP TABLE IF EXISTS `import_auths`;
3383 /*!40101 SET @saved_cs_client = @@character_set_client */;
3384 /*!40101 SET character_set_client = utf8 */;
3385 CREATE TABLE `import_auths` (
3386 `import_record_id` int(11) NOT NULL,
3387 `matched_authid` int(11) DEFAULT NULL,
3388 `control_number` varchar(25) DEFAULT NULL,
3389 `authorized_heading` varchar(128) DEFAULT NULL,
3390 `original_source` varchar(25) DEFAULT NULL,
3391 PRIMARY KEY (`import_record_id`),
3392 KEY `import_auths_ibfk_1` (`import_record_id`),
3393 KEY `matched_authid` (`matched_authid`),
3394 CONSTRAINT `import_auths_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3395 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3396 /*!40101 SET character_set_client = @saved_cs_client */;
3399 -- Table structure for table `import_batch_profiles`
3402 DROP TABLE IF EXISTS `import_batch_profiles`;
3403 /*!40101 SET @saved_cs_client = @@character_set_client */;
3404 /*!40101 SET character_set_client = utf8 */;
3405 CREATE TABLE `import_batch_profiles` (
3406 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3407 `name` varchar(100) NOT NULL COMMENT 'name of this profile',
3408 `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3409 `template_id` int(11) DEFAULT NULL COMMENT 'the id of the marc modification template',
3410 `overlay_action` varchar(50) DEFAULT NULL COMMENT 'how to handle duplicate records',
3411 `nomatch_action` varchar(50) DEFAULT NULL COMMENT 'how to handle records where no match is found',
3412 `item_action` varchar(50) DEFAULT NULL COMMENT 'what to do with item records',
3413 `parse_items` tinyint(1) DEFAULT NULL COMMENT 'should items be parsed',
3414 `record_type` varchar(50) DEFAULT NULL COMMENT 'type of record in the batch',
3415 `encoding` varchar(50) DEFAULT NULL COMMENT 'file encoding',
3416 `format` varchar(50) DEFAULT NULL COMMENT 'marc format',
3417 `comments` longtext DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3419 UNIQUE KEY `u_import_batch_profiles__name` (`name`)
3420 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3421 /*!40101 SET character_set_client = @saved_cs_client */;
3424 -- Table structure for table `import_batches`
3427 DROP TABLE IF EXISTS `import_batches`;
3428 /*!40101 SET @saved_cs_client = @@character_set_client */;
3429 /*!40101 SET character_set_client = utf8 */;
3430 CREATE TABLE `import_batches` (
3431 `import_batch_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3432 `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3433 `template_id` int(11) DEFAULT NULL,
3434 `branchcode` varchar(10) DEFAULT NULL,
3435 `num_records` int(11) NOT NULL DEFAULT 0 COMMENT 'number of records in the file',
3436 `num_items` int(11) NOT NULL DEFAULT 0 COMMENT 'number of items in the file',
3437 `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was uploaded',
3438 `overlay_action` enum('replace','create_new','use_template','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle duplicate records',
3439 `nomatch_action` enum('create_new','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle records where no match is found',
3440 `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',
3441 `import_status` enum('staging','staged','importing','imported','reverting','reverted','cleaned') NOT NULL DEFAULT 'staging' COMMENT 'the status of the imported file',
3442 `batch_type` enum('batch','z3950','webservice') NOT NULL DEFAULT 'batch' COMMENT 'where this batch has come from',
3443 `record_type` enum('biblio','auth','holdings') NOT NULL DEFAULT 'biblio' COMMENT 'type of record in the batch',
3444 `file_name` varchar(100) DEFAULT NULL COMMENT 'the name of the file uploaded',
3445 `comments` longtext DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3446 `profile_id` int(11) DEFAULT NULL,
3447 PRIMARY KEY (`import_batch_id`),
3448 KEY `branchcode` (`branchcode`),
3449 KEY `import_batches_ibfk_1` (`profile_id`),
3450 CONSTRAINT `import_batches_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `import_batch_profiles` (`id`) ON DELETE SET NULL ON UPDATE SET NULL
3451 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3452 /*!40101 SET character_set_client = @saved_cs_client */;
3455 -- Table structure for table `import_biblios`
3458 DROP TABLE IF EXISTS `import_biblios`;
3459 /*!40101 SET @saved_cs_client = @@character_set_client */;
3460 /*!40101 SET character_set_client = utf8 */;
3461 CREATE TABLE `import_biblios` (
3462 `import_record_id` int(11) NOT NULL,
3463 `matched_biblionumber` int(11) DEFAULT NULL,
3464 `control_number` varchar(25) DEFAULT NULL,
3465 `original_source` varchar(25) DEFAULT NULL,
3466 `title` longtext DEFAULT NULL,
3467 `author` longtext DEFAULT NULL,
3468 `isbn` longtext DEFAULT NULL,
3469 `issn` longtext DEFAULT NULL,
3470 `has_items` tinyint(1) NOT NULL DEFAULT 0,
3471 PRIMARY KEY (`import_record_id`),
3472 KEY `import_biblios_ibfk_1` (`import_record_id`),
3473 KEY `matched_biblionumber` (`matched_biblionumber`),
3474 KEY `title` (`title`(191)),
3475 KEY `isbn` (`isbn`(191)),
3476 CONSTRAINT `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3477 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3478 /*!40101 SET character_set_client = @saved_cs_client */;
3481 -- Table structure for table `import_items`
3484 DROP TABLE IF EXISTS `import_items`;
3485 /*!40101 SET @saved_cs_client = @@character_set_client */;
3486 /*!40101 SET character_set_client = utf8 */;
3487 CREATE TABLE `import_items` (
3488 `import_items_id` int(11) NOT NULL AUTO_INCREMENT,
3489 `import_record_id` int(11) NOT NULL,
3490 `itemnumber` int(11) DEFAULT NULL,
3491 `branchcode` varchar(10) DEFAULT NULL,
3492 `status` enum('error','staged','imported','reverted','ignored') NOT NULL DEFAULT 'staged',
3493 `marcxml` longtext NOT NULL,
3494 `import_error` longtext DEFAULT NULL,
3495 PRIMARY KEY (`import_items_id`),
3496 KEY `import_items_ibfk_1` (`import_record_id`),
3497 KEY `itemnumber` (`itemnumber`),
3498 KEY `branchcode` (`branchcode`),
3499 CONSTRAINT `import_items_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3500 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3501 /*!40101 SET character_set_client = @saved_cs_client */;
3504 -- Table structure for table `import_record_matches`
3507 DROP TABLE IF EXISTS `import_record_matches`;
3508 /*!40101 SET @saved_cs_client = @@character_set_client */;
3509 /*!40101 SET character_set_client = utf8 */;
3510 CREATE TABLE `import_record_matches` (
3511 `import_record_id` int(11) NOT NULL COMMENT 'the id given to the imported bib record (import_records.import_record_id)',
3512 `candidate_match_id` int(11) NOT NULL COMMENT 'the biblio the imported record matches (biblio.biblionumber)',
3513 `score` int(11) NOT NULL DEFAULT 0 COMMENT 'the match score',
3514 `chosen` tinyint(1) DEFAULT NULL COMMENT 'whether this match has been allowed or denied',
3515 PRIMARY KEY (`import_record_id`,`candidate_match_id`),
3516 KEY `record_score` (`import_record_id`,`score`),
3517 CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3518 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3519 /*!40101 SET character_set_client = @saved_cs_client */;
3522 -- Table structure for table `import_records`
3525 DROP TABLE IF EXISTS `import_records`;
3526 /*!40101 SET @saved_cs_client = @@character_set_client */;
3527 /*!40101 SET character_set_client = utf8 */;
3528 CREATE TABLE `import_records` (
3529 `import_record_id` int(11) NOT NULL AUTO_INCREMENT,
3530 `import_batch_id` int(11) NOT NULL,
3531 `branchcode` varchar(10) DEFAULT NULL,
3532 `record_sequence` int(11) NOT NULL DEFAULT 0,
3533 `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
3534 `import_date` date DEFAULT NULL,
3535 `marc` longblob NOT NULL,
3536 `marcxml` longtext NOT NULL,
3537 `marcxml_old` longtext NOT NULL,
3538 `record_type` enum('biblio','auth','holdings') NOT NULL DEFAULT 'biblio',
3539 `overlay_status` enum('no_match','auto_match','manual_match','match_applied') NOT NULL DEFAULT 'no_match',
3540 `status` enum('error','staged','imported','reverted','items_reverted','ignored') NOT NULL DEFAULT 'staged',
3541 `import_error` longtext DEFAULT NULL,
3542 `encoding` varchar(40) NOT NULL DEFAULT '',
3543 PRIMARY KEY (`import_record_id`),
3544 KEY `branchcode` (`branchcode`),
3545 KEY `batch_sequence` (`import_batch_id`,`record_sequence`),
3546 KEY `batch_id_record_type` (`import_batch_id`,`record_type`),
3547 CONSTRAINT `import_records_ifbk_1` FOREIGN KEY (`import_batch_id`) REFERENCES `import_batches` (`import_batch_id`) ON DELETE CASCADE ON UPDATE CASCADE
3548 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3549 /*!40101 SET character_set_client = @saved_cs_client */;
3552 -- Table structure for table `issues`
3555 DROP TABLE IF EXISTS `issues`;
3556 /*!40101 SET @saved_cs_client = @@character_set_client */;
3557 /*!40101 SET character_set_client = utf8 */;
3558 CREATE TABLE `issues` (
3559 `issue_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key for issues table',
3560 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
3561 `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
3562 `itemnumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
3563 `date_due` datetime DEFAULT NULL COMMENT 'datetime the item is due (yyyy-mm-dd hh:mm::ss)',
3564 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
3565 `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned, will be NULL until moved to old_issues',
3566 `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
3567 `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
3568 `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
3569 `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
3570 `auto_renew_error` varchar(32) DEFAULT NULL COMMENT 'automatic renewal error',
3571 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
3572 `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
3573 `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
3574 `note` longtext DEFAULT NULL COMMENT 'issue note text',
3575 `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
3576 `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
3577 PRIMARY KEY (`issue_id`),
3578 UNIQUE KEY `itemnumber` (`itemnumber`),
3579 KEY `issuesborridx` (`borrowernumber`),
3580 KEY `itemnumber_idx` (`itemnumber`),
3581 KEY `branchcode_idx` (`branchcode`),
3582 KEY `bordate` (`borrowernumber`,`timestamp`),
3583 KEY `issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
3584 CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE,
3585 CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE,
3586 CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3587 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3588 /*!40101 SET character_set_client = @saved_cs_client */;
3591 -- Table structure for table `item_bundles`
3594 DROP TABLE IF EXISTS `item_bundles`;
3595 /*!40101 SET @saved_cs_client = @@character_set_client */;
3596 /*!40101 SET character_set_client = utf8 */;
3597 CREATE TABLE `item_bundles` (
3598 `item` int(11) NOT NULL,
3599 `host` int(11) NOT NULL,
3600 PRIMARY KEY (`host`,`item`),
3601 UNIQUE KEY `item_bundles_uniq_1` (`item`),
3602 CONSTRAINT `item_bundles_ibfk_1` FOREIGN KEY (`item`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3603 CONSTRAINT `item_bundles_ibfk_2` FOREIGN KEY (`host`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3604 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3605 /*!40101 SET character_set_client = @saved_cs_client */;
3608 -- Table structure for table `item_circulation_alert_preferences`
3611 DROP TABLE IF EXISTS `item_circulation_alert_preferences`;
3612 /*!40101 SET @saved_cs_client = @@character_set_client */;
3613 /*!40101 SET character_set_client = utf8 */;
3614 CREATE TABLE `item_circulation_alert_preferences` (
3615 `id` int(11) NOT NULL AUTO_INCREMENT,
3616 `branchcode` varchar(10) NOT NULL,
3617 `categorycode` varchar(10) NOT NULL,
3618 `item_type` varchar(10) NOT NULL,
3619 `notification` varchar(16) NOT NULL,
3621 KEY `branchcode` (`branchcode`,`categorycode`,`item_type`,`notification`)
3622 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3623 /*!40101 SET character_set_client = @saved_cs_client */;
3626 -- Table structure for table `item_editor_templates`
3629 DROP TABLE IF EXISTS `item_editor_templates`;
3630 /*!40101 SET @saved_cs_client = @@character_set_client */;
3631 /*!40101 SET character_set_client = utf8 */;
3632 CREATE TABLE `item_editor_templates` (
3633 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the template',
3634 `patron_id` int(11) DEFAULT NULL COMMENT 'creator of this template',
3635 `name` mediumtext NOT NULL COMMENT 'template name',
3636 `is_shared` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if template is shared',
3637 `contents` longtext NOT NULL COMMENT 'json encoded template data',
3639 KEY `bn` (`patron_id`),
3640 CONSTRAINT `bn` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3641 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3642 /*!40101 SET character_set_client = @saved_cs_client */;
3645 -- Table structure for table `item_group_items`
3648 DROP TABLE IF EXISTS `item_group_items`;
3649 /*!40101 SET @saved_cs_client = @@character_set_client */;
3650 /*!40101 SET character_set_client = utf8 */;
3651 CREATE TABLE `item_group_items` (
3652 `item_group_items_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the group/item link',
3653 `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',
3654 `item_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the items table',
3655 PRIMARY KEY (`item_group_items_id`),
3656 UNIQUE KEY `item_id` (`item_id`),
3657 KEY `item_group_items_gifk_1` (`item_group_id`),
3658 CONSTRAINT `item_group_items_gifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3659 CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3660 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3661 /*!40101 SET character_set_client = @saved_cs_client */;
3664 -- Table structure for table `item_groups`
3667 DROP TABLE IF EXISTS `item_groups`;
3668 /*!40101 SET @saved_cs_client = @@character_set_client */;
3669 /*!40101 SET character_set_client = utf8 */;
3670 CREATE TABLE `item_groups` (
3671 `item_group_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the items group',
3672 `biblio_id` int(11) NOT NULL COMMENT 'id for the bibliographic record the group belongs to',
3673 `display_order` int(4) NOT NULL DEFAULT 0 COMMENT 'The ''sort order'' for item_groups',
3674 `description` mediumtext DEFAULT NULL COMMENT 'A group description',
3675 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the group was created',
3676 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the group',
3677 PRIMARY KEY (`item_group_id`),
3678 KEY `item_groups_ibfk_1` (`biblio_id`),
3679 CONSTRAINT `item_groups_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
3680 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3681 /*!40101 SET character_set_client = @saved_cs_client */;
3684 -- Table structure for table `items`
3687 DROP TABLE IF EXISTS `items`;
3688 /*!40101 SET @saved_cs_client = @@character_set_client */;
3689 /*!40101 SET character_set_client = utf8 */;
3690 CREATE TABLE `items` (
3691 `itemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier added by Koha',
3692 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
3693 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
3694 `barcode` varchar(20) DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
3695 `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
3696 `booksellerid` longtext DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
3697 `homebranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
3698 `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
3699 `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
3700 `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
3701 `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out/issued',
3702 `datelastseen` datetime DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
3703 `stack` tinyint(1) DEFAULT NULL,
3704 `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
3705 `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
3706 `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
3707 `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
3708 `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
3709 `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
3710 `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
3711 `itemcallnumber` varchar(255) DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
3712 `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
3713 `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out/issued',
3714 `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
3715 `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
3716 `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
3717 `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
3718 `itemnotes_nonpublic` longtext DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
3719 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
3720 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
3721 `deleted_on` datetime DEFAULT NULL COMMENT 'date/time of deletion',
3722 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
3723 `permanent_location` varchar(80) DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
3724 `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
3725 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
3726 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
3727 `ccode` varchar(80) DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
3728 `materials` mediumtext DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
3729 `uri` mediumtext DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
3730 `itype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
3731 `more_subfields_xml` longtext DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
3732 `enumchron` mediumtext DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
3733 `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
3734 `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
3735 `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.',
3736 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
3737 PRIMARY KEY (`itemnumber`),
3738 UNIQUE KEY `itembarcodeidx` (`barcode`),
3739 KEY `itemstocknumberidx` (`stocknumber`),
3740 KEY `itembinoidx` (`biblioitemnumber`),
3741 KEY `itembibnoidx` (`biblionumber`),
3742 KEY `homebranch` (`homebranch`),
3743 KEY `holdingbranch` (`holdingbranch`),
3744 KEY `itemcallnumber` (`itemcallnumber`(191)),
3745 KEY `items_location` (`location`),
3746 KEY `items_ccode` (`ccode`),
3747 KEY `itype_idx` (`itype`),
3748 KEY `timestamp` (`timestamp`),
3749 CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3750 CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
3751 CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
3752 CONSTRAINT `items_ibfk_4` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
3753 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3754 /*!40101 SET character_set_client = @saved_cs_client */;
3757 -- Table structure for table `items_last_borrower`
3760 DROP TABLE IF EXISTS `items_last_borrower`;
3761 /*!40101 SET @saved_cs_client = @@character_set_client */;
3762 /*!40101 SET character_set_client = utf8 */;
3763 CREATE TABLE `items_last_borrower` (
3764 `id` int(11) NOT NULL AUTO_INCREMENT,
3765 `itemnumber` int(11) NOT NULL,
3766 `borrowernumber` int(11) NOT NULL,
3767 `created_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
3769 UNIQUE KEY `itemnumber` (`itemnumber`),
3770 KEY `borrowernumber` (`borrowernumber`),
3771 CONSTRAINT `items_last_borrower_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3772 CONSTRAINT `items_last_borrower_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3773 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3774 /*!40101 SET character_set_client = @saved_cs_client */;
3777 -- Table structure for table `items_search_fields`
3780 DROP TABLE IF EXISTS `items_search_fields`;
3781 /*!40101 SET @saved_cs_client = @@character_set_client */;
3782 /*!40101 SET character_set_client = utf8 */;
3783 CREATE TABLE `items_search_fields` (
3784 `name` varchar(255) NOT NULL,
3785 `label` varchar(255) NOT NULL,
3786 `tagfield` char(3) NOT NULL,
3787 `tagsubfield` char(1) DEFAULT NULL,
3788 `authorised_values_category` varchar(32) DEFAULT NULL,
3789 PRIMARY KEY (`name`(191)),
3790 KEY `items_search_fields_authorised_values_category` (`authorised_values_category`),
3791 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
3792 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3793 /*!40101 SET character_set_client = @saved_cs_client */;
3796 -- Table structure for table `itemtypes`
3799 DROP TABLE IF EXISTS `itemtypes`;
3800 /*!40101 SET @saved_cs_client = @@character_set_client */;
3801 /*!40101 SET character_set_client = utf8 */;
3802 CREATE TABLE `itemtypes` (
3803 `itemtype` varchar(10) NOT NULL DEFAULT '' COMMENT 'unique key, a code associated with the item type',
3804 `parent_type` varchar(10) DEFAULT NULL COMMENT 'unique key, a code associated with the item type',
3805 `description` longtext DEFAULT NULL COMMENT 'a plain text explanation of the item type',
3806 `rentalcharge` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged when this item is checked out/issued',
3807 `rentalcharge_daily` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each day between checkout date and due date',
3808 `rentalcharge_daily_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the daily rental fee is calculated directly or using finesCalendar',
3809 `rentalcharge_hourly` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each hour between checkout date and due date',
3810 `rentalcharge_hourly_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the hourly rental fee is calculated directly or using finesCalendar',
3811 `defaultreplacecost` decimal(28,6) DEFAULT NULL COMMENT 'default replacement cost',
3812 `processfee` decimal(28,6) DEFAULT NULL COMMENT 'default text be recorded in the column note when the processing fee is applied',
3813 `notforloan` smallint(6) DEFAULT NULL COMMENT '1 if the item is not for loan, 0 if the item is available for loan',
3814 `imageurl` varchar(200) DEFAULT NULL COMMENT 'URL for the item type icon',
3815 `summary` mediumtext DEFAULT NULL COMMENT 'information from the summary field, may include HTML',
3816 `checkinmsg` varchar(255) DEFAULT NULL COMMENT 'message that is displayed when an item with the given item type is checked in',
3817 `checkinmsgtype` char(16) NOT NULL DEFAULT 'message' COMMENT 'type (CSS class) for the checkinmsg, can be ''alert'' or ''message''',
3818 `sip_media_type` varchar(3) DEFAULT NULL COMMENT 'SIP2 protocol media type for this itemtype',
3819 `hideinopac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Hide the item type from the search options in OPAC',
3820 `searchcategory` varchar(80) DEFAULT NULL COMMENT 'Group this item type with others with the same value on OPAC search options',
3821 `automatic_checkin` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If automatic checkin is enabled for items of this type',
3822 PRIMARY KEY (`itemtype`),
3823 UNIQUE KEY `itemtype` (`itemtype`),
3824 KEY `itemtypes_ibfk_1` (`parent_type`),
3825 CONSTRAINT `itemtypes_ibfk_1` FOREIGN KEY (`parent_type`) REFERENCES `itemtypes` (`itemtype`)
3826 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3827 /*!40101 SET character_set_client = @saved_cs_client */;
3830 -- Table structure for table `itemtypes_branches`
3833 DROP TABLE IF EXISTS `itemtypes_branches`;
3834 /*!40101 SET @saved_cs_client = @@character_set_client */;
3835 /*!40101 SET character_set_client = utf8 */;
3836 CREATE TABLE `itemtypes_branches` (
3837 `itemtype` varchar(10) NOT NULL,
3838 `branchcode` varchar(10) NOT NULL,
3839 KEY `itemtype` (`itemtype`),
3840 KEY `branchcode` (`branchcode`),
3841 CONSTRAINT `itemtypes_branches_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE,
3842 CONSTRAINT `itemtypes_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
3843 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3844 /*!40101 SET character_set_client = @saved_cs_client */;
3847 -- Table structure for table `keyboard_shortcuts`
3850 DROP TABLE IF EXISTS `keyboard_shortcuts`;
3851 /*!40101 SET @saved_cs_client = @@character_set_client */;
3852 /*!40101 SET character_set_client = utf8 */;
3853 CREATE TABLE `keyboard_shortcuts` (
3854 `shortcut_name` varchar(80) NOT NULL,
3855 `shortcut_keys` varchar(80) NOT NULL,
3856 PRIMARY KEY (`shortcut_name`)
3857 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3858 /*!40101 SET character_set_client = @saved_cs_client */;
3861 -- Table structure for table `language_descriptions`
3864 DROP TABLE IF EXISTS `language_descriptions`;
3865 /*!40101 SET @saved_cs_client = @@character_set_client */;
3866 /*!40101 SET character_set_client = utf8 */;
3867 CREATE TABLE `language_descriptions` (
3868 `subtag` varchar(25) DEFAULT NULL,
3869 `type` varchar(25) DEFAULT NULL,
3870 `lang` varchar(25) DEFAULT NULL,
3871 `description` varchar(255) DEFAULT NULL,
3872 `id` int(11) NOT NULL AUTO_INCREMENT,
3874 UNIQUE KEY `uniq_desc` (`subtag`,`type`,`lang`),
3876 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3877 /*!40101 SET character_set_client = @saved_cs_client */;
3880 -- Table structure for table `language_rfc4646_to_iso639`
3883 DROP TABLE IF EXISTS `language_rfc4646_to_iso639`;
3884 /*!40101 SET @saved_cs_client = @@character_set_client */;
3885 /*!40101 SET character_set_client = utf8 */;
3886 CREATE TABLE `language_rfc4646_to_iso639` (
3887 `rfc4646_subtag` varchar(25) DEFAULT NULL,
3888 `iso639_2_code` varchar(25) DEFAULT NULL,
3889 `id` int(11) NOT NULL AUTO_INCREMENT,
3891 UNIQUE KEY `uniq_code` (`rfc4646_subtag`,`iso639_2_code`),
3892 KEY `rfc4646_subtag` (`rfc4646_subtag`)
3893 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3894 /*!40101 SET character_set_client = @saved_cs_client */;
3897 -- Table structure for table `language_script_bidi`
3900 DROP TABLE IF EXISTS `language_script_bidi`;
3901 /*!40101 SET @saved_cs_client = @@character_set_client */;
3902 /*!40101 SET character_set_client = utf8 */;
3903 CREATE TABLE `language_script_bidi` (
3904 `rfc4646_subtag` varchar(25) DEFAULT NULL COMMENT 'script subtag, Arab, Hebr, etc.',
3905 `bidi` varchar(3) DEFAULT NULL COMMENT 'rtl ltr',
3906 KEY `rfc4646_subtag` (`rfc4646_subtag`)
3907 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3908 /*!40101 SET character_set_client = @saved_cs_client */;
3911 -- Table structure for table `language_script_mapping`
3914 DROP TABLE IF EXISTS `language_script_mapping`;
3915 /*!40101 SET @saved_cs_client = @@character_set_client */;
3916 /*!40101 SET character_set_client = utf8 */;
3917 CREATE TABLE `language_script_mapping` (
3918 `language_subtag` varchar(25) NOT NULL,
3919 `script_subtag` varchar(25) DEFAULT NULL,
3920 PRIMARY KEY (`language_subtag`)
3921 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3922 /*!40101 SET character_set_client = @saved_cs_client */;
3925 -- Table structure for table `language_subtag_registry`
3928 DROP TABLE IF EXISTS `language_subtag_registry`;
3929 /*!40101 SET @saved_cs_client = @@character_set_client */;
3930 /*!40101 SET character_set_client = utf8 */;
3931 CREATE TABLE `language_subtag_registry` (
3932 `subtag` varchar(25) DEFAULT NULL,
3933 `type` varchar(25) DEFAULT NULL COMMENT 'language-script-region-variant-extension-privateuse',
3934 `description` varchar(255) DEFAULT NULL COMMENT 'only one of the possible descriptions for ease of reference, see language_descriptions for the complete list',
3935 `added` date DEFAULT NULL,
3936 `id` int(11) NOT NULL AUTO_INCREMENT,
3938 UNIQUE KEY `uniq_lang` (`subtag`,`type`),
3939 KEY `subtag` (`subtag`)
3940 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3941 /*!40101 SET character_set_client = @saved_cs_client */;
3944 -- Table structure for table `letter`
3947 DROP TABLE IF EXISTS `letter`;
3948 /*!40101 SET @saved_cs_client = @@character_set_client */;
3949 /*!40101 SET character_set_client = utf8 */;
3950 CREATE TABLE `letter` (
3951 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
3952 `module` varchar(20) NOT NULL DEFAULT '' COMMENT 'Koha module that triggers this notice or slip',
3953 `code` varchar(20) NOT NULL DEFAULT '' COMMENT 'unique identifier for this notice or slip',
3954 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch this notice or slip is used at (branches.branchcode)',
3955 `name` varchar(100) NOT NULL DEFAULT '' COMMENT 'plain text name for this notice or slip',
3956 `is_html` tinyint(1) DEFAULT 0 COMMENT 'does this notice or slip use HTML (1 for yes, 0 for no)',
3957 `title` varchar(200) NOT NULL DEFAULT '' COMMENT 'subject line of the notice',
3958 `content` mediumtext DEFAULT NULL COMMENT 'body text for the notice or slip',
3959 `message_transport_type` varchar(20) NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3960 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3961 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3963 UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3964 KEY `message_transport_type_fk` (`message_transport_type`),
3965 CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
3966 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3967 /*!40101 SET character_set_client = @saved_cs_client */;
3970 -- Table structure for table `library_groups`
3973 DROP TABLE IF EXISTS `library_groups`;
3974 /*!40101 SET @saved_cs_client = @@character_set_client */;
3975 /*!40101 SET character_set_client = utf8 */;
3976 CREATE TABLE `library_groups` (
3977 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for each group',
3978 `parent_id` int(11) DEFAULT NULL COMMENT 'if this is a child group, the id of the parent group',
3979 `branchcode` varchar(10) DEFAULT NULL COMMENT 'The branchcode of a branch belonging to the parent group',
3980 `title` varchar(100) DEFAULT NULL COMMENT 'Short description of the goup',
3981 `description` mediumtext DEFAULT NULL COMMENT 'Longer explanation of the group, if necessary',
3982 `ft_hide_patron_info` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Turn on the feature ''Hide patron''s info'' for this group',
3983 `ft_limit_item_editing` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Turn on the feature "Limit item editing by group" for this group',
3984 `ft_search_groups_opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for staff side search groups',
3985 `ft_search_groups_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for opac side search groups',
3986 `ft_local_hold_group` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group to identify libraries as pick up location for holds',
3987 `ft_local_float_group` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group to identify libraries as part of float group',
3988 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Date and time of creation',
3989 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time of last',
3991 UNIQUE KEY `title` (`title`),
3992 UNIQUE KEY `library_groups_uniq_2` (`parent_id`,`branchcode`),
3993 KEY `branchcode` (`branchcode`),
3994 CONSTRAINT `library_groups_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `library_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
3995 CONSTRAINT `library_groups_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
3996 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3997 /*!40101 SET character_set_client = @saved_cs_client */;
4000 -- Table structure for table `library_smtp_servers`
4003 DROP TABLE IF EXISTS `library_smtp_servers`;
4004 /*!40101 SET @saved_cs_client = @@character_set_client */;
4005 /*!40101 SET character_set_client = utf8 */;
4006 CREATE TABLE `library_smtp_servers` (
4007 `id` int(11) NOT NULL AUTO_INCREMENT,
4008 `library_id` varchar(10) NOT NULL,
4009 `smtp_server_id` int(11) NOT NULL,
4011 UNIQUE KEY `library_id_idx` (`library_id`),
4012 KEY `smtp_server_id_idx` (`smtp_server_id`),
4013 CONSTRAINT `library_smtp_servers_library_fk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4014 CONSTRAINT `library_smtp_servers_smtp_servers_fk` FOREIGN KEY (`smtp_server_id`) REFERENCES `smtp_servers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4015 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4016 /*!40101 SET character_set_client = @saved_cs_client */;
4019 -- Table structure for table `linktracker`
4022 DROP TABLE IF EXISTS `linktracker`;
4023 /*!40101 SET @saved_cs_client = @@character_set_client */;
4024 /*!40101 SET character_set_client = utf8 */;
4025 CREATE TABLE `linktracker` (
4026 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
4027 `biblionumber` int(11) DEFAULT NULL COMMENT 'biblionumber of the record the link is from',
4028 `itemnumber` int(11) DEFAULT NULL COMMENT 'itemnumber if applicable that the link was from',
4029 `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrowernumber who clicked the link',
4030 `url` mediumtext DEFAULT NULL COMMENT 'the link itself',
4031 `timeclicked` datetime DEFAULT NULL COMMENT 'the date and time the link was clicked',
4033 KEY `bibidx` (`biblionumber`),
4034 KEY `itemidx` (`itemnumber`),
4035 KEY `borridx` (`borrowernumber`),
4036 KEY `dateidx` (`timeclicked`),
4037 CONSTRAINT `linktracker_biblio_ibfk` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4038 CONSTRAINT `linktracker_borrower_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4039 CONSTRAINT `linktracker_item_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL
4040 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4041 /*!40101 SET character_set_client = @saved_cs_client */;
4044 -- Table structure for table `localization`
4047 DROP TABLE IF EXISTS `localization`;
4048 /*!40101 SET @saved_cs_client = @@character_set_client */;
4049 /*!40101 SET character_set_client = utf8 */;
4050 CREATE TABLE `localization` (
4051 `localization_id` int(11) NOT NULL AUTO_INCREMENT,
4052 `entity` varchar(16) NOT NULL,
4053 `code` varchar(64) NOT NULL,
4054 `lang` varchar(25) NOT NULL COMMENT 'could be a foreign key',
4055 `translation` mediumtext DEFAULT NULL,
4056 PRIMARY KEY (`localization_id`),
4057 UNIQUE KEY `entity_code_lang` (`entity`,`code`,`lang`)
4058 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4059 /*!40101 SET character_set_client = @saved_cs_client */;
4062 -- Table structure for table `marc_matchers`
4065 DROP TABLE IF EXISTS `marc_matchers`;
4066 /*!40101 SET @saved_cs_client = @@character_set_client */;
4067 /*!40101 SET character_set_client = utf8 */;
4068 CREATE TABLE `marc_matchers` (
4069 `matcher_id` int(11) NOT NULL AUTO_INCREMENT,
4070 `code` varchar(10) NOT NULL DEFAULT '',
4071 `description` varchar(255) NOT NULL DEFAULT '',
4072 `record_type` varchar(10) NOT NULL DEFAULT 'biblio',
4073 `threshold` int(11) NOT NULL DEFAULT 0,
4074 PRIMARY KEY (`matcher_id`),
4075 KEY `code` (`code`),
4076 KEY `record_type` (`record_type`)
4077 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4078 /*!40101 SET character_set_client = @saved_cs_client */;
4081 -- Table structure for table `marc_modification_template_actions`
4084 DROP TABLE IF EXISTS `marc_modification_template_actions`;
4085 /*!40101 SET @saved_cs_client = @@character_set_client */;
4086 /*!40101 SET character_set_client = utf8 */;
4087 CREATE TABLE `marc_modification_template_actions` (
4088 `mmta_id` int(11) NOT NULL AUTO_INCREMENT,
4089 `template_id` int(11) NOT NULL,
4090 `ordering` int(3) NOT NULL,
4091 `action` enum('delete_field','add_field','update_field','move_field','copy_field','copy_and_replace_field') NOT NULL,
4092 `field_number` smallint(6) NOT NULL DEFAULT 0,
4093 `from_field` varchar(3) NOT NULL,
4094 `from_subfield` varchar(1) DEFAULT NULL,
4095 `field_value` text DEFAULT NULL,
4096 `to_field` varchar(3) DEFAULT NULL,
4097 `to_subfield` varchar(1) DEFAULT NULL,
4098 `to_regex_search` mediumtext DEFAULT NULL,
4099 `to_regex_replace` mediumtext DEFAULT NULL,
4100 `to_regex_modifiers` varchar(8) DEFAULT '',
4101 `conditional` enum('if','unless') DEFAULT NULL,
4102 `conditional_field` varchar(3) DEFAULT NULL,
4103 `conditional_subfield` varchar(1) DEFAULT NULL,
4104 `conditional_comparison` enum('exists','not_exists','equals','not_equals') DEFAULT NULL,
4105 `conditional_value` mediumtext DEFAULT NULL,
4106 `conditional_regex` tinyint(1) NOT NULL DEFAULT 0,
4107 `description` mediumtext DEFAULT NULL,
4108 PRIMARY KEY (`mmta_id`),
4109 KEY `mmta_ibfk_1` (`template_id`),
4110 CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
4111 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4112 /*!40101 SET character_set_client = @saved_cs_client */;
4115 -- Table structure for table `marc_modification_templates`
4118 DROP TABLE IF EXISTS `marc_modification_templates`;
4119 /*!40101 SET @saved_cs_client = @@character_set_client */;
4120 /*!40101 SET character_set_client = utf8 */;
4121 CREATE TABLE `marc_modification_templates` (
4122 `template_id` int(11) NOT NULL AUTO_INCREMENT,
4123 `name` mediumtext NOT NULL,
4124 PRIMARY KEY (`template_id`)
4125 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4126 /*!40101 SET character_set_client = @saved_cs_client */;
4129 -- Table structure for table `marc_overlay_rules`
4132 DROP TABLE IF EXISTS `marc_overlay_rules`;
4133 /*!40101 SET @saved_cs_client = @@character_set_client */;
4134 /*!40101 SET character_set_client = utf8 */;
4135 CREATE TABLE `marc_overlay_rules` (
4136 `id` int(11) NOT NULL AUTO_INCREMENT,
4137 `tag` varchar(255) NOT NULL,
4138 `module` varchar(127) NOT NULL,
4139 `filter` varchar(255) NOT NULL,
4140 `add` tinyint(1) NOT NULL DEFAULT 0,
4141 `append` tinyint(1) NOT NULL DEFAULT 0,
4142 `remove` tinyint(1) NOT NULL DEFAULT 0,
4143 `delete` tinyint(1) NOT NULL DEFAULT 0,
4145 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4146 /*!40101 SET character_set_client = @saved_cs_client */;
4149 -- Table structure for table `marc_subfield_structure`
4152 DROP TABLE IF EXISTS `marc_subfield_structure`;
4153 /*!40101 SET @saved_cs_client = @@character_set_client */;
4154 /*!40101 SET character_set_client = utf8 */;
4155 CREATE TABLE `marc_subfield_structure` (
4156 `tagfield` varchar(3) NOT NULL DEFAULT '',
4157 `tagsubfield` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
4158 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
4159 `libopac` varchar(255) NOT NULL DEFAULT '',
4160 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
4161 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4162 `important` tinyint(4) NOT NULL DEFAULT 0,
4163 `kohafield` varchar(40) DEFAULT NULL,
4164 `tab` tinyint(1) DEFAULT NULL,
4165 `authorised_value` varchar(32) DEFAULT NULL,
4166 `authtypecode` varchar(20) DEFAULT NULL,
4167 `value_builder` varchar(80) DEFAULT NULL,
4168 `isurl` tinyint(1) DEFAULT NULL,
4169 `hidden` tinyint(1) NOT NULL DEFAULT 8,
4170 `frameworkcode` varchar(4) NOT NULL DEFAULT '',
4171 `seealso` varchar(1100) DEFAULT NULL,
4172 `link` varchar(80) DEFAULT NULL,
4173 `defaultvalue` mediumtext DEFAULT NULL,
4174 `maxlength` int(4) NOT NULL DEFAULT 9999,
4175 `display_order` int(2) NOT NULL DEFAULT 0,
4176 PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`),
4177 KEY `kohafield_2` (`kohafield`),
4178 KEY `tab` (`frameworkcode`,`tab`),
4179 KEY `kohafield` (`frameworkcode`,`kohafield`),
4180 KEY `marc_subfield_structure_ibfk_1` (`authorised_value`),
4181 CONSTRAINT `marc_subfield_structure_ibfk_1` FOREIGN KEY (`authorised_value`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE SET NULL ON UPDATE CASCADE
4182 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4183 /*!40101 SET character_set_client = @saved_cs_client */;
4186 -- Table structure for table `marc_tag_structure`
4189 DROP TABLE IF EXISTS `marc_tag_structure`;
4190 /*!40101 SET @saved_cs_client = @@character_set_client */;
4191 /*!40101 SET character_set_client = utf8 */;
4192 CREATE TABLE `marc_tag_structure` (
4193 `tagfield` varchar(3) NOT NULL DEFAULT '',
4194 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
4195 `libopac` varchar(255) NOT NULL DEFAULT '',
4196 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
4197 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4198 `important` tinyint(4) NOT NULL DEFAULT 0,
4199 `authorised_value` varchar(32) DEFAULT NULL,
4200 `ind1_defaultvalue` varchar(1) NOT NULL DEFAULT '',
4201 `ind2_defaultvalue` varchar(1) NOT NULL DEFAULT '',
4202 `frameworkcode` varchar(4) NOT NULL DEFAULT '',
4203 PRIMARY KEY (`frameworkcode`,`tagfield`)
4204 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4205 /*!40101 SET character_set_client = @saved_cs_client */;
4208 -- Table structure for table `matchchecks`
4211 DROP TABLE IF EXISTS `matchchecks`;
4212 /*!40101 SET @saved_cs_client = @@character_set_client */;
4213 /*!40101 SET character_set_client = utf8 */;
4214 CREATE TABLE `matchchecks` (
4215 `matcher_id` int(11) NOT NULL,
4216 `matchcheck_id` int(11) NOT NULL AUTO_INCREMENT,
4217 `source_matchpoint_id` int(11) NOT NULL,
4218 `target_matchpoint_id` int(11) NOT NULL,
4219 PRIMARY KEY (`matchcheck_id`),
4220 KEY `matcher_matchchecks_ifbk_1` (`matcher_id`),
4221 KEY `matcher_matchchecks_ifbk_2` (`source_matchpoint_id`),
4222 KEY `matcher_matchchecks_ifbk_3` (`target_matchpoint_id`),
4223 CONSTRAINT `matcher_matchchecks_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4224 CONSTRAINT `matcher_matchchecks_ifbk_2` FOREIGN KEY (`source_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4225 CONSTRAINT `matcher_matchchecks_ifbk_3` FOREIGN KEY (`target_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4226 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4227 /*!40101 SET character_set_client = @saved_cs_client */;
4230 -- Table structure for table `matcher_matchpoints`
4233 DROP TABLE IF EXISTS `matcher_matchpoints`;
4234 /*!40101 SET @saved_cs_client = @@character_set_client */;
4235 /*!40101 SET character_set_client = utf8 */;
4236 CREATE TABLE `matcher_matchpoints` (
4237 `matcher_id` int(11) NOT NULL,
4238 `matchpoint_id` int(11) NOT NULL,
4239 KEY `matcher_matchpoints_ifbk_1` (`matcher_id`),
4240 KEY `matcher_matchpoints_ifbk_2` (`matchpoint_id`),
4241 CONSTRAINT `matcher_matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4242 CONSTRAINT `matcher_matchpoints_ifbk_2` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4243 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4244 /*!40101 SET character_set_client = @saved_cs_client */;
4247 -- Table structure for table `matchpoint_component_norms`
4250 DROP TABLE IF EXISTS `matchpoint_component_norms`;
4251 /*!40101 SET @saved_cs_client = @@character_set_client */;
4252 /*!40101 SET character_set_client = utf8 */;
4253 CREATE TABLE `matchpoint_component_norms` (
4254 `matchpoint_component_id` int(11) NOT NULL,
4255 `sequence` int(11) NOT NULL DEFAULT 0,
4256 `norm_routine` varchar(50) NOT NULL DEFAULT '',
4257 KEY `matchpoint_component_norms` (`matchpoint_component_id`,`sequence`),
4258 CONSTRAINT `matchpoint_component_norms_ifbk_1` FOREIGN KEY (`matchpoint_component_id`) REFERENCES `matchpoint_components` (`matchpoint_component_id`) ON DELETE CASCADE ON UPDATE CASCADE
4259 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4260 /*!40101 SET character_set_client = @saved_cs_client */;
4263 -- Table structure for table `matchpoint_components`
4266 DROP TABLE IF EXISTS `matchpoint_components`;
4267 /*!40101 SET @saved_cs_client = @@character_set_client */;
4268 /*!40101 SET character_set_client = utf8 */;
4269 CREATE TABLE `matchpoint_components` (
4270 `matchpoint_id` int(11) NOT NULL,
4271 `matchpoint_component_id` int(11) NOT NULL AUTO_INCREMENT,
4272 `sequence` int(11) NOT NULL DEFAULT 0,
4273 `tag` varchar(3) NOT NULL DEFAULT '',
4274 `subfields` varchar(40) NOT NULL DEFAULT '',
4275 `offset` int(4) NOT NULL DEFAULT 0,
4276 `length` int(4) NOT NULL DEFAULT 0,
4277 PRIMARY KEY (`matchpoint_component_id`),
4278 KEY `by_sequence` (`matchpoint_id`,`sequence`),
4279 CONSTRAINT `matchpoint_components_ifbk_1` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4280 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4281 /*!40101 SET character_set_client = @saved_cs_client */;
4284 -- Table structure for table `matchpoints`
4287 DROP TABLE IF EXISTS `matchpoints`;
4288 /*!40101 SET @saved_cs_client = @@character_set_client */;
4289 /*!40101 SET character_set_client = utf8 */;
4290 CREATE TABLE `matchpoints` (
4291 `matcher_id` int(11) NOT NULL,
4292 `matchpoint_id` int(11) NOT NULL AUTO_INCREMENT,
4293 `search_index` varchar(30) NOT NULL DEFAULT '',
4294 `score` int(11) NOT NULL DEFAULT 0,
4295 PRIMARY KEY (`matchpoint_id`),
4296 KEY `matchpoints_ifbk_1` (`matcher_id`),
4297 CONSTRAINT `matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE
4298 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4299 /*!40101 SET character_set_client = @saved_cs_client */;
4302 -- Table structure for table `message_attributes`
4305 DROP TABLE IF EXISTS `message_attributes`;
4306 /*!40101 SET @saved_cs_client = @@character_set_client */;
4307 /*!40101 SET character_set_client = utf8 */;
4308 CREATE TABLE `message_attributes` (
4309 `message_attribute_id` int(11) NOT NULL AUTO_INCREMENT,
4310 `message_name` varchar(40) NOT NULL DEFAULT '',
4311 `takes_days` tinyint(1) NOT NULL DEFAULT 0,
4312 PRIMARY KEY (`message_attribute_id`),
4313 UNIQUE KEY `message_name` (`message_name`)
4314 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4315 /*!40101 SET character_set_client = @saved_cs_client */;
4318 -- Table structure for table `message_queue`
4321 DROP TABLE IF EXISTS `message_queue`;
4322 /*!40101 SET @saved_cs_client = @@character_set_client */;
4323 /*!40101 SET character_set_client = utf8 */;
4324 CREATE TABLE `message_queue` (
4325 `message_id` int(11) NOT NULL AUTO_INCREMENT,
4326 `letter_id` int(11) DEFAULT NULL COMMENT 'Foreign key to the letters table',
4327 `borrowernumber` int(11) DEFAULT NULL,
4328 `subject` mediumtext DEFAULT NULL,
4329 `content` mediumtext DEFAULT NULL,
4330 `metadata` mediumtext DEFAULT NULL,
4331 `letter_code` varchar(64) DEFAULT NULL,
4332 `message_transport_type` varchar(20) NOT NULL,
4333 `status` enum('sent','pending','failed','deleted') NOT NULL DEFAULT 'pending',
4334 `time_queued` timestamp NULL DEFAULT NULL,
4335 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
4336 `to_address` longtext DEFAULT NULL,
4337 `cc_address` longtext DEFAULT NULL,
4338 `from_address` longtext DEFAULT NULL,
4339 `reply_address` longtext DEFAULT NULL,
4340 `content_type` mediumtext DEFAULT NULL,
4341 `failure_code` mediumtext DEFAULT NULL,
4342 PRIMARY KEY (`message_id`),
4343 KEY `borrowernumber` (`borrowernumber`),
4344 KEY `message_transport_type` (`message_transport_type`),
4345 KEY `letter_fk` (`letter_id`),
4346 CONSTRAINT `letter_fk` FOREIGN KEY (`letter_id`) REFERENCES `letter` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
4347 CONSTRAINT `messageq_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4348 CONSTRAINT `messageq_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON UPDATE CASCADE
4349 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4350 /*!40101 SET character_set_client = @saved_cs_client */;
4353 -- Table structure for table `message_transport_types`
4356 DROP TABLE IF EXISTS `message_transport_types`;
4357 /*!40101 SET @saved_cs_client = @@character_set_client */;
4358 /*!40101 SET character_set_client = utf8 */;
4359 CREATE TABLE `message_transport_types` (
4360 `message_transport_type` varchar(20) NOT NULL,
4361 PRIMARY KEY (`message_transport_type`)
4362 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4363 /*!40101 SET character_set_client = @saved_cs_client */;
4366 -- Table structure for table `message_transports`
4369 DROP TABLE IF EXISTS `message_transports`;
4370 /*!40101 SET @saved_cs_client = @@character_set_client */;
4371 /*!40101 SET character_set_client = utf8 */;
4372 CREATE TABLE `message_transports` (
4373 `message_attribute_id` int(11) NOT NULL,
4374 `message_transport_type` varchar(20) NOT NULL,
4375 `is_digest` tinyint(1) NOT NULL DEFAULT 0,
4376 `letter_module` varchar(20) NOT NULL DEFAULT '',
4377 `letter_code` varchar(20) NOT NULL DEFAULT '',
4378 `branchcode` varchar(10) NOT NULL DEFAULT '',
4379 PRIMARY KEY (`message_attribute_id`,`message_transport_type`,`is_digest`),
4380 KEY `message_transport_type` (`message_transport_type`),
4381 KEY `letter_module` (`letter_module`,`letter_code`),
4382 CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4383 CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
4384 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4385 /*!40101 SET character_set_client = @saved_cs_client */;
4388 -- Table structure for table `messages`
4391 DROP TABLE IF EXISTS `messages`;
4392 /*!40101 SET @saved_cs_client = @@character_set_client */;
4393 /*!40101 SET character_set_client = utf8 */;
4394 CREATE TABLE `messages` (
4395 `message_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4396 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking this message to the borrowers table',
4397 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key linking the message to the branches table',
4398 `message_type` varchar(1) NOT NULL COMMENT 'whether the message is for the librarians (L) or the patron (B)',
4399 `message` mediumtext NOT NULL COMMENT 'the text of the message',
4400 `message_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the message was written',
4401 `manager_id` int(11) DEFAULT NULL COMMENT 'creator of message',
4402 `patron_read_date` timestamp NULL DEFAULT NULL COMMENT 'the date and time the patron dismissed the message',
4403 PRIMARY KEY (`message_id`),
4404 KEY `messages_ibfk_1` (`manager_id`),
4405 KEY `messages_borrowernumber` (`borrowernumber`),
4406 CONSTRAINT `messages_borrowernumber` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4407 CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL
4408 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4409 /*!40101 SET character_set_client = @saved_cs_client */;
4412 -- Table structure for table `misc_files`
4415 DROP TABLE IF EXISTS `misc_files`;
4416 /*!40101 SET @saved_cs_client = @@character_set_client */;
4417 /*!40101 SET character_set_client = utf8 */;
4418 CREATE TABLE `misc_files` (
4419 `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the file record',
4420 `table_tag` varchar(255) NOT NULL COMMENT 'usually table name, or arbitrary unique tag',
4421 `record_id` int(11) NOT NULL COMMENT 'record id from the table this file is associated to',
4422 `file_name` varchar(255) NOT NULL COMMENT 'file name',
4423 `file_type` varchar(255) NOT NULL COMMENT 'MIME type of the file',
4424 `file_description` varchar(255) DEFAULT NULL COMMENT 'description given to the file',
4425 `file_content` longblob NOT NULL COMMENT 'file content',
4426 `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
4427 PRIMARY KEY (`file_id`),
4428 KEY `table_tag` (`table_tag`(191)),
4429 KEY `record_id` (`record_id`)
4430 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4431 /*!40101 SET character_set_client = @saved_cs_client */;
4434 -- Table structure for table `need_merge_authorities`
4437 DROP TABLE IF EXISTS `need_merge_authorities`;
4438 /*!40101 SET @saved_cs_client = @@character_set_client */;
4439 /*!40101 SET character_set_client = utf8 */;
4440 CREATE TABLE `need_merge_authorities` (
4441 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id',
4442 `authid` bigint(20) NOT NULL COMMENT 'reference to original authority record',
4443 `authid_new` bigint(20) DEFAULT NULL COMMENT 'reference to optional new authority record',
4444 `reportxml` mediumtext DEFAULT NULL COMMENT 'xml showing original reporting tag',
4445 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time last modified',
4446 `done` tinyint(4) DEFAULT 0,
4448 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4449 /*!40101 SET character_set_client = @saved_cs_client */;
4452 -- Table structure for table `oai_sets`
4455 DROP TABLE IF EXISTS `oai_sets`;
4456 /*!40101 SET @saved_cs_client = @@character_set_client */;
4457 /*!40101 SET character_set_client = utf8 */;
4458 CREATE TABLE `oai_sets` (
4459 `id` int(11) NOT NULL AUTO_INCREMENT,
4460 `spec` varchar(80) NOT NULL,
4461 `name` varchar(80) NOT NULL,
4463 UNIQUE KEY `spec` (`spec`)
4464 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4465 /*!40101 SET character_set_client = @saved_cs_client */;
4468 -- Table structure for table `oai_sets_biblios`
4471 DROP TABLE IF EXISTS `oai_sets_biblios`;
4472 /*!40101 SET @saved_cs_client = @@character_set_client */;
4473 /*!40101 SET character_set_client = utf8 */;
4474 CREATE TABLE `oai_sets_biblios` (
4475 `biblionumber` int(11) NOT NULL,
4476 `set_id` int(11) NOT NULL,
4477 PRIMARY KEY (`biblionumber`,`set_id`),
4478 KEY `oai_sets_biblios_ibfk_2` (`set_id`),
4479 CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4480 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4481 /*!40101 SET character_set_client = @saved_cs_client */;
4484 -- Table structure for table `oai_sets_descriptions`
4487 DROP TABLE IF EXISTS `oai_sets_descriptions`;
4488 /*!40101 SET @saved_cs_client = @@character_set_client */;
4489 /*!40101 SET character_set_client = utf8 */;
4490 CREATE TABLE `oai_sets_descriptions` (
4491 `set_id` int(11) NOT NULL,
4492 `description` varchar(255) NOT NULL,
4493 KEY `oai_sets_descriptions_ibfk_1` (`set_id`),
4494 CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4495 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4496 /*!40101 SET character_set_client = @saved_cs_client */;
4499 -- Table structure for table `oai_sets_mappings`
4502 DROP TABLE IF EXISTS `oai_sets_mappings`;
4503 /*!40101 SET @saved_cs_client = @@character_set_client */;
4504 /*!40101 SET character_set_client = utf8 */;
4505 CREATE TABLE `oai_sets_mappings` (
4506 `set_id` int(11) NOT NULL,
4507 `rule_order` int(11) DEFAULT NULL,
4508 `rule_operator` varchar(3) DEFAULT NULL,
4509 `marcfield` char(3) NOT NULL,
4510 `marcsubfield` char(1) NOT NULL,
4511 `operator` varchar(8) NOT NULL DEFAULT 'equal',
4512 `marcvalue` varchar(80) NOT NULL,
4513 KEY `oai_sets_mappings_ibfk_1` (`set_id`),
4514 CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4515 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4516 /*!40101 SET character_set_client = @saved_cs_client */;
4519 -- Table structure for table `oauth_access_tokens`
4522 DROP TABLE IF EXISTS `oauth_access_tokens`;
4523 /*!40101 SET @saved_cs_client = @@character_set_client */;
4524 /*!40101 SET character_set_client = utf8 */;
4525 CREATE TABLE `oauth_access_tokens` (
4526 `access_token` varchar(191) NOT NULL COMMENT 'generarated access token',
4527 `client_id` varchar(191) NOT NULL COMMENT 'the client id the access token belongs to',
4528 `expires` int(11) NOT NULL COMMENT 'expiration time in seconds',
4529 PRIMARY KEY (`access_token`)
4530 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4531 /*!40101 SET character_set_client = @saved_cs_client */;
4534 -- Table structure for table `old_issues`
4537 DROP TABLE IF EXISTS `old_issues`;
4538 /*!40101 SET @saved_cs_client = @@character_set_client */;
4539 /*!40101 SET character_set_client = utf8 */;
4540 CREATE TABLE `old_issues` (
4541 `issue_id` int(11) NOT NULL COMMENT 'primary key for issues table',
4542 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
4543 `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
4544 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
4545 `date_due` datetime DEFAULT NULL COMMENT 'date the item is due (yyyy-mm-dd)',
4546 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
4547 `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned',
4548 `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
4549 `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
4550 `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
4551 `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
4552 `auto_renew_error` varchar(32) DEFAULT NULL COMMENT 'automatic renewal error',
4553 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
4554 `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
4555 `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
4556 `note` longtext DEFAULT NULL COMMENT 'issue note text',
4557 `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
4558 `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
4559 PRIMARY KEY (`issue_id`),
4560 KEY `old_issuesborridx` (`borrowernumber`),
4561 KEY `old_issuesitemidx` (`itemnumber`),
4562 KEY `branchcode_idx` (`branchcode`),
4563 KEY `old_bordate` (`borrowernumber`,`timestamp`),
4564 KEY `old_issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
4565 CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4566 CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4567 CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL 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 `old_reserves`
4575 DROP TABLE IF EXISTS `old_reserves`;
4576 /*!40101 SET @saved_cs_client = @@character_set_client */;
4577 /*!40101 SET character_set_client = utf8 */;
4578 CREATE TABLE `old_reserves` (
4579 `reserve_id` int(11) NOT NULL COMMENT 'primary key',
4580 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4581 `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places',
4582 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4583 `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
4584 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
4585 `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4586 `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4587 `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4588 `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4589 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4590 `reservenotes` longtext DEFAULT NULL COMMENT 'notes related to this hold',
4591 `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4592 `found` varchar(1) DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
4593 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4594 `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',
4595 `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4596 `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)',
4597 `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',
4598 `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)',
4599 `suspend` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'in this hold suspended (1 for yes, 0 for no)',
4600 `suspend_until` datetime DEFAULT NULL COMMENT 'the date this hold is suspended until (NULL for infinitely)',
4601 `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4602 `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
4603 `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4604 PRIMARY KEY (`reserve_id`),
4605 KEY `old_reserves_borrowernumber` (`borrowernumber`),
4606 KEY `old_reserves_biblionumber` (`biblionumber`),
4607 KEY `old_reserves_itemnumber` (`itemnumber`),
4608 KEY `old_reserves_branchcode` (`branchcode`),
4609 KEY `old_reserves_itemtype` (`itemtype`),
4610 KEY `old_reserves_ibfk_ig` (`item_group_id`),
4611 CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4612 CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4613 CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4614 CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
4615 CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
4616 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4617 /*!40101 SET character_set_client = @saved_cs_client */;
4620 -- Table structure for table `overduerules`
4623 DROP TABLE IF EXISTS `overduerules`;
4624 /*!40101 SET @saved_cs_client = @@character_set_client */;
4625 /*!40101 SET character_set_client = utf8 */;
4626 CREATE TABLE `overduerules` (
4627 `overduerules_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the overduerules',
4628 `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)',
4629 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table to define which patron category this rule is for',
4630 `delay1` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the first notice is sent',
4631 `letter1` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the first notice',
4632 `debarred1` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the first notice is sent (1 for yes, 0 for no)',
4633 `delay2` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the second notice is sent',
4634 `debarred2` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the second notice is sent (1 for yes, 0 for no)',
4635 `letter2` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the second notice',
4636 `delay3` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the third notice is sent',
4637 `letter3` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the third notice',
4638 `debarred3` int(1) DEFAULT 0 COMMENT 'is the patron restricted when the third notice is sent (1 for yes, 0 for no)',
4639 PRIMARY KEY (`overduerules_id`),
4640 UNIQUE KEY `overduerules_branch_cat` (`branchcode`,`categorycode`)
4641 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4642 /*!40101 SET character_set_client = @saved_cs_client */;
4645 -- Table structure for table `overduerules_transport_types`
4648 DROP TABLE IF EXISTS `overduerules_transport_types`;
4649 /*!40101 SET @saved_cs_client = @@character_set_client */;
4650 /*!40101 SET character_set_client = utf8 */;
4651 CREATE TABLE `overduerules_transport_types` (
4652 `id` int(11) NOT NULL AUTO_INCREMENT,
4653 `letternumber` int(1) NOT NULL DEFAULT 1,
4654 `message_transport_type` varchar(20) NOT NULL DEFAULT 'email',
4655 `overduerules_id` int(11) NOT NULL,
4657 KEY `overduerules_fk` (`overduerules_id`),
4658 KEY `mtt_fk` (`message_transport_type`),
4659 CONSTRAINT `mtt_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
4660 CONSTRAINT `overduerules_fk` FOREIGN KEY (`overduerules_id`) REFERENCES `overduerules` (`overduerules_id`) ON DELETE CASCADE ON UPDATE CASCADE
4661 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4662 /*!40101 SET character_set_client = @saved_cs_client */;
4665 -- Table structure for table `patron_consent`
4668 DROP TABLE IF EXISTS `patron_consent`;
4669 /*!40101 SET @saved_cs_client = @@character_set_client */;
4670 /*!40101 SET character_set_client = utf8 */;
4671 CREATE TABLE `patron_consent` (
4672 `id` int(11) NOT NULL AUTO_INCREMENT,
4673 `borrowernumber` int(11) NOT NULL,
4674 `type` enum('GDPR_PROCESSING') DEFAULT NULL COMMENT 'allows for future extension',
4675 `given_on` datetime DEFAULT NULL,
4676 `refused_on` datetime DEFAULT NULL,
4678 KEY `borrowernumber` (`borrowernumber`),
4679 CONSTRAINT `patron_consent_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4680 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4681 /*!40101 SET character_set_client = @saved_cs_client */;
4684 -- Table structure for table `patron_list_patrons`
4687 DROP TABLE IF EXISTS `patron_list_patrons`;
4688 /*!40101 SET @saved_cs_client = @@character_set_client */;
4689 /*!40101 SET character_set_client = utf8 */;
4690 CREATE TABLE `patron_list_patrons` (
4691 `patron_list_patron_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
4692 `patron_list_id` int(11) NOT NULL COMMENT 'the list this entry is part of',
4693 `borrowernumber` int(11) NOT NULL COMMENT 'the borrower that is part of this list',
4694 PRIMARY KEY (`patron_list_patron_id`),
4695 KEY `patron_list_id` (`patron_list_id`),
4696 KEY `borrowernumber` (`borrowernumber`),
4697 CONSTRAINT `patron_list_patrons_ibfk_1` FOREIGN KEY (`patron_list_id`) REFERENCES `patron_lists` (`patron_list_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4698 CONSTRAINT `patron_list_patrons_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4699 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4700 /*!40101 SET character_set_client = @saved_cs_client */;
4703 -- Table structure for table `patron_lists`
4706 DROP TABLE IF EXISTS `patron_lists`;
4707 /*!40101 SET @saved_cs_client = @@character_set_client */;
4708 /*!40101 SET character_set_client = utf8 */;
4709 CREATE TABLE `patron_lists` (
4710 `patron_list_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
4711 `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'the list''s name',
4712 `owner` int(11) NOT NULL COMMENT 'borrowernumber of the list creator',
4713 `shared` tinyint(1) DEFAULT 0,
4714 PRIMARY KEY (`patron_list_id`),
4715 KEY `owner` (`owner`),
4716 CONSTRAINT `patron_lists_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4717 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4718 /*!40101 SET character_set_client = @saved_cs_client */;
4721 -- Table structure for table `patronimage`
4724 DROP TABLE IF EXISTS `patronimage`;
4725 /*!40101 SET @saved_cs_client = @@character_set_client */;
4726 /*!40101 SET character_set_client = utf8 */;
4727 CREATE TABLE `patronimage` (
4728 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron this image is attached to (borrowers.borrowernumber)',
4729 `mimetype` varchar(15) NOT NULL COMMENT 'the format of the image (png, jpg, etc)',
4730 `imagefile` mediumblob NOT NULL COMMENT 'the image',
4731 PRIMARY KEY (`borrowernumber`),
4732 CONSTRAINT `patronimage_fk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4733 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4734 /*!40101 SET character_set_client = @saved_cs_client */;
4737 -- Table structure for table `pending_offline_operations`
4740 DROP TABLE IF EXISTS `pending_offline_operations`;
4741 /*!40101 SET @saved_cs_client = @@character_set_client */;
4742 /*!40101 SET character_set_client = utf8 */;
4743 CREATE TABLE `pending_offline_operations` (
4744 `operationid` int(11) NOT NULL AUTO_INCREMENT,
4745 `userid` varchar(30) NOT NULL,
4746 `branchcode` varchar(10) NOT NULL,
4747 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
4748 `action` varchar(10) NOT NULL,
4749 `barcode` varchar(20) DEFAULT NULL,
4750 `cardnumber` varchar(32) DEFAULT NULL,
4751 `amount` decimal(28,6) DEFAULT NULL,
4752 PRIMARY KEY (`operationid`)
4753 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4754 /*!40101 SET character_set_client = @saved_cs_client */;
4757 -- Table structure for table `permissions`
4760 DROP TABLE IF EXISTS `permissions`;
4761 /*!40101 SET @saved_cs_client = @@character_set_client */;
4762 /*!40101 SET character_set_client = utf8 */;
4763 CREATE TABLE `permissions` (
4764 `module_bit` int(11) NOT NULL DEFAULT 0,
4765 `code` varchar(64) NOT NULL DEFAULT '',
4766 `description` varchar(255) DEFAULT NULL,
4767 PRIMARY KEY (`module_bit`,`code`),
4768 CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`) ON DELETE CASCADE ON UPDATE CASCADE
4769 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4770 /*!40101 SET character_set_client = @saved_cs_client */;
4773 -- Table structure for table `plugin_data`
4776 DROP TABLE IF EXISTS `plugin_data`;
4777 /*!40101 SET @saved_cs_client = @@character_set_client */;
4778 /*!40101 SET character_set_client = utf8 */;
4779 CREATE TABLE `plugin_data` (
4780 `plugin_class` varchar(255) NOT NULL,
4781 `plugin_key` varchar(255) NOT NULL,
4782 `plugin_value` mediumtext DEFAULT NULL,
4783 PRIMARY KEY (`plugin_class`(191),`plugin_key`(191))
4784 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4785 /*!40101 SET character_set_client = @saved_cs_client */;
4788 -- Table structure for table `plugin_methods`
4791 DROP TABLE IF EXISTS `plugin_methods`;
4792 /*!40101 SET @saved_cs_client = @@character_set_client */;
4793 /*!40101 SET character_set_client = utf8 */;
4794 CREATE TABLE `plugin_methods` (
4795 `plugin_class` varchar(255) NOT NULL,
4796 `plugin_method` varchar(255) NOT NULL,
4797 PRIMARY KEY (`plugin_class`(191),`plugin_method`(191))
4798 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4799 /*!40101 SET character_set_client = @saved_cs_client */;
4802 -- Table structure for table `preservation_trains`
4805 DROP TABLE IF EXISTS `preservation_trains`;
4806 /*!40101 SET @saved_cs_client = @@character_set_client */;
4807 /*!40101 SET character_set_client = utf8 */;
4808 CREATE TABLE `preservation_trains` (
4809 `train_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4810 `name` varchar(80) NOT NULL COMMENT 'name of the train',
4811 `description` varchar(255) NULL COMMENT 'description of the train',
4812 `default_processing_id` int(11) NULL COMMENT 'default processing, link to preservation_processings.processing_id',
4813 `not_for_loan` varchar(80) NOT NULL DEFAULT 0 COMMENT 'NOT_LOAN authorised value to apply toitem added to this train',
4814 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'creation date',
4815 `closed_on` datetime DEFAULT NULL COMMENT 'closing date',
4816 `sent_on` datetime DEFAULT NULL COMMENT 'sending date',
4817 `received_on` datetime DEFAULT NULL COMMENT 'receiving date',
4818 PRIMARY KEY (`train_id`),
4819 CONSTRAINT `preservation_trains_ibfk_1` FOREIGN KEY (`default_processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE SET NULL ON UPDATE CASCADE
4820 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4821 /*!40101 SET character_set_client = @saved_cs_client */;
4824 -- Table structure for table `preservation_processings`
4827 DROP TABLE IF EXISTS `preservation_processings`;
4828 /*!40101 SET @saved_cs_client = @@character_set_client */;
4829 /*!40101 SET character_set_client = utf8 */;
4830 CREATE TABLE `preservation_processings` (
4831 `processing_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4832 `name` varchar(80) NOT NULL COMMENT 'name of the processing',
4833 PRIMARY KEY (`processing_id`)
4834 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4835 /*!40101 SET character_set_client = @saved_cs_client */;
4838 -- Table structure for table `preservation_processing_attributes`
4841 DROP TABLE IF EXISTS `preservation_processing_attributes`;
4842 /*!40101 SET @saved_cs_client = @@character_set_client */;
4843 /*!40101 SET character_set_client = utf8 */;
4844 CREATE TABLE `preservation_processing_attributes` (
4845 `processing_attribute_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4846 `processing_id` int(11) NOT NULL COMMENT 'link to the processing',
4847 `name` varchar(80) NOT NULL COMMENT 'name of the processing attribute',
4848 `type` enum('authorised_value', 'free_text', 'db_column') NOT NULL COMMENT 'Type of the processing attribute',
4849 `option_source` varchar(80) NULL COMMENT 'source of the possible options for this attribute',
4850 PRIMARY KEY (`processing_attribute_id`),
4851 CONSTRAINT `preservation_processing_attributes_ibfk_1` FOREIGN KEY (`processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE CASCADE ON UPDATE CASCADE
4852 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4853 /*!40101 SET character_set_client = @saved_cs_client */;
4856 -- Table structure for table `preservation_processing_attributes_items`
4859 DROP TABLE IF EXISTS `preservation_processing_attributes_items`;
4860 /*!40101 SET @saved_cs_client = @@character_set_client */;
4861 /*!40101 SET character_set_client = utf8 */;
4862 CREATE TABLE `preservation_processing_attributes_items` (
4863 `processing_attribute_item_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4864 `processing_attribute_id` int(11) NOT NULL COMMENT 'link with preservation_processing_attributes',
4865 `train_item_id` int(11) NOT NULL COMMENT 'link with preservation_trains_items',
4866 `value` varchar(255) NULL COMMENT 'value for this attribute',
4867 PRIMARY KEY (`processing_attribute_item_id`),
4868 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,
4869 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
4870 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4871 /*!40101 SET character_set_client = @saved_cs_client */;
4874 -- Table structure for table `preservation_trains_items`
4877 DROP TABLE IF EXISTS `preservation_trains_items`;
4878 /*!40101 SET @saved_cs_client = @@character_set_client */;
4879 /*!40101 SET character_set_client = utf8 */;
4880 CREATE TABLE `preservation_trains_items` (
4881 `train_item_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4882 `train_id` int(11) NOT NULL COMMENT 'link with preservation_train',
4883 `item_id` int(11) NOT NULL COMMENT 'link with items',
4884 `processing_id` int(11) NULL COMMENT 'specific processing for this item',
4885 `user_train_item_id` int(11) NOT NULL COMMENT 'train item id for this train, starts from 1',
4886 `added_on` datetime DEFAULT NULL COMMENT 'added date',
4887 PRIMARY KEY (`train_item_id`),
4888 UNIQUE KEY (`train_id`,`item_id`),
4889 CONSTRAINT `preservation_item_ibfk_1` FOREIGN KEY (`train_id`) REFERENCES `preservation_trains` (`train_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4890 CONSTRAINT `preservation_item_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4891 CONSTRAINT `preservation_item_ibfk_3` FOREIGN KEY (`processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE SET NULL ON UPDATE CASCADE
4892 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4893 /*!40101 SET character_set_client = @saved_cs_client */;
4896 -- Table structure for table `printers_profile`
4899 DROP TABLE IF EXISTS `printers_profile`;
4900 /*!40101 SET @saved_cs_client = @@character_set_client */;
4901 /*!40101 SET character_set_client = utf8 */;
4902 CREATE TABLE `printers_profile` (
4903 `profile_id` int(4) NOT NULL AUTO_INCREMENT,
4904 `printer_name` varchar(40) NOT NULL DEFAULT 'Default Printer',
4905 `template_id` int(4) NOT NULL DEFAULT 0,
4906 `paper_bin` varchar(20) NOT NULL DEFAULT 'Bypass',
4907 `offset_horz` float NOT NULL DEFAULT 0,
4908 `offset_vert` float NOT NULL DEFAULT 0,
4909 `creep_horz` float NOT NULL DEFAULT 0,
4910 `creep_vert` float NOT NULL DEFAULT 0,
4911 `units` char(20) NOT NULL DEFAULT 'POINT',
4912 `creator` char(15) NOT NULL DEFAULT 'Labels',
4913 PRIMARY KEY (`profile_id`),
4914 UNIQUE KEY `printername` (`printer_name`,`template_id`,`paper_bin`,`creator`)
4915 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4916 /*!40101 SET character_set_client = @saved_cs_client */;
4919 -- Table structure for table `problem_reports`
4922 DROP TABLE IF EXISTS `problem_reports`;
4923 /*!40101 SET @saved_cs_client = @@character_set_client */;
4924 /*!40101 SET character_set_client = utf8 */;
4925 CREATE TABLE `problem_reports` (
4926 `reportid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4927 `title` varchar(40) NOT NULL DEFAULT '' COMMENT 'report subject line',
4928 `content` text NOT NULL COMMENT 'report message content',
4929 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the user who created the problem report',
4930 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'borrower''s branch',
4931 `username` varchar(75) DEFAULT NULL COMMENT 'OPAC username',
4932 `problempage` text DEFAULT NULL COMMENT 'page the user triggered the problem report form from',
4933 `recipient` enum('admin','library') NOT NULL DEFAULT 'library' COMMENT 'the ''to-address'' of the problem report',
4934 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'timestamp of report submission',
4935 `status` varchar(6) NOT NULL DEFAULT 'New' COMMENT 'status of the report. New, Viewed, Closed',
4936 PRIMARY KEY (`reportid`),
4937 KEY `problem_reports_ibfk1` (`borrowernumber`),
4938 KEY `problem_reports_ibfk2` (`branchcode`),
4939 CONSTRAINT `problem_reports_ibfk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4940 CONSTRAINT `problem_reports_ibfk2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4941 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4942 /*!40101 SET character_set_client = @saved_cs_client */;
4945 -- Table structure for table `pseudonymized_borrower_attributes`
4948 DROP TABLE IF EXISTS `pseudonymized_borrower_attributes`;
4949 /*!40101 SET @saved_cs_client = @@character_set_client */;
4950 /*!40101 SET character_set_client = utf8 */;
4951 CREATE TABLE `pseudonymized_borrower_attributes` (
4952 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
4953 `transaction_id` int(11) NOT NULL,
4954 `code` varchar(10) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
4955 `attribute` varchar(255) DEFAULT NULL COMMENT 'custom patron field value',
4957 KEY `pseudonymized_borrower_attributes_ibfk_1` (`transaction_id`),
4958 KEY `anonymized_borrower_attributes_ibfk_2` (`code`),
4959 CONSTRAINT `anonymized_borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
4960 CONSTRAINT `pseudonymized_borrower_attributes_ibfk_1` FOREIGN KEY (`transaction_id`) REFERENCES `pseudonymized_transactions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4961 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4962 /*!40101 SET character_set_client = @saved_cs_client */;
4965 -- Table structure for table `pseudonymized_transactions`
4968 DROP TABLE IF EXISTS `pseudonymized_transactions`;
4969 /*!40101 SET @saved_cs_client = @@character_set_client */;
4970 /*!40101 SET character_set_client = utf8 */;
4971 CREATE TABLE `pseudonymized_transactions` (
4972 `id` int(11) NOT NULL AUTO_INCREMENT,
4973 `hashed_borrowernumber` varchar(60) NOT NULL,
4974 `has_cardnumber` tinyint(1) NOT NULL DEFAULT 0,
4975 `title` longtext DEFAULT NULL,
4976 `city` longtext DEFAULT NULL,
4977 `state` mediumtext DEFAULT NULL,
4978 `zipcode` varchar(25) DEFAULT NULL,
4979 `country` mediumtext DEFAULT NULL,
4980 `branchcode` varchar(10) NOT NULL DEFAULT '',
4981 `categorycode` varchar(10) NOT NULL DEFAULT '',
4982 `dateenrolled` date DEFAULT NULL,
4983 `sex` varchar(1) DEFAULT NULL,
4984 `sort1` varchar(80) DEFAULT NULL,
4985 `sort2` varchar(80) DEFAULT NULL,
4986 `datetime` datetime DEFAULT NULL,
4987 `transaction_branchcode` varchar(10) DEFAULT NULL,
4988 `transaction_type` varchar(16) DEFAULT NULL,
4989 `itemnumber` int(11) DEFAULT NULL,
4990 `itemtype` varchar(10) DEFAULT NULL,
4991 `holdingbranch` varchar(10) DEFAULT NULL,
4992 `homebranch` varchar(10) DEFAULT NULL,
4993 `location` varchar(80) DEFAULT NULL,
4994 `itemcallnumber` varchar(255) DEFAULT NULL,
4995 `ccode` varchar(80) DEFAULT NULL,
4997 KEY `pseudonymized_transactions_ibfk_1` (`categorycode`),
4998 KEY `pseudonymized_transactions_borrowers_ibfk_2` (`branchcode`),
4999 KEY `pseudonymized_transactions_borrowers_ibfk_3` (`transaction_branchcode`)
5000 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5001 /*!40101 SET character_set_client = @saved_cs_client */;
5004 -- Table structure for table `quotes`
5007 DROP TABLE IF EXISTS `quotes`;
5008 /*!40101 SET @saved_cs_client = @@character_set_client */;
5009 /*!40101 SET character_set_client = utf8 */;
5010 CREATE TABLE `quotes` (
5011 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the quote',
5012 `source` mediumtext DEFAULT NULL COMMENT 'source/credit for the quote',
5013 `text` longtext NOT NULL COMMENT 'text of the quote',
5014 `timestamp` datetime DEFAULT NULL COMMENT 'date and time that the quote last appeared in the opac',
5016 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5017 /*!40101 SET character_set_client = @saved_cs_client */;
5020 -- Table structure for table `ratings`
5023 DROP TABLE IF EXISTS `ratings`;
5024 /*!40101 SET @saved_cs_client = @@character_set_client */;
5025 /*!40101 SET character_set_client = utf8 */;
5026 CREATE TABLE `ratings` (
5027 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron who left this rating (borrowers.borrowernumber)',
5028 `biblionumber` int(11) NOT NULL COMMENT 'the biblio this rating is for (biblio.biblionumber)',
5029 `rating_value` tinyint(1) NOT NULL COMMENT 'the rating, from 1 to 5',
5030 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
5031 PRIMARY KEY (`borrowernumber`,`biblionumber`),
5032 KEY `ratings_ibfk_2` (`biblionumber`),
5033 CONSTRAINT `ratings_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5034 CONSTRAINT `ratings_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5035 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5036 /*!40101 SET character_set_client = @saved_cs_client */;
5039 -- Table structure for table `recalls`
5042 DROP TABLE IF EXISTS `recalls`;
5043 /*!40101 SET @saved_cs_client = @@character_set_client */;
5044 /*!40101 SET character_set_client = utf8 */;
5045 CREATE TABLE `recalls` (
5046 `recall_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier for this recall',
5047 `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Identifier for patron who requested recall',
5048 `created_date` datetime DEFAULT NULL COMMENT 'Date the recall was requested',
5049 `biblio_id` int(11) NOT NULL COMMENT 'Identifier for bibliographic record that has been recalled',
5050 `pickup_library_id` varchar(10) DEFAULT NULL COMMENT 'Identifier for recall pickup library',
5051 `completed_date` datetime DEFAULT NULL COMMENT 'Date the recall is completed (fulfilled, cancelled or expired)',
5052 `notes` mediumtext DEFAULT NULL COMMENT 'Notes related to the recall',
5053 `priority` smallint(6) DEFAULT NULL COMMENT 'Where in the queue the patron sits',
5054 `status` enum('requested','overdue','waiting','in_transit','cancelled','expired','fulfilled') DEFAULT 'requested' COMMENT 'Status of recall',
5055 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time the recall was last updated',
5056 `item_id` int(11) DEFAULT NULL COMMENT 'Identifier for item record that was recalled, if an item-level recall',
5057 `waiting_date` datetime DEFAULT NULL COMMENT 'Date an item was marked as waiting for the patron at the library',
5058 `expiration_date` datetime DEFAULT NULL COMMENT 'Date recall is no longer required, or date recall will expire after waiting on shelf for pickup',
5059 `completed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is old and no longer active, i.e. expired, cancelled or completed',
5060 `item_level` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is for a specific item',
5061 PRIMARY KEY (`recall_id`),
5062 KEY `recalls_ibfk_1` (`patron_id`),
5063 KEY `recalls_ibfk_2` (`biblio_id`),
5064 KEY `recalls_ibfk_3` (`item_id`),
5065 KEY `recalls_ibfk_4` (`pickup_library_id`),
5066 CONSTRAINT `recalls_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5067 CONSTRAINT `recalls_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5068 CONSTRAINT `recalls_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5069 CONSTRAINT `recalls_ibfk_4` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5070 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Information related to recalls in Koha';
5071 /*!40101 SET character_set_client = @saved_cs_client */;
5074 -- Table structure for table `repeatable_holidays`
5077 DROP TABLE IF EXISTS `repeatable_holidays`;
5078 /*!40101 SET @saved_cs_client = @@character_set_client */;
5079 /*!40101 SET character_set_client = utf8 */;
5080 CREATE TABLE `repeatable_holidays` (
5081 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5082 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
5083 `weekday` smallint(6) DEFAULT NULL COMMENT 'day of the week (0=Sunday, 1=Monday, etc) this closing is repeated on',
5084 `day` smallint(6) DEFAULT NULL COMMENT 'day of the month this closing is on',
5085 `month` smallint(6) DEFAULT NULL COMMENT 'month this closing is in',
5086 `title` varchar(50) NOT NULL DEFAULT '' COMMENT 'title of this closing',
5087 `description` mediumtext NOT NULL COMMENT 'description for this closing',
5089 KEY `repeatable_holidays_ibfk_1` (`branchcode`),
5090 CONSTRAINT `repeatable_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5091 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5092 /*!40101 SET character_set_client = @saved_cs_client */;
5095 -- Table structure for table `reports_dictionary`
5098 DROP TABLE IF EXISTS `reports_dictionary`;
5099 /*!40101 SET @saved_cs_client = @@character_set_client */;
5100 /*!40101 SET character_set_client = utf8 */;
5101 CREATE TABLE `reports_dictionary` (
5102 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5103 `name` varchar(255) DEFAULT NULL COMMENT 'name for this definition',
5104 `description` mediumtext DEFAULT NULL COMMENT 'description for this definition',
5105 `date_created` datetime DEFAULT NULL COMMENT 'date and time this definition was created',
5106 `date_modified` datetime DEFAULT NULL COMMENT 'date and time this definition was last modified',
5107 `saved_sql` mediumtext DEFAULT NULL COMMENT 'SQL snippet for us in reports',
5108 `report_area` varchar(6) DEFAULT NULL COMMENT 'Koha module this definition is for Circulation, Catalog, Patrons, Acquistions, Accounts)',
5110 KEY `dictionary_area_idx` (`report_area`)
5111 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5112 /*!40101 SET character_set_client = @saved_cs_client */;
5115 -- Table structure for table `reserves`
5118 DROP TABLE IF EXISTS `reserves`;
5119 /*!40101 SET @saved_cs_client = @@character_set_client */;
5120 /*!40101 SET character_set_client = utf8 */;
5121 CREATE TABLE `reserves` (
5122 `reserve_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
5123 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
5124 `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
5125 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
5126 `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
5127 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
5128 `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
5129 `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
5130 `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
5131 `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
5132 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
5133 `reservenotes` longtext DEFAULT NULL COMMENT 'notes related to this hold',
5134 `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
5135 `found` varchar(1) DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
5136 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
5137 `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',
5138 `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
5139 `expirationdate` date DEFAULT NULL COMMENT 'the date the hold expires (calculated value)',
5140 `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',
5141 `lowestPriority` tinyint(1) NOT NULL DEFAULT 0,
5142 `suspend` tinyint(1) NOT NULL DEFAULT 0,
5143 `suspend_until` datetime DEFAULT NULL,
5144 `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
5145 `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
5146 `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
5147 PRIMARY KEY (`reserve_id`),
5148 KEY `priorityfoundidx` (`priority`,`found`),
5149 KEY `borrowernumber` (`borrowernumber`),
5150 KEY `biblionumber` (`biblionumber`),
5151 KEY `itemnumber` (`itemnumber`),
5152 KEY `branchcode` (`branchcode`),
5153 KEY `desk_id` (`desk_id`),
5154 KEY `itemtype` (`itemtype`),
5155 KEY `reserves_ibfk_ig` (`item_group_id`),
5156 CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5157 CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5158 CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5159 CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5160 CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
5161 CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5162 CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE
5163 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5164 /*!40101 SET character_set_client = @saved_cs_client */;
5167 -- Table structure for table `restriction_types`
5170 DROP TABLE IF EXISTS `restriction_types`;
5171 /*!40101 SET @saved_cs_client = @@character_set_client */;
5172 /*!40101 SET character_set_client = utf8 */;
5173 CREATE TABLE `restriction_types` (
5174 `code` varchar(50) NOT NULL,
5175 `display_text` text NOT NULL,
5176 `is_system` tinyint(1) NOT NULL DEFAULT 0,
5177 `is_default` tinyint(1) NOT NULL DEFAULT 0,
5178 `lift_after_payment` tinyint(1) NOT NULL DEFAULT 0,
5179 `fee_limit` decimal(28,6) DEFAULT NULL,
5180 PRIMARY KEY (`code`)
5181 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5182 /*!40101 SET character_set_client = @saved_cs_client */;
5185 -- Table structure for table `return_claims`
5188 DROP TABLE IF EXISTS `return_claims`;
5189 /*!40101 SET @saved_cs_client = @@character_set_client */;
5190 /*!40101 SET character_set_client = utf8 */;
5191 CREATE TABLE `return_claims` (
5192 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the return claim',
5193 `itemnumber` int(11) NOT NULL COMMENT 'ID of the item',
5194 `issue_id` int(11) DEFAULT NULL COMMENT 'ID of the checkout that triggered the claim',
5195 `borrowernumber` int(11) NOT NULL COMMENT 'ID of the patron',
5196 `notes` mediumtext DEFAULT NULL COMMENT 'Notes about the claim',
5197 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was created',
5198 `created_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that registered the claim',
5199 `updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the claim (notes)',
5200 `updated_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that updated the claim',
5201 `resolution` varchar(80) DEFAULT NULL COMMENT 'Resolution code (RETURN_CLAIM_RESOLUTION AVs)',
5202 `resolved_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was resolved',
5203 `resolved_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that resolved the claim',
5205 UNIQUE KEY `item_issue` (`itemnumber`,`issue_id`),
5206 KEY `itemnumber` (`itemnumber`),
5207 KEY `rc_borrowers_ibfk` (`borrowernumber`),
5208 KEY `rc_created_by_ibfk` (`created_by`),
5209 KEY `rc_updated_by_ibfk` (`updated_by`),
5210 KEY `rc_resolved_by_ibfk` (`resolved_by`),
5211 CONSTRAINT `rc_borrowers_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5212 CONSTRAINT `rc_created_by_ibfk` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5213 CONSTRAINT `rc_items_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5214 CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5215 CONSTRAINT `rc_updated_by_ibfk` FOREIGN KEY (`updated_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5216 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5217 /*!40101 SET character_set_client = @saved_cs_client */;
5220 -- Table structure for table `reviews`
5223 DROP TABLE IF EXISTS `reviews`;
5224 /*!40101 SET @saved_cs_client = @@character_set_client */;
5225 /*!40101 SET character_set_client = utf8 */;
5226 CREATE TABLE `reviews` (
5227 `reviewid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for this comment',
5228 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron left this comment',
5229 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bibliographic record this comment is for',
5230 `review` mediumtext DEFAULT NULL COMMENT 'the body of the comment',
5231 `approved` tinyint(4) DEFAULT 0 COMMENT 'whether this comment has been approved by a librarian (1 for yes, 0 for no)',
5232 `datereviewed` datetime DEFAULT NULL COMMENT 'the date the comment was left',
5233 PRIMARY KEY (`reviewid`),
5234 KEY `reviews_ibfk_1` (`borrowernumber`),
5235 KEY `reviews_ibfk_2` (`biblionumber`),
5236 CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5237 CONSTRAINT `reviews_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5238 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5239 /*!40101 SET character_set_client = @saved_cs_client */;
5242 -- Table structure for table `saved_reports`
5245 DROP TABLE IF EXISTS `saved_reports`;
5246 /*!40101 SET @saved_cs_client = @@character_set_client */;
5247 /*!40101 SET character_set_client = utf8 */;
5248 CREATE TABLE `saved_reports` (
5249 `id` int(11) NOT NULL AUTO_INCREMENT,
5250 `report_id` int(11) DEFAULT NULL,
5251 `report` longtext DEFAULT NULL,
5252 `date_run` datetime DEFAULT NULL,
5254 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5255 /*!40101 SET character_set_client = @saved_cs_client */;
5258 -- Table structure for table `saved_sql`
5261 DROP TABLE IF EXISTS `saved_sql`;
5262 /*!40101 SET @saved_cs_client = @@character_set_client */;
5263 /*!40101 SET character_set_client = utf8 */;
5264 CREATE TABLE `saved_sql` (
5265 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key assigned by Koha',
5266 `borrowernumber` int(11) DEFAULT NULL COMMENT 'the staff member who created this report (borrowers.borrowernumber)',
5267 `date_created` datetime DEFAULT NULL COMMENT 'the date this report was created',
5268 `last_modified` datetime DEFAULT NULL COMMENT 'the date this report was last edited',
5269 `savedsql` mediumtext DEFAULT NULL COMMENT 'the SQL for this report',
5270 `last_run` datetime DEFAULT NULL,
5271 `report_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'the name of this report',
5272 `type` varchar(255) DEFAULT NULL COMMENT 'always 1 for tabular',
5273 `notes` mediumtext DEFAULT NULL COMMENT 'the notes or description given to this report',
5274 `cache_expiry` int(11) NOT NULL DEFAULT 300,
5275 `public` tinyint(1) NOT NULL DEFAULT 0,
5276 `report_area` varchar(6) DEFAULT NULL,
5277 `report_group` varchar(80) DEFAULT NULL,
5278 `report_subgroup` varchar(80) DEFAULT NULL,
5279 `mana_id` int(11) DEFAULT NULL,
5281 KEY `sql_area_group_idx` (`report_group`,`report_subgroup`),
5282 KEY `boridx` (`borrowernumber`)
5283 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5284 /*!40101 SET character_set_client = @saved_cs_client */;
5287 -- Table structure for table `search_field`
5290 DROP TABLE IF EXISTS `search_field`;
5291 /*!40101 SET @saved_cs_client = @@character_set_client */;
5292 /*!40101 SET character_set_client = utf8 */;
5293 CREATE TABLE `search_field` (
5294 `id` int(11) NOT NULL AUTO_INCREMENT,
5295 `name` varchar(255) NOT NULL COMMENT 'the name of the field as it will be stored in the search engine',
5296 `label` varchar(255) NOT NULL COMMENT 'the human readable name of the field, for display',
5297 `type` enum('','string','date','number','boolean','sum','isbn','stdno','year','callnumber') NOT NULL COMMENT 'what type of data this holds, relevant when storing it in the search engine',
5298 `weight` decimal(5,2) DEFAULT NULL,
5299 `facet_order` tinyint(4) DEFAULT NULL COMMENT 'the order place of the field in facet list if faceted',
5300 `staff_client` tinyint(1) NOT NULL DEFAULT 1,
5301 `opac` tinyint(1) NOT NULL DEFAULT 1,
5302 `mandatory` tinyint(1) DEFAULT NULL COMMENT 'if marked this field is not editable or removable',
5304 UNIQUE KEY `name` (`name`(191))
5305 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5306 /*!40101 SET character_set_client = @saved_cs_client */;
5309 -- Table structure for table `search_filters`
5312 DROP TABLE IF EXISTS `search_filters`;
5313 /*!40101 SET @saved_cs_client = @@character_set_client */;
5314 /*!40101 SET character_set_client = utf8 */;
5315 CREATE TABLE `search_filters` (
5316 `search_filter_id` int(11) NOT NULL AUTO_INCREMENT,
5317 `name` varchar(255) NOT NULL COMMENT 'filter name',
5318 `query` mediumtext DEFAULT NULL COMMENT 'filter query part',
5319 `limits` mediumtext DEFAULT NULL COMMENT 'filter limits part',
5320 `opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown on OPAC',
5321 `staff_client` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown in staff client',
5322 PRIMARY KEY (`search_filter_id`)
5323 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5324 /*!40101 SET character_set_client = @saved_cs_client */;
5327 -- Table structure for table `search_history`
5330 DROP TABLE IF EXISTS `search_history`;
5331 /*!40101 SET @saved_cs_client = @@character_set_client */;
5332 /*!40101 SET character_set_client = utf8 */;
5333 CREATE TABLE `search_history` (
5334 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'search history id',
5335 `userid` int(11) NOT NULL COMMENT 'the patron who performed the search (borrowers.borrowernumber)',
5336 `sessionid` varchar(32) NOT NULL COMMENT 'a system generated session id',
5337 `query_desc` varchar(255) NOT NULL COMMENT 'the search that was performed',
5338 `query_cgi` mediumtext NOT NULL COMMENT 'the string to append to the search url to rerun the search',
5339 `type` varchar(16) NOT NULL DEFAULT 'biblio' COMMENT 'search type, must be ''biblio'' or ''authority''',
5340 `total` int(11) NOT NULL COMMENT 'the total of results found',
5341 `time` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the search was run',
5343 KEY `userid` (`userid`),
5344 KEY `sessionid` (`sessionid`)
5345 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Opac search history results';
5346 /*!40101 SET character_set_client = @saved_cs_client */;
5349 -- Table structure for table `search_marc_map`
5352 DROP TABLE IF EXISTS `search_marc_map`;
5353 /*!40101 SET @saved_cs_client = @@character_set_client */;
5354 /*!40101 SET character_set_client = utf8 */;
5355 CREATE TABLE `search_marc_map` (
5356 `id` int(11) NOT NULL AUTO_INCREMENT,
5357 `index_name` enum('biblios','authorities') NOT NULL COMMENT 'what storage index this map is for',
5358 `marc_type` enum('marc21','unimarc') NOT NULL COMMENT 'what MARC type this map is for',
5359 `marc_field` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the MARC specifier for this field',
5361 UNIQUE KEY `index_name` (`index_name`,`marc_field`(191),`marc_type`),
5362 KEY `index_name_2` (`index_name`)
5363 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5364 /*!40101 SET character_set_client = @saved_cs_client */;
5367 -- Table structure for table `search_marc_to_field`
5370 DROP TABLE IF EXISTS `search_marc_to_field`;
5371 /*!40101 SET @saved_cs_client = @@character_set_client */;
5372 /*!40101 SET character_set_client = utf8 */;
5373 CREATE TABLE `search_marc_to_field` (
5374 `search` tinyint(1) NOT NULL DEFAULT 1,
5375 `search_marc_map_id` int(11) NOT NULL,
5376 `search_field_id` int(11) NOT NULL,
5377 `facet` tinyint(1) DEFAULT 0 COMMENT 'true if a facet field should be generated for this',
5378 `suggestible` tinyint(1) DEFAULT 0 COMMENT 'true if this field can be used to generate suggestions for browse',
5379 `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',
5380 PRIMARY KEY (`search_marc_map_id`,`search_field_id`),
5381 KEY `search_field_id` (`search_field_id`),
5382 CONSTRAINT `search_marc_to_field_ibfk_1` FOREIGN KEY (`search_marc_map_id`) REFERENCES `search_marc_map` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
5383 CONSTRAINT `search_marc_to_field_ibfk_2` FOREIGN KEY (`search_field_id`) REFERENCES `search_field` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
5384 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5385 /*!40101 SET character_set_client = @saved_cs_client */;
5388 -- Table structure for table `serial`
5391 DROP TABLE IF EXISTS `serial`;
5392 /*!40101 SET @saved_cs_client = @@character_set_client */;
5393 /*!40101 SET character_set_client = utf8 */;
5394 CREATE TABLE `serial` (
5395 `serialid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the issue',
5396 `biblionumber` int(11) NOT NULL COMMENT 'foreign key for the biblio.biblionumber that this issue is attached to',
5397 `subscriptionid` int(11) NOT NULL COMMENT 'foreign key to the subscription.subscriptionid that this issue is part of',
5398 `serialseq` varchar(100) NOT NULL DEFAULT '' COMMENT 'issue information (volume, number, etc)',
5399 `serialseq_x` varchar(100) DEFAULT NULL COMMENT 'first part of issue information',
5400 `serialseq_y` varchar(100) DEFAULT NULL COMMENT 'second part of issue information',
5401 `serialseq_z` varchar(100) DEFAULT NULL COMMENT 'third part of issue information',
5402 `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'status code for this issue (see manual for full descriptions)',
5403 `planneddate` date DEFAULT NULL COMMENT 'date expected',
5404 `notes` mediumtext DEFAULT NULL COMMENT 'notes',
5405 `publisheddate` date DEFAULT NULL COMMENT 'date published',
5406 `publisheddatetext` varchar(100) DEFAULT NULL COMMENT 'date published (descriptive)',
5407 `claimdate` date DEFAULT NULL COMMENT 'date claimed',
5408 `claims_count` int(11) DEFAULT 0 COMMENT 'number of claims made related to this issue',
5409 `routingnotes` mediumtext DEFAULT NULL COMMENT 'notes from the routing list',
5410 PRIMARY KEY (`serialid`),
5411 KEY `serial_ibfk_1` (`biblionumber`),
5412 KEY `serial_ibfk_2` (`subscriptionid`),
5413 CONSTRAINT `serial_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5414 CONSTRAINT `serial_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5415 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5416 /*!40101 SET character_set_client = @saved_cs_client */;
5419 -- Table structure for table `serialitems`
5422 DROP TABLE IF EXISTS `serialitems`;
5423 /*!40101 SET @saved_cs_client = @@character_set_client */;
5424 /*!40101 SET character_set_client = utf8 */;
5425 CREATE TABLE `serialitems` (
5426 `itemnumber` int(11) NOT NULL,
5427 `serialid` int(11) NOT NULL,
5428 PRIMARY KEY (`itemnumber`),
5429 KEY `serialitems_sfk_1` (`serialid`),
5430 CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE,
5431 CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
5432 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5433 /*!40101 SET character_set_client = @saved_cs_client */;
5436 -- Table structure for table `sessions`
5439 DROP TABLE IF EXISTS `sessions`;
5440 /*!40101 SET @saved_cs_client = @@character_set_client */;
5441 /*!40101 SET character_set_client = utf8 */;
5442 CREATE TABLE `sessions` (
5443 `id` varchar(32) NOT NULL,
5444 `a_session` longblob NOT NULL,
5446 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5447 /*!40101 SET character_set_client = @saved_cs_client */;
5450 -- Table structure for table `sms_providers`
5453 DROP TABLE IF EXISTS `sms_providers`;
5454 /*!40101 SET @saved_cs_client = @@character_set_client */;
5455 /*!40101 SET character_set_client = utf8 */;
5456 CREATE TABLE `sms_providers` (
5457 `id` int(11) NOT NULL AUTO_INCREMENT,
5458 `name` varchar(255) NOT NULL,
5459 `domain` varchar(255) NOT NULL,
5461 UNIQUE KEY `name` (`name`(191))
5462 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5463 /*!40101 SET character_set_client = @saved_cs_client */;
5466 -- Table structure for table `smtp_servers`
5469 DROP TABLE IF EXISTS `smtp_servers`;
5470 /*!40101 SET @saved_cs_client = @@character_set_client */;
5471 /*!40101 SET character_set_client = utf8 */;
5472 CREATE TABLE `smtp_servers` (
5473 `id` int(11) NOT NULL AUTO_INCREMENT,
5474 `name` varchar(80) NOT NULL,
5475 `host` varchar(80) NOT NULL DEFAULT 'localhost',
5476 `port` int(11) NOT NULL DEFAULT 25,
5477 `timeout` int(11) NOT NULL DEFAULT 120,
5478 `ssl_mode` enum('disabled','ssl','starttls') NOT NULL,
5479 `user_name` varchar(80) DEFAULT NULL,
5480 `password` varchar(80) DEFAULT NULL,
5481 `debug` tinyint(1) NOT NULL DEFAULT 0,
5482 `is_default` tinyint(1) NOT NULL DEFAULT 0,
5484 KEY `host_idx` (`host`)
5485 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5486 /*!40101 SET character_set_client = @saved_cs_client */;
5489 -- Table structure for table `social_data`
5492 DROP TABLE IF EXISTS `social_data`;
5493 /*!40101 SET @saved_cs_client = @@character_set_client */;
5494 /*!40101 SET character_set_client = utf8 */;
5495 CREATE TABLE `social_data` (
5496 `isbn` varchar(30) NOT NULL DEFAULT '',
5497 `num_critics` int(11) DEFAULT NULL,
5498 `num_critics_pro` int(11) DEFAULT NULL,
5499 `num_quotations` int(11) DEFAULT NULL,
5500 `num_videos` int(11) DEFAULT NULL,
5501 `score_avg` decimal(5,2) DEFAULT NULL,
5502 `num_scores` int(11) DEFAULT NULL,
5503 PRIMARY KEY (`isbn`)
5504 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5505 /*!40101 SET character_set_client = @saved_cs_client */;
5508 -- Table structure for table `special_holidays`
5511 DROP TABLE IF EXISTS `special_holidays`;
5512 /*!40101 SET @saved_cs_client = @@character_set_client */;
5513 /*!40101 SET character_set_client = utf8 */;
5514 CREATE TABLE `special_holidays` (
5515 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5516 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
5517 `day` smallint(6) NOT NULL DEFAULT 0 COMMENT 'day of the month this closing is on',
5518 `month` smallint(6) NOT NULL DEFAULT 0 COMMENT 'month this closing is in',
5519 `year` smallint(6) NOT NULL DEFAULT 0 COMMENT 'year this closing is in',
5520 `isexception` smallint(1) NOT NULL DEFAULT 1 COMMENT 'is this a holiday exception to a repeatable holiday (1 for yes, 0 for no)',
5521 `title` varchar(50) NOT NULL DEFAULT '' COMMENT 'title for this closing',
5522 `description` mediumtext NOT NULL COMMENT 'description of this closing',
5524 KEY `special_holidays_ibfk_1` (`branchcode`),
5525 CONSTRAINT `special_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5526 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5527 /*!40101 SET character_set_client = @saved_cs_client */;
5530 -- Table structure for table `statistics`
5533 DROP TABLE IF EXISTS `statistics`;
5534 /*!40101 SET @saved_cs_client = @@character_set_client */;
5535 /*!40101 SET character_set_client = utf8 */;
5536 CREATE TABLE `statistics` (
5537 `datetime` datetime DEFAULT NULL COMMENT 'date and time of the transaction',
5538 `branch` varchar(10) DEFAULT NULL COMMENT 'foreign key, branch where the transaction occurred',
5539 `value` double(16,4) DEFAULT NULL COMMENT 'monetary value associated with the transaction',
5540 `type` varchar(16) DEFAULT NULL COMMENT 'transaction type (localuse, issue, return, renew, writeoff, payment)',
5541 `other` longtext DEFAULT NULL COMMENT 'used by SIP',
5542 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific item',
5543 `itemtype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table, links transaction to a specific item type',
5544 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
5545 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower',
5546 `ccode` varchar(80) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific collection code',
5547 `categorycode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower category',
5548 `interface` varchar(30) DEFAULT NULL COMMENT 'the context this action was taken in',
5549 KEY `timeidx` (`datetime`),
5550 KEY `branch_idx` (`branch`),
5551 KEY `type_idx` (`type`),
5552 KEY `itemnumber_idx` (`itemnumber`),
5553 KEY `itemtype_idx` (`itemtype`),
5554 KEY `borrowernumber_idx` (`borrowernumber`),
5555 KEY `ccode_idx` (`ccode`)
5556 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5557 /*!40101 SET character_set_client = @saved_cs_client */;
5560 -- Table structure for table `stockrotationitems`
5563 DROP TABLE IF EXISTS `stockrotationitems`;
5564 /*!40101 SET @saved_cs_client = @@character_set_client */;
5565 /*!40101 SET character_set_client = utf8 */;
5566 CREATE TABLE `stockrotationitems` (
5567 `itemnumber_id` int(11) NOT NULL COMMENT 'Itemnumber to link to a stage & rota',
5568 `stage_id` int(11) NOT NULL COMMENT 'stage ID to link the item to',
5569 `indemand` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should this item be skipped for rotation?',
5570 `fresh` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag showing item is only just added to rota',
5571 PRIMARY KEY (`itemnumber_id`),
5572 KEY `stockrotationitems_sifk` (`stage_id`),
5573 CONSTRAINT `stockrotationitems_iifk` FOREIGN KEY (`itemnumber_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5574 CONSTRAINT `stockrotationitems_sifk` FOREIGN KEY (`stage_id`) REFERENCES `stockrotationstages` (`stage_id`) ON DELETE CASCADE ON UPDATE CASCADE
5575 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5576 /*!40101 SET character_set_client = @saved_cs_client */;
5579 -- Table structure for table `stockrotationrotas`
5582 DROP TABLE IF EXISTS `stockrotationrotas`;
5583 /*!40101 SET @saved_cs_client = @@character_set_client */;
5584 /*!40101 SET character_set_client = utf8 */;
5585 CREATE TABLE `stockrotationrotas` (
5586 `rota_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Stockrotation rota ID',
5587 `title` varchar(100) NOT NULL COMMENT 'Title for this rota',
5588 `description` text NOT NULL COMMENT 'Description for this rota',
5589 `cyclical` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should items on this rota keep cycling?',
5590 `active` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this rota currently active?',
5591 PRIMARY KEY (`rota_id`),
5592 UNIQUE KEY `stockrotationrotas_title` (`title`)
5593 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5594 /*!40101 SET character_set_client = @saved_cs_client */;
5597 -- Table structure for table `stockrotationstages`
5600 DROP TABLE IF EXISTS `stockrotationstages`;
5601 /*!40101 SET @saved_cs_client = @@character_set_client */;
5602 /*!40101 SET character_set_client = utf8 */;
5603 CREATE TABLE `stockrotationstages` (
5604 `stage_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique stage ID',
5605 `position` int(11) NOT NULL COMMENT 'The position of this stage within its rota',
5606 `rota_id` int(11) NOT NULL COMMENT 'The rota this stage belongs to',
5607 `branchcode_id` varchar(10) NOT NULL COMMENT 'Branch this stage relates to',
5608 `duration` int(11) NOT NULL DEFAULT 4 COMMENT 'The number of days items shoud occupy this stage',
5609 PRIMARY KEY (`stage_id`),
5610 KEY `stockrotationstages_rifk` (`rota_id`),
5611 KEY `stockrotationstages_bifk` (`branchcode_id`),
5612 CONSTRAINT `stockrotationstages_bifk` FOREIGN KEY (`branchcode_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5613 CONSTRAINT `stockrotationstages_rifk` FOREIGN KEY (`rota_id`) REFERENCES `stockrotationrotas` (`rota_id`) ON DELETE CASCADE ON UPDATE CASCADE
5614 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5615 /*!40101 SET character_set_client = @saved_cs_client */;
5618 -- Table structure for table `subscription`
5621 DROP TABLE IF EXISTS `subscription`;
5622 /*!40101 SET @saved_cs_client = @@character_set_client */;
5623 /*!40101 SET character_set_client = utf8 */;
5624 CREATE TABLE `subscription` (
5625 `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
5626 `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
5627 `librarian` varchar(100) DEFAULT '' COMMENT 'the librarian''s username from borrowers.userid',
5628 `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
5629 `aqbooksellerid` int(11) DEFAULT 0 COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
5630 `cost` int(11) DEFAULT 0,
5631 `aqbudgetid` int(11) DEFAULT 0,
5632 `weeklength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or numberlength is set)',
5633 `monthlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if weeklength or numberlength is set)',
5634 `numberlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or weeklength is set)',
5635 `periodicity` int(11) DEFAULT NULL COMMENT 'frequency type links to subscription_frequencies.id',
5636 `countissuesperunit` int(11) NOT NULL DEFAULT 1,
5637 `notes` longtext DEFAULT NULL COMMENT 'notes',
5638 `status` varchar(100) NOT NULL DEFAULT '' COMMENT 'status of this subscription',
5639 `lastvalue1` int(11) DEFAULT NULL,
5640 `innerloop1` int(11) DEFAULT 0,
5641 `lastvalue2` int(11) DEFAULT NULL,
5642 `innerloop2` int(11) DEFAULT 0,
5643 `lastvalue3` int(11) DEFAULT NULL,
5644 `innerloop3` int(11) DEFAULT 0,
5645 `firstacquidate` date DEFAULT NULL COMMENT 'first issue received date',
5646 `manualhistory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes or no to managing the history manually',
5647 `irregularity` mediumtext DEFAULT NULL COMMENT 'any irregularities in the subscription',
5648 `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
5649 `letter` varchar(20) DEFAULT NULL,
5650 `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
5651 `locale` varchar(80) DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
5652 `distributedto` mediumtext DEFAULT NULL,
5653 `internalnotes` longtext DEFAULT NULL,
5654 `callnumber` mediumtext DEFAULT NULL COMMENT 'default call number',
5655 `location` varchar(80) DEFAULT '' COMMENT 'default shelving location (items.location)',
5656 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'default branches (items.homebranch)',
5657 `lastbranch` varchar(10) DEFAULT NULL,
5658 `serialsadditems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'does receiving this serial create an item record',
5659 `staffdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the staff',
5660 `opacdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the public',
5661 `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
5662 `enddate` date DEFAULT NULL COMMENT 'subscription end date',
5663 `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
5664 `reneweddate` date DEFAULT NULL COMMENT 'date of last renewal for the subscription',
5665 `itemtype` varchar(10) DEFAULT NULL,
5666 `previousitemtype` varchar(10) DEFAULT NULL,
5667 `mana_id` int(11) DEFAULT NULL,
5668 `ccode` varchar(80) DEFAULT NULL COMMENT 'collection code to assign to serial items',
5669 `published_on_template` TEXT DEFAULT NULL COMMENT 'Template Toolkit syntax to generate the default "Published on (text)" field when receiving an issue this serial',
5670 PRIMARY KEY (`subscriptionid`),
5671 KEY `subscription_ibfk_1` (`periodicity`),
5672 KEY `subscription_ibfk_2` (`numberpattern`),
5673 KEY `subscription_ibfk_3` (`biblionumber`),
5674 CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5675 CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5676 CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5677 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5678 /*!40101 SET character_set_client = @saved_cs_client */;
5681 -- Table structure for table `subscription_frequencies`
5684 DROP TABLE IF EXISTS `subscription_frequencies`;
5685 /*!40101 SET @saved_cs_client = @@character_set_client */;
5686 /*!40101 SET character_set_client = utf8 */;
5687 CREATE TABLE `subscription_frequencies` (
5688 `id` int(11) NOT NULL AUTO_INCREMENT,
5689 `description` mediumtext NOT NULL,
5690 `displayorder` int(11) DEFAULT NULL,
5691 `unit` enum('day','week','month','year') DEFAULT NULL,
5692 `unitsperissue` int(11) NOT NULL DEFAULT 1,
5693 `issuesperunit` int(11) NOT NULL DEFAULT 1,
5695 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5696 /*!40101 SET character_set_client = @saved_cs_client */;
5699 -- Table structure for table `subscription_numberpatterns`
5702 DROP TABLE IF EXISTS `subscription_numberpatterns`;
5703 /*!40101 SET @saved_cs_client = @@character_set_client */;
5704 /*!40101 SET character_set_client = utf8 */;
5705 CREATE TABLE `subscription_numberpatterns` (
5706 `id` int(11) NOT NULL AUTO_INCREMENT,
5707 `label` varchar(255) NOT NULL,
5708 `displayorder` int(11) DEFAULT NULL,
5709 `description` mediumtext NOT NULL,
5710 `numberingmethod` varchar(255) NOT NULL,
5711 `label1` varchar(255) DEFAULT NULL,
5712 `add1` int(11) DEFAULT NULL,
5713 `every1` int(11) DEFAULT NULL,
5714 `whenmorethan1` int(11) DEFAULT NULL,
5715 `setto1` int(11) DEFAULT NULL,
5716 `numbering1` varchar(255) DEFAULT NULL,
5717 `label2` varchar(255) DEFAULT NULL,
5718 `add2` int(11) DEFAULT NULL,
5719 `every2` int(11) DEFAULT NULL,
5720 `whenmorethan2` int(11) DEFAULT NULL,
5721 `setto2` int(11) DEFAULT NULL,
5722 `numbering2` varchar(255) DEFAULT NULL,
5723 `label3` varchar(255) DEFAULT NULL,
5724 `add3` int(11) DEFAULT NULL,
5725 `every3` int(11) DEFAULT NULL,
5726 `whenmorethan3` int(11) DEFAULT NULL,
5727 `setto3` int(11) DEFAULT NULL,
5728 `numbering3` varchar(255) DEFAULT NULL,
5730 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5731 /*!40101 SET character_set_client = @saved_cs_client */;
5734 -- Table structure for table `subscriptionhistory`
5737 DROP TABLE IF EXISTS `subscriptionhistory`;
5738 /*!40101 SET @saved_cs_client = @@character_set_client */;
5739 /*!40101 SET character_set_client = utf8 */;
5740 CREATE TABLE `subscriptionhistory` (
5741 `biblionumber` int(11) NOT NULL,
5742 `subscriptionid` int(11) NOT NULL,
5743 `histstartdate` date DEFAULT NULL,
5744 `histenddate` date DEFAULT NULL,
5745 `missinglist` longtext NOT NULL,
5746 `recievedlist` longtext NOT NULL,
5747 `opacnote` longtext DEFAULT NULL,
5748 `librariannote` longtext DEFAULT NULL,
5749 PRIMARY KEY (`subscriptionid`),
5750 KEY `subscription_history_ibfk_1` (`biblionumber`),
5751 CONSTRAINT `subscription_history_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5752 CONSTRAINT `subscription_history_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5753 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5754 /*!40101 SET character_set_client = @saved_cs_client */;
5757 -- Table structure for table `subscriptionroutinglist`
5760 DROP TABLE IF EXISTS `subscriptionroutinglist`;
5761 /*!40101 SET @saved_cs_client = @@character_set_client */;
5762 /*!40101 SET character_set_client = utf8 */;
5763 CREATE TABLE `subscriptionroutinglist` (
5764 `routingid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5765 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines with patron is on the routing list',
5766 `ranking` int(11) DEFAULT NULL COMMENT 'where the patron stands in line to receive the serial',
5767 `subscriptionid` int(11) NOT NULL COMMENT 'foreign key from the subscription table, defines which subscription this routing list is for',
5768 PRIMARY KEY (`routingid`),
5769 UNIQUE KEY `subscriptionid` (`subscriptionid`,`borrowernumber`),
5770 KEY `subscriptionroutinglist_ibfk_1` (`borrowernumber`),
5771 CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5772 CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5773 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5774 /*!40101 SET character_set_client = @saved_cs_client */;
5777 -- Table structure for table `suggestions`
5780 DROP TABLE IF EXISTS `suggestions`;
5781 /*!40101 SET @saved_cs_client = @@character_set_client */;
5782 /*!40101 SET character_set_client = utf8 */;
5783 CREATE TABLE `suggestions` (
5784 `suggestionid` int(8) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned automatically by Koha',
5785 `suggestedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the person making the suggestion, foreign key linking to the borrowers table',
5786 `suggesteddate` date NOT NULL COMMENT 'date the suggestion was submitted',
5787 `managedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian managing the suggestion, foreign key linking to the borrowers table',
5788 `manageddate` date DEFAULT NULL COMMENT 'date the suggestion was updated',
5789 `acceptedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who accepted the suggestion, foreign key linking to the borrowers table',
5790 `accepteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as accepted',
5791 `rejectedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table',
5792 `rejecteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as rejected',
5793 `lastmodificationby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who edit the suggestion for the last time',
5794 `lastmodificationdate` date DEFAULT NULL COMMENT 'date of the last modification',
5795 `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)',
5796 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the suggestion archived?',
5797 `note` longtext DEFAULT NULL COMMENT 'note entered on the suggestion',
5798 `staff_note` longtext DEFAULT NULL COMMENT 'non-public note entered on the suggestion',
5799 `author` varchar(80) DEFAULT NULL COMMENT 'author of the suggested item',
5800 `title` varchar(255) DEFAULT NULL COMMENT 'title of the suggested item',
5801 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'copyright date of the suggested item',
5802 `publishercode` varchar(255) DEFAULT NULL COMMENT 'publisher of the suggested item',
5803 `date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the suggestion was updated',
5804 `volumedesc` varchar(255) DEFAULT NULL,
5805 `publicationyear` smallint(6) DEFAULT 0,
5806 `place` varchar(255) DEFAULT NULL COMMENT 'publication place of the suggested item',
5807 `isbn` varchar(30) DEFAULT NULL COMMENT 'isbn of the suggested item',
5808 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggestion to the biblio table after the suggestion has been ordered',
5809 `reason` mediumtext DEFAULT NULL COMMENT 'reason for accepting or rejecting the suggestion',
5810 `patronreason` mediumtext DEFAULT NULL COMMENT 'reason for making the suggestion',
5811 `budgetid` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggested budget to the aqbudgets table',
5812 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key linking the suggested branch to the branches table',
5813 `collectiontitle` mediumtext DEFAULT NULL COMMENT 'collection name for the suggested item',
5814 `itemtype` varchar(30) DEFAULT NULL COMMENT 'suggested item type',
5815 `quantity` smallint(6) DEFAULT NULL COMMENT 'suggested quantity to be purchased',
5816 `currency` varchar(10) DEFAULT NULL COMMENT 'suggested currency for the suggested price',
5817 `price` decimal(28,6) DEFAULT NULL COMMENT 'suggested price',
5818 `total` decimal(28,6) DEFAULT NULL COMMENT 'suggested total cost (price*quantity updated for currency)',
5819 PRIMARY KEY (`suggestionid`),
5820 KEY `suggestedby` (`suggestedby`),
5821 KEY `managedby` (`managedby`),
5822 KEY `acceptedby` (`acceptedby`),
5823 KEY `rejectedby` (`rejectedby`),
5824 KEY `biblionumber` (`biblionumber`),
5825 KEY `budgetid` (`budgetid`),
5826 KEY `branchcode` (`branchcode`),
5827 KEY `status` (`STATUS`),
5828 KEY `suggestions_ibfk_lastmodificationby` (`lastmodificationby`),
5829 CONSTRAINT `suggestions_budget_id_fk` FOREIGN KEY (`budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5830 CONSTRAINT `suggestions_ibfk_acceptedby` FOREIGN KEY (`acceptedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5831 CONSTRAINT `suggestions_ibfk_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5832 CONSTRAINT `suggestions_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
5833 CONSTRAINT `suggestions_ibfk_lastmodificationby` FOREIGN KEY (`lastmodificationby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5834 CONSTRAINT `suggestions_ibfk_managedby` FOREIGN KEY (`managedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5835 CONSTRAINT `suggestions_ibfk_rejectedby` FOREIGN KEY (`rejectedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5836 CONSTRAINT `suggestions_ibfk_suggestedby` FOREIGN KEY (`suggestedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5837 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5838 /*!40101 SET character_set_client = @saved_cs_client */;
5841 -- Table structure for table `systempreferences`
5844 DROP TABLE IF EXISTS `systempreferences`;
5845 /*!40101 SET @saved_cs_client = @@character_set_client */;
5846 /*!40101 SET character_set_client = utf8 */;
5847 CREATE TABLE `systempreferences` (
5848 `variable` varchar(50) NOT NULL DEFAULT '' COMMENT 'system preference name',
5849 `value` mediumtext DEFAULT NULL COMMENT 'system preference values',
5850 `options` longtext DEFAULT NULL COMMENT 'options for multiple choice system preferences',
5851 `explanation` mediumtext DEFAULT NULL COMMENT 'descriptive text for the system preference',
5852 `type` varchar(20) DEFAULT NULL COMMENT 'type of question this preference asks (multiple choice, plain text, yes or no, etc)',
5853 PRIMARY KEY (`variable`)
5854 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5855 /*!40101 SET character_set_client = @saved_cs_client */;
5858 -- Table structure for table `tables_settings`
5861 DROP TABLE IF EXISTS `tables_settings`;
5862 /*!40101 SET @saved_cs_client = @@character_set_client */;
5863 /*!40101 SET character_set_client = utf8 */;
5864 CREATE TABLE `tables_settings` (
5865 `module` varchar(255) NOT NULL,
5866 `page` varchar(255) NOT NULL,
5867 `tablename` varchar(255) NOT NULL,
5868 `default_display_length` smallint(6) DEFAULT NULL,
5869 `default_sort_order` varchar(255) DEFAULT NULL,
5870 PRIMARY KEY (`module`(191),`page`(191),`tablename`(191))
5871 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5872 /*!40101 SET character_set_client = @saved_cs_client */;
5875 -- Table structure for table `tags`
5878 DROP TABLE IF EXISTS `tags`;
5879 /*!40101 SET @saved_cs_client = @@character_set_client */;
5880 /*!40101 SET character_set_client = utf8 */;
5881 CREATE TABLE `tags` (
5882 `entry` varchar(255) NOT NULL DEFAULT '',
5883 `weight` bigint(20) NOT NULL DEFAULT 0,
5884 PRIMARY KEY (`entry`(191))
5885 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5886 /*!40101 SET character_set_client = @saved_cs_client */;
5889 -- Table structure for table `tags_all`
5892 DROP TABLE IF EXISTS `tags_all`;
5893 /*!40101 SET @saved_cs_client = @@character_set_client */;
5894 /*!40101 SET character_set_client = utf8 */;
5895 CREATE TABLE `tags_all` (
5896 `tag_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key',
5897 `borrowernumber` int(11) DEFAULT NULL COMMENT 'the patron who added the tag (borrowers.borrowernumber)',
5898 `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was left on (biblio.biblionumber)',
5899 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5900 `language` int(4) DEFAULT NULL COMMENT 'the language the tag was left in',
5901 `date_created` datetime NOT NULL COMMENT 'the date the tag was added',
5902 PRIMARY KEY (`tag_id`),
5903 KEY `tags_borrowers_fk_1` (`borrowernumber`),
5904 KEY `tags_biblionumber_fk_1` (`biblionumber`),
5905 CONSTRAINT `tags_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5906 CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5907 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5908 /*!40101 SET character_set_client = @saved_cs_client */;
5911 -- Table structure for table `tags_approval`
5914 DROP TABLE IF EXISTS `tags_approval`;
5915 /*!40101 SET @saved_cs_client = @@character_set_client */;
5916 /*!40101 SET character_set_client = utf8 */;
5917 CREATE TABLE `tags_approval` (
5918 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5919 `approved` int(1) NOT NULL DEFAULT 0 COMMENT 'whether the tag is approved or not (1=yes, 0=pending, -1=rejected)',
5920 `date_approved` datetime DEFAULT NULL COMMENT 'the date this tag was approved',
5921 `approved_by` int(11) DEFAULT NULL COMMENT 'the librarian who approved the tag (borrowers.borrowernumber)',
5922 `weight_total` int(9) NOT NULL DEFAULT 1 COMMENT 'the total number of times this tag was used',
5923 PRIMARY KEY (`term`),
5924 KEY `tags_approval_borrowers_fk_1` (`approved_by`),
5925 CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5926 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5927 /*!40101 SET character_set_client = @saved_cs_client */;
5930 -- Table structure for table `tags_index`
5933 DROP TABLE IF EXISTS `tags_index`;
5934 /*!40101 SET @saved_cs_client = @@character_set_client */;
5935 /*!40101 SET character_set_client = utf8 */;
5936 CREATE TABLE `tags_index` (
5937 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5938 `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was used on (biblio.biblionumber)',
5939 `weight` int(9) NOT NULL DEFAULT 1 COMMENT 'the number of times this term was used on this bib record',
5940 PRIMARY KEY (`term`,`biblionumber`),
5941 KEY `tags_index_biblionumber_fk_1` (`biblionumber`),
5942 CONSTRAINT `tags_index_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5943 CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`) REFERENCES `tags_approval` (`term`) ON DELETE CASCADE ON UPDATE CASCADE
5944 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5945 /*!40101 SET character_set_client = @saved_cs_client */;
5948 -- Table structure for table `ticket_updates`
5951 DROP TABLE IF EXISTS `ticket_updates`;
5952 /*!40101 SET @saved_cs_client = @@character_set_client */;
5953 /*!40101 SET character_set_client = utf8 */;
5954 CREATE TABLE `ticket_updates` (
5955 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
5956 `ticket_id` int(11) NOT NULL COMMENT 'id of catalog ticket the update relates to',
5957 `user_id` int(11) NOT NULL DEFAULT 0 COMMENT 'id of the user who logged the update',
5958 `public` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote whether this update is public',
5959 `date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time this update was logged',
5960 `message` text NOT NULL COMMENT 'update message content',
5962 KEY `ticket_updates_ibfk_1` (`ticket_id`),
5963 KEY `ticket_updates_ibfk_2` (`user_id`),
5964 CONSTRAINT `ticket_updates_ibfk_1` FOREIGN KEY (`ticket_id`) REFERENCES `tickets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
5965 CONSTRAINT `ticket_updates_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
5966 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5967 /*!40101 SET character_set_client = @saved_cs_client */;
5970 -- Table structure for table `tickets`
5973 DROP TABLE IF EXISTS `tickets`;
5974 /*!40101 SET @saved_cs_client = @@character_set_client */;
5975 /*!40101 SET character_set_client = utf8 */;
5976 CREATE TABLE `tickets` (
5977 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
5978 `reporter_id` int(11) NOT NULL DEFAULT 0 COMMENT 'id of the patron who reported the ticket',
5979 `reported_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time this ticket was reported',
5980 `title` text NOT NULL COMMENT 'ticket title',
5981 `body` text NOT NULL COMMENT 'ticket details',
5982 `resolver_id` int(11) DEFAULT NULL COMMENT 'id of the user who resolved the ticket',
5983 `resolved_date` datetime DEFAULT NULL COMMENT 'date and time this ticket was resolved',
5984 `biblio_id` int(11) DEFAULT NULL COMMENT 'id of biblio linked',
5986 KEY `tickets_ibfk_1` (`reporter_id`),
5987 KEY `tickets_ibfk_2` (`resolver_id`),
5988 KEY `tickets_ibfk_3` (`biblio_id`),
5989 CONSTRAINT `tickets_ibfk_1` FOREIGN KEY (`reporter_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5990 CONSTRAINT `tickets_ibfk_2` FOREIGN KEY (`resolver_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5991 CONSTRAINT `tickets_ibfk_3` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5992 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5993 /*!40101 SET character_set_client = @saved_cs_client */;
5996 -- Table structure for table `tmp_holdsqueue`
5999 DROP TABLE IF EXISTS `tmp_holdsqueue`;
6000 /*!40101 SET @saved_cs_client = @@character_set_client */;
6001 /*!40101 SET character_set_client = utf8 */;
6002 CREATE TABLE `tmp_holdsqueue` (
6003 `biblionumber` int(11) DEFAULT NULL,
6004 `itemnumber` int(11) NOT NULL,
6005 `barcode` varchar(20) DEFAULT NULL,
6006 `surname` longtext NOT NULL,
6007 `firstname` mediumtext DEFAULT NULL,
6008 `phone` mediumtext DEFAULT NULL,
6009 `borrowernumber` int(11) NOT NULL,
6010 `cardnumber` varchar(32) DEFAULT NULL,
6011 `reservedate` date DEFAULT NULL,
6012 `title` longtext DEFAULT NULL,
6013 `itemcallnumber` varchar(255) DEFAULT NULL,
6014 `holdingbranch` varchar(10) DEFAULT NULL,
6015 `pickbranch` varchar(10) DEFAULT NULL,
6016 `notes` mediumtext DEFAULT NULL,
6017 `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
6018 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this entry as added/last updated',
6019 PRIMARY KEY (`itemnumber`),
6020 KEY `tmp_holdsqueue_ibfk_1` (`itemnumber`),
6021 KEY `tmp_holdsqueue_ibfk_2` (`biblionumber`),
6022 KEY `tmp_holdsqueue_ibfk_3` (`borrowernumber`),
6023 CONSTRAINT `tmp_holdsqueue_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6024 CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6025 CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
6026 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6027 /*!40101 SET character_set_client = @saved_cs_client */;
6030 -- Table structure for table `transport_cost`
6033 DROP TABLE IF EXISTS `transport_cost`;
6034 /*!40101 SET @saved_cs_client = @@character_set_client */;
6035 /*!40101 SET character_set_client = utf8 */;
6036 CREATE TABLE `transport_cost` (
6037 `frombranch` varchar(10) NOT NULL,
6038 `tobranch` varchar(10) NOT NULL,
6039 `cost` decimal(6,2) NOT NULL,
6040 `disable_transfer` tinyint(1) NOT NULL DEFAULT 0,
6041 PRIMARY KEY (`frombranch`,`tobranch`),
6042 KEY `transport_cost_ibfk_2` (`tobranch`),
6043 CONSTRAINT `transport_cost_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
6044 CONSTRAINT `transport_cost_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
6045 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6046 /*!40101 SET character_set_client = @saved_cs_client */;
6049 -- Table structure for table `uploaded_files`
6052 DROP TABLE IF EXISTS `uploaded_files`;
6053 /*!40101 SET @saved_cs_client = @@character_set_client */;
6054 /*!40101 SET character_set_client = utf8 */;
6055 CREATE TABLE `uploaded_files` (
6056 `id` int(11) NOT NULL AUTO_INCREMENT,
6057 `hashvalue` char(40) NOT NULL,
6058 `filename` mediumtext NOT NULL,
6059 `dir` mediumtext NOT NULL,
6060 `filesize` int(11) DEFAULT NULL,
6061 `dtcreated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
6062 `uploadcategorycode` text DEFAULT NULL,
6063 `owner` int(11) DEFAULT NULL,
6064 `public` tinyint(4) DEFAULT NULL,
6065 `permanent` tinyint(4) DEFAULT NULL,
6067 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6068 /*!40101 SET character_set_client = @saved_cs_client */;
6071 -- Table structure for table `user_permissions`
6074 DROP TABLE IF EXISTS `user_permissions`;
6075 /*!40101 SET @saved_cs_client = @@character_set_client */;
6076 /*!40101 SET character_set_client = utf8 */;
6077 CREATE TABLE `user_permissions` (
6078 `borrowernumber` int(11) NOT NULL DEFAULT 0,
6079 `module_bit` int(11) NOT NULL DEFAULT 0,
6080 `code` varchar(64) NOT NULL,
6081 PRIMARY KEY (`borrowernumber`,`module_bit`,`code`),
6082 KEY `user_permissions_ibfk_1` (`borrowernumber`),
6083 KEY `user_permissions_ibfk_2` (`module_bit`,`code`),
6084 CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6085 CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`) ON DELETE CASCADE ON UPDATE CASCADE
6086 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6087 /*!40101 SET character_set_client = @saved_cs_client */;
6090 -- Table structure for table `userflags`
6093 DROP TABLE IF EXISTS `userflags`;
6094 /*!40101 SET @saved_cs_client = @@character_set_client */;
6095 /*!40101 SET character_set_client = utf8 */;
6096 CREATE TABLE `userflags` (
6097 `bit` int(11) NOT NULL DEFAULT 0,
6098 `flag` varchar(30) DEFAULT NULL,
6099 `flagdesc` varchar(255) DEFAULT NULL,
6100 `defaulton` int(11) DEFAULT NULL,
6102 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6103 /*!40101 SET character_set_client = @saved_cs_client */;
6106 -- Table structure for table `vendor_edi_accounts`
6109 DROP TABLE IF EXISTS `vendor_edi_accounts`;
6110 /*!40101 SET @saved_cs_client = @@character_set_client */;
6111 /*!40101 SET character_set_client = utf8 */;
6112 CREATE TABLE `vendor_edi_accounts` (
6113 `id` int(11) NOT NULL AUTO_INCREMENT,
6114 `description` mediumtext NOT NULL,
6115 `host` varchar(40) DEFAULT NULL,
6116 `username` varchar(40) DEFAULT NULL,
6117 `password` mediumtext DEFAULT NULL,
6118 `last_activity` date DEFAULT NULL,
6119 `vendor_id` int(11) DEFAULT NULL,
6120 `download_directory` mediumtext DEFAULT NULL,
6121 `upload_directory` mediumtext DEFAULT NULL,
6122 `san` varchar(20) DEFAULT NULL,
6123 `standard` varchar(3) DEFAULT 'EUR',
6124 `id_code_qualifier` varchar(3) DEFAULT '14',
6125 `transport` varchar(6) DEFAULT 'FTP',
6126 `quotes_enabled` tinyint(1) NOT NULL DEFAULT 0,
6127 `invoices_enabled` tinyint(1) NOT NULL DEFAULT 0,
6128 `orders_enabled` tinyint(1) NOT NULL DEFAULT 0,
6129 `responses_enabled` tinyint(1) NOT NULL DEFAULT 0,
6130 `auto_orders` tinyint(1) NOT NULL DEFAULT 0,
6131 `shipment_budget` int(11) DEFAULT NULL,
6132 `plugin` varchar(256) NOT NULL DEFAULT '',
6134 KEY `vendorid` (`vendor_id`),
6135 KEY `shipmentbudget` (`shipment_budget`),
6136 CONSTRAINT `vfk_shipment_budget` FOREIGN KEY (`shipment_budget`) REFERENCES `aqbudgets` (`budget_id`),
6137 CONSTRAINT `vfk_vendor_id` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`)
6138 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6139 /*!40101 SET character_set_client = @saved_cs_client */;
6142 -- Table structure for table `virtualshelfcontents`
6145 DROP TABLE IF EXISTS `virtualshelfcontents`;
6146 /*!40101 SET @saved_cs_client = @@character_set_client */;
6147 /*!40101 SET character_set_client = utf8 */;
6148 CREATE TABLE `virtualshelfcontents` (
6149 `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',
6150 `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',
6151 `dateadded` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this bib record was added to the list',
6152 `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)',
6153 KEY `shelfnumber` (`shelfnumber`),
6154 KEY `biblionumber` (`biblionumber`),
6155 KEY `shelfcontents_ibfk_3` (`borrowernumber`),
6156 CONSTRAINT `shelfcontents_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6157 CONSTRAINT `shelfcontents_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
6158 CONSTRAINT `virtualshelfcontents_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE
6159 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6160 /*!40101 SET character_set_client = @saved_cs_client */;
6163 -- Table structure for table `virtualshelfshares`
6166 DROP TABLE IF EXISTS `virtualshelfshares`;
6167 /*!40101 SET @saved_cs_client = @@character_set_client */;
6168 /*!40101 SET character_set_client = utf8 */;
6169 CREATE TABLE `virtualshelfshares` (
6170 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
6171 `shelfnumber` int(11) NOT NULL COMMENT 'foreign key for virtualshelves',
6172 `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrower that accepted access to this list',
6173 `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',
6174 `sharedate` datetime DEFAULT NULL COMMENT 'date of invitation or acceptance of invitation',
6176 KEY `virtualshelfshares_ibfk_1` (`shelfnumber`),
6177 KEY `virtualshelfshares_ibfk_2` (`borrowernumber`),
6178 CONSTRAINT `virtualshelfshares_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6179 CONSTRAINT `virtualshelfshares_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
6180 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6181 /*!40101 SET character_set_client = @saved_cs_client */;
6184 -- Table structure for table `virtualshelves`
6187 DROP TABLE IF EXISTS `virtualshelves`;
6188 /*!40101 SET @saved_cs_client = @@character_set_client */;
6189 /*!40101 SET character_set_client = utf8 */;
6190 CREATE TABLE `virtualshelves` (
6191 `shelfnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
6192 `shelfname` varchar(255) DEFAULT NULL COMMENT 'name of the list',
6193 `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)',
6194 `public` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If the list is public',
6195 `sortfield` varchar(16) DEFAULT 'title' COMMENT 'the field this list is sorted on',
6196 `lastmodified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the list was last modified',
6197 `created_on` datetime NOT NULL COMMENT 'creation time',
6198 `allow_change_from_owner` tinyint(1) DEFAULT 1 COMMENT 'can owner change contents?',
6199 `allow_change_from_others` tinyint(1) DEFAULT 0 COMMENT 'can others change contents?',
6200 `allow_change_from_staff` tinyint(1) DEFAULT 0 COMMENT 'can staff change contents?',
6201 `allow_change_from_permitted_staff` tinyint(1) DEFAULT 0 COMMENT 'can staff with edit_public_list_contents permission change contents?',
6202 PRIMARY KEY (`shelfnumber`),
6203 KEY `virtualshelves_ibfk_1` (`owner`),
6204 CONSTRAINT `virtualshelves_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
6205 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6206 /*!40101 SET character_set_client = @saved_cs_client */;
6209 -- Table structure for table `z3950servers`
6212 DROP TABLE IF EXISTS `z3950servers`;
6213 /*!40101 SET @saved_cs_client = @@character_set_client */;
6214 /*!40101 SET character_set_client = utf8 */;
6215 CREATE TABLE `z3950servers` (
6216 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
6217 `host` varchar(255) NOT NULL COMMENT 'target''s host name',
6218 `port` int(11) DEFAULT NULL COMMENT 'port number used to connect to target',
6219 `db` varchar(255) DEFAULT NULL COMMENT 'target''s database name',
6220 `userid` varchar(255) DEFAULT NULL COMMENT 'username needed to log in to target',
6221 `password` varchar(255) DEFAULT NULL COMMENT 'password needed to log in to target',
6222 `servername` longtext NOT NULL COMMENT 'name given to the target by the library',
6223 `checked` smallint(6) DEFAULT NULL COMMENT 'whether this target is checked by default (1 for yes, 0 for no)',
6224 `rank` int(11) DEFAULT NULL COMMENT 'where this target appears in the list of targets',
6225 `syntax` varchar(80) NOT NULL COMMENT 'MARC format provided by this target',
6226 `timeout` int(11) NOT NULL DEFAULT 0 COMMENT 'number of seconds before Koha stops trying to access this server',
6227 `servertype` enum('zed','sru') NOT NULL DEFAULT 'zed' COMMENT 'zed means z39.50 server',
6228 `encoding` mediumtext NOT NULL COMMENT 'characters encoding provided by this target',
6229 `recordtype` enum('authority','biblio') NOT NULL DEFAULT 'biblio' COMMENT 'server contains bibliographic or authority records',
6230 `sru_options` varchar(255) DEFAULT NULL COMMENT 'options like sru=get, sru_version=1.1; will be passed to the server via ZOOM',
6231 `sru_fields` longtext DEFAULT NULL COMMENT 'contains the mapping between the Z3950 search fields and the specific SRU server indexes',
6232 `add_xslt` longtext DEFAULT NULL COMMENT 'zero or more paths to XSLT files to be processed on the search results',
6233 `attributes` varchar(255) DEFAULT NULL COMMENT 'additional attributes passed to PQF queries',
6235 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6236 /*!40101 SET character_set_client = @saved_cs_client */;
6239 -- Table structure for table `zebraqueue`
6242 DROP TABLE IF EXISTS `zebraqueue`;
6243 /*!40101 SET @saved_cs_client = @@character_set_client */;
6244 /*!40101 SET character_set_client = utf8 */;
6245 CREATE TABLE `zebraqueue` (
6246 `id` int(11) NOT NULL AUTO_INCREMENT,
6247 `biblio_auth_number` bigint(20) unsigned NOT NULL DEFAULT 0,
6248 `operation` char(20) NOT NULL DEFAULT '',
6249 `server` char(20) NOT NULL DEFAULT '',
6250 `done` int(11) NOT NULL DEFAULT 0,
6251 `time` timestamp NOT NULL DEFAULT current_timestamp(),
6253 KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
6254 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6255 /*!40101 SET character_set_client = @saved_cs_client */;
6256 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
6258 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
6259 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
6260 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
6261 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
6262 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
6263 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
6264 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
6266 -- Dump completed on 2023-05-31 12:31:12