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, -- Status ID
3310 `name` varchar(100) NOT NULL, -- Name of status
3311 `code` varchar(20) NOT NULL, -- Unique, immutable code for status
3312 `is_system` int(1), -- 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 `id` int(11) NOT NULL auto_increment, -- Batch ID
3323 `name` varchar(100) NOT NULL, -- Unique name of batch
3324 `backend` varchar(20) NOT NULL, -- Name of batch backend
3325 `borrowernumber` int(11), -- Patron associated with batch
3326 `branchcode` varchar(50), -- Branch associated with batch
3327 `statuscode` varchar(20), -- Status of batch
3329 UNIQUE KEY `u_illbatches__name` (`name`),
3330 CONSTRAINT `illbatches_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
3331 CONSTRAINT `illbatches_bcfk` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
3332 CONSTRAINT `illbatches_sfk` FOREIGN KEY (`statuscode`) 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 CONSTRAINT `illrequests_bcfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3370 CONSTRAINT `illrequests_bibfk` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
3371 CONSTRAINT `illrequests_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3372 CONSTRAINT `illrequests_safk` FOREIGN KEY (`status_alias`) REFERENCES `authorised_values` (`authorised_value`) ON DELETE SET NULL ON UPDATE CASCADE,
3373 CONSTRAINT `illrequests_ibfk` FOREIGN KEY (`batch_id`) REFERENCES `illbatches` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
3374 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3375 /*!40101 SET character_set_client = @saved_cs_client */;
3378 -- Table structure for table `import_auths`
3381 DROP TABLE IF EXISTS `import_auths`;
3382 /*!40101 SET @saved_cs_client = @@character_set_client */;
3383 /*!40101 SET character_set_client = utf8 */;
3384 CREATE TABLE `import_auths` (
3385 `import_record_id` int(11) NOT NULL,
3386 `matched_authid` int(11) DEFAULT NULL,
3387 `control_number` varchar(25) DEFAULT NULL,
3388 `authorized_heading` varchar(128) DEFAULT NULL,
3389 `original_source` varchar(25) DEFAULT NULL,
3390 PRIMARY KEY (`import_record_id`),
3391 KEY `import_auths_ibfk_1` (`import_record_id`),
3392 KEY `matched_authid` (`matched_authid`),
3393 CONSTRAINT `import_auths_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3394 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3395 /*!40101 SET character_set_client = @saved_cs_client */;
3398 -- Table structure for table `import_batch_profiles`
3401 DROP TABLE IF EXISTS `import_batch_profiles`;
3402 /*!40101 SET @saved_cs_client = @@character_set_client */;
3403 /*!40101 SET character_set_client = utf8 */;
3404 CREATE TABLE `import_batch_profiles` (
3405 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3406 `name` varchar(100) NOT NULL COMMENT 'name of this profile',
3407 `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3408 `template_id` int(11) DEFAULT NULL COMMENT 'the id of the marc modification template',
3409 `overlay_action` varchar(50) DEFAULT NULL COMMENT 'how to handle duplicate records',
3410 `nomatch_action` varchar(50) DEFAULT NULL COMMENT 'how to handle records where no match is found',
3411 `item_action` varchar(50) DEFAULT NULL COMMENT 'what to do with item records',
3412 `parse_items` tinyint(1) DEFAULT NULL COMMENT 'should items be parsed',
3413 `record_type` varchar(50) DEFAULT NULL COMMENT 'type of record in the batch',
3414 `encoding` varchar(50) DEFAULT NULL COMMENT 'file encoding',
3415 `format` varchar(50) DEFAULT NULL COMMENT 'marc format',
3416 `comments` longtext DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3418 UNIQUE KEY `u_import_batch_profiles__name` (`name`)
3419 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3420 /*!40101 SET character_set_client = @saved_cs_client */;
3423 -- Table structure for table `import_batches`
3426 DROP TABLE IF EXISTS `import_batches`;
3427 /*!40101 SET @saved_cs_client = @@character_set_client */;
3428 /*!40101 SET character_set_client = utf8 */;
3429 CREATE TABLE `import_batches` (
3430 `import_batch_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3431 `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3432 `template_id` int(11) DEFAULT NULL,
3433 `branchcode` varchar(10) DEFAULT NULL,
3434 `num_records` int(11) NOT NULL DEFAULT 0 COMMENT 'number of records in the file',
3435 `num_items` int(11) NOT NULL DEFAULT 0 COMMENT 'number of items in the file',
3436 `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was uploaded',
3437 `overlay_action` enum('replace','create_new','use_template','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle duplicate records',
3438 `nomatch_action` enum('create_new','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle records where no match is found',
3439 `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',
3440 `import_status` enum('staging','staged','importing','imported','reverting','reverted','cleaned') NOT NULL DEFAULT 'staging' COMMENT 'the status of the imported file',
3441 `batch_type` enum('batch','z3950','webservice') NOT NULL DEFAULT 'batch' COMMENT 'where this batch has come from',
3442 `record_type` enum('biblio','auth','holdings') NOT NULL DEFAULT 'biblio' COMMENT 'type of record in the batch',
3443 `file_name` varchar(100) DEFAULT NULL COMMENT 'the name of the file uploaded',
3444 `comments` longtext DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3445 `profile_id` int(11) DEFAULT NULL,
3446 PRIMARY KEY (`import_batch_id`),
3447 KEY `branchcode` (`branchcode`),
3448 KEY `import_batches_ibfk_1` (`profile_id`),
3449 CONSTRAINT `import_batches_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `import_batch_profiles` (`id`) ON DELETE SET NULL ON UPDATE SET NULL
3450 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3451 /*!40101 SET character_set_client = @saved_cs_client */;
3454 -- Table structure for table `import_biblios`
3457 DROP TABLE IF EXISTS `import_biblios`;
3458 /*!40101 SET @saved_cs_client = @@character_set_client */;
3459 /*!40101 SET character_set_client = utf8 */;
3460 CREATE TABLE `import_biblios` (
3461 `import_record_id` int(11) NOT NULL,
3462 `matched_biblionumber` int(11) DEFAULT NULL,
3463 `control_number` varchar(25) DEFAULT NULL,
3464 `original_source` varchar(25) DEFAULT NULL,
3465 `title` longtext DEFAULT NULL,
3466 `author` longtext DEFAULT NULL,
3467 `isbn` longtext DEFAULT NULL,
3468 `issn` longtext DEFAULT NULL,
3469 `has_items` tinyint(1) NOT NULL DEFAULT 0,
3470 PRIMARY KEY (`import_record_id`),
3471 KEY `import_biblios_ibfk_1` (`import_record_id`),
3472 KEY `matched_biblionumber` (`matched_biblionumber`),
3473 KEY `title` (`title`(191)),
3474 KEY `isbn` (`isbn`(191)),
3475 CONSTRAINT `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3476 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3477 /*!40101 SET character_set_client = @saved_cs_client */;
3480 -- Table structure for table `import_items`
3483 DROP TABLE IF EXISTS `import_items`;
3484 /*!40101 SET @saved_cs_client = @@character_set_client */;
3485 /*!40101 SET character_set_client = utf8 */;
3486 CREATE TABLE `import_items` (
3487 `import_items_id` int(11) NOT NULL AUTO_INCREMENT,
3488 `import_record_id` int(11) NOT NULL,
3489 `itemnumber` int(11) DEFAULT NULL,
3490 `branchcode` varchar(10) DEFAULT NULL,
3491 `status` enum('error','staged','imported','reverted','ignored') NOT NULL DEFAULT 'staged',
3492 `marcxml` longtext NOT NULL,
3493 `import_error` longtext DEFAULT NULL,
3494 PRIMARY KEY (`import_items_id`),
3495 KEY `import_items_ibfk_1` (`import_record_id`),
3496 KEY `itemnumber` (`itemnumber`),
3497 KEY `branchcode` (`branchcode`),
3498 CONSTRAINT `import_items_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3499 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3500 /*!40101 SET character_set_client = @saved_cs_client */;
3503 -- Table structure for table `import_record_matches`
3506 DROP TABLE IF EXISTS `import_record_matches`;
3507 /*!40101 SET @saved_cs_client = @@character_set_client */;
3508 /*!40101 SET character_set_client = utf8 */;
3509 CREATE TABLE `import_record_matches` (
3510 `import_record_id` int(11) NOT NULL COMMENT 'the id given to the imported bib record (import_records.import_record_id)',
3511 `candidate_match_id` int(11) NOT NULL COMMENT 'the biblio the imported record matches (biblio.biblionumber)',
3512 `score` int(11) NOT NULL DEFAULT 0 COMMENT 'the match score',
3513 `chosen` tinyint(1) DEFAULT NULL COMMENT 'whether this match has been allowed or denied',
3514 PRIMARY KEY (`import_record_id`,`candidate_match_id`),
3515 KEY `record_score` (`import_record_id`,`score`),
3516 CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3517 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3518 /*!40101 SET character_set_client = @saved_cs_client */;
3521 -- Table structure for table `import_records`
3524 DROP TABLE IF EXISTS `import_records`;
3525 /*!40101 SET @saved_cs_client = @@character_set_client */;
3526 /*!40101 SET character_set_client = utf8 */;
3527 CREATE TABLE `import_records` (
3528 `import_record_id` int(11) NOT NULL AUTO_INCREMENT,
3529 `import_batch_id` int(11) NOT NULL,
3530 `branchcode` varchar(10) DEFAULT NULL,
3531 `record_sequence` int(11) NOT NULL DEFAULT 0,
3532 `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
3533 `import_date` date DEFAULT NULL,
3534 `marc` longblob NOT NULL,
3535 `marcxml` longtext NOT NULL,
3536 `marcxml_old` longtext NOT NULL,
3537 `record_type` enum('biblio','auth','holdings') NOT NULL DEFAULT 'biblio',
3538 `overlay_status` enum('no_match','auto_match','manual_match','match_applied') NOT NULL DEFAULT 'no_match',
3539 `status` enum('error','staged','imported','reverted','items_reverted','ignored') NOT NULL DEFAULT 'staged',
3540 `import_error` longtext DEFAULT NULL,
3541 `encoding` varchar(40) NOT NULL DEFAULT '',
3542 PRIMARY KEY (`import_record_id`),
3543 KEY `branchcode` (`branchcode`),
3544 KEY `batch_sequence` (`import_batch_id`,`record_sequence`),
3545 KEY `batch_id_record_type` (`import_batch_id`,`record_type`),
3546 CONSTRAINT `import_records_ifbk_1` FOREIGN KEY (`import_batch_id`) REFERENCES `import_batches` (`import_batch_id`) ON DELETE CASCADE ON UPDATE CASCADE
3547 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3548 /*!40101 SET character_set_client = @saved_cs_client */;
3551 -- Table structure for table `issues`
3554 DROP TABLE IF EXISTS `issues`;
3555 /*!40101 SET @saved_cs_client = @@character_set_client */;
3556 /*!40101 SET character_set_client = utf8 */;
3557 CREATE TABLE `issues` (
3558 `issue_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key for issues table',
3559 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
3560 `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
3561 `itemnumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
3562 `date_due` datetime DEFAULT NULL COMMENT 'datetime the item is due (yyyy-mm-dd hh:mm::ss)',
3563 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
3564 `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned, will be NULL until moved to old_issues',
3565 `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
3566 `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
3567 `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
3568 `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
3569 `auto_renew_error` varchar(32) DEFAULT NULL COMMENT 'automatic renewal error',
3570 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
3571 `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
3572 `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
3573 `note` longtext DEFAULT NULL COMMENT 'issue note text',
3574 `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
3575 `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
3576 PRIMARY KEY (`issue_id`),
3577 UNIQUE KEY `itemnumber` (`itemnumber`),
3578 KEY `issuesborridx` (`borrowernumber`),
3579 KEY `itemnumber_idx` (`itemnumber`),
3580 KEY `branchcode_idx` (`branchcode`),
3581 KEY `bordate` (`borrowernumber`,`timestamp`),
3582 KEY `issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
3583 CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE,
3584 CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE,
3585 CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3586 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3587 /*!40101 SET character_set_client = @saved_cs_client */;
3590 -- Table structure for table `item_bundles`
3593 DROP TABLE IF EXISTS `item_bundles`;
3594 /*!40101 SET @saved_cs_client = @@character_set_client */;
3595 /*!40101 SET character_set_client = utf8 */;
3596 CREATE TABLE `item_bundles` (
3597 `item` int(11) NOT NULL,
3598 `host` int(11) NOT NULL,
3599 PRIMARY KEY (`host`,`item`),
3600 UNIQUE KEY `item_bundles_uniq_1` (`item`),
3601 CONSTRAINT `item_bundles_ibfk_1` FOREIGN KEY (`item`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3602 CONSTRAINT `item_bundles_ibfk_2` FOREIGN KEY (`host`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3603 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3604 /*!40101 SET character_set_client = @saved_cs_client */;
3607 -- Table structure for table `item_circulation_alert_preferences`
3610 DROP TABLE IF EXISTS `item_circulation_alert_preferences`;
3611 /*!40101 SET @saved_cs_client = @@character_set_client */;
3612 /*!40101 SET character_set_client = utf8 */;
3613 CREATE TABLE `item_circulation_alert_preferences` (
3614 `id` int(11) NOT NULL AUTO_INCREMENT,
3615 `branchcode` varchar(10) NOT NULL,
3616 `categorycode` varchar(10) NOT NULL,
3617 `item_type` varchar(10) NOT NULL,
3618 `notification` varchar(16) NOT NULL,
3620 KEY `branchcode` (`branchcode`,`categorycode`,`item_type`,`notification`)
3621 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3622 /*!40101 SET character_set_client = @saved_cs_client */;
3625 -- Table structure for table `item_editor_templates`
3628 DROP TABLE IF EXISTS `item_editor_templates`;
3629 /*!40101 SET @saved_cs_client = @@character_set_client */;
3630 /*!40101 SET character_set_client = utf8 */;
3631 CREATE TABLE `item_editor_templates` (
3632 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the template',
3633 `patron_id` int(11) DEFAULT NULL COMMENT 'creator of this template',
3634 `name` mediumtext NOT NULL COMMENT 'template name',
3635 `is_shared` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if template is shared',
3636 `contents` longtext NOT NULL COMMENT 'json encoded template data',
3638 KEY `bn` (`patron_id`),
3639 CONSTRAINT `bn` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3640 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3641 /*!40101 SET character_set_client = @saved_cs_client */;
3644 -- Table structure for table `item_group_items`
3647 DROP TABLE IF EXISTS `item_group_items`;
3648 /*!40101 SET @saved_cs_client = @@character_set_client */;
3649 /*!40101 SET character_set_client = utf8 */;
3650 CREATE TABLE `item_group_items` (
3651 `item_group_items_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the group/item link',
3652 `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',
3653 `item_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the items table',
3654 PRIMARY KEY (`item_group_items_id`),
3655 UNIQUE KEY `item_id` (`item_id`),
3656 KEY `item_group_items_gifk_1` (`item_group_id`),
3657 CONSTRAINT `item_group_items_gifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3658 CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3659 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3660 /*!40101 SET character_set_client = @saved_cs_client */;
3663 -- Table structure for table `item_groups`
3666 DROP TABLE IF EXISTS `item_groups`;
3667 /*!40101 SET @saved_cs_client = @@character_set_client */;
3668 /*!40101 SET character_set_client = utf8 */;
3669 CREATE TABLE `item_groups` (
3670 `item_group_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the items group',
3671 `biblio_id` int(11) NOT NULL COMMENT 'id for the bibliographic record the group belongs to',
3672 `display_order` int(4) NOT NULL DEFAULT 0 COMMENT 'The ''sort order'' for item_groups',
3673 `description` mediumtext DEFAULT NULL COMMENT 'A group description',
3674 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the group was created',
3675 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the group',
3676 PRIMARY KEY (`item_group_id`),
3677 KEY `item_groups_ibfk_1` (`biblio_id`),
3678 CONSTRAINT `item_groups_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
3679 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3680 /*!40101 SET character_set_client = @saved_cs_client */;
3683 -- Table structure for table `items`
3686 DROP TABLE IF EXISTS `items`;
3687 /*!40101 SET @saved_cs_client = @@character_set_client */;
3688 /*!40101 SET character_set_client = utf8 */;
3689 CREATE TABLE `items` (
3690 `itemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier added by Koha',
3691 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
3692 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
3693 `barcode` varchar(20) DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
3694 `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
3695 `booksellerid` longtext DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
3696 `homebranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
3697 `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
3698 `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
3699 `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
3700 `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out/issued',
3701 `datelastseen` datetime DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
3702 `stack` tinyint(1) DEFAULT NULL,
3703 `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
3704 `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
3705 `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
3706 `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
3707 `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
3708 `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
3709 `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
3710 `itemcallnumber` varchar(255) DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
3711 `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
3712 `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out/issued',
3713 `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
3714 `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
3715 `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
3716 `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
3717 `itemnotes_nonpublic` longtext DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
3718 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
3719 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
3720 `deleted_on` datetime DEFAULT NULL COMMENT 'date/time of deletion',
3721 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
3722 `permanent_location` varchar(80) DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
3723 `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
3724 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
3725 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
3726 `ccode` varchar(80) DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
3727 `materials` mediumtext DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
3728 `uri` mediumtext DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
3729 `itype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
3730 `more_subfields_xml` longtext DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
3731 `enumchron` mediumtext DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
3732 `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
3733 `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
3734 `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.',
3735 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
3736 PRIMARY KEY (`itemnumber`),
3737 UNIQUE KEY `itembarcodeidx` (`barcode`),
3738 KEY `itemstocknumberidx` (`stocknumber`),
3739 KEY `itembinoidx` (`biblioitemnumber`),
3740 KEY `itembibnoidx` (`biblionumber`),
3741 KEY `homebranch` (`homebranch`),
3742 KEY `holdingbranch` (`holdingbranch`),
3743 KEY `itemcallnumber` (`itemcallnumber`(191)),
3744 KEY `items_location` (`location`),
3745 KEY `items_ccode` (`ccode`),
3746 KEY `itype_idx` (`itype`),
3747 KEY `timestamp` (`timestamp`),
3748 CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3749 CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
3750 CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
3751 CONSTRAINT `items_ibfk_4` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
3752 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3753 /*!40101 SET character_set_client = @saved_cs_client */;
3756 -- Table structure for table `items_last_borrower`
3759 DROP TABLE IF EXISTS `items_last_borrower`;
3760 /*!40101 SET @saved_cs_client = @@character_set_client */;
3761 /*!40101 SET character_set_client = utf8 */;
3762 CREATE TABLE `items_last_borrower` (
3763 `id` int(11) NOT NULL AUTO_INCREMENT,
3764 `itemnumber` int(11) NOT NULL,
3765 `borrowernumber` int(11) NOT NULL,
3766 `created_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
3768 UNIQUE KEY `itemnumber` (`itemnumber`),
3769 KEY `borrowernumber` (`borrowernumber`),
3770 CONSTRAINT `items_last_borrower_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3771 CONSTRAINT `items_last_borrower_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3772 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3773 /*!40101 SET character_set_client = @saved_cs_client */;
3776 -- Table structure for table `items_search_fields`
3779 DROP TABLE IF EXISTS `items_search_fields`;
3780 /*!40101 SET @saved_cs_client = @@character_set_client */;
3781 /*!40101 SET character_set_client = utf8 */;
3782 CREATE TABLE `items_search_fields` (
3783 `name` varchar(255) NOT NULL,
3784 `label` varchar(255) NOT NULL,
3785 `tagfield` char(3) NOT NULL,
3786 `tagsubfield` char(1) DEFAULT NULL,
3787 `authorised_values_category` varchar(32) DEFAULT NULL,
3788 PRIMARY KEY (`name`(191)),
3789 KEY `items_search_fields_authorised_values_category` (`authorised_values_category`),
3790 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
3791 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3792 /*!40101 SET character_set_client = @saved_cs_client */;
3795 -- Table structure for table `itemtypes`
3798 DROP TABLE IF EXISTS `itemtypes`;
3799 /*!40101 SET @saved_cs_client = @@character_set_client */;
3800 /*!40101 SET character_set_client = utf8 */;
3801 CREATE TABLE `itemtypes` (
3802 `itemtype` varchar(10) NOT NULL DEFAULT '' COMMENT 'unique key, a code associated with the item type',
3803 `parent_type` varchar(10) DEFAULT NULL COMMENT 'unique key, a code associated with the item type',
3804 `description` longtext DEFAULT NULL COMMENT 'a plain text explanation of the item type',
3805 `rentalcharge` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged when this item is checked out/issued',
3806 `rentalcharge_daily` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each day between checkout date and due date',
3807 `rentalcharge_daily_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the daily rental fee is calculated directly or using finesCalendar',
3808 `rentalcharge_hourly` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each hour between checkout date and due date',
3809 `rentalcharge_hourly_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the hourly rental fee is calculated directly or using finesCalendar',
3810 `defaultreplacecost` decimal(28,6) DEFAULT NULL COMMENT 'default replacement cost',
3811 `processfee` decimal(28,6) DEFAULT NULL COMMENT 'default text be recorded in the column note when the processing fee is applied',
3812 `notforloan` smallint(6) DEFAULT NULL COMMENT '1 if the item is not for loan, 0 if the item is available for loan',
3813 `imageurl` varchar(200) DEFAULT NULL COMMENT 'URL for the item type icon',
3814 `summary` mediumtext DEFAULT NULL COMMENT 'information from the summary field, may include HTML',
3815 `checkinmsg` varchar(255) DEFAULT NULL COMMENT 'message that is displayed when an item with the given item type is checked in',
3816 `checkinmsgtype` char(16) NOT NULL DEFAULT 'message' COMMENT 'type (CSS class) for the checkinmsg, can be ''alert'' or ''message''',
3817 `sip_media_type` varchar(3) DEFAULT NULL COMMENT 'SIP2 protocol media type for this itemtype',
3818 `hideinopac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Hide the item type from the search options in OPAC',
3819 `searchcategory` varchar(80) DEFAULT NULL COMMENT 'Group this item type with others with the same value on OPAC search options',
3820 `automatic_checkin` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If automatic checkin is enabled for items of this type',
3821 PRIMARY KEY (`itemtype`),
3822 UNIQUE KEY `itemtype` (`itemtype`),
3823 KEY `itemtypes_ibfk_1` (`parent_type`),
3824 CONSTRAINT `itemtypes_ibfk_1` FOREIGN KEY (`parent_type`) REFERENCES `itemtypes` (`itemtype`)
3825 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3826 /*!40101 SET character_set_client = @saved_cs_client */;
3829 -- Table structure for table `itemtypes_branches`
3832 DROP TABLE IF EXISTS `itemtypes_branches`;
3833 /*!40101 SET @saved_cs_client = @@character_set_client */;
3834 /*!40101 SET character_set_client = utf8 */;
3835 CREATE TABLE `itemtypes_branches` (
3836 `itemtype` varchar(10) NOT NULL,
3837 `branchcode` varchar(10) NOT NULL,
3838 KEY `itemtype` (`itemtype`),
3839 KEY `branchcode` (`branchcode`),
3840 CONSTRAINT `itemtypes_branches_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE,
3841 CONSTRAINT `itemtypes_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
3842 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3843 /*!40101 SET character_set_client = @saved_cs_client */;
3846 -- Table structure for table `keyboard_shortcuts`
3849 DROP TABLE IF EXISTS `keyboard_shortcuts`;
3850 /*!40101 SET @saved_cs_client = @@character_set_client */;
3851 /*!40101 SET character_set_client = utf8 */;
3852 CREATE TABLE `keyboard_shortcuts` (
3853 `shortcut_name` varchar(80) NOT NULL,
3854 `shortcut_keys` varchar(80) NOT NULL,
3855 PRIMARY KEY (`shortcut_name`)
3856 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3857 /*!40101 SET character_set_client = @saved_cs_client */;
3860 -- Table structure for table `language_descriptions`
3863 DROP TABLE IF EXISTS `language_descriptions`;
3864 /*!40101 SET @saved_cs_client = @@character_set_client */;
3865 /*!40101 SET character_set_client = utf8 */;
3866 CREATE TABLE `language_descriptions` (
3867 `subtag` varchar(25) DEFAULT NULL,
3868 `type` varchar(25) DEFAULT NULL,
3869 `lang` varchar(25) DEFAULT NULL,
3870 `description` varchar(255) DEFAULT NULL,
3871 `id` int(11) NOT NULL AUTO_INCREMENT,
3873 UNIQUE KEY `uniq_desc` (`subtag`,`type`,`lang`),
3875 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3876 /*!40101 SET character_set_client = @saved_cs_client */;
3879 -- Table structure for table `language_rfc4646_to_iso639`
3882 DROP TABLE IF EXISTS `language_rfc4646_to_iso639`;
3883 /*!40101 SET @saved_cs_client = @@character_set_client */;
3884 /*!40101 SET character_set_client = utf8 */;
3885 CREATE TABLE `language_rfc4646_to_iso639` (
3886 `rfc4646_subtag` varchar(25) DEFAULT NULL,
3887 `iso639_2_code` varchar(25) DEFAULT NULL,
3888 `id` int(11) NOT NULL AUTO_INCREMENT,
3890 UNIQUE KEY `uniq_code` (`rfc4646_subtag`,`iso639_2_code`),
3891 KEY `rfc4646_subtag` (`rfc4646_subtag`)
3892 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3893 /*!40101 SET character_set_client = @saved_cs_client */;
3896 -- Table structure for table `language_script_bidi`
3899 DROP TABLE IF EXISTS `language_script_bidi`;
3900 /*!40101 SET @saved_cs_client = @@character_set_client */;
3901 /*!40101 SET character_set_client = utf8 */;
3902 CREATE TABLE `language_script_bidi` (
3903 `rfc4646_subtag` varchar(25) DEFAULT NULL COMMENT 'script subtag, Arab, Hebr, etc.',
3904 `bidi` varchar(3) DEFAULT NULL COMMENT 'rtl ltr',
3905 KEY `rfc4646_subtag` (`rfc4646_subtag`)
3906 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3907 /*!40101 SET character_set_client = @saved_cs_client */;
3910 -- Table structure for table `language_script_mapping`
3913 DROP TABLE IF EXISTS `language_script_mapping`;
3914 /*!40101 SET @saved_cs_client = @@character_set_client */;
3915 /*!40101 SET character_set_client = utf8 */;
3916 CREATE TABLE `language_script_mapping` (
3917 `language_subtag` varchar(25) NOT NULL,
3918 `script_subtag` varchar(25) DEFAULT NULL,
3919 PRIMARY KEY (`language_subtag`)
3920 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3921 /*!40101 SET character_set_client = @saved_cs_client */;
3924 -- Table structure for table `language_subtag_registry`
3927 DROP TABLE IF EXISTS `language_subtag_registry`;
3928 /*!40101 SET @saved_cs_client = @@character_set_client */;
3929 /*!40101 SET character_set_client = utf8 */;
3930 CREATE TABLE `language_subtag_registry` (
3931 `subtag` varchar(25) DEFAULT NULL,
3932 `type` varchar(25) DEFAULT NULL COMMENT 'language-script-region-variant-extension-privateuse',
3933 `description` varchar(255) DEFAULT NULL COMMENT 'only one of the possible descriptions for ease of reference, see language_descriptions for the complete list',
3934 `added` date DEFAULT NULL,
3935 `id` int(11) NOT NULL AUTO_INCREMENT,
3937 UNIQUE KEY `uniq_lang` (`subtag`,`type`),
3938 KEY `subtag` (`subtag`)
3939 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3940 /*!40101 SET character_set_client = @saved_cs_client */;
3943 -- Table structure for table `letter`
3946 DROP TABLE IF EXISTS `letter`;
3947 /*!40101 SET @saved_cs_client = @@character_set_client */;
3948 /*!40101 SET character_set_client = utf8 */;
3949 CREATE TABLE `letter` (
3950 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
3951 `module` varchar(20) NOT NULL DEFAULT '' COMMENT 'Koha module that triggers this notice or slip',
3952 `code` varchar(20) NOT NULL DEFAULT '' COMMENT 'unique identifier for this notice or slip',
3953 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch this notice or slip is used at (branches.branchcode)',
3954 `name` varchar(100) NOT NULL DEFAULT '' COMMENT 'plain text name for this notice or slip',
3955 `is_html` tinyint(1) DEFAULT 0 COMMENT 'does this notice or slip use HTML (1 for yes, 0 for no)',
3956 `title` varchar(200) NOT NULL DEFAULT '' COMMENT 'subject line of the notice',
3957 `content` mediumtext DEFAULT NULL COMMENT 'body text for the notice or slip',
3958 `message_transport_type` varchar(20) NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3959 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3960 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3962 UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3963 KEY `message_transport_type_fk` (`message_transport_type`),
3964 CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
3965 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3966 /*!40101 SET character_set_client = @saved_cs_client */;
3969 -- Table structure for table `library_groups`
3972 DROP TABLE IF EXISTS `library_groups`;
3973 /*!40101 SET @saved_cs_client = @@character_set_client */;
3974 /*!40101 SET character_set_client = utf8 */;
3975 CREATE TABLE `library_groups` (
3976 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for each group',
3977 `parent_id` int(11) DEFAULT NULL COMMENT 'if this is a child group, the id of the parent group',
3978 `branchcode` varchar(10) DEFAULT NULL COMMENT 'The branchcode of a branch belonging to the parent group',
3979 `title` varchar(100) DEFAULT NULL COMMENT 'Short description of the goup',
3980 `description` mediumtext DEFAULT NULL COMMENT 'Longer explanation of the group, if necessary',
3981 `ft_hide_patron_info` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Turn on the feature ''Hide patron''s info'' for this group',
3982 `ft_limit_item_editing` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Turn on the feature "Limit item editing by group" for this group',
3983 `ft_search_groups_opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for staff side search groups',
3984 `ft_search_groups_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for opac side search groups',
3985 `ft_local_hold_group` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group to identify libraries as pick up location for holds',
3986 `ft_local_float_group` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group to identify libraries as part of float group',
3987 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Date and time of creation',
3988 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time of last',
3990 UNIQUE KEY `title` (`title`),
3991 UNIQUE KEY `library_groups_uniq_2` (`parent_id`,`branchcode`),
3992 KEY `branchcode` (`branchcode`),
3993 CONSTRAINT `library_groups_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `library_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
3994 CONSTRAINT `library_groups_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
3995 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3996 /*!40101 SET character_set_client = @saved_cs_client */;
3999 -- Table structure for table `library_smtp_servers`
4002 DROP TABLE IF EXISTS `library_smtp_servers`;
4003 /*!40101 SET @saved_cs_client = @@character_set_client */;
4004 /*!40101 SET character_set_client = utf8 */;
4005 CREATE TABLE `library_smtp_servers` (
4006 `id` int(11) NOT NULL AUTO_INCREMENT,
4007 `library_id` varchar(10) NOT NULL,
4008 `smtp_server_id` int(11) NOT NULL,
4010 UNIQUE KEY `library_id_idx` (`library_id`),
4011 KEY `smtp_server_id_idx` (`smtp_server_id`),
4012 CONSTRAINT `library_smtp_servers_library_fk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4013 CONSTRAINT `library_smtp_servers_smtp_servers_fk` FOREIGN KEY (`smtp_server_id`) REFERENCES `smtp_servers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4014 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4015 /*!40101 SET character_set_client = @saved_cs_client */;
4018 -- Table structure for table `linktracker`
4021 DROP TABLE IF EXISTS `linktracker`;
4022 /*!40101 SET @saved_cs_client = @@character_set_client */;
4023 /*!40101 SET character_set_client = utf8 */;
4024 CREATE TABLE `linktracker` (
4025 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
4026 `biblionumber` int(11) DEFAULT NULL COMMENT 'biblionumber of the record the link is from',
4027 `itemnumber` int(11) DEFAULT NULL COMMENT 'itemnumber if applicable that the link was from',
4028 `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrowernumber who clicked the link',
4029 `url` mediumtext DEFAULT NULL COMMENT 'the link itself',
4030 `timeclicked` datetime DEFAULT NULL COMMENT 'the date and time the link was clicked',
4032 KEY `bibidx` (`biblionumber`),
4033 KEY `itemidx` (`itemnumber`),
4034 KEY `borridx` (`borrowernumber`),
4035 KEY `dateidx` (`timeclicked`),
4036 CONSTRAINT `linktracker_biblio_ibfk` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4037 CONSTRAINT `linktracker_borrower_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4038 CONSTRAINT `linktracker_item_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL
4039 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4040 /*!40101 SET character_set_client = @saved_cs_client */;
4043 -- Table structure for table `localization`
4046 DROP TABLE IF EXISTS `localization`;
4047 /*!40101 SET @saved_cs_client = @@character_set_client */;
4048 /*!40101 SET character_set_client = utf8 */;
4049 CREATE TABLE `localization` (
4050 `localization_id` int(11) NOT NULL AUTO_INCREMENT,
4051 `entity` varchar(16) NOT NULL,
4052 `code` varchar(64) NOT NULL,
4053 `lang` varchar(25) NOT NULL COMMENT 'could be a foreign key',
4054 `translation` mediumtext DEFAULT NULL,
4055 PRIMARY KEY (`localization_id`),
4056 UNIQUE KEY `entity_code_lang` (`entity`,`code`,`lang`)
4057 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4058 /*!40101 SET character_set_client = @saved_cs_client */;
4061 -- Table structure for table `marc_matchers`
4064 DROP TABLE IF EXISTS `marc_matchers`;
4065 /*!40101 SET @saved_cs_client = @@character_set_client */;
4066 /*!40101 SET character_set_client = utf8 */;
4067 CREATE TABLE `marc_matchers` (
4068 `matcher_id` int(11) NOT NULL AUTO_INCREMENT,
4069 `code` varchar(10) NOT NULL DEFAULT '',
4070 `description` varchar(255) NOT NULL DEFAULT '',
4071 `record_type` varchar(10) NOT NULL DEFAULT 'biblio',
4072 `threshold` int(11) NOT NULL DEFAULT 0,
4073 PRIMARY KEY (`matcher_id`),
4074 KEY `code` (`code`),
4075 KEY `record_type` (`record_type`)
4076 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4077 /*!40101 SET character_set_client = @saved_cs_client */;
4080 -- Table structure for table `marc_modification_template_actions`
4083 DROP TABLE IF EXISTS `marc_modification_template_actions`;
4084 /*!40101 SET @saved_cs_client = @@character_set_client */;
4085 /*!40101 SET character_set_client = utf8 */;
4086 CREATE TABLE `marc_modification_template_actions` (
4087 `mmta_id` int(11) NOT NULL AUTO_INCREMENT,
4088 `template_id` int(11) NOT NULL,
4089 `ordering` int(3) NOT NULL,
4090 `action` enum('delete_field','add_field','update_field','move_field','copy_field','copy_and_replace_field') NOT NULL,
4091 `field_number` smallint(6) NOT NULL DEFAULT 0,
4092 `from_field` varchar(3) NOT NULL,
4093 `from_subfield` varchar(1) DEFAULT NULL,
4094 `field_value` text DEFAULT NULL,
4095 `to_field` varchar(3) DEFAULT NULL,
4096 `to_subfield` varchar(1) DEFAULT NULL,
4097 `to_regex_search` mediumtext DEFAULT NULL,
4098 `to_regex_replace` mediumtext DEFAULT NULL,
4099 `to_regex_modifiers` varchar(8) DEFAULT '',
4100 `conditional` enum('if','unless') DEFAULT NULL,
4101 `conditional_field` varchar(3) DEFAULT NULL,
4102 `conditional_subfield` varchar(1) DEFAULT NULL,
4103 `conditional_comparison` enum('exists','not_exists','equals','not_equals') DEFAULT NULL,
4104 `conditional_value` mediumtext DEFAULT NULL,
4105 `conditional_regex` tinyint(1) NOT NULL DEFAULT 0,
4106 `description` mediumtext DEFAULT NULL,
4107 PRIMARY KEY (`mmta_id`),
4108 KEY `mmta_ibfk_1` (`template_id`),
4109 CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
4110 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4111 /*!40101 SET character_set_client = @saved_cs_client */;
4114 -- Table structure for table `marc_modification_templates`
4117 DROP TABLE IF EXISTS `marc_modification_templates`;
4118 /*!40101 SET @saved_cs_client = @@character_set_client */;
4119 /*!40101 SET character_set_client = utf8 */;
4120 CREATE TABLE `marc_modification_templates` (
4121 `template_id` int(11) NOT NULL AUTO_INCREMENT,
4122 `name` mediumtext NOT NULL,
4123 PRIMARY KEY (`template_id`)
4124 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4125 /*!40101 SET character_set_client = @saved_cs_client */;
4128 -- Table structure for table `marc_overlay_rules`
4131 DROP TABLE IF EXISTS `marc_overlay_rules`;
4132 /*!40101 SET @saved_cs_client = @@character_set_client */;
4133 /*!40101 SET character_set_client = utf8 */;
4134 CREATE TABLE `marc_overlay_rules` (
4135 `id` int(11) NOT NULL AUTO_INCREMENT,
4136 `tag` varchar(255) NOT NULL,
4137 `module` varchar(127) NOT NULL,
4138 `filter` varchar(255) NOT NULL,
4139 `add` tinyint(1) NOT NULL DEFAULT 0,
4140 `append` tinyint(1) NOT NULL DEFAULT 0,
4141 `remove` tinyint(1) NOT NULL DEFAULT 0,
4142 `delete` tinyint(1) NOT NULL DEFAULT 0,
4144 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4145 /*!40101 SET character_set_client = @saved_cs_client */;
4148 -- Table structure for table `marc_subfield_structure`
4151 DROP TABLE IF EXISTS `marc_subfield_structure`;
4152 /*!40101 SET @saved_cs_client = @@character_set_client */;
4153 /*!40101 SET character_set_client = utf8 */;
4154 CREATE TABLE `marc_subfield_structure` (
4155 `tagfield` varchar(3) NOT NULL DEFAULT '',
4156 `tagsubfield` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
4157 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
4158 `libopac` varchar(255) NOT NULL DEFAULT '',
4159 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
4160 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4161 `important` tinyint(4) NOT NULL DEFAULT 0,
4162 `kohafield` varchar(40) DEFAULT NULL,
4163 `tab` tinyint(1) DEFAULT NULL,
4164 `authorised_value` varchar(32) DEFAULT NULL,
4165 `authtypecode` varchar(20) DEFAULT NULL,
4166 `value_builder` varchar(80) DEFAULT NULL,
4167 `isurl` tinyint(1) DEFAULT NULL,
4168 `hidden` tinyint(1) NOT NULL DEFAULT 8,
4169 `frameworkcode` varchar(4) NOT NULL DEFAULT '',
4170 `seealso` varchar(1100) DEFAULT NULL,
4171 `link` varchar(80) DEFAULT NULL,
4172 `defaultvalue` mediumtext DEFAULT NULL,
4173 `maxlength` int(4) NOT NULL DEFAULT 9999,
4174 `display_order` int(2) NOT NULL DEFAULT 0,
4175 PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`),
4176 KEY `kohafield_2` (`kohafield`),
4177 KEY `tab` (`frameworkcode`,`tab`),
4178 KEY `kohafield` (`frameworkcode`,`kohafield`),
4179 KEY `marc_subfield_structure_ibfk_1` (`authorised_value`),
4180 CONSTRAINT `marc_subfield_structure_ibfk_1` FOREIGN KEY (`authorised_value`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE SET NULL ON UPDATE CASCADE
4181 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4182 /*!40101 SET character_set_client = @saved_cs_client */;
4185 -- Table structure for table `marc_tag_structure`
4188 DROP TABLE IF EXISTS `marc_tag_structure`;
4189 /*!40101 SET @saved_cs_client = @@character_set_client */;
4190 /*!40101 SET character_set_client = utf8 */;
4191 CREATE TABLE `marc_tag_structure` (
4192 `tagfield` varchar(3) NOT NULL DEFAULT '',
4193 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
4194 `libopac` varchar(255) NOT NULL DEFAULT '',
4195 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
4196 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4197 `important` tinyint(4) NOT NULL DEFAULT 0,
4198 `authorised_value` varchar(32) DEFAULT NULL,
4199 `ind1_defaultvalue` varchar(1) NOT NULL DEFAULT '',
4200 `ind2_defaultvalue` varchar(1) NOT NULL DEFAULT '',
4201 `frameworkcode` varchar(4) NOT NULL DEFAULT '',
4202 PRIMARY KEY (`frameworkcode`,`tagfield`)
4203 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4204 /*!40101 SET character_set_client = @saved_cs_client */;
4207 -- Table structure for table `matchchecks`
4210 DROP TABLE IF EXISTS `matchchecks`;
4211 /*!40101 SET @saved_cs_client = @@character_set_client */;
4212 /*!40101 SET character_set_client = utf8 */;
4213 CREATE TABLE `matchchecks` (
4214 `matcher_id` int(11) NOT NULL,
4215 `matchcheck_id` int(11) NOT NULL AUTO_INCREMENT,
4216 `source_matchpoint_id` int(11) NOT NULL,
4217 `target_matchpoint_id` int(11) NOT NULL,
4218 PRIMARY KEY (`matchcheck_id`),
4219 KEY `matcher_matchchecks_ifbk_1` (`matcher_id`),
4220 KEY `matcher_matchchecks_ifbk_2` (`source_matchpoint_id`),
4221 KEY `matcher_matchchecks_ifbk_3` (`target_matchpoint_id`),
4222 CONSTRAINT `matcher_matchchecks_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4223 CONSTRAINT `matcher_matchchecks_ifbk_2` FOREIGN KEY (`source_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4224 CONSTRAINT `matcher_matchchecks_ifbk_3` FOREIGN KEY (`target_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4225 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4226 /*!40101 SET character_set_client = @saved_cs_client */;
4229 -- Table structure for table `matcher_matchpoints`
4232 DROP TABLE IF EXISTS `matcher_matchpoints`;
4233 /*!40101 SET @saved_cs_client = @@character_set_client */;
4234 /*!40101 SET character_set_client = utf8 */;
4235 CREATE TABLE `matcher_matchpoints` (
4236 `matcher_id` int(11) NOT NULL,
4237 `matchpoint_id` int(11) NOT NULL,
4238 KEY `matcher_matchpoints_ifbk_1` (`matcher_id`),
4239 KEY `matcher_matchpoints_ifbk_2` (`matchpoint_id`),
4240 CONSTRAINT `matcher_matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4241 CONSTRAINT `matcher_matchpoints_ifbk_2` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4242 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4243 /*!40101 SET character_set_client = @saved_cs_client */;
4246 -- Table structure for table `matchpoint_component_norms`
4249 DROP TABLE IF EXISTS `matchpoint_component_norms`;
4250 /*!40101 SET @saved_cs_client = @@character_set_client */;
4251 /*!40101 SET character_set_client = utf8 */;
4252 CREATE TABLE `matchpoint_component_norms` (
4253 `matchpoint_component_id` int(11) NOT NULL,
4254 `sequence` int(11) NOT NULL DEFAULT 0,
4255 `norm_routine` varchar(50) NOT NULL DEFAULT '',
4256 KEY `matchpoint_component_norms` (`matchpoint_component_id`,`sequence`),
4257 CONSTRAINT `matchpoint_component_norms_ifbk_1` FOREIGN KEY (`matchpoint_component_id`) REFERENCES `matchpoint_components` (`matchpoint_component_id`) ON DELETE CASCADE ON UPDATE CASCADE
4258 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4259 /*!40101 SET character_set_client = @saved_cs_client */;
4262 -- Table structure for table `matchpoint_components`
4265 DROP TABLE IF EXISTS `matchpoint_components`;
4266 /*!40101 SET @saved_cs_client = @@character_set_client */;
4267 /*!40101 SET character_set_client = utf8 */;
4268 CREATE TABLE `matchpoint_components` (
4269 `matchpoint_id` int(11) NOT NULL,
4270 `matchpoint_component_id` int(11) NOT NULL AUTO_INCREMENT,
4271 `sequence` int(11) NOT NULL DEFAULT 0,
4272 `tag` varchar(3) NOT NULL DEFAULT '',
4273 `subfields` varchar(40) NOT NULL DEFAULT '',
4274 `offset` int(4) NOT NULL DEFAULT 0,
4275 `length` int(4) NOT NULL DEFAULT 0,
4276 PRIMARY KEY (`matchpoint_component_id`),
4277 KEY `by_sequence` (`matchpoint_id`,`sequence`),
4278 CONSTRAINT `matchpoint_components_ifbk_1` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4279 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4280 /*!40101 SET character_set_client = @saved_cs_client */;
4283 -- Table structure for table `matchpoints`
4286 DROP TABLE IF EXISTS `matchpoints`;
4287 /*!40101 SET @saved_cs_client = @@character_set_client */;
4288 /*!40101 SET character_set_client = utf8 */;
4289 CREATE TABLE `matchpoints` (
4290 `matcher_id` int(11) NOT NULL,
4291 `matchpoint_id` int(11) NOT NULL AUTO_INCREMENT,
4292 `search_index` varchar(30) NOT NULL DEFAULT '',
4293 `score` int(11) NOT NULL DEFAULT 0,
4294 PRIMARY KEY (`matchpoint_id`),
4295 KEY `matchpoints_ifbk_1` (`matcher_id`),
4296 CONSTRAINT `matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE
4297 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4298 /*!40101 SET character_set_client = @saved_cs_client */;
4301 -- Table structure for table `message_attributes`
4304 DROP TABLE IF EXISTS `message_attributes`;
4305 /*!40101 SET @saved_cs_client = @@character_set_client */;
4306 /*!40101 SET character_set_client = utf8 */;
4307 CREATE TABLE `message_attributes` (
4308 `message_attribute_id` int(11) NOT NULL AUTO_INCREMENT,
4309 `message_name` varchar(40) NOT NULL DEFAULT '',
4310 `takes_days` tinyint(1) NOT NULL DEFAULT 0,
4311 PRIMARY KEY (`message_attribute_id`),
4312 UNIQUE KEY `message_name` (`message_name`)
4313 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4314 /*!40101 SET character_set_client = @saved_cs_client */;
4317 -- Table structure for table `message_queue`
4320 DROP TABLE IF EXISTS `message_queue`;
4321 /*!40101 SET @saved_cs_client = @@character_set_client */;
4322 /*!40101 SET character_set_client = utf8 */;
4323 CREATE TABLE `message_queue` (
4324 `message_id` int(11) NOT NULL AUTO_INCREMENT,
4325 `letter_id` int(11) DEFAULT NULL COMMENT 'Foreign key to the letters table',
4326 `borrowernumber` int(11) DEFAULT NULL,
4327 `subject` mediumtext DEFAULT NULL,
4328 `content` mediumtext DEFAULT NULL,
4329 `metadata` mediumtext DEFAULT NULL,
4330 `letter_code` varchar(64) DEFAULT NULL,
4331 `message_transport_type` varchar(20) NOT NULL,
4332 `status` enum('sent','pending','failed','deleted') NOT NULL DEFAULT 'pending',
4333 `time_queued` timestamp NULL DEFAULT NULL,
4334 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
4335 `to_address` longtext DEFAULT NULL,
4336 `cc_address` longtext DEFAULT NULL,
4337 `from_address` longtext DEFAULT NULL,
4338 `reply_address` longtext DEFAULT NULL,
4339 `content_type` mediumtext DEFAULT NULL,
4340 `failure_code` mediumtext DEFAULT NULL,
4341 PRIMARY KEY (`message_id`),
4342 KEY `borrowernumber` (`borrowernumber`),
4343 KEY `message_transport_type` (`message_transport_type`),
4344 KEY `letter_fk` (`letter_id`),
4345 CONSTRAINT `letter_fk` FOREIGN KEY (`letter_id`) REFERENCES `letter` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
4346 CONSTRAINT `messageq_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4347 CONSTRAINT `messageq_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON UPDATE CASCADE
4348 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4349 /*!40101 SET character_set_client = @saved_cs_client */;
4352 -- Table structure for table `message_transport_types`
4355 DROP TABLE IF EXISTS `message_transport_types`;
4356 /*!40101 SET @saved_cs_client = @@character_set_client */;
4357 /*!40101 SET character_set_client = utf8 */;
4358 CREATE TABLE `message_transport_types` (
4359 `message_transport_type` varchar(20) NOT NULL,
4360 PRIMARY KEY (`message_transport_type`)
4361 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4362 /*!40101 SET character_set_client = @saved_cs_client */;
4365 -- Table structure for table `message_transports`
4368 DROP TABLE IF EXISTS `message_transports`;
4369 /*!40101 SET @saved_cs_client = @@character_set_client */;
4370 /*!40101 SET character_set_client = utf8 */;
4371 CREATE TABLE `message_transports` (
4372 `message_attribute_id` int(11) NOT NULL,
4373 `message_transport_type` varchar(20) NOT NULL,
4374 `is_digest` tinyint(1) NOT NULL DEFAULT 0,
4375 `letter_module` varchar(20) NOT NULL DEFAULT '',
4376 `letter_code` varchar(20) NOT NULL DEFAULT '',
4377 `branchcode` varchar(10) NOT NULL DEFAULT '',
4378 PRIMARY KEY (`message_attribute_id`,`message_transport_type`,`is_digest`),
4379 KEY `message_transport_type` (`message_transport_type`),
4380 KEY `letter_module` (`letter_module`,`letter_code`),
4381 CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4382 CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
4383 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4384 /*!40101 SET character_set_client = @saved_cs_client */;
4387 -- Table structure for table `messages`
4390 DROP TABLE IF EXISTS `messages`;
4391 /*!40101 SET @saved_cs_client = @@character_set_client */;
4392 /*!40101 SET character_set_client = utf8 */;
4393 CREATE TABLE `messages` (
4394 `message_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4395 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking this message to the borrowers table',
4396 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key linking the message to the branches table',
4397 `message_type` varchar(1) NOT NULL COMMENT 'whether the message is for the librarians (L) or the patron (B)',
4398 `message` mediumtext NOT NULL COMMENT 'the text of the message',
4399 `message_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the message was written',
4400 `manager_id` int(11) DEFAULT NULL COMMENT 'creator of message',
4401 `patron_read_date` timestamp NULL DEFAULT NULL COMMENT 'the date and time the patron dismissed the message',
4402 PRIMARY KEY (`message_id`),
4403 KEY `messages_ibfk_1` (`manager_id`),
4404 KEY `messages_borrowernumber` (`borrowernumber`),
4405 CONSTRAINT `messages_borrowernumber` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4406 CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL
4407 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4408 /*!40101 SET character_set_client = @saved_cs_client */;
4411 -- Table structure for table `misc_files`
4414 DROP TABLE IF EXISTS `misc_files`;
4415 /*!40101 SET @saved_cs_client = @@character_set_client */;
4416 /*!40101 SET character_set_client = utf8 */;
4417 CREATE TABLE `misc_files` (
4418 `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the file record',
4419 `table_tag` varchar(255) NOT NULL COMMENT 'usually table name, or arbitrary unique tag',
4420 `record_id` int(11) NOT NULL COMMENT 'record id from the table this file is associated to',
4421 `file_name` varchar(255) NOT NULL COMMENT 'file name',
4422 `file_type` varchar(255) NOT NULL COMMENT 'MIME type of the file',
4423 `file_description` varchar(255) DEFAULT NULL COMMENT 'description given to the file',
4424 `file_content` longblob NOT NULL COMMENT 'file content',
4425 `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
4426 PRIMARY KEY (`file_id`),
4427 KEY `table_tag` (`table_tag`(191)),
4428 KEY `record_id` (`record_id`)
4429 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4430 /*!40101 SET character_set_client = @saved_cs_client */;
4433 -- Table structure for table `need_merge_authorities`
4436 DROP TABLE IF EXISTS `need_merge_authorities`;
4437 /*!40101 SET @saved_cs_client = @@character_set_client */;
4438 /*!40101 SET character_set_client = utf8 */;
4439 CREATE TABLE `need_merge_authorities` (
4440 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id',
4441 `authid` bigint(20) NOT NULL COMMENT 'reference to original authority record',
4442 `authid_new` bigint(20) DEFAULT NULL COMMENT 'reference to optional new authority record',
4443 `reportxml` mediumtext DEFAULT NULL COMMENT 'xml showing original reporting tag',
4444 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time last modified',
4445 `done` tinyint(4) DEFAULT 0,
4447 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4448 /*!40101 SET character_set_client = @saved_cs_client */;
4451 -- Table structure for table `oai_sets`
4454 DROP TABLE IF EXISTS `oai_sets`;
4455 /*!40101 SET @saved_cs_client = @@character_set_client */;
4456 /*!40101 SET character_set_client = utf8 */;
4457 CREATE TABLE `oai_sets` (
4458 `id` int(11) NOT NULL AUTO_INCREMENT,
4459 `spec` varchar(80) NOT NULL,
4460 `name` varchar(80) NOT NULL,
4462 UNIQUE KEY `spec` (`spec`)
4463 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4464 /*!40101 SET character_set_client = @saved_cs_client */;
4467 -- Table structure for table `oai_sets_biblios`
4470 DROP TABLE IF EXISTS `oai_sets_biblios`;
4471 /*!40101 SET @saved_cs_client = @@character_set_client */;
4472 /*!40101 SET character_set_client = utf8 */;
4473 CREATE TABLE `oai_sets_biblios` (
4474 `biblionumber` int(11) NOT NULL,
4475 `set_id` int(11) NOT NULL,
4476 PRIMARY KEY (`biblionumber`,`set_id`),
4477 KEY `oai_sets_biblios_ibfk_2` (`set_id`),
4478 CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4479 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4480 /*!40101 SET character_set_client = @saved_cs_client */;
4483 -- Table structure for table `oai_sets_descriptions`
4486 DROP TABLE IF EXISTS `oai_sets_descriptions`;
4487 /*!40101 SET @saved_cs_client = @@character_set_client */;
4488 /*!40101 SET character_set_client = utf8 */;
4489 CREATE TABLE `oai_sets_descriptions` (
4490 `set_id` int(11) NOT NULL,
4491 `description` varchar(255) NOT NULL,
4492 KEY `oai_sets_descriptions_ibfk_1` (`set_id`),
4493 CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4494 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4495 /*!40101 SET character_set_client = @saved_cs_client */;
4498 -- Table structure for table `oai_sets_mappings`
4501 DROP TABLE IF EXISTS `oai_sets_mappings`;
4502 /*!40101 SET @saved_cs_client = @@character_set_client */;
4503 /*!40101 SET character_set_client = utf8 */;
4504 CREATE TABLE `oai_sets_mappings` (
4505 `set_id` int(11) NOT NULL,
4506 `rule_order` int(11) DEFAULT NULL,
4507 `rule_operator` varchar(3) DEFAULT NULL,
4508 `marcfield` char(3) NOT NULL,
4509 `marcsubfield` char(1) NOT NULL,
4510 `operator` varchar(8) NOT NULL DEFAULT 'equal',
4511 `marcvalue` varchar(80) NOT NULL,
4512 KEY `oai_sets_mappings_ibfk_1` (`set_id`),
4513 CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4514 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4515 /*!40101 SET character_set_client = @saved_cs_client */;
4518 -- Table structure for table `oauth_access_tokens`
4521 DROP TABLE IF EXISTS `oauth_access_tokens`;
4522 /*!40101 SET @saved_cs_client = @@character_set_client */;
4523 /*!40101 SET character_set_client = utf8 */;
4524 CREATE TABLE `oauth_access_tokens` (
4525 `access_token` varchar(191) NOT NULL COMMENT 'generarated access token',
4526 `client_id` varchar(191) NOT NULL COMMENT 'the client id the access token belongs to',
4527 `expires` int(11) NOT NULL COMMENT 'expiration time in seconds',
4528 PRIMARY KEY (`access_token`)
4529 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4530 /*!40101 SET character_set_client = @saved_cs_client */;
4533 -- Table structure for table `old_issues`
4536 DROP TABLE IF EXISTS `old_issues`;
4537 /*!40101 SET @saved_cs_client = @@character_set_client */;
4538 /*!40101 SET character_set_client = utf8 */;
4539 CREATE TABLE `old_issues` (
4540 `issue_id` int(11) NOT NULL COMMENT 'primary key for issues table',
4541 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
4542 `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
4543 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
4544 `date_due` datetime DEFAULT NULL COMMENT 'date the item is due (yyyy-mm-dd)',
4545 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
4546 `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned',
4547 `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
4548 `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
4549 `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
4550 `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
4551 `auto_renew_error` varchar(32) DEFAULT NULL COMMENT 'automatic renewal error',
4552 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
4553 `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
4554 `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
4555 `note` longtext DEFAULT NULL COMMENT 'issue note text',
4556 `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
4557 `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
4558 PRIMARY KEY (`issue_id`),
4559 KEY `old_issuesborridx` (`borrowernumber`),
4560 KEY `old_issuesitemidx` (`itemnumber`),
4561 KEY `branchcode_idx` (`branchcode`),
4562 KEY `old_bordate` (`borrowernumber`,`timestamp`),
4563 KEY `old_issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
4564 CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4565 CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4566 CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
4567 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4568 /*!40101 SET character_set_client = @saved_cs_client */;
4571 -- Table structure for table `old_reserves`
4574 DROP TABLE IF EXISTS `old_reserves`;
4575 /*!40101 SET @saved_cs_client = @@character_set_client */;
4576 /*!40101 SET character_set_client = utf8 */;
4577 CREATE TABLE `old_reserves` (
4578 `reserve_id` int(11) NOT NULL COMMENT 'primary key',
4579 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4580 `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places',
4581 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4582 `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
4583 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
4584 `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4585 `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4586 `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4587 `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4588 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4589 `reservenotes` longtext DEFAULT NULL COMMENT 'notes related to this hold',
4590 `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4591 `found` varchar(1) DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
4592 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4593 `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',
4594 `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4595 `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)',
4596 `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',
4597 `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)',
4598 `suspend` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'in this hold suspended (1 for yes, 0 for no)',
4599 `suspend_until` datetime DEFAULT NULL COMMENT 'the date this hold is suspended until (NULL for infinitely)',
4600 `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4601 `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
4602 `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4603 PRIMARY KEY (`reserve_id`),
4604 KEY `old_reserves_borrowernumber` (`borrowernumber`),
4605 KEY `old_reserves_biblionumber` (`biblionumber`),
4606 KEY `old_reserves_itemnumber` (`itemnumber`),
4607 KEY `old_reserves_branchcode` (`branchcode`),
4608 KEY `old_reserves_itemtype` (`itemtype`),
4609 KEY `old_reserves_ibfk_ig` (`item_group_id`),
4610 CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4611 CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4612 CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4613 CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
4614 CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
4615 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4616 /*!40101 SET character_set_client = @saved_cs_client */;
4619 -- Table structure for table `overduerules`
4622 DROP TABLE IF EXISTS `overduerules`;
4623 /*!40101 SET @saved_cs_client = @@character_set_client */;
4624 /*!40101 SET character_set_client = utf8 */;
4625 CREATE TABLE `overduerules` (
4626 `overduerules_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the overduerules',
4627 `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)',
4628 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table to define which patron category this rule is for',
4629 `delay1` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the first notice is sent',
4630 `letter1` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the first notice',
4631 `debarred1` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the first notice is sent (1 for yes, 0 for no)',
4632 `delay2` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the second notice is sent',
4633 `debarred2` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the second notice is sent (1 for yes, 0 for no)',
4634 `letter2` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the second notice',
4635 `delay3` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the third notice is sent',
4636 `letter3` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the third notice',
4637 `debarred3` int(1) DEFAULT 0 COMMENT 'is the patron restricted when the third notice is sent (1 for yes, 0 for no)',
4638 PRIMARY KEY (`overduerules_id`),
4639 UNIQUE KEY `overduerules_branch_cat` (`branchcode`,`categorycode`)
4640 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4641 /*!40101 SET character_set_client = @saved_cs_client */;
4644 -- Table structure for table `overduerules_transport_types`
4647 DROP TABLE IF EXISTS `overduerules_transport_types`;
4648 /*!40101 SET @saved_cs_client = @@character_set_client */;
4649 /*!40101 SET character_set_client = utf8 */;
4650 CREATE TABLE `overduerules_transport_types` (
4651 `id` int(11) NOT NULL AUTO_INCREMENT,
4652 `letternumber` int(1) NOT NULL DEFAULT 1,
4653 `message_transport_type` varchar(20) NOT NULL DEFAULT 'email',
4654 `overduerules_id` int(11) NOT NULL,
4656 KEY `overduerules_fk` (`overduerules_id`),
4657 KEY `mtt_fk` (`message_transport_type`),
4658 CONSTRAINT `mtt_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
4659 CONSTRAINT `overduerules_fk` FOREIGN KEY (`overduerules_id`) REFERENCES `overduerules` (`overduerules_id`) ON DELETE CASCADE ON UPDATE CASCADE
4660 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4661 /*!40101 SET character_set_client = @saved_cs_client */;
4664 -- Table structure for table `patron_consent`
4667 DROP TABLE IF EXISTS `patron_consent`;
4668 /*!40101 SET @saved_cs_client = @@character_set_client */;
4669 /*!40101 SET character_set_client = utf8 */;
4670 CREATE TABLE `patron_consent` (
4671 `id` int(11) NOT NULL AUTO_INCREMENT,
4672 `borrowernumber` int(11) NOT NULL,
4673 `type` enum('GDPR_PROCESSING') DEFAULT NULL COMMENT 'allows for future extension',
4674 `given_on` datetime DEFAULT NULL,
4675 `refused_on` datetime DEFAULT NULL,
4677 KEY `borrowernumber` (`borrowernumber`),
4678 CONSTRAINT `patron_consent_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4679 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4680 /*!40101 SET character_set_client = @saved_cs_client */;
4683 -- Table structure for table `patron_list_patrons`
4686 DROP TABLE IF EXISTS `patron_list_patrons`;
4687 /*!40101 SET @saved_cs_client = @@character_set_client */;
4688 /*!40101 SET character_set_client = utf8 */;
4689 CREATE TABLE `patron_list_patrons` (
4690 `patron_list_patron_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
4691 `patron_list_id` int(11) NOT NULL COMMENT 'the list this entry is part of',
4692 `borrowernumber` int(11) NOT NULL COMMENT 'the borrower that is part of this list',
4693 PRIMARY KEY (`patron_list_patron_id`),
4694 KEY `patron_list_id` (`patron_list_id`),
4695 KEY `borrowernumber` (`borrowernumber`),
4696 CONSTRAINT `patron_list_patrons_ibfk_1` FOREIGN KEY (`patron_list_id`) REFERENCES `patron_lists` (`patron_list_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4697 CONSTRAINT `patron_list_patrons_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4698 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4699 /*!40101 SET character_set_client = @saved_cs_client */;
4702 -- Table structure for table `patron_lists`
4705 DROP TABLE IF EXISTS `patron_lists`;
4706 /*!40101 SET @saved_cs_client = @@character_set_client */;
4707 /*!40101 SET character_set_client = utf8 */;
4708 CREATE TABLE `patron_lists` (
4709 `patron_list_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
4710 `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'the list''s name',
4711 `owner` int(11) NOT NULL COMMENT 'borrowernumber of the list creator',
4712 `shared` tinyint(1) DEFAULT 0,
4713 PRIMARY KEY (`patron_list_id`),
4714 KEY `owner` (`owner`),
4715 CONSTRAINT `patron_lists_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4716 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4717 /*!40101 SET character_set_client = @saved_cs_client */;
4720 -- Table structure for table `patronimage`
4723 DROP TABLE IF EXISTS `patronimage`;
4724 /*!40101 SET @saved_cs_client = @@character_set_client */;
4725 /*!40101 SET character_set_client = utf8 */;
4726 CREATE TABLE `patronimage` (
4727 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron this image is attached to (borrowers.borrowernumber)',
4728 `mimetype` varchar(15) NOT NULL COMMENT 'the format of the image (png, jpg, etc)',
4729 `imagefile` mediumblob NOT NULL COMMENT 'the image',
4730 PRIMARY KEY (`borrowernumber`),
4731 CONSTRAINT `patronimage_fk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4732 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4733 /*!40101 SET character_set_client = @saved_cs_client */;
4736 -- Table structure for table `pending_offline_operations`
4739 DROP TABLE IF EXISTS `pending_offline_operations`;
4740 /*!40101 SET @saved_cs_client = @@character_set_client */;
4741 /*!40101 SET character_set_client = utf8 */;
4742 CREATE TABLE `pending_offline_operations` (
4743 `operationid` int(11) NOT NULL AUTO_INCREMENT,
4744 `userid` varchar(30) NOT NULL,
4745 `branchcode` varchar(10) NOT NULL,
4746 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
4747 `action` varchar(10) NOT NULL,
4748 `barcode` varchar(20) DEFAULT NULL,
4749 `cardnumber` varchar(32) DEFAULT NULL,
4750 `amount` decimal(28,6) DEFAULT NULL,
4751 PRIMARY KEY (`operationid`)
4752 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4753 /*!40101 SET character_set_client = @saved_cs_client */;
4756 -- Table structure for table `permissions`
4759 DROP TABLE IF EXISTS `permissions`;
4760 /*!40101 SET @saved_cs_client = @@character_set_client */;
4761 /*!40101 SET character_set_client = utf8 */;
4762 CREATE TABLE `permissions` (
4763 `module_bit` int(11) NOT NULL DEFAULT 0,
4764 `code` varchar(64) NOT NULL DEFAULT '',
4765 `description` varchar(255) DEFAULT NULL,
4766 PRIMARY KEY (`module_bit`,`code`),
4767 CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`) ON DELETE CASCADE ON UPDATE CASCADE
4768 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4769 /*!40101 SET character_set_client = @saved_cs_client */;
4772 -- Table structure for table `plugin_data`
4775 DROP TABLE IF EXISTS `plugin_data`;
4776 /*!40101 SET @saved_cs_client = @@character_set_client */;
4777 /*!40101 SET character_set_client = utf8 */;
4778 CREATE TABLE `plugin_data` (
4779 `plugin_class` varchar(255) NOT NULL,
4780 `plugin_key` varchar(255) NOT NULL,
4781 `plugin_value` mediumtext DEFAULT NULL,
4782 PRIMARY KEY (`plugin_class`(191),`plugin_key`(191))
4783 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4784 /*!40101 SET character_set_client = @saved_cs_client */;
4787 -- Table structure for table `plugin_methods`
4790 DROP TABLE IF EXISTS `plugin_methods`;
4791 /*!40101 SET @saved_cs_client = @@character_set_client */;
4792 /*!40101 SET character_set_client = utf8 */;
4793 CREATE TABLE `plugin_methods` (
4794 `plugin_class` varchar(255) NOT NULL,
4795 `plugin_method` varchar(255) NOT NULL,
4796 PRIMARY KEY (`plugin_class`(191),`plugin_method`(191))
4797 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4798 /*!40101 SET character_set_client = @saved_cs_client */;
4801 -- Table structure for table `printers_profile`
4804 DROP TABLE IF EXISTS `printers_profile`;
4805 /*!40101 SET @saved_cs_client = @@character_set_client */;
4806 /*!40101 SET character_set_client = utf8 */;
4807 CREATE TABLE `printers_profile` (
4808 `profile_id` int(4) NOT NULL AUTO_INCREMENT,
4809 `printer_name` varchar(40) NOT NULL DEFAULT 'Default Printer',
4810 `template_id` int(4) NOT NULL DEFAULT 0,
4811 `paper_bin` varchar(20) NOT NULL DEFAULT 'Bypass',
4812 `offset_horz` float NOT NULL DEFAULT 0,
4813 `offset_vert` float NOT NULL DEFAULT 0,
4814 `creep_horz` float NOT NULL DEFAULT 0,
4815 `creep_vert` float NOT NULL DEFAULT 0,
4816 `units` char(20) NOT NULL DEFAULT 'POINT',
4817 `creator` char(15) NOT NULL DEFAULT 'Labels',
4818 PRIMARY KEY (`profile_id`),
4819 UNIQUE KEY `printername` (`printer_name`,`template_id`,`paper_bin`,`creator`)
4820 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4821 /*!40101 SET character_set_client = @saved_cs_client */;
4824 -- Table structure for table `problem_reports`
4827 DROP TABLE IF EXISTS `problem_reports`;
4828 /*!40101 SET @saved_cs_client = @@character_set_client */;
4829 /*!40101 SET character_set_client = utf8 */;
4830 CREATE TABLE `problem_reports` (
4831 `reportid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4832 `title` varchar(40) NOT NULL DEFAULT '' COMMENT 'report subject line',
4833 `content` text NOT NULL COMMENT 'report message content',
4834 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the user who created the problem report',
4835 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'borrower''s branch',
4836 `username` varchar(75) DEFAULT NULL COMMENT 'OPAC username',
4837 `problempage` text DEFAULT NULL COMMENT 'page the user triggered the problem report form from',
4838 `recipient` enum('admin','library') NOT NULL DEFAULT 'library' COMMENT 'the ''to-address'' of the problem report',
4839 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'timestamp of report submission',
4840 `status` varchar(6) NOT NULL DEFAULT 'New' COMMENT 'status of the report. New, Viewed, Closed',
4841 PRIMARY KEY (`reportid`),
4842 KEY `problem_reports_ibfk1` (`borrowernumber`),
4843 KEY `problem_reports_ibfk2` (`branchcode`),
4844 CONSTRAINT `problem_reports_ibfk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4845 CONSTRAINT `problem_reports_ibfk2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4846 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4847 /*!40101 SET character_set_client = @saved_cs_client */;
4850 -- Table structure for table `pseudonymized_borrower_attributes`
4853 DROP TABLE IF EXISTS `pseudonymized_borrower_attributes`;
4854 /*!40101 SET @saved_cs_client = @@character_set_client */;
4855 /*!40101 SET character_set_client = utf8 */;
4856 CREATE TABLE `pseudonymized_borrower_attributes` (
4857 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
4858 `transaction_id` int(11) NOT NULL,
4859 `code` varchar(10) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
4860 `attribute` varchar(255) DEFAULT NULL COMMENT 'custom patron field value',
4862 KEY `pseudonymized_borrower_attributes_ibfk_1` (`transaction_id`),
4863 KEY `anonymized_borrower_attributes_ibfk_2` (`code`),
4864 CONSTRAINT `anonymized_borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
4865 CONSTRAINT `pseudonymized_borrower_attributes_ibfk_1` FOREIGN KEY (`transaction_id`) REFERENCES `pseudonymized_transactions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4866 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4867 /*!40101 SET character_set_client = @saved_cs_client */;
4870 -- Table structure for table `pseudonymized_transactions`
4873 DROP TABLE IF EXISTS `pseudonymized_transactions`;
4874 /*!40101 SET @saved_cs_client = @@character_set_client */;
4875 /*!40101 SET character_set_client = utf8 */;
4876 CREATE TABLE `pseudonymized_transactions` (
4877 `id` int(11) NOT NULL AUTO_INCREMENT,
4878 `hashed_borrowernumber` varchar(60) NOT NULL,
4879 `has_cardnumber` tinyint(1) NOT NULL DEFAULT 0,
4880 `title` longtext DEFAULT NULL,
4881 `city` longtext DEFAULT NULL,
4882 `state` mediumtext DEFAULT NULL,
4883 `zipcode` varchar(25) DEFAULT NULL,
4884 `country` mediumtext DEFAULT NULL,
4885 `branchcode` varchar(10) NOT NULL DEFAULT '',
4886 `categorycode` varchar(10) NOT NULL DEFAULT '',
4887 `dateenrolled` date DEFAULT NULL,
4888 `sex` varchar(1) DEFAULT NULL,
4889 `sort1` varchar(80) DEFAULT NULL,
4890 `sort2` varchar(80) DEFAULT NULL,
4891 `datetime` datetime DEFAULT NULL,
4892 `transaction_branchcode` varchar(10) DEFAULT NULL,
4893 `transaction_type` varchar(16) DEFAULT NULL,
4894 `itemnumber` int(11) DEFAULT NULL,
4895 `itemtype` varchar(10) DEFAULT NULL,
4896 `holdingbranch` varchar(10) DEFAULT NULL,
4897 `homebranch` varchar(10) DEFAULT NULL,
4898 `location` varchar(80) DEFAULT NULL,
4899 `itemcallnumber` varchar(255) DEFAULT NULL,
4900 `ccode` varchar(80) DEFAULT NULL,
4902 KEY `pseudonymized_transactions_ibfk_1` (`categorycode`),
4903 KEY `pseudonymized_transactions_borrowers_ibfk_2` (`branchcode`),
4904 KEY `pseudonymized_transactions_borrowers_ibfk_3` (`transaction_branchcode`)
4905 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4906 /*!40101 SET character_set_client = @saved_cs_client */;
4909 -- Table structure for table `quotes`
4912 DROP TABLE IF EXISTS `quotes`;
4913 /*!40101 SET @saved_cs_client = @@character_set_client */;
4914 /*!40101 SET character_set_client = utf8 */;
4915 CREATE TABLE `quotes` (
4916 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the quote',
4917 `source` mediumtext DEFAULT NULL COMMENT 'source/credit for the quote',
4918 `text` longtext NOT NULL COMMENT 'text of the quote',
4919 `timestamp` datetime DEFAULT NULL COMMENT 'date and time that the quote last appeared in the opac',
4921 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4922 /*!40101 SET character_set_client = @saved_cs_client */;
4925 -- Table structure for table `ratings`
4928 DROP TABLE IF EXISTS `ratings`;
4929 /*!40101 SET @saved_cs_client = @@character_set_client */;
4930 /*!40101 SET character_set_client = utf8 */;
4931 CREATE TABLE `ratings` (
4932 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron who left this rating (borrowers.borrowernumber)',
4933 `biblionumber` int(11) NOT NULL COMMENT 'the biblio this rating is for (biblio.biblionumber)',
4934 `rating_value` tinyint(1) NOT NULL COMMENT 'the rating, from 1 to 5',
4935 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
4936 PRIMARY KEY (`borrowernumber`,`biblionumber`),
4937 KEY `ratings_ibfk_2` (`biblionumber`),
4938 CONSTRAINT `ratings_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4939 CONSTRAINT `ratings_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
4940 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4941 /*!40101 SET character_set_client = @saved_cs_client */;
4944 -- Table structure for table `recalls`
4947 DROP TABLE IF EXISTS `recalls`;
4948 /*!40101 SET @saved_cs_client = @@character_set_client */;
4949 /*!40101 SET character_set_client = utf8 */;
4950 CREATE TABLE `recalls` (
4951 `recall_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier for this recall',
4952 `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Identifier for patron who requested recall',
4953 `created_date` datetime DEFAULT NULL COMMENT 'Date the recall was requested',
4954 `biblio_id` int(11) NOT NULL COMMENT 'Identifier for bibliographic record that has been recalled',
4955 `pickup_library_id` varchar(10) DEFAULT NULL COMMENT 'Identifier for recall pickup library',
4956 `completed_date` datetime DEFAULT NULL COMMENT 'Date the recall is completed (fulfilled, cancelled or expired)',
4957 `notes` mediumtext DEFAULT NULL COMMENT 'Notes related to the recall',
4958 `priority` smallint(6) DEFAULT NULL COMMENT 'Where in the queue the patron sits',
4959 `status` enum('requested','overdue','waiting','in_transit','cancelled','expired','fulfilled') DEFAULT 'requested' COMMENT 'Status of recall',
4960 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time the recall was last updated',
4961 `item_id` int(11) DEFAULT NULL COMMENT 'Identifier for item record that was recalled, if an item-level recall',
4962 `waiting_date` datetime DEFAULT NULL COMMENT 'Date an item was marked as waiting for the patron at the library',
4963 `expiration_date` datetime DEFAULT NULL COMMENT 'Date recall is no longer required, or date recall will expire after waiting on shelf for pickup',
4964 `completed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is old and no longer active, i.e. expired, cancelled or completed',
4965 `item_level` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is for a specific item',
4966 PRIMARY KEY (`recall_id`),
4967 KEY `recalls_ibfk_1` (`patron_id`),
4968 KEY `recalls_ibfk_2` (`biblio_id`),
4969 KEY `recalls_ibfk_3` (`item_id`),
4970 KEY `recalls_ibfk_4` (`pickup_library_id`),
4971 CONSTRAINT `recalls_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4972 CONSTRAINT `recalls_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4973 CONSTRAINT `recalls_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4974 CONSTRAINT `recalls_ibfk_4` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4975 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Information related to recalls in Koha';
4976 /*!40101 SET character_set_client = @saved_cs_client */;
4979 -- Table structure for table `repeatable_holidays`
4982 DROP TABLE IF EXISTS `repeatable_holidays`;
4983 /*!40101 SET @saved_cs_client = @@character_set_client */;
4984 /*!40101 SET character_set_client = utf8 */;
4985 CREATE TABLE `repeatable_holidays` (
4986 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4987 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
4988 `weekday` smallint(6) DEFAULT NULL COMMENT 'day of the week (0=Sunday, 1=Monday, etc) this closing is repeated on',
4989 `day` smallint(6) DEFAULT NULL COMMENT 'day of the month this closing is on',
4990 `month` smallint(6) DEFAULT NULL COMMENT 'month this closing is in',
4991 `title` varchar(50) NOT NULL DEFAULT '' COMMENT 'title of this closing',
4992 `description` mediumtext NOT NULL COMMENT 'description for this closing',
4994 KEY `repeatable_holidays_ibfk_1` (`branchcode`),
4995 CONSTRAINT `repeatable_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4996 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4997 /*!40101 SET character_set_client = @saved_cs_client */;
5000 -- Table structure for table `reports_dictionary`
5003 DROP TABLE IF EXISTS `reports_dictionary`;
5004 /*!40101 SET @saved_cs_client = @@character_set_client */;
5005 /*!40101 SET character_set_client = utf8 */;
5006 CREATE TABLE `reports_dictionary` (
5007 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5008 `name` varchar(255) DEFAULT NULL COMMENT 'name for this definition',
5009 `description` mediumtext DEFAULT NULL COMMENT 'description for this definition',
5010 `date_created` datetime DEFAULT NULL COMMENT 'date and time this definition was created',
5011 `date_modified` datetime DEFAULT NULL COMMENT 'date and time this definition was last modified',
5012 `saved_sql` mediumtext DEFAULT NULL COMMENT 'SQL snippet for us in reports',
5013 `report_area` varchar(6) DEFAULT NULL COMMENT 'Koha module this definition is for Circulation, Catalog, Patrons, Acquistions, Accounts)',
5015 KEY `dictionary_area_idx` (`report_area`)
5016 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5017 /*!40101 SET character_set_client = @saved_cs_client */;
5020 -- Table structure for table `reserves`
5023 DROP TABLE IF EXISTS `reserves`;
5024 /*!40101 SET @saved_cs_client = @@character_set_client */;
5025 /*!40101 SET character_set_client = utf8 */;
5026 CREATE TABLE `reserves` (
5027 `reserve_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
5028 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
5029 `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
5030 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
5031 `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
5032 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
5033 `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
5034 `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
5035 `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
5036 `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
5037 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
5038 `reservenotes` longtext DEFAULT NULL COMMENT 'notes related to this hold',
5039 `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
5040 `found` varchar(1) DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
5041 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
5042 `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',
5043 `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
5044 `expirationdate` date DEFAULT NULL COMMENT 'the date the hold expires (calculated value)',
5045 `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',
5046 `lowestPriority` tinyint(1) NOT NULL DEFAULT 0,
5047 `suspend` tinyint(1) NOT NULL DEFAULT 0,
5048 `suspend_until` datetime DEFAULT NULL,
5049 `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
5050 `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
5051 `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
5052 PRIMARY KEY (`reserve_id`),
5053 KEY `priorityfoundidx` (`priority`,`found`),
5054 KEY `borrowernumber` (`borrowernumber`),
5055 KEY `biblionumber` (`biblionumber`),
5056 KEY `itemnumber` (`itemnumber`),
5057 KEY `branchcode` (`branchcode`),
5058 KEY `desk_id` (`desk_id`),
5059 KEY `itemtype` (`itemtype`),
5060 KEY `reserves_ibfk_ig` (`item_group_id`),
5061 CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5062 CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5063 CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5064 CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5065 CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
5066 CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5067 CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE
5068 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5069 /*!40101 SET character_set_client = @saved_cs_client */;
5072 -- Table structure for table `restriction_types`
5075 DROP TABLE IF EXISTS `restriction_types`;
5076 /*!40101 SET @saved_cs_client = @@character_set_client */;
5077 /*!40101 SET character_set_client = utf8 */;
5078 CREATE TABLE `restriction_types` (
5079 `code` varchar(50) NOT NULL,
5080 `display_text` text NOT NULL,
5081 `is_system` tinyint(1) NOT NULL DEFAULT 0,
5082 `is_default` tinyint(1) NOT NULL DEFAULT 0,
5083 `lift_after_payment` tinyint(1) NOT NULL DEFAULT 0,
5084 `fee_limit` decimal(28,6) DEFAULT NULL,
5085 PRIMARY KEY (`code`)
5086 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5087 /*!40101 SET character_set_client = @saved_cs_client */;
5090 -- Table structure for table `return_claims`
5093 DROP TABLE IF EXISTS `return_claims`;
5094 /*!40101 SET @saved_cs_client = @@character_set_client */;
5095 /*!40101 SET character_set_client = utf8 */;
5096 CREATE TABLE `return_claims` (
5097 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the return claim',
5098 `itemnumber` int(11) NOT NULL COMMENT 'ID of the item',
5099 `issue_id` int(11) DEFAULT NULL COMMENT 'ID of the checkout that triggered the claim',
5100 `borrowernumber` int(11) NOT NULL COMMENT 'ID of the patron',
5101 `notes` mediumtext DEFAULT NULL COMMENT 'Notes about the claim',
5102 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was created',
5103 `created_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that registered the claim',
5104 `updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the claim (notes)',
5105 `updated_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that updated the claim',
5106 `resolution` varchar(80) DEFAULT NULL COMMENT 'Resolution code (RETURN_CLAIM_RESOLUTION AVs)',
5107 `resolved_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was resolved',
5108 `resolved_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that resolved the claim',
5110 UNIQUE KEY `item_issue` (`itemnumber`,`issue_id`),
5111 KEY `itemnumber` (`itemnumber`),
5112 KEY `rc_borrowers_ibfk` (`borrowernumber`),
5113 KEY `rc_created_by_ibfk` (`created_by`),
5114 KEY `rc_updated_by_ibfk` (`updated_by`),
5115 KEY `rc_resolved_by_ibfk` (`resolved_by`),
5116 CONSTRAINT `rc_borrowers_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5117 CONSTRAINT `rc_created_by_ibfk` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5118 CONSTRAINT `rc_items_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5119 CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5120 CONSTRAINT `rc_updated_by_ibfk` FOREIGN KEY (`updated_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5121 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5122 /*!40101 SET character_set_client = @saved_cs_client */;
5125 -- Table structure for table `reviews`
5128 DROP TABLE IF EXISTS `reviews`;
5129 /*!40101 SET @saved_cs_client = @@character_set_client */;
5130 /*!40101 SET character_set_client = utf8 */;
5131 CREATE TABLE `reviews` (
5132 `reviewid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for this comment',
5133 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron left this comment',
5134 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bibliographic record this comment is for',
5135 `review` mediumtext DEFAULT NULL COMMENT 'the body of the comment',
5136 `approved` tinyint(4) DEFAULT 0 COMMENT 'whether this comment has been approved by a librarian (1 for yes, 0 for no)',
5137 `datereviewed` datetime DEFAULT NULL COMMENT 'the date the comment was left',
5138 PRIMARY KEY (`reviewid`),
5139 KEY `reviews_ibfk_1` (`borrowernumber`),
5140 KEY `reviews_ibfk_2` (`biblionumber`),
5141 CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5142 CONSTRAINT `reviews_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5143 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5144 /*!40101 SET character_set_client = @saved_cs_client */;
5147 -- Table structure for table `saved_reports`
5150 DROP TABLE IF EXISTS `saved_reports`;
5151 /*!40101 SET @saved_cs_client = @@character_set_client */;
5152 /*!40101 SET character_set_client = utf8 */;
5153 CREATE TABLE `saved_reports` (
5154 `id` int(11) NOT NULL AUTO_INCREMENT,
5155 `report_id` int(11) DEFAULT NULL,
5156 `report` longtext DEFAULT NULL,
5157 `date_run` datetime DEFAULT NULL,
5159 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5160 /*!40101 SET character_set_client = @saved_cs_client */;
5163 -- Table structure for table `saved_sql`
5166 DROP TABLE IF EXISTS `saved_sql`;
5167 /*!40101 SET @saved_cs_client = @@character_set_client */;
5168 /*!40101 SET character_set_client = utf8 */;
5169 CREATE TABLE `saved_sql` (
5170 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key assigned by Koha',
5171 `borrowernumber` int(11) DEFAULT NULL COMMENT 'the staff member who created this report (borrowers.borrowernumber)',
5172 `date_created` datetime DEFAULT NULL COMMENT 'the date this report was created',
5173 `last_modified` datetime DEFAULT NULL COMMENT 'the date this report was last edited',
5174 `savedsql` mediumtext DEFAULT NULL COMMENT 'the SQL for this report',
5175 `last_run` datetime DEFAULT NULL,
5176 `report_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'the name of this report',
5177 `type` varchar(255) DEFAULT NULL COMMENT 'always 1 for tabular',
5178 `notes` mediumtext DEFAULT NULL COMMENT 'the notes or description given to this report',
5179 `cache_expiry` int(11) NOT NULL DEFAULT 300,
5180 `public` tinyint(1) NOT NULL DEFAULT 0,
5181 `report_area` varchar(6) DEFAULT NULL,
5182 `report_group` varchar(80) DEFAULT NULL,
5183 `report_subgroup` varchar(80) DEFAULT NULL,
5184 `mana_id` int(11) DEFAULT NULL,
5186 KEY `sql_area_group_idx` (`report_group`,`report_subgroup`),
5187 KEY `boridx` (`borrowernumber`)
5188 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5189 /*!40101 SET character_set_client = @saved_cs_client */;
5192 -- Table structure for table `search_field`
5195 DROP TABLE IF EXISTS `search_field`;
5196 /*!40101 SET @saved_cs_client = @@character_set_client */;
5197 /*!40101 SET character_set_client = utf8 */;
5198 CREATE TABLE `search_field` (
5199 `id` int(11) NOT NULL AUTO_INCREMENT,
5200 `name` varchar(255) NOT NULL COMMENT 'the name of the field as it will be stored in the search engine',
5201 `label` varchar(255) NOT NULL COMMENT 'the human readable name of the field, for display',
5202 `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',
5203 `weight` decimal(5,2) DEFAULT NULL,
5204 `facet_order` tinyint(4) DEFAULT NULL COMMENT 'the order place of the field in facet list if faceted',
5205 `staff_client` tinyint(1) NOT NULL DEFAULT 1,
5206 `opac` tinyint(1) NOT NULL DEFAULT 1,
5207 `mandatory` tinyint(1) DEFAULT NULL COMMENT 'if marked this field is not editable or removable',
5209 UNIQUE KEY `name` (`name`(191))
5210 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5211 /*!40101 SET character_set_client = @saved_cs_client */;
5214 -- Table structure for table `search_filters`
5217 DROP TABLE IF EXISTS `search_filters`;
5218 /*!40101 SET @saved_cs_client = @@character_set_client */;
5219 /*!40101 SET character_set_client = utf8 */;
5220 CREATE TABLE `search_filters` (
5221 `search_filter_id` int(11) NOT NULL AUTO_INCREMENT,
5222 `name` varchar(255) NOT NULL COMMENT 'filter name',
5223 `query` mediumtext DEFAULT NULL COMMENT 'filter query part',
5224 `limits` mediumtext DEFAULT NULL COMMENT 'filter limits part',
5225 `opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown on OPAC',
5226 `staff_client` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown in staff client',
5227 PRIMARY KEY (`search_filter_id`)
5228 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5229 /*!40101 SET character_set_client = @saved_cs_client */;
5232 -- Table structure for table `search_history`
5235 DROP TABLE IF EXISTS `search_history`;
5236 /*!40101 SET @saved_cs_client = @@character_set_client */;
5237 /*!40101 SET character_set_client = utf8 */;
5238 CREATE TABLE `search_history` (
5239 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'search history id',
5240 `userid` int(11) NOT NULL COMMENT 'the patron who performed the search (borrowers.borrowernumber)',
5241 `sessionid` varchar(32) NOT NULL COMMENT 'a system generated session id',
5242 `query_desc` varchar(255) NOT NULL COMMENT 'the search that was performed',
5243 `query_cgi` mediumtext NOT NULL COMMENT 'the string to append to the search url to rerun the search',
5244 `type` varchar(16) NOT NULL DEFAULT 'biblio' COMMENT 'search type, must be ''biblio'' or ''authority''',
5245 `total` int(11) NOT NULL COMMENT 'the total of results found',
5246 `time` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the search was run',
5248 KEY `userid` (`userid`),
5249 KEY `sessionid` (`sessionid`)
5250 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Opac search history results';
5251 /*!40101 SET character_set_client = @saved_cs_client */;
5254 -- Table structure for table `search_marc_map`
5257 DROP TABLE IF EXISTS `search_marc_map`;
5258 /*!40101 SET @saved_cs_client = @@character_set_client */;
5259 /*!40101 SET character_set_client = utf8 */;
5260 CREATE TABLE `search_marc_map` (
5261 `id` int(11) NOT NULL AUTO_INCREMENT,
5262 `index_name` enum('biblios','authorities') NOT NULL COMMENT 'what storage index this map is for',
5263 `marc_type` enum('marc21','unimarc') NOT NULL COMMENT 'what MARC type this map is for',
5264 `marc_field` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the MARC specifier for this field',
5266 UNIQUE KEY `index_name` (`index_name`,`marc_field`(191),`marc_type`),
5267 KEY `index_name_2` (`index_name`)
5268 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5269 /*!40101 SET character_set_client = @saved_cs_client */;
5272 -- Table structure for table `search_marc_to_field`
5275 DROP TABLE IF EXISTS `search_marc_to_field`;
5276 /*!40101 SET @saved_cs_client = @@character_set_client */;
5277 /*!40101 SET character_set_client = utf8 */;
5278 CREATE TABLE `search_marc_to_field` (
5279 `search` tinyint(1) NOT NULL DEFAULT 1,
5280 `search_marc_map_id` int(11) NOT NULL,
5281 `search_field_id` int(11) NOT NULL,
5282 `facet` tinyint(1) DEFAULT 0 COMMENT 'true if a facet field should be generated for this',
5283 `suggestible` tinyint(1) DEFAULT 0 COMMENT 'true if this field can be used to generate suggestions for browse',
5284 `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',
5285 PRIMARY KEY (`search_marc_map_id`,`search_field_id`),
5286 KEY `search_field_id` (`search_field_id`),
5287 CONSTRAINT `search_marc_to_field_ibfk_1` FOREIGN KEY (`search_marc_map_id`) REFERENCES `search_marc_map` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
5288 CONSTRAINT `search_marc_to_field_ibfk_2` FOREIGN KEY (`search_field_id`) REFERENCES `search_field` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
5289 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5290 /*!40101 SET character_set_client = @saved_cs_client */;
5293 -- Table structure for table `serial`
5296 DROP TABLE IF EXISTS `serial`;
5297 /*!40101 SET @saved_cs_client = @@character_set_client */;
5298 /*!40101 SET character_set_client = utf8 */;
5299 CREATE TABLE `serial` (
5300 `serialid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the issue',
5301 `biblionumber` int(11) NOT NULL COMMENT 'foreign key for the biblio.biblionumber that this issue is attached to',
5302 `subscriptionid` int(11) NOT NULL COMMENT 'foreign key to the subscription.subscriptionid that this issue is part of',
5303 `serialseq` varchar(100) NOT NULL DEFAULT '' COMMENT 'issue information (volume, number, etc)',
5304 `serialseq_x` varchar(100) DEFAULT NULL COMMENT 'first part of issue information',
5305 `serialseq_y` varchar(100) DEFAULT NULL COMMENT 'second part of issue information',
5306 `serialseq_z` varchar(100) DEFAULT NULL COMMENT 'third part of issue information',
5307 `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'status code for this issue (see manual for full descriptions)',
5308 `planneddate` date DEFAULT NULL COMMENT 'date expected',
5309 `notes` mediumtext DEFAULT NULL COMMENT 'notes',
5310 `publisheddate` date DEFAULT NULL COMMENT 'date published',
5311 `publisheddatetext` varchar(100) DEFAULT NULL COMMENT 'date published (descriptive)',
5312 `claimdate` date DEFAULT NULL COMMENT 'date claimed',
5313 `claims_count` int(11) DEFAULT 0 COMMENT 'number of claims made related to this issue',
5314 `routingnotes` mediumtext DEFAULT NULL COMMENT 'notes from the routing list',
5315 PRIMARY KEY (`serialid`),
5316 KEY `serial_ibfk_1` (`biblionumber`),
5317 KEY `serial_ibfk_2` (`subscriptionid`),
5318 CONSTRAINT `serial_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5319 CONSTRAINT `serial_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5320 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5321 /*!40101 SET character_set_client = @saved_cs_client */;
5324 -- Table structure for table `serialitems`
5327 DROP TABLE IF EXISTS `serialitems`;
5328 /*!40101 SET @saved_cs_client = @@character_set_client */;
5329 /*!40101 SET character_set_client = utf8 */;
5330 CREATE TABLE `serialitems` (
5331 `itemnumber` int(11) NOT NULL,
5332 `serialid` int(11) NOT NULL,
5333 PRIMARY KEY (`itemnumber`),
5334 KEY `serialitems_sfk_1` (`serialid`),
5335 CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE,
5336 CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
5337 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5338 /*!40101 SET character_set_client = @saved_cs_client */;
5341 -- Table structure for table `sessions`
5344 DROP TABLE IF EXISTS `sessions`;
5345 /*!40101 SET @saved_cs_client = @@character_set_client */;
5346 /*!40101 SET character_set_client = utf8 */;
5347 CREATE TABLE `sessions` (
5348 `id` varchar(32) NOT NULL,
5349 `a_session` longblob NOT NULL,
5351 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5352 /*!40101 SET character_set_client = @saved_cs_client */;
5355 -- Table structure for table `sms_providers`
5358 DROP TABLE IF EXISTS `sms_providers`;
5359 /*!40101 SET @saved_cs_client = @@character_set_client */;
5360 /*!40101 SET character_set_client = utf8 */;
5361 CREATE TABLE `sms_providers` (
5362 `id` int(11) NOT NULL AUTO_INCREMENT,
5363 `name` varchar(255) NOT NULL,
5364 `domain` varchar(255) NOT NULL,
5366 UNIQUE KEY `name` (`name`(191))
5367 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5368 /*!40101 SET character_set_client = @saved_cs_client */;
5371 -- Table structure for table `smtp_servers`
5374 DROP TABLE IF EXISTS `smtp_servers`;
5375 /*!40101 SET @saved_cs_client = @@character_set_client */;
5376 /*!40101 SET character_set_client = utf8 */;
5377 CREATE TABLE `smtp_servers` (
5378 `id` int(11) NOT NULL AUTO_INCREMENT,
5379 `name` varchar(80) NOT NULL,
5380 `host` varchar(80) NOT NULL DEFAULT 'localhost',
5381 `port` int(11) NOT NULL DEFAULT 25,
5382 `timeout` int(11) NOT NULL DEFAULT 120,
5383 `ssl_mode` enum('disabled','ssl','starttls') NOT NULL,
5384 `user_name` varchar(80) DEFAULT NULL,
5385 `password` varchar(80) DEFAULT NULL,
5386 `debug` tinyint(1) NOT NULL DEFAULT 0,
5387 `is_default` tinyint(1) NOT NULL DEFAULT 0,
5389 KEY `host_idx` (`host`)
5390 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5391 /*!40101 SET character_set_client = @saved_cs_client */;
5394 -- Table structure for table `social_data`
5397 DROP TABLE IF EXISTS `social_data`;
5398 /*!40101 SET @saved_cs_client = @@character_set_client */;
5399 /*!40101 SET character_set_client = utf8 */;
5400 CREATE TABLE `social_data` (
5401 `isbn` varchar(30) NOT NULL DEFAULT '',
5402 `num_critics` int(11) DEFAULT NULL,
5403 `num_critics_pro` int(11) DEFAULT NULL,
5404 `num_quotations` int(11) DEFAULT NULL,
5405 `num_videos` int(11) DEFAULT NULL,
5406 `score_avg` decimal(5,2) DEFAULT NULL,
5407 `num_scores` int(11) DEFAULT NULL,
5408 PRIMARY KEY (`isbn`)
5409 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5410 /*!40101 SET character_set_client = @saved_cs_client */;
5413 -- Table structure for table `special_holidays`
5416 DROP TABLE IF EXISTS `special_holidays`;
5417 /*!40101 SET @saved_cs_client = @@character_set_client */;
5418 /*!40101 SET character_set_client = utf8 */;
5419 CREATE TABLE `special_holidays` (
5420 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5421 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
5422 `day` smallint(6) NOT NULL DEFAULT 0 COMMENT 'day of the month this closing is on',
5423 `month` smallint(6) NOT NULL DEFAULT 0 COMMENT 'month this closing is in',
5424 `year` smallint(6) NOT NULL DEFAULT 0 COMMENT 'year this closing is in',
5425 `isexception` smallint(1) NOT NULL DEFAULT 1 COMMENT 'is this a holiday exception to a repeatable holiday (1 for yes, 0 for no)',
5426 `title` varchar(50) NOT NULL DEFAULT '' COMMENT 'title for this closing',
5427 `description` mediumtext NOT NULL COMMENT 'description of this closing',
5429 KEY `special_holidays_ibfk_1` (`branchcode`),
5430 CONSTRAINT `special_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5431 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5432 /*!40101 SET character_set_client = @saved_cs_client */;
5435 -- Table structure for table `statistics`
5438 DROP TABLE IF EXISTS `statistics`;
5439 /*!40101 SET @saved_cs_client = @@character_set_client */;
5440 /*!40101 SET character_set_client = utf8 */;
5441 CREATE TABLE `statistics` (
5442 `datetime` datetime DEFAULT NULL COMMENT 'date and time of the transaction',
5443 `branch` varchar(10) DEFAULT NULL COMMENT 'foreign key, branch where the transaction occurred',
5444 `value` double(16,4) DEFAULT NULL COMMENT 'monetary value associated with the transaction',
5445 `type` varchar(16) DEFAULT NULL COMMENT 'transaction type (localuse, issue, return, renew, writeoff, payment)',
5446 `other` longtext DEFAULT NULL COMMENT 'used by SIP',
5447 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific item',
5448 `itemtype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table, links transaction to a specific item type',
5449 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
5450 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower',
5451 `ccode` varchar(80) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific collection code',
5452 `categorycode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower category',
5453 `interface` varchar(30) DEFAULT NULL COMMENT 'the context this action was taken in',
5454 KEY `timeidx` (`datetime`),
5455 KEY `branch_idx` (`branch`),
5456 KEY `type_idx` (`type`),
5457 KEY `itemnumber_idx` (`itemnumber`),
5458 KEY `itemtype_idx` (`itemtype`),
5459 KEY `borrowernumber_idx` (`borrowernumber`),
5460 KEY `ccode_idx` (`ccode`)
5461 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5462 /*!40101 SET character_set_client = @saved_cs_client */;
5465 -- Table structure for table `stockrotationitems`
5468 DROP TABLE IF EXISTS `stockrotationitems`;
5469 /*!40101 SET @saved_cs_client = @@character_set_client */;
5470 /*!40101 SET character_set_client = utf8 */;
5471 CREATE TABLE `stockrotationitems` (
5472 `itemnumber_id` int(11) NOT NULL COMMENT 'Itemnumber to link to a stage & rota',
5473 `stage_id` int(11) NOT NULL COMMENT 'stage ID to link the item to',
5474 `indemand` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should this item be skipped for rotation?',
5475 `fresh` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag showing item is only just added to rota',
5476 PRIMARY KEY (`itemnumber_id`),
5477 KEY `stockrotationitems_sifk` (`stage_id`),
5478 CONSTRAINT `stockrotationitems_iifk` FOREIGN KEY (`itemnumber_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5479 CONSTRAINT `stockrotationitems_sifk` FOREIGN KEY (`stage_id`) REFERENCES `stockrotationstages` (`stage_id`) ON DELETE CASCADE ON UPDATE CASCADE
5480 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5481 /*!40101 SET character_set_client = @saved_cs_client */;
5484 -- Table structure for table `stockrotationrotas`
5487 DROP TABLE IF EXISTS `stockrotationrotas`;
5488 /*!40101 SET @saved_cs_client = @@character_set_client */;
5489 /*!40101 SET character_set_client = utf8 */;
5490 CREATE TABLE `stockrotationrotas` (
5491 `rota_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Stockrotation rota ID',
5492 `title` varchar(100) NOT NULL COMMENT 'Title for this rota',
5493 `description` text NOT NULL COMMENT 'Description for this rota',
5494 `cyclical` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should items on this rota keep cycling?',
5495 `active` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this rota currently active?',
5496 PRIMARY KEY (`rota_id`),
5497 UNIQUE KEY `stockrotationrotas_title` (`title`)
5498 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5499 /*!40101 SET character_set_client = @saved_cs_client */;
5502 -- Table structure for table `stockrotationstages`
5505 DROP TABLE IF EXISTS `stockrotationstages`;
5506 /*!40101 SET @saved_cs_client = @@character_set_client */;
5507 /*!40101 SET character_set_client = utf8 */;
5508 CREATE TABLE `stockrotationstages` (
5509 `stage_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique stage ID',
5510 `position` int(11) NOT NULL COMMENT 'The position of this stage within its rota',
5511 `rota_id` int(11) NOT NULL COMMENT 'The rota this stage belongs to',
5512 `branchcode_id` varchar(10) NOT NULL COMMENT 'Branch this stage relates to',
5513 `duration` int(11) NOT NULL DEFAULT 4 COMMENT 'The number of days items shoud occupy this stage',
5514 PRIMARY KEY (`stage_id`),
5515 KEY `stockrotationstages_rifk` (`rota_id`),
5516 KEY `stockrotationstages_bifk` (`branchcode_id`),
5517 CONSTRAINT `stockrotationstages_bifk` FOREIGN KEY (`branchcode_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5518 CONSTRAINT `stockrotationstages_rifk` FOREIGN KEY (`rota_id`) REFERENCES `stockrotationrotas` (`rota_id`) ON DELETE CASCADE ON UPDATE CASCADE
5519 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5520 /*!40101 SET character_set_client = @saved_cs_client */;
5523 -- Table structure for table `subscription`
5526 DROP TABLE IF EXISTS `subscription`;
5527 /*!40101 SET @saved_cs_client = @@character_set_client */;
5528 /*!40101 SET character_set_client = utf8 */;
5529 CREATE TABLE `subscription` (
5530 `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
5531 `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
5532 `librarian` varchar(100) DEFAULT '' COMMENT 'the librarian''s username from borrowers.userid',
5533 `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
5534 `aqbooksellerid` int(11) DEFAULT 0 COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
5535 `cost` int(11) DEFAULT 0,
5536 `aqbudgetid` int(11) DEFAULT 0,
5537 `weeklength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or numberlength is set)',
5538 `monthlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if weeklength or numberlength is set)',
5539 `numberlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or weeklength is set)',
5540 `periodicity` int(11) DEFAULT NULL COMMENT 'frequency type links to subscription_frequencies.id',
5541 `countissuesperunit` int(11) NOT NULL DEFAULT 1,
5542 `notes` longtext DEFAULT NULL COMMENT 'notes',
5543 `status` varchar(100) NOT NULL DEFAULT '' COMMENT 'status of this subscription',
5544 `lastvalue1` int(11) DEFAULT NULL,
5545 `innerloop1` int(11) DEFAULT 0,
5546 `lastvalue2` int(11) DEFAULT NULL,
5547 `innerloop2` int(11) DEFAULT 0,
5548 `lastvalue3` int(11) DEFAULT NULL,
5549 `innerloop3` int(11) DEFAULT 0,
5550 `firstacquidate` date DEFAULT NULL COMMENT 'first issue received date',
5551 `manualhistory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes or no to managing the history manually',
5552 `irregularity` mediumtext DEFAULT NULL COMMENT 'any irregularities in the subscription',
5553 `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
5554 `letter` varchar(20) DEFAULT NULL,
5555 `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
5556 `locale` varchar(80) DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
5557 `distributedto` mediumtext DEFAULT NULL,
5558 `internalnotes` longtext DEFAULT NULL,
5559 `callnumber` mediumtext DEFAULT NULL COMMENT 'default call number',
5560 `location` varchar(80) DEFAULT '' COMMENT 'default shelving location (items.location)',
5561 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'default branches (items.homebranch)',
5562 `lastbranch` varchar(10) DEFAULT NULL,
5563 `serialsadditems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'does receiving this serial create an item record',
5564 `staffdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the staff',
5565 `opacdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the public',
5566 `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
5567 `enddate` date DEFAULT NULL COMMENT 'subscription end date',
5568 `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
5569 `reneweddate` date DEFAULT NULL COMMENT 'date of last renewal for the subscription',
5570 `itemtype` varchar(10) DEFAULT NULL,
5571 `previousitemtype` varchar(10) DEFAULT NULL,
5572 `mana_id` int(11) DEFAULT NULL,
5573 `ccode` varchar(80) DEFAULT NULL COMMENT 'collection code to assign to serial items',
5574 `published_on_template` TEXT DEFAULT NULL COMMENT 'Template Toolkit syntax to generate the default "Published on (text)" field when receiving an issue this serial',
5575 PRIMARY KEY (`subscriptionid`),
5576 KEY `subscription_ibfk_1` (`periodicity`),
5577 KEY `subscription_ibfk_2` (`numberpattern`),
5578 KEY `subscription_ibfk_3` (`biblionumber`),
5579 CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5580 CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5581 CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5582 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5583 /*!40101 SET character_set_client = @saved_cs_client */;
5586 -- Table structure for table `subscription_frequencies`
5589 DROP TABLE IF EXISTS `subscription_frequencies`;
5590 /*!40101 SET @saved_cs_client = @@character_set_client */;
5591 /*!40101 SET character_set_client = utf8 */;
5592 CREATE TABLE `subscription_frequencies` (
5593 `id` int(11) NOT NULL AUTO_INCREMENT,
5594 `description` mediumtext NOT NULL,
5595 `displayorder` int(11) DEFAULT NULL,
5596 `unit` enum('day','week','month','year') DEFAULT NULL,
5597 `unitsperissue` int(11) NOT NULL DEFAULT 1,
5598 `issuesperunit` int(11) NOT NULL DEFAULT 1,
5600 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5601 /*!40101 SET character_set_client = @saved_cs_client */;
5604 -- Table structure for table `subscription_numberpatterns`
5607 DROP TABLE IF EXISTS `subscription_numberpatterns`;
5608 /*!40101 SET @saved_cs_client = @@character_set_client */;
5609 /*!40101 SET character_set_client = utf8 */;
5610 CREATE TABLE `subscription_numberpatterns` (
5611 `id` int(11) NOT NULL AUTO_INCREMENT,
5612 `label` varchar(255) NOT NULL,
5613 `displayorder` int(11) DEFAULT NULL,
5614 `description` mediumtext NOT NULL,
5615 `numberingmethod` varchar(255) NOT NULL,
5616 `label1` varchar(255) DEFAULT NULL,
5617 `add1` int(11) DEFAULT NULL,
5618 `every1` int(11) DEFAULT NULL,
5619 `whenmorethan1` int(11) DEFAULT NULL,
5620 `setto1` int(11) DEFAULT NULL,
5621 `numbering1` varchar(255) DEFAULT NULL,
5622 `label2` varchar(255) DEFAULT NULL,
5623 `add2` int(11) DEFAULT NULL,
5624 `every2` int(11) DEFAULT NULL,
5625 `whenmorethan2` int(11) DEFAULT NULL,
5626 `setto2` int(11) DEFAULT NULL,
5627 `numbering2` varchar(255) DEFAULT NULL,
5628 `label3` varchar(255) DEFAULT NULL,
5629 `add3` int(11) DEFAULT NULL,
5630 `every3` int(11) DEFAULT NULL,
5631 `whenmorethan3` int(11) DEFAULT NULL,
5632 `setto3` int(11) DEFAULT NULL,
5633 `numbering3` varchar(255) DEFAULT NULL,
5635 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5636 /*!40101 SET character_set_client = @saved_cs_client */;
5639 -- Table structure for table `subscriptionhistory`
5642 DROP TABLE IF EXISTS `subscriptionhistory`;
5643 /*!40101 SET @saved_cs_client = @@character_set_client */;
5644 /*!40101 SET character_set_client = utf8 */;
5645 CREATE TABLE `subscriptionhistory` (
5646 `biblionumber` int(11) NOT NULL,
5647 `subscriptionid` int(11) NOT NULL,
5648 `histstartdate` date DEFAULT NULL,
5649 `histenddate` date DEFAULT NULL,
5650 `missinglist` longtext NOT NULL,
5651 `recievedlist` longtext NOT NULL,
5652 `opacnote` longtext DEFAULT NULL,
5653 `librariannote` longtext DEFAULT NULL,
5654 PRIMARY KEY (`subscriptionid`),
5655 KEY `subscription_history_ibfk_1` (`biblionumber`),
5656 CONSTRAINT `subscription_history_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5657 CONSTRAINT `subscription_history_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5658 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5659 /*!40101 SET character_set_client = @saved_cs_client */;
5662 -- Table structure for table `subscriptionroutinglist`
5665 DROP TABLE IF EXISTS `subscriptionroutinglist`;
5666 /*!40101 SET @saved_cs_client = @@character_set_client */;
5667 /*!40101 SET character_set_client = utf8 */;
5668 CREATE TABLE `subscriptionroutinglist` (
5669 `routingid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5670 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines with patron is on the routing list',
5671 `ranking` int(11) DEFAULT NULL COMMENT 'where the patron stands in line to receive the serial',
5672 `subscriptionid` int(11) NOT NULL COMMENT 'foreign key from the subscription table, defines which subscription this routing list is for',
5673 PRIMARY KEY (`routingid`),
5674 UNIQUE KEY `subscriptionid` (`subscriptionid`,`borrowernumber`),
5675 KEY `subscriptionroutinglist_ibfk_1` (`borrowernumber`),
5676 CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5677 CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5678 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5679 /*!40101 SET character_set_client = @saved_cs_client */;
5682 -- Table structure for table `suggestions`
5685 DROP TABLE IF EXISTS `suggestions`;
5686 /*!40101 SET @saved_cs_client = @@character_set_client */;
5687 /*!40101 SET character_set_client = utf8 */;
5688 CREATE TABLE `suggestions` (
5689 `suggestionid` int(8) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned automatically by Koha',
5690 `suggestedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the person making the suggestion, foreign key linking to the borrowers table',
5691 `suggesteddate` date NOT NULL COMMENT 'date the suggestion was submitted',
5692 `managedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian managing the suggestion, foreign key linking to the borrowers table',
5693 `manageddate` date DEFAULT NULL COMMENT 'date the suggestion was updated',
5694 `acceptedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who accepted the suggestion, foreign key linking to the borrowers table',
5695 `accepteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as accepted',
5696 `rejectedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table',
5697 `rejecteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as rejected',
5698 `lastmodificationby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who edit the suggestion for the last time',
5699 `lastmodificationdate` date DEFAULT NULL COMMENT 'date of the last modification',
5700 `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)',
5701 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the suggestion archived?',
5702 `note` longtext DEFAULT NULL COMMENT 'note entered on the suggestion',
5703 `staff_note` longtext DEFAULT NULL COMMENT 'non-public note entered on the suggestion',
5704 `author` varchar(80) DEFAULT NULL COMMENT 'author of the suggested item',
5705 `title` varchar(255) DEFAULT NULL COMMENT 'title of the suggested item',
5706 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'copyright date of the suggested item',
5707 `publishercode` varchar(255) DEFAULT NULL COMMENT 'publisher of the suggested item',
5708 `date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the suggestion was updated',
5709 `volumedesc` varchar(255) DEFAULT NULL,
5710 `publicationyear` smallint(6) DEFAULT 0,
5711 `place` varchar(255) DEFAULT NULL COMMENT 'publication place of the suggested item',
5712 `isbn` varchar(30) DEFAULT NULL COMMENT 'isbn of the suggested item',
5713 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggestion to the biblio table after the suggestion has been ordered',
5714 `reason` mediumtext DEFAULT NULL COMMENT 'reason for accepting or rejecting the suggestion',
5715 `patronreason` mediumtext DEFAULT NULL COMMENT 'reason for making the suggestion',
5716 `budgetid` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggested budget to the aqbudgets table',
5717 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key linking the suggested branch to the branches table',
5718 `collectiontitle` mediumtext DEFAULT NULL COMMENT 'collection name for the suggested item',
5719 `itemtype` varchar(30) DEFAULT NULL COMMENT 'suggested item type',
5720 `quantity` smallint(6) DEFAULT NULL COMMENT 'suggested quantity to be purchased',
5721 `currency` varchar(10) DEFAULT NULL COMMENT 'suggested currency for the suggested price',
5722 `price` decimal(28,6) DEFAULT NULL COMMENT 'suggested price',
5723 `total` decimal(28,6) DEFAULT NULL COMMENT 'suggested total cost (price*quantity updated for currency)',
5724 PRIMARY KEY (`suggestionid`),
5725 KEY `suggestedby` (`suggestedby`),
5726 KEY `managedby` (`managedby`),
5727 KEY `acceptedby` (`acceptedby`),
5728 KEY `rejectedby` (`rejectedby`),
5729 KEY `biblionumber` (`biblionumber`),
5730 KEY `budgetid` (`budgetid`),
5731 KEY `branchcode` (`branchcode`),
5732 KEY `status` (`STATUS`),
5733 KEY `suggestions_ibfk_lastmodificationby` (`lastmodificationby`),
5734 CONSTRAINT `suggestions_budget_id_fk` FOREIGN KEY (`budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5735 CONSTRAINT `suggestions_ibfk_acceptedby` FOREIGN KEY (`acceptedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5736 CONSTRAINT `suggestions_ibfk_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5737 CONSTRAINT `suggestions_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
5738 CONSTRAINT `suggestions_ibfk_lastmodificationby` FOREIGN KEY (`lastmodificationby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5739 CONSTRAINT `suggestions_ibfk_managedby` FOREIGN KEY (`managedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5740 CONSTRAINT `suggestions_ibfk_rejectedby` FOREIGN KEY (`rejectedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5741 CONSTRAINT `suggestions_ibfk_suggestedby` FOREIGN KEY (`suggestedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5742 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5743 /*!40101 SET character_set_client = @saved_cs_client */;
5746 -- Table structure for table `systempreferences`
5749 DROP TABLE IF EXISTS `systempreferences`;
5750 /*!40101 SET @saved_cs_client = @@character_set_client */;
5751 /*!40101 SET character_set_client = utf8 */;
5752 CREATE TABLE `systempreferences` (
5753 `variable` varchar(50) NOT NULL DEFAULT '' COMMENT 'system preference name',
5754 `value` mediumtext DEFAULT NULL COMMENT 'system preference values',
5755 `options` longtext DEFAULT NULL COMMENT 'options for multiple choice system preferences',
5756 `explanation` mediumtext DEFAULT NULL COMMENT 'descriptive text for the system preference',
5757 `type` varchar(20) DEFAULT NULL COMMENT 'type of question this preference asks (multiple choice, plain text, yes or no, etc)',
5758 PRIMARY KEY (`variable`)
5759 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5760 /*!40101 SET character_set_client = @saved_cs_client */;
5763 -- Table structure for table `tables_settings`
5766 DROP TABLE IF EXISTS `tables_settings`;
5767 /*!40101 SET @saved_cs_client = @@character_set_client */;
5768 /*!40101 SET character_set_client = utf8 */;
5769 CREATE TABLE `tables_settings` (
5770 `module` varchar(255) NOT NULL,
5771 `page` varchar(255) NOT NULL,
5772 `tablename` varchar(255) NOT NULL,
5773 `default_display_length` smallint(6) DEFAULT NULL,
5774 `default_sort_order` varchar(255) DEFAULT NULL,
5775 PRIMARY KEY (`module`(191),`page`(191),`tablename`(191))
5776 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5777 /*!40101 SET character_set_client = @saved_cs_client */;
5780 -- Table structure for table `tags`
5783 DROP TABLE IF EXISTS `tags`;
5784 /*!40101 SET @saved_cs_client = @@character_set_client */;
5785 /*!40101 SET character_set_client = utf8 */;
5786 CREATE TABLE `tags` (
5787 `entry` varchar(255) NOT NULL DEFAULT '',
5788 `weight` bigint(20) NOT NULL DEFAULT 0,
5789 PRIMARY KEY (`entry`(191))
5790 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5791 /*!40101 SET character_set_client = @saved_cs_client */;
5794 -- Table structure for table `tags_all`
5797 DROP TABLE IF EXISTS `tags_all`;
5798 /*!40101 SET @saved_cs_client = @@character_set_client */;
5799 /*!40101 SET character_set_client = utf8 */;
5800 CREATE TABLE `tags_all` (
5801 `tag_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key',
5802 `borrowernumber` int(11) DEFAULT NULL COMMENT 'the patron who added the tag (borrowers.borrowernumber)',
5803 `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was left on (biblio.biblionumber)',
5804 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5805 `language` int(4) DEFAULT NULL COMMENT 'the language the tag was left in',
5806 `date_created` datetime NOT NULL COMMENT 'the date the tag was added',
5807 PRIMARY KEY (`tag_id`),
5808 KEY `tags_borrowers_fk_1` (`borrowernumber`),
5809 KEY `tags_biblionumber_fk_1` (`biblionumber`),
5810 CONSTRAINT `tags_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5811 CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5812 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5813 /*!40101 SET character_set_client = @saved_cs_client */;
5816 -- Table structure for table `tags_approval`
5819 DROP TABLE IF EXISTS `tags_approval`;
5820 /*!40101 SET @saved_cs_client = @@character_set_client */;
5821 /*!40101 SET character_set_client = utf8 */;
5822 CREATE TABLE `tags_approval` (
5823 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5824 `approved` int(1) NOT NULL DEFAULT 0 COMMENT 'whether the tag is approved or not (1=yes, 0=pending, -1=rejected)',
5825 `date_approved` datetime DEFAULT NULL COMMENT 'the date this tag was approved',
5826 `approved_by` int(11) DEFAULT NULL COMMENT 'the librarian who approved the tag (borrowers.borrowernumber)',
5827 `weight_total` int(9) NOT NULL DEFAULT 1 COMMENT 'the total number of times this tag was used',
5828 PRIMARY KEY (`term`),
5829 KEY `tags_approval_borrowers_fk_1` (`approved_by`),
5830 CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5831 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5832 /*!40101 SET character_set_client = @saved_cs_client */;
5835 -- Table structure for table `tags_index`
5838 DROP TABLE IF EXISTS `tags_index`;
5839 /*!40101 SET @saved_cs_client = @@character_set_client */;
5840 /*!40101 SET character_set_client = utf8 */;
5841 CREATE TABLE `tags_index` (
5842 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5843 `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was used on (biblio.biblionumber)',
5844 `weight` int(9) NOT NULL DEFAULT 1 COMMENT 'the number of times this term was used on this bib record',
5845 PRIMARY KEY (`term`,`biblionumber`),
5846 KEY `tags_index_biblionumber_fk_1` (`biblionumber`),
5847 CONSTRAINT `tags_index_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5848 CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`) REFERENCES `tags_approval` (`term`) ON DELETE CASCADE ON UPDATE CASCADE
5849 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5850 /*!40101 SET character_set_client = @saved_cs_client */;
5853 -- Table structure for table `ticket_updates`
5856 DROP TABLE IF EXISTS `ticket_updates`;
5857 /*!40101 SET @saved_cs_client = @@character_set_client */;
5858 /*!40101 SET character_set_client = utf8 */;
5859 CREATE TABLE `ticket_updates` (
5860 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
5861 `ticket_id` int(11) NOT NULL COMMENT 'id of catalog ticket the update relates to',
5862 `user_id` int(11) NOT NULL DEFAULT 0 COMMENT 'id of the user who logged the update',
5863 `public` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote whether this update is public',
5864 `date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time this update was logged',
5865 `message` text NOT NULL COMMENT 'update message content',
5867 KEY `ticket_updates_ibfk_1` (`ticket_id`),
5868 KEY `ticket_updates_ibfk_2` (`user_id`),
5869 CONSTRAINT `ticket_updates_ibfk_1` FOREIGN KEY (`ticket_id`) REFERENCES `tickets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
5870 CONSTRAINT `ticket_updates_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
5871 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5872 /*!40101 SET character_set_client = @saved_cs_client */;
5875 -- Table structure for table `tickets`
5878 DROP TABLE IF EXISTS `tickets`;
5879 /*!40101 SET @saved_cs_client = @@character_set_client */;
5880 /*!40101 SET character_set_client = utf8 */;
5881 CREATE TABLE `tickets` (
5882 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
5883 `reporter_id` int(11) NOT NULL DEFAULT 0 COMMENT 'id of the patron who reported the ticket',
5884 `reported_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time this ticket was reported',
5885 `title` text NOT NULL COMMENT 'ticket title',
5886 `body` text NOT NULL COMMENT 'ticket details',
5887 `resolver_id` int(11) DEFAULT NULL COMMENT 'id of the user who resolved the ticket',
5888 `resolved_date` datetime DEFAULT NULL COMMENT 'date and time this ticket was resolved',
5889 `biblio_id` int(11) DEFAULT NULL COMMENT 'id of biblio linked',
5891 KEY `tickets_ibfk_1` (`reporter_id`),
5892 KEY `tickets_ibfk_2` (`resolver_id`),
5893 KEY `tickets_ibfk_3` (`biblio_id`),
5894 CONSTRAINT `tickets_ibfk_1` FOREIGN KEY (`reporter_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5895 CONSTRAINT `tickets_ibfk_2` FOREIGN KEY (`resolver_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5896 CONSTRAINT `tickets_ibfk_3` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5897 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5898 /*!40101 SET character_set_client = @saved_cs_client */;
5901 -- Table structure for table `tmp_holdsqueue`
5904 DROP TABLE IF EXISTS `tmp_holdsqueue`;
5905 /*!40101 SET @saved_cs_client = @@character_set_client */;
5906 /*!40101 SET character_set_client = utf8 */;
5907 CREATE TABLE `tmp_holdsqueue` (
5908 `biblionumber` int(11) DEFAULT NULL,
5909 `itemnumber` int(11) NOT NULL,
5910 `barcode` varchar(20) DEFAULT NULL,
5911 `surname` longtext NOT NULL,
5912 `firstname` mediumtext DEFAULT NULL,
5913 `phone` mediumtext DEFAULT NULL,
5914 `borrowernumber` int(11) NOT NULL,
5915 `cardnumber` varchar(32) DEFAULT NULL,
5916 `reservedate` date DEFAULT NULL,
5917 `title` longtext DEFAULT NULL,
5918 `itemcallnumber` varchar(255) DEFAULT NULL,
5919 `holdingbranch` varchar(10) DEFAULT NULL,
5920 `pickbranch` varchar(10) DEFAULT NULL,
5921 `notes` mediumtext DEFAULT NULL,
5922 `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
5923 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this entry as added/last updated',
5924 PRIMARY KEY (`itemnumber`),
5925 KEY `tmp_holdsqueue_ibfk_1` (`itemnumber`),
5926 KEY `tmp_holdsqueue_ibfk_2` (`biblionumber`),
5927 KEY `tmp_holdsqueue_ibfk_3` (`borrowernumber`),
5928 CONSTRAINT `tmp_holdsqueue_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5929 CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5930 CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
5931 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5932 /*!40101 SET character_set_client = @saved_cs_client */;
5935 -- Table structure for table `transport_cost`
5938 DROP TABLE IF EXISTS `transport_cost`;
5939 /*!40101 SET @saved_cs_client = @@character_set_client */;
5940 /*!40101 SET character_set_client = utf8 */;
5941 CREATE TABLE `transport_cost` (
5942 `frombranch` varchar(10) NOT NULL,
5943 `tobranch` varchar(10) NOT NULL,
5944 `cost` decimal(6,2) NOT NULL,
5945 `disable_transfer` tinyint(1) NOT NULL DEFAULT 0,
5946 PRIMARY KEY (`frombranch`,`tobranch`),
5947 KEY `transport_cost_ibfk_2` (`tobranch`),
5948 CONSTRAINT `transport_cost_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5949 CONSTRAINT `transport_cost_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5950 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5951 /*!40101 SET character_set_client = @saved_cs_client */;
5954 -- Table structure for table `uploaded_files`
5957 DROP TABLE IF EXISTS `uploaded_files`;
5958 /*!40101 SET @saved_cs_client = @@character_set_client */;
5959 /*!40101 SET character_set_client = utf8 */;
5960 CREATE TABLE `uploaded_files` (
5961 `id` int(11) NOT NULL AUTO_INCREMENT,
5962 `hashvalue` char(40) NOT NULL,
5963 `filename` mediumtext NOT NULL,
5964 `dir` mediumtext NOT NULL,
5965 `filesize` int(11) DEFAULT NULL,
5966 `dtcreated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
5967 `uploadcategorycode` text DEFAULT NULL,
5968 `owner` int(11) DEFAULT NULL,
5969 `public` tinyint(4) DEFAULT NULL,
5970 `permanent` tinyint(4) DEFAULT NULL,
5972 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5973 /*!40101 SET character_set_client = @saved_cs_client */;
5976 -- Table structure for table `user_permissions`
5979 DROP TABLE IF EXISTS `user_permissions`;
5980 /*!40101 SET @saved_cs_client = @@character_set_client */;
5981 /*!40101 SET character_set_client = utf8 */;
5982 CREATE TABLE `user_permissions` (
5983 `borrowernumber` int(11) NOT NULL DEFAULT 0,
5984 `module_bit` int(11) NOT NULL DEFAULT 0,
5985 `code` varchar(64) NOT NULL,
5986 PRIMARY KEY (`borrowernumber`,`module_bit`,`code`),
5987 KEY `user_permissions_ibfk_1` (`borrowernumber`),
5988 KEY `user_permissions_ibfk_2` (`module_bit`,`code`),
5989 CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5990 CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`) ON DELETE CASCADE ON UPDATE CASCADE
5991 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5992 /*!40101 SET character_set_client = @saved_cs_client */;
5995 -- Table structure for table `userflags`
5998 DROP TABLE IF EXISTS `userflags`;
5999 /*!40101 SET @saved_cs_client = @@character_set_client */;
6000 /*!40101 SET character_set_client = utf8 */;
6001 CREATE TABLE `userflags` (
6002 `bit` int(11) NOT NULL DEFAULT 0,
6003 `flag` varchar(30) DEFAULT NULL,
6004 `flagdesc` varchar(255) DEFAULT NULL,
6005 `defaulton` int(11) DEFAULT NULL,
6007 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6008 /*!40101 SET character_set_client = @saved_cs_client */;
6011 -- Table structure for table `vendor_edi_accounts`
6014 DROP TABLE IF EXISTS `vendor_edi_accounts`;
6015 /*!40101 SET @saved_cs_client = @@character_set_client */;
6016 /*!40101 SET character_set_client = utf8 */;
6017 CREATE TABLE `vendor_edi_accounts` (
6018 `id` int(11) NOT NULL AUTO_INCREMENT,
6019 `description` mediumtext NOT NULL,
6020 `host` varchar(40) DEFAULT NULL,
6021 `username` varchar(40) DEFAULT NULL,
6022 `password` mediumtext DEFAULT NULL,
6023 `last_activity` date DEFAULT NULL,
6024 `vendor_id` int(11) DEFAULT NULL,
6025 `download_directory` mediumtext DEFAULT NULL,
6026 `upload_directory` mediumtext DEFAULT NULL,
6027 `san` varchar(20) DEFAULT NULL,
6028 `standard` varchar(3) DEFAULT 'EUR',
6029 `id_code_qualifier` varchar(3) DEFAULT '14',
6030 `transport` varchar(6) DEFAULT 'FTP',
6031 `quotes_enabled` tinyint(1) NOT NULL DEFAULT 0,
6032 `invoices_enabled` tinyint(1) NOT NULL DEFAULT 0,
6033 `orders_enabled` tinyint(1) NOT NULL DEFAULT 0,
6034 `responses_enabled` tinyint(1) NOT NULL DEFAULT 0,
6035 `auto_orders` tinyint(1) NOT NULL DEFAULT 0,
6036 `shipment_budget` int(11) DEFAULT NULL,
6037 `plugin` varchar(256) NOT NULL DEFAULT '',
6039 KEY `vendorid` (`vendor_id`),
6040 KEY `shipmentbudget` (`shipment_budget`),
6041 CONSTRAINT `vfk_shipment_budget` FOREIGN KEY (`shipment_budget`) REFERENCES `aqbudgets` (`budget_id`),
6042 CONSTRAINT `vfk_vendor_id` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`)
6043 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6044 /*!40101 SET character_set_client = @saved_cs_client */;
6047 -- Table structure for table `virtualshelfcontents`
6050 DROP TABLE IF EXISTS `virtualshelfcontents`;
6051 /*!40101 SET @saved_cs_client = @@character_set_client */;
6052 /*!40101 SET character_set_client = utf8 */;
6053 CREATE TABLE `virtualshelfcontents` (
6054 `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',
6055 `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',
6056 `dateadded` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this bib record was added to the list',
6057 `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)',
6058 KEY `shelfnumber` (`shelfnumber`),
6059 KEY `biblionumber` (`biblionumber`),
6060 KEY `shelfcontents_ibfk_3` (`borrowernumber`),
6061 CONSTRAINT `shelfcontents_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6062 CONSTRAINT `shelfcontents_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
6063 CONSTRAINT `virtualshelfcontents_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE
6064 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6065 /*!40101 SET character_set_client = @saved_cs_client */;
6068 -- Table structure for table `virtualshelfshares`
6071 DROP TABLE IF EXISTS `virtualshelfshares`;
6072 /*!40101 SET @saved_cs_client = @@character_set_client */;
6073 /*!40101 SET character_set_client = utf8 */;
6074 CREATE TABLE `virtualshelfshares` (
6075 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
6076 `shelfnumber` int(11) NOT NULL COMMENT 'foreign key for virtualshelves',
6077 `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrower that accepted access to this list',
6078 `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',
6079 `sharedate` datetime DEFAULT NULL COMMENT 'date of invitation or acceptance of invitation',
6081 KEY `virtualshelfshares_ibfk_1` (`shelfnumber`),
6082 KEY `virtualshelfshares_ibfk_2` (`borrowernumber`),
6083 CONSTRAINT `virtualshelfshares_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6084 CONSTRAINT `virtualshelfshares_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
6085 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6086 /*!40101 SET character_set_client = @saved_cs_client */;
6089 -- Table structure for table `virtualshelves`
6092 DROP TABLE IF EXISTS `virtualshelves`;
6093 /*!40101 SET @saved_cs_client = @@character_set_client */;
6094 /*!40101 SET character_set_client = utf8 */;
6095 CREATE TABLE `virtualshelves` (
6096 `shelfnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
6097 `shelfname` varchar(255) DEFAULT NULL COMMENT 'name of the list',
6098 `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)',
6099 `public` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If the list is public',
6100 `sortfield` varchar(16) DEFAULT 'title' COMMENT 'the field this list is sorted on',
6101 `lastmodified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the list was last modified',
6102 `created_on` datetime NOT NULL COMMENT 'creation time',
6103 `allow_change_from_owner` tinyint(1) DEFAULT 1 COMMENT 'can owner change contents?',
6104 `allow_change_from_others` tinyint(1) DEFAULT 0 COMMENT 'can others change contents?',
6105 `allow_change_from_staff` tinyint(1) DEFAULT 0 COMMENT 'can staff change contents?',
6106 `allow_change_from_permitted_staff` tinyint(1) DEFAULT 0 COMMENT 'can staff with edit_public_list_contents permission change contents?',
6107 PRIMARY KEY (`shelfnumber`),
6108 KEY `virtualshelves_ibfk_1` (`owner`),
6109 CONSTRAINT `virtualshelves_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
6110 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6111 /*!40101 SET character_set_client = @saved_cs_client */;
6114 -- Table structure for table `z3950servers`
6117 DROP TABLE IF EXISTS `z3950servers`;
6118 /*!40101 SET @saved_cs_client = @@character_set_client */;
6119 /*!40101 SET character_set_client = utf8 */;
6120 CREATE TABLE `z3950servers` (
6121 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
6122 `host` varchar(255) NOT NULL COMMENT 'target''s host name',
6123 `port` int(11) DEFAULT NULL COMMENT 'port number used to connect to target',
6124 `db` varchar(255) DEFAULT NULL COMMENT 'target''s database name',
6125 `userid` varchar(255) DEFAULT NULL COMMENT 'username needed to log in to target',
6126 `password` varchar(255) DEFAULT NULL COMMENT 'password needed to log in to target',
6127 `servername` longtext NOT NULL COMMENT 'name given to the target by the library',
6128 `checked` smallint(6) DEFAULT NULL COMMENT 'whether this target is checked by default (1 for yes, 0 for no)',
6129 `rank` int(11) DEFAULT NULL COMMENT 'where this target appears in the list of targets',
6130 `syntax` varchar(80) NOT NULL COMMENT 'MARC format provided by this target',
6131 `timeout` int(11) NOT NULL DEFAULT 0 COMMENT 'number of seconds before Koha stops trying to access this server',
6132 `servertype` enum('zed','sru') NOT NULL DEFAULT 'zed' COMMENT 'zed means z39.50 server',
6133 `encoding` mediumtext NOT NULL COMMENT 'characters encoding provided by this target',
6134 `recordtype` enum('authority','biblio') NOT NULL DEFAULT 'biblio' COMMENT 'server contains bibliographic or authority records',
6135 `sru_options` varchar(255) DEFAULT NULL COMMENT 'options like sru=get, sru_version=1.1; will be passed to the server via ZOOM',
6136 `sru_fields` longtext DEFAULT NULL COMMENT 'contains the mapping between the Z3950 search fields and the specific SRU server indexes',
6137 `add_xslt` longtext DEFAULT NULL COMMENT 'zero or more paths to XSLT files to be processed on the search results',
6138 `attributes` varchar(255) DEFAULT NULL COMMENT 'additional attributes passed to PQF queries',
6140 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6141 /*!40101 SET character_set_client = @saved_cs_client */;
6144 -- Table structure for table `zebraqueue`
6147 DROP TABLE IF EXISTS `zebraqueue`;
6148 /*!40101 SET @saved_cs_client = @@character_set_client */;
6149 /*!40101 SET character_set_client = utf8 */;
6150 CREATE TABLE `zebraqueue` (
6151 `id` int(11) NOT NULL AUTO_INCREMENT,
6152 `biblio_auth_number` bigint(20) unsigned NOT NULL DEFAULT 0,
6153 `operation` char(20) NOT NULL DEFAULT '',
6154 `server` char(20) NOT NULL DEFAULT '',
6155 `done` int(11) NOT NULL DEFAULT 0,
6156 `time` timestamp NOT NULL DEFAULT current_timestamp(),
6158 KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
6159 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6160 /*!40101 SET character_set_client = @saved_cs_client */;
6161 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
6163 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
6164 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
6165 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
6166 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
6167 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
6168 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
6169 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
6171 -- Dump completed on 2023-05-31 12:31:12