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 `aqbudgetborrowers`
473 DROP TABLE IF EXISTS `aqbudgetborrowers`;
474 /*!40101 SET @saved_cs_client = @@character_set_client */;
475 /*!40101 SET character_set_client = utf8 */;
476 CREATE TABLE `aqbudgetborrowers` (
477 `budget_id` int(11) NOT NULL,
478 `borrowernumber` int(11) NOT NULL,
479 PRIMARY KEY (`budget_id`,`borrowernumber`),
480 KEY `aqbudgetborrowers_ibfk_2` (`borrowernumber`),
481 CONSTRAINT `aqbudgetborrowers_ibfk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
482 CONSTRAINT `aqbudgetborrowers_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
483 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
484 /*!40101 SET character_set_client = @saved_cs_client */;
487 -- Table structure for table `aqbudgetperiods`
490 DROP TABLE IF EXISTS `aqbudgetperiods`;
491 /*!40101 SET @saved_cs_client = @@character_set_client */;
492 /*!40101 SET character_set_client = utf8 */;
493 CREATE TABLE `aqbudgetperiods` (
494 `budget_period_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned by Koha',
495 `budget_period_startdate` date NOT NULL COMMENT 'date when the budget starts',
496 `budget_period_enddate` date NOT NULL COMMENT 'date when the budget ends',
497 `budget_period_active` tinyint(1) DEFAULT 0 COMMENT 'whether this budget is active or not (1 for yes, 0 for no)',
498 `budget_period_description` longtext DEFAULT NULL COMMENT 'description assigned to this budget',
499 `budget_period_total` decimal(28,6) DEFAULT NULL COMMENT 'total amount available in this budget',
500 `budget_period_locked` tinyint(1) DEFAULT NULL COMMENT 'whether this budget is locked or not (1 for yes, 0 for no)',
501 `sort1_authcat` varchar(10) DEFAULT NULL COMMENT 'statistical category for this budget',
502 `sort2_authcat` varchar(10) DEFAULT NULL COMMENT 'second statistical category for this budget',
503 PRIMARY KEY (`budget_period_id`)
504 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
505 /*!40101 SET character_set_client = @saved_cs_client */;
508 -- Table structure for table `aqbudgets`
511 DROP TABLE IF EXISTS `aqbudgets`;
512 /*!40101 SET @saved_cs_client = @@character_set_client */;
513 /*!40101 SET character_set_client = utf8 */;
514 CREATE TABLE `aqbudgets` (
515 `budget_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned to each fund by Koha',
516 `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)',
517 `budget_code` varchar(30) DEFAULT NULL COMMENT 'code assigned to the fund by the user',
518 `budget_name` varchar(80) DEFAULT NULL COMMENT 'name assigned to the fund by the user',
519 `budget_branchcode` varchar(10) DEFAULT NULL COMMENT 'branch that this fund belongs to (branches.branchcode)',
520 `budget_amount` decimal(28,6) DEFAULT 0.000000 COMMENT 'total amount for this fund',
521 `budget_encumb` decimal(28,6) DEFAULT 0.000000 COMMENT 'budget warning at percentage',
522 `budget_expend` decimal(28,6) DEFAULT 0.000000 COMMENT 'budget warning at amount',
523 `budget_notes` longtext DEFAULT NULL COMMENT 'notes related to this fund',
524 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this fund was last touched (created or modified)',
525 `budget_period_id` int(11) DEFAULT NULL COMMENT 'id of the budget that this fund belongs to (aqbudgetperiods.budget_period_id)',
526 `sort1_authcat` varchar(80) DEFAULT NULL COMMENT 'statistical category for this fund',
527 `sort2_authcat` varchar(80) DEFAULT NULL COMMENT 'second statistical category for this fund',
528 `budget_owner_id` int(11) DEFAULT NULL COMMENT 'borrowernumber of the person who owns this fund (borrowers.borrowernumber)',
529 `budget_permission` int(1) DEFAULT 0 COMMENT 'level of permission for this fund (used only by the owner, only by the library, or anyone)',
530 PRIMARY KEY (`budget_id`),
531 KEY `budget_parent_id` (`budget_parent_id`),
532 KEY `budget_code` (`budget_code`),
533 KEY `budget_branchcode` (`budget_branchcode`),
534 KEY `budget_period_id` (`budget_period_id`),
535 KEY `budget_owner_id` (`budget_owner_id`),
536 CONSTRAINT `aqbudgetperiods_ibfk_1` FOREIGN KEY (`budget_period_id`) REFERENCES `aqbudgetperiods` (`budget_period_id`) ON DELETE CASCADE ON UPDATE CASCADE
537 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
538 /*!40101 SET character_set_client = @saved_cs_client */;
541 -- Table structure for table `aqbudgets_planning`
544 DROP TABLE IF EXISTS `aqbudgets_planning`;
545 /*!40101 SET @saved_cs_client = @@character_set_client */;
546 /*!40101 SET character_set_client = utf8 */;
547 CREATE TABLE `aqbudgets_planning` (
548 `plan_id` int(11) NOT NULL AUTO_INCREMENT,
549 `budget_id` int(11) NOT NULL,
550 `budget_period_id` int(11) NOT NULL,
551 `estimated_amount` decimal(28,6) DEFAULT NULL,
552 `authcat` varchar(30) NOT NULL,
553 `authvalue` varchar(30) NOT NULL,
554 `display` tinyint(1) DEFAULT 1,
555 PRIMARY KEY (`plan_id`),
556 KEY `budget_period_id` (`budget_period_id`),
557 KEY `aqbudgets_planning_ifbk_1` (`budget_id`),
558 CONSTRAINT `aqbudgets_planning_ifbk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE
559 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
560 /*!40101 SET character_set_client = @saved_cs_client */;
563 -- Table structure for table `aqcontacts`
566 DROP TABLE IF EXISTS `aqcontacts`;
567 /*!40101 SET @saved_cs_client = @@character_set_client */;
568 /*!40101 SET character_set_client = utf8 */;
569 CREATE TABLE `aqcontacts` (
570 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned by Koha',
571 `name` varchar(100) DEFAULT NULL COMMENT 'name of contact at vendor',
572 `position` varchar(100) DEFAULT NULL COMMENT 'contact person''s position',
573 `phone` varchar(100) DEFAULT NULL COMMENT 'contact''s phone number',
574 `altphone` varchar(100) DEFAULT NULL COMMENT 'contact''s alternate phone number',
575 `fax` varchar(100) DEFAULT NULL COMMENT 'contact''s fax number',
576 `email` varchar(100) DEFAULT NULL COMMENT 'contact''s email address',
577 `notes` longtext DEFAULT NULL COMMENT 'notes related to the contact',
578 `orderacquisition` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive acquisition orders',
579 `claimacquisition` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive acquisitions claims',
580 `claimissues` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive serial claims',
581 `acqprimary` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is this the primary contact for acquisitions messages',
582 `serialsprimary` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is this the primary contact for serials messages',
583 `booksellerid` int(11) NOT NULL,
585 KEY `booksellerid_aqcontacts_fk` (`booksellerid`),
586 CONSTRAINT `booksellerid_aqcontacts_fk` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
587 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
588 /*!40101 SET character_set_client = @saved_cs_client */;
591 -- Table structure for table `aqcontract`
594 DROP TABLE IF EXISTS `aqcontract`;
595 /*!40101 SET @saved_cs_client = @@character_set_client */;
596 /*!40101 SET character_set_client = utf8 */;
597 CREATE TABLE `aqcontract` (
598 `contractnumber` int(11) NOT NULL AUTO_INCREMENT,
599 `contractstartdate` date DEFAULT NULL,
600 `contractenddate` date DEFAULT NULL,
601 `contractname` varchar(50) DEFAULT NULL,
602 `contractdescription` longtext DEFAULT NULL,
603 `booksellerid` int(11) NOT NULL,
604 PRIMARY KEY (`contractnumber`),
605 KEY `booksellerid_fk1` (`booksellerid`),
606 CONSTRAINT `booksellerid_fk1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
607 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
608 /*!40101 SET character_set_client = @saved_cs_client */;
611 -- Table structure for table `aqinvoice_adjustments`
614 DROP TABLE IF EXISTS `aqinvoice_adjustments`;
615 /*!40101 SET @saved_cs_client = @@character_set_client */;
616 /*!40101 SET character_set_client = utf8 */;
617 CREATE TABLE `aqinvoice_adjustments` (
618 `adjustment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key for adjustments',
619 `invoiceid` int(11) NOT NULL COMMENT 'foreign key to link an adjustment to an invoice',
620 `adjustment` decimal(28,6) DEFAULT NULL COMMENT 'amount of adjustment',
621 `reason` varchar(80) DEFAULT NULL COMMENT 'reason for adjustment defined by authorised values in ADJ_REASON category',
622 `note` mediumtext DEFAULT NULL COMMENT 'text to explain adjustment',
623 `budget_id` int(11) DEFAULT NULL COMMENT 'optional link to budget to apply adjustment to',
624 `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',
625 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'timestamp of last adjustment to adjustment',
626 PRIMARY KEY (`adjustment_id`),
627 KEY `aqinvoice_adjustments_fk_invoiceid` (`invoiceid`),
628 KEY `aqinvoice_adjustments_fk_budget_id` (`budget_id`),
629 CONSTRAINT `aqinvoice_adjustments_fk_budget_id` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
630 CONSTRAINT `aqinvoice_adjustments_fk_invoiceid` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE CASCADE ON UPDATE CASCADE
631 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
632 /*!40101 SET character_set_client = @saved_cs_client */;
635 -- Table structure for table `aqinvoices`
638 DROP TABLE IF EXISTS `aqinvoices`;
639 /*!40101 SET @saved_cs_client = @@character_set_client */;
640 /*!40101 SET character_set_client = utf8 */;
641 CREATE TABLE `aqinvoices` (
642 `invoiceid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the invoice, primary key',
643 `invoicenumber` longtext NOT NULL COMMENT 'Name of invoice',
644 `booksellerid` int(11) NOT NULL COMMENT 'foreign key to aqbooksellers',
645 `shipmentdate` date DEFAULT NULL COMMENT 'date of shipment',
646 `billingdate` date DEFAULT NULL COMMENT 'date of billing',
647 `closedate` date DEFAULT NULL COMMENT 'invoice close date, NULL means the invoice is open',
648 `shipmentcost` decimal(28,6) DEFAULT NULL COMMENT 'shipment cost',
649 `shipmentcost_budgetid` int(11) DEFAULT NULL COMMENT 'foreign key to aqbudgets, link the shipment cost to a budget',
650 `message_id` int(11) DEFAULT NULL COMMENT 'foreign key to edifact invoice message',
651 PRIMARY KEY (`invoiceid`),
652 KEY `aqinvoices_fk_aqbooksellerid` (`booksellerid`),
653 KEY `edifact_msg_fk` (`message_id`),
654 KEY `aqinvoices_fk_shipmentcost_budgetid` (`shipmentcost_budgetid`),
655 CONSTRAINT `aqinvoices_fk_aqbooksellerid` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
656 CONSTRAINT `aqinvoices_fk_shipmentcost_budgetid` FOREIGN KEY (`shipmentcost_budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
657 CONSTRAINT `edifact_msg_fk` FOREIGN KEY (`message_id`) REFERENCES `edifact_messages` (`id`) ON DELETE SET NULL
658 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
659 /*!40101 SET character_set_client = @saved_cs_client */;
662 -- Table structure for table `aqorder_users`
665 DROP TABLE IF EXISTS `aqorder_users`;
666 /*!40101 SET @saved_cs_client = @@character_set_client */;
667 /*!40101 SET character_set_client = utf8 */;
668 CREATE TABLE `aqorder_users` (
669 `ordernumber` int(11) NOT NULL COMMENT 'the order this patrons receive notifications from (aqorders.ordernumber)',
670 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber for the patron receiving notifications for this order (borrowers.borrowernumber)',
671 PRIMARY KEY (`ordernumber`,`borrowernumber`),
672 KEY `aqorder_users_ibfk_2` (`borrowernumber`),
673 CONSTRAINT `aqorder_users_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
674 CONSTRAINT `aqorder_users_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
675 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
676 /*!40101 SET character_set_client = @saved_cs_client */;
679 -- Table structure for table `aqorders`
682 DROP TABLE IF EXISTS `aqorders`;
683 /*!40101 SET @saved_cs_client = @@character_set_client */;
684 /*!40101 SET character_set_client = utf8 */;
685 CREATE TABLE `aqorders` (
686 `ordernumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha to each line',
687 `biblionumber` int(11) DEFAULT NULL COMMENT 'links the order to the biblio being ordered (biblio.biblionumber)',
688 `deleted_biblionumber` int(11) DEFAULT NULL COMMENT 'links the order to the deleted bibliographic record (deletedbiblio.biblionumber)',
689 `entrydate` date DEFAULT NULL COMMENT 'the date the bib was added to the basket',
690 `quantity` smallint(6) DEFAULT NULL COMMENT 'the quantity ordered',
691 `currency` varchar(10) DEFAULT NULL COMMENT 'the currency used for the purchase',
692 `listprice` decimal(28,6) DEFAULT NULL COMMENT 'the vendor price for this line item',
693 `datereceived` date DEFAULT NULL COMMENT 'the date this order was received',
694 `invoiceid` int(11) DEFAULT NULL COMMENT 'id of invoice',
695 `freight` decimal(28,6) DEFAULT NULL COMMENT 'shipping costs (not used)',
696 `unitprice` decimal(28,6) DEFAULT NULL COMMENT 'the actual cost entered when receiving this line item',
697 `unitprice_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the unit price excluding tax (on receiving)',
698 `unitprice_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the unit price including tax (on receiving)',
699 `quantityreceived` smallint(6) NOT NULL DEFAULT 0 COMMENT 'the quantity that have been received so far',
700 `created_by` int(11) DEFAULT NULL COMMENT 'the borrowernumber of order line''s creator',
701 `datecancellationprinted` date DEFAULT NULL COMMENT 'the date the line item was deleted',
702 `cancellationreason` mediumtext DEFAULT NULL COMMENT 'reason of cancellation',
703 `order_internalnote` longtext DEFAULT NULL COMMENT 'notes related to this order line, made for staff',
704 `order_vendornote` longtext DEFAULT NULL COMMENT 'notes related to this order line, made for vendor',
705 `purchaseordernumber` longtext DEFAULT NULL COMMENT 'not used? always NULL',
706 `basketno` int(11) DEFAULT NULL COMMENT 'links this order line to a specific basket (aqbasket.basketno)',
707 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this order line was last modified',
708 `rrp` decimal(13,2) DEFAULT NULL COMMENT 'the retail cost for this line item',
709 `replacementprice` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost for this line item',
710 `rrp_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost excluding tax',
711 `rrp_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost including tax',
712 `ecost` decimal(13,2) DEFAULT NULL COMMENT 'the replacement cost for this line item',
713 `ecost_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the estimated cost excluding tax',
714 `ecost_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the estimated cost including tax',
715 `tax_rate_bak` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate for this line item (%)',
716 `tax_rate_on_ordering` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate on ordering for this line item (%)',
717 `tax_rate_on_receiving` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate on receiving for this line item (%)',
718 `tax_value_bak` decimal(28,6) DEFAULT NULL COMMENT 'the tax value for this line item',
719 `tax_value_on_ordering` decimal(28,6) DEFAULT NULL COMMENT 'the tax value on ordering for this line item',
720 `tax_value_on_receiving` decimal(28,6) DEFAULT NULL COMMENT 'the tax value on receiving for this line item',
721 `discount` float(6,4) DEFAULT NULL COMMENT 'the discount for this line item (%)',
722 `budget_id` int(11) NOT NULL COMMENT 'the fund this order goes against (aqbudgets.budget_id)',
723 `budgetdate` date DEFAULT NULL COMMENT 'not used? always NULL',
724 `sort1` varchar(80) DEFAULT NULL COMMENT 'statistical field',
725 `sort2` varchar(80) DEFAULT NULL COMMENT 'second statistical field',
726 `sort1_authcat` varchar(10) DEFAULT NULL,
727 `sort2_authcat` varchar(10) DEFAULT NULL,
728 `uncertainprice` tinyint(1) DEFAULT NULL COMMENT 'was this price uncertain (1 for yes, 0 for no)',
729 `subscriptionid` int(11) DEFAULT NULL COMMENT 'links this order line to a subscription (subscription.subscriptionid)',
730 `parent_ordernumber` int(11) DEFAULT NULL COMMENT 'ordernumber of parent order line, or same as ordernumber if no parent',
731 `orderstatus` varchar(16) DEFAULT 'new' COMMENT 'the current status for this line item. Can be ''new'', ''ordered'', ''partial'', ''complete'' or ''cancelled''',
732 `line_item_id` varchar(35) DEFAULT NULL COMMENT 'Supplier''s article id for Edifact orderline',
733 `suppliers_reference_number` varchar(35) DEFAULT NULL COMMENT 'Suppliers unique edifact quote ref',
734 `suppliers_reference_qualifier` varchar(3) DEFAULT NULL COMMENT 'Type of number above usually ''QLI''',
735 `suppliers_report` mediumtext DEFAULT NULL COMMENT 'reports received from suppliers',
736 `estimated_delivery_date` date DEFAULT NULL COMMENT 'Estimated delivery date',
737 `invoice_unitprice` decimal(28,6) DEFAULT NULL COMMENT 'the unit price in foreign currency',
738 `invoice_currency` varchar(10) DEFAULT NULL COMMENT 'the currency of the invoice_unitprice',
739 PRIMARY KEY (`ordernumber`),
740 KEY `basketno` (`basketno`),
741 KEY `biblionumber` (`biblionumber`),
742 KEY `budget_id` (`budget_id`),
743 KEY `parent_ordernumber` (`parent_ordernumber`),
744 KEY `orderstatus` (`orderstatus`),
745 KEY `aqorders_created_by` (`created_by`),
746 KEY `aqorders_ibfk_3` (`invoiceid`),
747 KEY `aqorders_subscriptionid` (`subscriptionid`),
748 KEY `aqorders_currency` (`currency`),
749 KEY `aqorders_invoice_currency` (`invoice_currency`),
750 CONSTRAINT `aqorders_budget_id_fk` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
751 CONSTRAINT `aqorders_created_by` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
752 CONSTRAINT `aqorders_currency` FOREIGN KEY (`currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
753 CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
754 CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
755 CONSTRAINT `aqorders_ibfk_3` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE SET NULL ON UPDATE CASCADE,
756 CONSTRAINT `aqorders_invoice_currency` FOREIGN KEY (`invoice_currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
757 CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
758 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
759 /*!40101 SET character_set_client = @saved_cs_client */;
762 -- Table structure for table `aqorders_claims`
765 DROP TABLE IF EXISTS `aqorders_claims`;
766 /*!40101 SET @saved_cs_client = @@character_set_client */;
767 /*!40101 SET character_set_client = utf8 */;
768 CREATE TABLE `aqorders_claims` (
769 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the claims',
770 `ordernumber` int(11) NOT NULL COMMENT 'order linked to this claim',
771 `claimed_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date of the claims',
773 KEY `aqorders_claims_ibfk_1` (`ordernumber`),
774 CONSTRAINT `aqorders_claims_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE
775 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
776 /*!40101 SET character_set_client = @saved_cs_client */;
779 -- Table structure for table `aqorders_items`
782 DROP TABLE IF EXISTS `aqorders_items`;
783 /*!40101 SET @saved_cs_client = @@character_set_client */;
784 /*!40101 SET character_set_client = utf8 */;
785 CREATE TABLE `aqorders_items` (
786 `ordernumber` int(11) NOT NULL COMMENT 'the order this item is attached to (aqorders.ordernumber)',
787 `itemnumber` int(11) NOT NULL COMMENT 'the item number for this item (items.itemnumber)',
788 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this order item was last touched',
789 PRIMARY KEY (`itemnumber`),
790 KEY `ordernumber` (`ordernumber`),
791 CONSTRAINT `aqorders_items_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE
792 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
793 /*!40101 SET character_set_client = @saved_cs_client */;
796 -- Table structure for table `aqorders_transfers`
799 DROP TABLE IF EXISTS `aqorders_transfers`;
800 /*!40101 SET @saved_cs_client = @@character_set_client */;
801 /*!40101 SET character_set_client = utf8 */;
802 CREATE TABLE `aqorders_transfers` (
803 `ordernumber_from` int(11) DEFAULT NULL,
804 `ordernumber_to` int(11) DEFAULT NULL,
805 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
806 UNIQUE KEY `ordernumber_from` (`ordernumber_from`),
807 UNIQUE KEY `ordernumber_to` (`ordernumber_to`),
808 CONSTRAINT `aqorders_transfers_ordernumber_from` FOREIGN KEY (`ordernumber_from`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
809 CONSTRAINT `aqorders_transfers_ordernumber_to` FOREIGN KEY (`ordernumber_to`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE
810 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
811 /*!40101 SET character_set_client = @saved_cs_client */;
814 -- Table structure for table `article_requests`
817 DROP TABLE IF EXISTS `article_requests`;
818 /*!40101 SET @saved_cs_client = @@character_set_client */;
819 /*!40101 SET character_set_client = utf8 */;
820 CREATE TABLE `article_requests` (
821 `id` int(11) NOT NULL AUTO_INCREMENT,
822 `borrowernumber` int(11) NOT NULL,
823 `biblionumber` int(11) NOT NULL,
824 `itemnumber` int(11) DEFAULT NULL,
825 `branchcode` varchar(10) DEFAULT NULL,
826 `title` mediumtext DEFAULT NULL,
827 `author` mediumtext DEFAULT NULL,
828 `volume` mediumtext DEFAULT NULL,
829 `issue` mediumtext DEFAULT NULL,
830 `date` mediumtext DEFAULT NULL,
831 `pages` mediumtext DEFAULT NULL,
832 `chapters` mediumtext DEFAULT NULL,
833 `patron_notes` mediumtext DEFAULT NULL,
834 `status` enum('REQUESTED','PENDING','PROCESSING','COMPLETED','CANCELED') NOT NULL DEFAULT 'REQUESTED',
835 `notes` mediumtext DEFAULT NULL,
836 `format` enum('PHOTOCOPY','SCAN') NOT NULL DEFAULT 'PHOTOCOPY',
837 `urls` mediumtext DEFAULT NULL,
838 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value AR_CANCELLATION',
839 `debit_id` int(11) DEFAULT NULL COMMENT 'Debit line with cost for article scan request',
840 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Be careful with two timestamps in one table not allowing NULL',
841 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
842 `toc_request` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'borrower requested table of contents',
844 KEY `borrowernumber` (`borrowernumber`),
845 KEY `biblionumber` (`biblionumber`),
846 KEY `itemnumber` (`itemnumber`),
847 KEY `branchcode` (`branchcode`),
848 KEY `debit_id` (`debit_id`),
849 CONSTRAINT `article_requests_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
850 CONSTRAINT `article_requests_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
851 CONSTRAINT `article_requests_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
852 CONSTRAINT `article_requests_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
853 CONSTRAINT `article_requests_ibfk_5` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE SET NULL ON UPDATE CASCADE
854 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
855 /*!40101 SET character_set_client = @saved_cs_client */;
858 -- Table structure for table `audio_alerts`
861 DROP TABLE IF EXISTS `audio_alerts`;
862 /*!40101 SET @saved_cs_client = @@character_set_client */;
863 /*!40101 SET character_set_client = utf8 */;
864 CREATE TABLE `audio_alerts` (
865 `id` int(11) NOT NULL AUTO_INCREMENT,
866 `precedence` smallint(5) unsigned NOT NULL,
867 `selector` varchar(255) NOT NULL,
868 `sound` varchar(255) NOT NULL,
870 KEY `precedence` (`precedence`)
871 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
872 /*!40101 SET character_set_client = @saved_cs_client */;
875 -- Table structure for table `auth_header`
878 DROP TABLE IF EXISTS `auth_header`;
879 /*!40101 SET @saved_cs_client = @@character_set_client */;
880 /*!40101 SET character_set_client = utf8 */;
881 CREATE TABLE `auth_header` (
882 `authid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
883 `authtypecode` varchar(10) NOT NULL DEFAULT '',
884 `datecreated` date DEFAULT NULL,
885 `modification_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
886 `origincode` varchar(20) DEFAULT NULL,
887 `authtrees` longtext DEFAULT NULL,
888 `marc` blob DEFAULT NULL,
889 `linkid` bigint(20) DEFAULT NULL,
890 `marcxml` longtext NOT NULL,
891 PRIMARY KEY (`authid`),
892 KEY `origincode` (`origincode`)
893 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
894 /*!40101 SET character_set_client = @saved_cs_client */;
897 -- Table structure for table `auth_subfield_structure`
900 DROP TABLE IF EXISTS `auth_subfield_structure`;
901 /*!40101 SET @saved_cs_client = @@character_set_client */;
902 /*!40101 SET character_set_client = utf8 */;
903 CREATE TABLE `auth_subfield_structure` (
904 `authtypecode` varchar(10) NOT NULL DEFAULT '',
905 `tagfield` varchar(3) NOT NULL DEFAULT '',
906 `tagsubfield` varchar(1) NOT NULL DEFAULT '',
907 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
908 `libopac` varchar(255) NOT NULL DEFAULT '',
909 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
910 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
911 `tab` tinyint(1) DEFAULT NULL,
912 `authorised_value` varchar(32) DEFAULT NULL,
913 `value_builder` varchar(80) DEFAULT NULL,
914 `seealso` varchar(255) DEFAULT NULL,
915 `isurl` tinyint(1) DEFAULT NULL,
916 `hidden` tinyint(3) NOT NULL DEFAULT 0,
917 `linkid` tinyint(1) NOT NULL DEFAULT 0,
918 `kohafield` varchar(45) DEFAULT '',
919 `frameworkcode` varchar(10) NOT NULL DEFAULT '',
920 `defaultvalue` mediumtext DEFAULT NULL,
921 `display_order` int(2) NOT NULL DEFAULT 0,
922 PRIMARY KEY (`authtypecode`,`tagfield`,`tagsubfield`),
923 KEY `tab` (`authtypecode`,`tab`),
924 CONSTRAINT `auth_subfield_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
925 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
926 /*!40101 SET character_set_client = @saved_cs_client */;
929 -- Table structure for table `auth_tag_structure`
932 DROP TABLE IF EXISTS `auth_tag_structure`;
933 /*!40101 SET @saved_cs_client = @@character_set_client */;
934 /*!40101 SET character_set_client = utf8 */;
935 CREATE TABLE `auth_tag_structure` (
936 `authtypecode` varchar(10) NOT NULL DEFAULT '',
937 `tagfield` varchar(3) NOT NULL DEFAULT '',
938 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
939 `libopac` varchar(255) NOT NULL DEFAULT '',
940 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
941 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
942 `authorised_value` varchar(32) DEFAULT NULL,
943 PRIMARY KEY (`authtypecode`,`tagfield`),
944 CONSTRAINT `auth_tag_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
945 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
946 /*!40101 SET character_set_client = @saved_cs_client */;
949 -- Table structure for table `auth_types`
952 DROP TABLE IF EXISTS `auth_types`;
953 /*!40101 SET @saved_cs_client = @@character_set_client */;
954 /*!40101 SET character_set_client = utf8 */;
955 CREATE TABLE `auth_types` (
956 `authtypecode` varchar(10) NOT NULL DEFAULT '',
957 `authtypetext` varchar(255) NOT NULL DEFAULT '',
958 `auth_tag_to_report` varchar(3) NOT NULL DEFAULT '',
959 `summary` longtext NOT NULL,
960 PRIMARY KEY (`authtypecode`)
961 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
962 /*!40101 SET character_set_client = @saved_cs_client */;
965 -- Table structure for table `authorised_value_categories`
968 DROP TABLE IF EXISTS `authorised_value_categories`;
969 /*!40101 SET @saved_cs_client = @@character_set_client */;
970 /*!40101 SET character_set_client = utf8 */;
971 CREATE TABLE `authorised_value_categories` (
972 `category_name` varchar(32) NOT NULL DEFAULT '',
973 `is_system` tinyint(1) DEFAULT 0,
974 PRIMARY KEY (`category_name`)
975 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
976 /*!40101 SET character_set_client = @saved_cs_client */;
979 -- Table structure for table `authorised_values`
982 DROP TABLE IF EXISTS `authorised_values`;
983 /*!40101 SET @saved_cs_client = @@character_set_client */;
984 /*!40101 SET character_set_client = utf8 */;
985 CREATE TABLE `authorised_values` (
986 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify the authorized value',
987 `category` varchar(32) NOT NULL DEFAULT '' COMMENT 'key used to identify the authorized value category',
988 `authorised_value` varchar(80) NOT NULL DEFAULT '' COMMENT 'code use to identify the authorized value',
989 `lib` varchar(200) DEFAULT NULL COMMENT 'authorized value description as printed in the staff interface',
990 `lib_opac` varchar(200) DEFAULT NULL COMMENT 'authorized value description as printed in the OPAC',
991 `imageurl` varchar(200) DEFAULT NULL COMMENT 'authorized value URL',
993 UNIQUE KEY `av_uniq` (`category`,`authorised_value`),
994 KEY `name` (`category`),
995 KEY `lib` (`lib`(191)),
996 KEY `auth_value_idx` (`authorised_value`),
997 CONSTRAINT `authorised_values_authorised_values_category` FOREIGN KEY (`category`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE CASCADE ON UPDATE CASCADE
998 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
999 /*!40101 SET character_set_client = @saved_cs_client */;
1002 -- Table structure for table `authorised_values_branches`
1005 DROP TABLE IF EXISTS `authorised_values_branches`;
1006 /*!40101 SET @saved_cs_client = @@character_set_client */;
1007 /*!40101 SET character_set_client = utf8 */;
1008 CREATE TABLE `authorised_values_branches` (
1009 `av_id` int(11) NOT NULL,
1010 `branchcode` varchar(10) NOT NULL,
1011 KEY `av_id` (`av_id`),
1012 KEY `branchcode` (`branchcode`),
1013 CONSTRAINT `authorised_values_branches_ibfk_1` FOREIGN KEY (`av_id`) REFERENCES `authorised_values` (`id`) ON DELETE CASCADE,
1014 CONSTRAINT `authorised_values_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1015 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1016 /*!40101 SET character_set_client = @saved_cs_client */;
1019 -- Table structure for table `background_jobs`
1022 DROP TABLE IF EXISTS `background_jobs`;
1023 /*!40101 SET @saved_cs_client = @@character_set_client */;
1024 /*!40101 SET character_set_client = utf8 */;
1025 CREATE TABLE `background_jobs` (
1026 `id` int(11) NOT NULL AUTO_INCREMENT,
1027 `status` varchar(32) DEFAULT NULL,
1028 `progress` int(11) DEFAULT NULL,
1029 `size` int(11) DEFAULT NULL,
1030 `borrowernumber` int(11) DEFAULT NULL,
1031 `type` varchar(64) DEFAULT NULL,
1032 `queue` varchar(191) NOT NULL DEFAULT 'default' COMMENT 'Name of the queue the job is sent to',
1033 `data` longtext DEFAULT NULL,
1034 `context` longtext DEFAULT NULL COMMENT 'JSON-serialized context information for the job',
1035 `enqueued_on` datetime DEFAULT NULL,
1036 `started_on` datetime DEFAULT NULL,
1037 `ended_on` datetime DEFAULT NULL,
1039 KEY `borrowernumber` (`borrowernumber`),
1040 KEY `queue` (`queue`),
1041 KEY `status` (`status`)
1042 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1043 /*!40101 SET character_set_client = @saved_cs_client */;
1046 -- Table structure for table `biblio`
1049 DROP TABLE IF EXISTS `biblio`;
1050 /*!40101 SET @saved_cs_client = @@character_set_client */;
1051 /*!40101 SET character_set_client = utf8 */;
1052 CREATE TABLE `biblio` (
1053 `biblionumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned to each bibliographic record',
1054 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'foreign key from the biblio_framework table to identify which framework was used in cataloging this record',
1055 `author` longtext DEFAULT NULL COMMENT 'statement of responsibility from MARC record (100$a in MARC21)',
1056 `title` longtext DEFAULT NULL COMMENT 'title (without the subtitle) from the MARC record (245$a in MARC21)',
1057 `medium` longtext DEFAULT NULL COMMENT 'medium from the MARC record (245$h in MARC21)',
1058 `subtitle` longtext DEFAULT NULL COMMENT 'remainder of the title from the MARC record (245$b in MARC21)',
1059 `part_number` longtext DEFAULT NULL COMMENT 'part number from the MARC record (245$n in MARC21)',
1060 `part_name` longtext DEFAULT NULL COMMENT 'part name from the MARC record (245$p in MARC21)',
1061 `unititle` longtext DEFAULT NULL COMMENT 'uniform title (without the subtitle) from the MARC record (240$a in MARC21)',
1062 `notes` longtext DEFAULT NULL COMMENT 'values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)',
1063 `serial` tinyint(1) DEFAULT NULL COMMENT 'Boolean indicating whether biblio is for a serial',
1064 `seriestitle` longtext DEFAULT NULL,
1065 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'publication or copyright date from the MARC record',
1066 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
1067 `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
1068 `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
1069 PRIMARY KEY (`biblionumber`),
1070 KEY `blbnoidx` (`biblionumber`)
1071 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1072 /*!40101 SET character_set_client = @saved_cs_client */;
1075 -- Table structure for table `biblio_framework`
1078 DROP TABLE IF EXISTS `biblio_framework`;
1079 /*!40101 SET @saved_cs_client = @@character_set_client */;
1080 /*!40101 SET character_set_client = utf8 */;
1081 CREATE TABLE `biblio_framework` (
1082 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'the unique code assigned to the framework',
1083 `frameworktext` varchar(255) NOT NULL DEFAULT '' COMMENT 'the description/name given to the framework',
1084 PRIMARY KEY (`frameworkcode`)
1085 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1086 /*!40101 SET character_set_client = @saved_cs_client */;
1089 -- Table structure for table `biblio_metadata`
1092 DROP TABLE IF EXISTS `biblio_metadata`;
1093 /*!40101 SET @saved_cs_client = @@character_set_client */;
1094 /*!40101 SET character_set_client = utf8 */;
1095 CREATE TABLE `biblio_metadata` (
1096 `id` int(11) NOT NULL AUTO_INCREMENT,
1097 `biblionumber` int(11) NOT NULL,
1098 `format` varchar(16) NOT NULL,
1099 `schema` varchar(16) NOT NULL,
1100 `metadata` longtext NOT NULL,
1101 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1103 UNIQUE KEY `biblio_metadata_uniq_key` (`biblionumber`,`format`,`schema`),
1104 KEY `timestamp` (`timestamp`),
1105 CONSTRAINT `record_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1106 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1107 /*!40101 SET character_set_client = @saved_cs_client */;
1110 -- Table structure for table `biblioitems`
1113 DROP TABLE IF EXISTS `biblioitems`;
1114 /*!40101 SET @saved_cs_client = @@character_set_client */;
1115 /*!40101 SET character_set_client = utf8 */;
1116 CREATE TABLE `biblioitems` (
1117 `biblioitemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, unique identifier assigned by Koha',
1118 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the biblio table',
1119 `volume` longtext DEFAULT NULL,
1120 `number` longtext DEFAULT NULL,
1121 `itemtype` varchar(10) DEFAULT NULL COMMENT 'biblio level item type (MARC21 942$c)',
1122 `isbn` longtext DEFAULT NULL COMMENT 'ISBN (MARC21 020$a)',
1123 `issn` longtext DEFAULT NULL COMMENT 'ISSN (MARC21 022$a)',
1124 `ean` longtext DEFAULT NULL,
1125 `publicationyear` mediumtext DEFAULT NULL,
1126 `publishercode` text DEFAULT NULL COMMENT 'publisher (MARC21 260$b and 246$b)',
1127 `volumedate` date DEFAULT NULL,
1128 `volumedesc` mediumtext DEFAULT NULL COMMENT 'volume information (MARC21 362$a)',
1129 `collectiontitle` longtext DEFAULT NULL,
1130 `collectionissn` mediumtext DEFAULT NULL,
1131 `collectionvolume` longtext DEFAULT NULL,
1132 `editionstatement` mediumtext DEFAULT NULL,
1133 `editionresponsibility` mediumtext DEFAULT NULL,
1134 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1135 `illus` text DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)',
1136 `pages` text DEFAULT NULL COMMENT 'number of pages (MARC21 300$a)',
1137 `notes` longtext DEFAULT NULL,
1138 `size` text DEFAULT NULL COMMENT 'material size (MARC21 300$c)',
1139 `place` text DEFAULT NULL COMMENT 'publication place (MARC21 260$a and 264$a)',
1140 `lccn` longtext DEFAULT NULL COMMENT 'library of congress control number (MARC21 010$a)',
1141 `url` mediumtext DEFAULT NULL COMMENT 'url (MARC21 856$u)',
1142 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source (MARC21 942$2)',
1143 `cn_class` varchar(30) DEFAULT NULL,
1144 `cn_item` varchar(10) DEFAULT NULL,
1145 `cn_suffix` varchar(10) DEFAULT NULL,
1146 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized version of the call number used for sorting',
1147 `agerestriction` varchar(255) DEFAULT NULL COMMENT 'target audience/age restriction from the bib record (MARC21 521$a)',
1148 `totalissues` int(10) DEFAULT NULL,
1149 PRIMARY KEY (`biblioitemnumber`),
1150 KEY `bibinoidx` (`biblioitemnumber`),
1151 KEY `bibnoidx` (`biblionumber`),
1152 KEY `itemtype_idx` (`itemtype`),
1153 KEY `isbn` (`isbn`(191)),
1154 KEY `issn` (`issn`(191)),
1155 KEY `ean` (`ean`(191)),
1156 KEY `publishercode` (`publishercode`(191)),
1157 KEY `timestamp` (`timestamp`),
1158 CONSTRAINT `biblioitems_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1159 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1160 /*!40101 SET character_set_client = @saved_cs_client */;
1163 -- Table structure for table `borrower_attribute_types`
1166 DROP TABLE IF EXISTS `borrower_attribute_types`;
1167 /*!40101 SET @saved_cs_client = @@character_set_client */;
1168 /*!40101 SET character_set_client = utf8 */;
1169 CREATE TABLE `borrower_attribute_types` (
1170 `code` varchar(10) NOT NULL COMMENT 'unique key used to identify each custom field',
1171 `description` varchar(255) NOT NULL COMMENT 'description for each custom field',
1172 `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)',
1173 `unique_id` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this value needs to be unique (1 for yes, 0 for no)',
1174 `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)',
1175 `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)',
1176 `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)',
1177 `authorised_value_category` varchar(32) DEFAULT NULL COMMENT 'foreign key from authorised_values that links this custom field to an authorized value category',
1178 `display_checkout` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field displays in checkout screens',
1179 `category_code` varchar(10) DEFAULT NULL COMMENT 'defines a category for an attribute_type',
1180 `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1181 `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)',
1182 `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1183 PRIMARY KEY (`code`),
1184 KEY `auth_val_cat_idx` (`authorised_value_category`),
1185 KEY `category_code` (`category_code`),
1186 CONSTRAINT `borrower_attribute_types_ibfk_1` FOREIGN KEY (`category_code`) REFERENCES `categories` (`categorycode`)
1187 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1188 /*!40101 SET character_set_client = @saved_cs_client */;
1191 -- Table structure for table `borrower_attribute_types_branches`
1194 DROP TABLE IF EXISTS `borrower_attribute_types_branches`;
1195 /*!40101 SET @saved_cs_client = @@character_set_client */;
1196 /*!40101 SET character_set_client = utf8 */;
1197 CREATE TABLE `borrower_attribute_types_branches` (
1198 `bat_code` varchar(10) DEFAULT NULL,
1199 `b_branchcode` varchar(10) DEFAULT NULL,
1200 KEY `bat_code` (`bat_code`),
1201 KEY `b_branchcode` (`b_branchcode`),
1202 CONSTRAINT `borrower_attribute_types_branches_ibfk_1` FOREIGN KEY (`bat_code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE,
1203 CONSTRAINT `borrower_attribute_types_branches_ibfk_2` FOREIGN KEY (`b_branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1204 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1205 /*!40101 SET character_set_client = @saved_cs_client */;
1208 -- Table structure for table `borrower_attributes`
1211 DROP TABLE IF EXISTS `borrower_attributes`;
1212 /*!40101 SET @saved_cs_client = @@character_set_client */;
1213 /*!40101 SET character_set_client = utf8 */;
1214 CREATE TABLE `borrower_attributes` (
1215 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
1216 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines which patron/borrower has this attribute',
1217 `code` varchar(10) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
1218 `attribute` varchar(255) DEFAULT NULL COMMENT 'custom patron field value',
1220 KEY `borrowernumber` (`borrowernumber`),
1221 KEY `code_attribute` (`code`,`attribute`(191)),
1222 CONSTRAINT `borrower_attributes_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1223 CONSTRAINT `borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE
1224 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1225 /*!40101 SET character_set_client = @saved_cs_client */;
1228 -- Table structure for table `borrower_debarments`
1231 DROP TABLE IF EXISTS `borrower_debarments`;
1232 /*!40101 SET @saved_cs_client = @@character_set_client */;
1233 /*!40101 SET character_set_client = utf8 */;
1234 CREATE TABLE `borrower_debarments` (
1235 `borrower_debarment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the restriction',
1236 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key for borrowers.borrowernumber for patron who is restricted',
1237 `expiration` date DEFAULT NULL COMMENT 'expiration date of the restriction',
1238 `type` varchar(50) NOT NULL COMMENT 'type of restriction, FK to restriction_types.code',
1239 `comment` mediumtext DEFAULT NULL COMMENT 'comments about the restriction',
1240 `manager_id` int(11) DEFAULT NULL COMMENT 'foreign key for borrowers.borrowernumber for the librarian managing the restriction',
1241 `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date the restriction was added',
1242 `updated` timestamp NULL DEFAULT NULL COMMENT 'date the restriction was updated',
1243 PRIMARY KEY (`borrower_debarment_id`),
1244 KEY `borrowernumber` (`borrowernumber`),
1245 KEY `borrower_debarments_ibfk_2` (`type`),
1246 CONSTRAINT `borrower_debarments_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1247 CONSTRAINT `borrower_debarments_ibfk_2` FOREIGN KEY (`type`) REFERENCES `restriction_types` (`code`) ON DELETE NO ACTION ON UPDATE CASCADE
1248 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1249 /*!40101 SET character_set_client = @saved_cs_client */;
1252 -- Table structure for table `borrower_files`
1255 DROP TABLE IF EXISTS `borrower_files`;
1256 /*!40101 SET @saved_cs_client = @@character_set_client */;
1257 /*!40101 SET character_set_client = utf8 */;
1258 CREATE TABLE `borrower_files` (
1259 `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
1260 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking to the patron via the borrowernumber',
1261 `file_name` varchar(255) NOT NULL COMMENT 'file name',
1262 `file_type` varchar(255) NOT NULL COMMENT 'type of file',
1263 `file_description` varchar(255) DEFAULT NULL COMMENT 'description given to the file',
1264 `file_content` longblob NOT NULL COMMENT 'the file',
1265 `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
1266 PRIMARY KEY (`file_id`),
1267 KEY `borrowernumber` (`borrowernumber`),
1268 CONSTRAINT `borrower_files_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1269 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1270 /*!40101 SET character_set_client = @saved_cs_client */;
1273 -- Table structure for table `borrower_message_preferences`
1276 DROP TABLE IF EXISTS `borrower_message_preferences`;
1277 /*!40101 SET @saved_cs_client = @@character_set_client */;
1278 /*!40101 SET character_set_client = utf8 */;
1279 CREATE TABLE `borrower_message_preferences` (
1280 `borrower_message_preference_id` int(11) NOT NULL AUTO_INCREMENT,
1281 `borrowernumber` int(11) DEFAULT NULL,
1282 `categorycode` varchar(10) DEFAULT NULL,
1283 `message_attribute_id` int(11) DEFAULT 0,
1284 `days_in_advance` int(11) DEFAULT NULL,
1285 `wants_digest` tinyint(1) NOT NULL DEFAULT 0,
1286 PRIMARY KEY (`borrower_message_preference_id`),
1287 KEY `borrowernumber` (`borrowernumber`),
1288 KEY `categorycode` (`categorycode`),
1289 KEY `message_attribute_id` (`message_attribute_id`),
1290 CONSTRAINT `borrower_message_preferences_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1291 CONSTRAINT `borrower_message_preferences_ibfk_2` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1292 CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
1293 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1294 /*!40101 SET character_set_client = @saved_cs_client */;
1297 -- Table structure for table `borrower_message_transport_preferences`
1300 DROP TABLE IF EXISTS `borrower_message_transport_preferences`;
1301 /*!40101 SET @saved_cs_client = @@character_set_client */;
1302 /*!40101 SET character_set_client = utf8 */;
1303 CREATE TABLE `borrower_message_transport_preferences` (
1304 `borrower_message_preference_id` int(11) NOT NULL DEFAULT 0,
1305 `message_transport_type` varchar(20) NOT NULL DEFAULT '0',
1306 PRIMARY KEY (`borrower_message_preference_id`,`message_transport_type`),
1307 KEY `message_transport_type` (`message_transport_type`),
1308 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,
1309 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
1310 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1311 /*!40101 SET character_set_client = @saved_cs_client */;
1314 -- Table structure for table `borrower_modifications`
1317 DROP TABLE IF EXISTS `borrower_modifications`;
1318 /*!40101 SET @saved_cs_client = @@character_set_client */;
1319 /*!40101 SET character_set_client = utf8 */;
1320 CREATE TABLE `borrower_modifications` (
1321 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1322 `verification_token` varchar(255) NOT NULL DEFAULT '',
1323 `changed_fields` mediumtext DEFAULT NULL,
1324 `borrowernumber` int(11) NOT NULL DEFAULT 0,
1325 `cardnumber` varchar(32) DEFAULT NULL,
1326 `surname` longtext DEFAULT NULL,
1327 `firstname` mediumtext DEFAULT NULL,
1328 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1329 `title` longtext DEFAULT NULL,
1330 `othernames` longtext DEFAULT NULL,
1331 `initials` mediumtext DEFAULT NULL,
1332 `pronouns` longtext DEFAULT NULL,
1333 `streetnumber` varchar(10) DEFAULT NULL,
1334 `streettype` varchar(50) DEFAULT NULL,
1335 `address` longtext DEFAULT NULL,
1336 `address2` mediumtext DEFAULT NULL,
1337 `city` longtext DEFAULT NULL,
1338 `state` mediumtext DEFAULT NULL,
1339 `zipcode` varchar(25) DEFAULT NULL,
1340 `country` mediumtext DEFAULT NULL,
1341 `email` longtext DEFAULT NULL,
1342 `phone` mediumtext DEFAULT NULL,
1343 `mobile` varchar(50) DEFAULT NULL,
1344 `fax` longtext DEFAULT NULL,
1345 `emailpro` mediumtext DEFAULT NULL,
1346 `phonepro` mediumtext DEFAULT NULL,
1347 `B_streetnumber` varchar(10) DEFAULT NULL,
1348 `B_streettype` varchar(50) DEFAULT NULL,
1349 `B_address` varchar(100) DEFAULT NULL,
1350 `B_address2` mediumtext DEFAULT NULL,
1351 `B_city` longtext DEFAULT NULL,
1352 `B_state` mediumtext DEFAULT NULL,
1353 `B_zipcode` varchar(25) DEFAULT NULL,
1354 `B_country` mediumtext DEFAULT NULL,
1355 `B_email` mediumtext DEFAULT NULL,
1356 `B_phone` longtext DEFAULT NULL,
1357 `dateofbirth` date DEFAULT NULL,
1358 `branchcode` varchar(10) DEFAULT NULL,
1359 `categorycode` varchar(10) DEFAULT NULL,
1360 `dateenrolled` date DEFAULT NULL,
1361 `dateexpiry` date DEFAULT NULL,
1362 `date_renewed` date DEFAULT NULL,
1363 `gonenoaddress` tinyint(1) DEFAULT NULL,
1364 `lost` tinyint(1) DEFAULT NULL,
1365 `debarred` date DEFAULT NULL,
1366 `debarredcomment` varchar(255) DEFAULT NULL,
1367 `contactname` longtext DEFAULT NULL,
1368 `contactfirstname` mediumtext DEFAULT NULL,
1369 `contacttitle` mediumtext DEFAULT NULL,
1370 `borrowernotes` longtext DEFAULT NULL,
1371 `relationship` varchar(100) DEFAULT NULL,
1372 `sex` varchar(1) DEFAULT NULL,
1373 `password` varchar(30) DEFAULT NULL,
1374 `flags` bigint(11) DEFAULT NULL,
1375 `userid` varchar(75) DEFAULT NULL,
1376 `opacnote` longtext DEFAULT NULL,
1377 `contactnote` varchar(255) DEFAULT NULL,
1378 `sort1` varchar(80) DEFAULT NULL,
1379 `sort2` varchar(80) DEFAULT NULL,
1380 `altcontactfirstname` varchar(255) DEFAULT NULL,
1381 `altcontactsurname` varchar(255) DEFAULT NULL,
1382 `altcontactaddress1` varchar(255) DEFAULT NULL,
1383 `altcontactaddress2` varchar(255) DEFAULT NULL,
1384 `altcontactaddress3` varchar(255) DEFAULT NULL,
1385 `altcontactstate` mediumtext DEFAULT NULL,
1386 `altcontactzipcode` varchar(50) DEFAULT NULL,
1387 `altcontactcountry` mediumtext DEFAULT NULL,
1388 `altcontactphone` varchar(50) DEFAULT NULL,
1389 `smsalertnumber` varchar(50) DEFAULT NULL,
1390 `privacy` int(11) DEFAULT NULL,
1391 `extended_attributes` mediumtext DEFAULT NULL,
1392 `gdpr_proc_consent` datetime DEFAULT NULL COMMENT 'data processing consent',
1393 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1394 PRIMARY KEY (`verification_token`(191),`borrowernumber`),
1395 KEY `verification_token` (`verification_token`(191)),
1396 KEY `borrowernumber` (`borrowernumber`)
1397 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1398 /*!40101 SET character_set_client = @saved_cs_client */;
1401 -- Table structure for table `borrower_password_recovery`
1404 DROP TABLE IF EXISTS `borrower_password_recovery`;
1405 /*!40101 SET @saved_cs_client = @@character_set_client */;
1406 /*!40101 SET character_set_client = utf8 */;
1407 CREATE TABLE `borrower_password_recovery` (
1408 `borrowernumber` int(11) NOT NULL COMMENT 'the user asking a password recovery',
1409 `uuid` varchar(128) NOT NULL COMMENT 'a unique string to identify a password recovery attempt',
1410 `valid_until` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'a time limit on the password recovery attempt',
1411 PRIMARY KEY (`borrowernumber`),
1412 KEY `borrowernumber` (`borrowernumber`)
1413 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1414 /*!40101 SET character_set_client = @saved_cs_client */;
1417 -- Table structure for table `borrower_relationships`
1420 DROP TABLE IF EXISTS `borrower_relationships`;
1421 /*!40101 SET @saved_cs_client = @@character_set_client */;
1422 /*!40101 SET character_set_client = utf8 */;
1423 CREATE TABLE `borrower_relationships` (
1424 `id` int(11) NOT NULL AUTO_INCREMENT,
1425 `guarantor_id` int(11) NOT NULL,
1426 `guarantee_id` int(11) NOT NULL,
1427 `relationship` varchar(100) NOT NULL,
1429 UNIQUE KEY `guarantor_guarantee_idx` (`guarantor_id`,`guarantee_id`),
1430 KEY `r_guarantee` (`guarantee_id`),
1431 CONSTRAINT `r_guarantee` FOREIGN KEY (`guarantee_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1432 CONSTRAINT `r_guarantor` FOREIGN KEY (`guarantor_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1433 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1434 /*!40101 SET character_set_client = @saved_cs_client */;
1437 -- Table structure for table `borrowers`
1440 DROP TABLE IF EXISTS `borrowers`;
1441 /*!40101 SET @saved_cs_client = @@character_set_client */;
1442 /*!40101 SET character_set_client = utf8 */;
1443 CREATE TABLE `borrowers` (
1444 `borrowernumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, Koha assigned ID number for patrons/borrowers',
1445 `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
1446 `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1447 `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
1448 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1449 `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1450 `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
1451 `initials` mediumtext DEFAULT NULL COMMENT 'initials for your patron/borrower',
1452 `pronouns` longtext DEFAULT NULL COMMENT 'patron/borrower pronouns',
1453 `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',
1454 `streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s primary address',
1455 `address` longtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s primary address',
1456 `address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s primary address',
1457 `city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s primary address',
1458 `state` mediumtext DEFAULT NULL COMMENT 'the state or province for your patron/borrower''s primary address',
1459 `zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s primary address',
1460 `country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s primary address',
1461 `email` longtext DEFAULT NULL COMMENT 'the primary email address for your patron/borrower''s primary address',
1462 `phone` mediumtext DEFAULT NULL COMMENT 'the primary phone number for your patron/borrower''s primary address',
1463 `mobile` tinytext DEFAULT NULL COMMENT 'the other phone number for your patron/borrower''s primary address',
1464 `fax` longtext DEFAULT NULL COMMENT 'the fax number for your patron/borrower''s primary address',
1465 `emailpro` mediumtext DEFAULT NULL COMMENT 'the secondary email addres for your patron/borrower''s primary address',
1466 `phonepro` mediumtext DEFAULT NULL COMMENT 'the secondary phone number for your patron/borrower''s primary address',
1467 `B_streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address',
1468 `B_streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s alternate address',
1469 `B_address` mediumtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s alternate address',
1470 `B_address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s alternate address',
1471 `B_city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s alternate address',
1472 `B_state` mediumtext DEFAULT NULL COMMENT 'the state for your patron/borrower''s alternate address',
1473 `B_zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s alternate address',
1474 `B_country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s alternate address',
1475 `B_email` mediumtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate email address',
1476 `B_phone` longtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate phone number',
1477 `dateofbirth` date DEFAULT NULL COMMENT 'the patron/borrower''s date of birth (YYYY-MM-DD)',
1478 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table, includes the code of the patron/borrower''s home branch',
1479 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category',
1480 `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)',
1481 `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)',
1482 `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)',
1483 `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed',
1484 `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',
1485 `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',
1486 `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)',
1487 `debarredcomment` varchar(255) DEFAULT NULL COMMENT 'comment on the stop of the patron',
1488 `contactname` longtext DEFAULT NULL COMMENT 'used for children and profesionals to include surname or last name of guarantor or organization name',
1489 `contactfirstname` mediumtext DEFAULT NULL COMMENT 'used for children to include first name of guarantor',
1490 `contacttitle` mediumtext DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor',
1491 `borrowernotes` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface',
1492 `relationship` varchar(100) DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor',
1493 `sex` varchar(1) DEFAULT NULL COMMENT 'patron/borrower''s gender',
1494 `password` varchar(60) DEFAULT NULL COMMENT 'patron/borrower''s Bcrypt encrypted password',
1495 `secret` mediumtext DEFAULT NULL COMMENT 'Secret for 2FA',
1496 `auth_method` enum('password','two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method',
1497 `flags` bigint(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions',
1498 `userid` varchar(75) DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in',
1499 `opacnote` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface',
1500 `contactnote` varchar(255) DEFAULT NULL COMMENT 'a note related to the patron/borrower''s alternate address',
1501 `sort1` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
1502 `sort2` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
1503 `altcontactfirstname` mediumtext DEFAULT NULL COMMENT 'first name of alternate contact for the patron/borrower',
1504 `altcontactsurname` mediumtext DEFAULT NULL COMMENT 'surname or last name of the alternate contact for the patron/borrower',
1505 `altcontactaddress1` mediumtext DEFAULT NULL COMMENT 'the first address line for the alternate contact for the patron/borrower',
1506 `altcontactaddress2` mediumtext DEFAULT NULL COMMENT 'the second address line for the alternate contact for the patron/borrower',
1507 `altcontactaddress3` mediumtext DEFAULT NULL COMMENT 'the city for the alternate contact for the patron/borrower',
1508 `altcontactstate` mediumtext DEFAULT NULL COMMENT 'the state for the alternate contact for the patron/borrower',
1509 `altcontactzipcode` mediumtext DEFAULT NULL COMMENT 'the zipcode for the alternate contact for the patron/borrower',
1510 `altcontactcountry` mediumtext DEFAULT NULL COMMENT 'the country for the alternate contact for the patron/borrower',
1511 `altcontactphone` mediumtext DEFAULT NULL COMMENT 'the phone number for the alternate contact for the patron/borrower',
1512 `smsalertnumber` varchar(50) DEFAULT NULL COMMENT 'the mobile phone number where the patron/borrower would like to receive notices (if SMS turned on)',
1513 `sms_provider_id` int(11) DEFAULT NULL COMMENT 'the provider of the mobile phone number defined in smsalertnumber',
1514 `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history',
1515 `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines',
1516 `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
1517 `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''.',
1518 `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)',
1519 `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
1520 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
1521 `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
1522 `overdrive_auth_token` mediumtext DEFAULT NULL COMMENT 'persist OverDrive auth token',
1523 `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1524 `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1525 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1526 PRIMARY KEY (`borrowernumber`),
1527 UNIQUE KEY `cardnumber` (`cardnumber`),
1528 UNIQUE KEY `userid` (`userid`),
1529 KEY `categorycode` (`categorycode`),
1530 KEY `branchcode` (`branchcode`),
1531 KEY `surname_idx` (`surname`(191)),
1532 KEY `firstname_idx` (`firstname`(191)),
1533 KEY `othernames_idx` (`othernames`(191)),
1534 KEY `sms_provider_id` (`sms_provider_id`),
1535 KEY `cardnumber_idx` (`cardnumber`),
1536 KEY `userid_idx` (`userid`),
1537 KEY `middle_name_idx` (`middle_name`(768)),
1538 CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
1539 CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`),
1540 CONSTRAINT `borrowers_ibfk_3` FOREIGN KEY (`sms_provider_id`) REFERENCES `sms_providers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
1541 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1542 /*!40101 SET character_set_client = @saved_cs_client */;
1545 -- Table structure for table `branch_transfer_limits`
1548 DROP TABLE IF EXISTS `branch_transfer_limits`;
1549 /*!40101 SET @saved_cs_client = @@character_set_client */;
1550 /*!40101 SET character_set_client = utf8 */;
1551 CREATE TABLE `branch_transfer_limits` (
1552 `limitId` int(8) NOT NULL AUTO_INCREMENT,
1553 `toBranch` varchar(10) NOT NULL,
1554 `fromBranch` varchar(10) NOT NULL,
1555 `itemtype` varchar(10) DEFAULT NULL,
1556 `ccode` varchar(80) DEFAULT NULL,
1557 PRIMARY KEY (`limitId`),
1558 KEY `fromBranch_idx` (`fromBranch`)
1559 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1560 /*!40101 SET character_set_client = @saved_cs_client */;
1563 -- Table structure for table `branches`
1566 DROP TABLE IF EXISTS `branches`;
1567 /*!40101 SET @saved_cs_client = @@character_set_client */;
1568 /*!40101 SET character_set_client = utf8 */;
1569 CREATE TABLE `branches` (
1570 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'a unique key assigned to each branch',
1571 `branchname` longtext NOT NULL COMMENT 'the name of your library or branch',
1572 `branchaddress1` longtext DEFAULT NULL COMMENT 'the first address line of for your library or branch',
1573 `branchaddress2` longtext DEFAULT NULL COMMENT 'the second address line of for your library or branch',
1574 `branchaddress3` longtext DEFAULT NULL COMMENT 'the third address line of for your library or branch',
1575 `branchzip` varchar(25) DEFAULT NULL COMMENT 'the zip or postal code for your library or branch',
1576 `branchcity` longtext DEFAULT NULL COMMENT 'the city or province for your library or branch',
1577 `branchstate` longtext DEFAULT NULL COMMENT 'the state for your library or branch',
1578 `branchcountry` mediumtext DEFAULT NULL COMMENT 'the county for your library or branch',
1579 `branchphone` longtext DEFAULT NULL COMMENT 'the primary phone for your library or branch',
1580 `branchfax` longtext DEFAULT NULL COMMENT 'the fax number for your library or branch',
1581 `branchemail` longtext DEFAULT NULL COMMENT 'the primary email address for your library or branch',
1582 `branchillemail` longtext DEFAULT NULL COMMENT 'the ILL staff email address for your library or branch',
1583 `branchreplyto` longtext DEFAULT NULL COMMENT 'the email to be used as a Reply-To',
1584 `branchreturnpath` longtext DEFAULT NULL COMMENT 'the email to be used as Return-Path',
1585 `branchurl` longtext DEFAULT NULL COMMENT 'the URL for your library or branch''s website',
1586 `issuing` tinyint(4) DEFAULT NULL COMMENT 'unused in Koha',
1587 `branchip` varchar(15) DEFAULT NULL COMMENT 'the IP address for your library or branch',
1588 `branchnotes` longtext DEFAULT NULL COMMENT 'notes related to your library or branch',
1589 `geolocation` varchar(255) DEFAULT NULL COMMENT 'geolocation of your library',
1590 `marcorgcode` varchar(16) DEFAULT NULL COMMENT 'MARC Organization Code, see http://www.loc.gov/marc/organizations/orgshome.html, when empty defaults to syspref MARCOrgCode',
1591 `pickup_location` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'the ability to act as a pickup location',
1592 `public` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'whether this library should show in the opac',
1593 PRIMARY KEY (`branchcode`)
1594 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1595 /*!40101 SET character_set_client = @saved_cs_client */;
1598 -- Table structure for table `branches_overdrive`
1601 DROP TABLE IF EXISTS `branches_overdrive`;
1602 /*!40101 SET @saved_cs_client = @@character_set_client */;
1603 /*!40101 SET character_set_client = utf8 */;
1604 CREATE TABLE `branches_overdrive` (
1605 `branchcode` varchar(10) NOT NULL,
1606 `authname` varchar(255) NOT NULL,
1607 PRIMARY KEY (`branchcode`),
1608 CONSTRAINT `branches_overdrive_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1609 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1610 /*!40101 SET character_set_client = @saved_cs_client */;
1613 -- Table structure for table `branchtransfers`
1616 DROP TABLE IF EXISTS `branchtransfers`;
1617 /*!40101 SET @saved_cs_client = @@character_set_client */;
1618 /*!40101 SET character_set_client = utf8 */;
1619 CREATE TABLE `branchtransfers` (
1620 `branchtransfer_id` int(12) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
1621 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the itemnumber that it is in transit (items.itemnumber)',
1622 `daterequested` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date the transfer was requested',
1623 `datesent` datetime DEFAULT NULL COMMENT 'the date the transfer was initialized',
1624 `frombranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer is coming from',
1625 `datearrived` datetime DEFAULT NULL COMMENT 'the date the transfer arrived at its destination',
1626 `datecancelled` datetime DEFAULT NULL COMMENT 'the date the transfer was cancelled',
1627 `tobranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer was going to',
1628 `comments` longtext DEFAULT NULL COMMENT 'any comments related to the transfer',
1629 `reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation','Recall','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer',
1630 `cancellation_reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','ItemLost','WrongTransfer','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer cancellation',
1631 PRIMARY KEY (`branchtransfer_id`),
1632 KEY `frombranch` (`frombranch`),
1633 KEY `tobranch` (`tobranch`),
1634 KEY `itemnumber` (`itemnumber`),
1635 CONSTRAINT `branchtransfers_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1636 CONSTRAINT `branchtransfers_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1637 CONSTRAINT `branchtransfers_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1638 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1639 /*!40101 SET character_set_client = @saved_cs_client */;
1642 -- Table structure for table `browser`
1645 DROP TABLE IF EXISTS `browser`;
1646 /*!40101 SET @saved_cs_client = @@character_set_client */;
1647 /*!40101 SET character_set_client = utf8 */;
1648 CREATE TABLE `browser` (
1649 `level` int(11) NOT NULL,
1650 `classification` varchar(20) NOT NULL,
1651 `description` varchar(255) NOT NULL,
1652 `number` bigint(20) NOT NULL,
1653 `endnode` tinyint(4) NOT NULL
1654 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1655 /*!40101 SET character_set_client = @saved_cs_client */;
1658 -- Table structure for table `cash_register_actions`
1661 DROP TABLE IF EXISTS `cash_register_actions`;
1662 /*!40101 SET @saved_cs_client = @@character_set_client */;
1663 /*!40101 SET character_set_client = utf8 */;
1664 CREATE TABLE `cash_register_actions` (
1665 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each account register action',
1666 `code` varchar(24) NOT NULL COMMENT 'action code denoting the type of action recorded (enum),',
1667 `register_id` int(11) NOT NULL COMMENT 'id of cash_register this action belongs to,',
1668 `manager_id` int(11) NOT NULL COMMENT 'staff member performing the action',
1669 `amount` decimal(28,6) DEFAULT NULL COMMENT 'amount recorded in action (signed)',
1670 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1672 KEY `cash_register_actions_manager` (`manager_id`),
1673 KEY `cash_register_actions_register` (`register_id`),
1674 CONSTRAINT `cash_register_actions_manager` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1675 CONSTRAINT `cash_register_actions_register` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1676 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1677 /*!40101 SET character_set_client = @saved_cs_client */;
1680 -- Table structure for table `cash_registers`
1683 DROP TABLE IF EXISTS `cash_registers`;
1684 /*!40101 SET @saved_cs_client = @@character_set_client */;
1685 /*!40101 SET character_set_client = utf8 */;
1686 CREATE TABLE `cash_registers` (
1687 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each account register',
1688 `name` varchar(24) NOT NULL COMMENT 'the user friendly identifier for each account register',
1689 `description` longtext NOT NULL COMMENT 'the user friendly description for each account register',
1690 `branch` varchar(10) NOT NULL COMMENT 'the foreign key the library this account register belongs',
1691 `branch_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote that this till is the branch default',
1692 `starting_float` decimal(28,6) DEFAULT NULL COMMENT 'the starting float this account register should be assigned',
1693 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote if this till is archived or not',
1695 UNIQUE KEY `name` (`name`,`branch`),
1696 KEY `cash_registers_branch` (`branch`),
1697 CONSTRAINT `cash_registers_branch` FOREIGN KEY (`branch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1698 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1699 /*!40101 SET character_set_client = @saved_cs_client */;
1702 -- Table structure for table `categories`
1705 DROP TABLE IF EXISTS `categories`;
1706 /*!40101 SET @saved_cs_client = @@character_set_client */;
1707 /*!40101 SET character_set_client = utf8 */;
1708 CREATE TABLE `categories` (
1709 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'unique primary key used to idenfity the patron category',
1710 `description` longtext DEFAULT NULL COMMENT 'description of the patron category',
1711 `enrolmentperiod` smallint(6) DEFAULT NULL COMMENT 'number of months the patron is enrolled for (will be NULL if enrolmentperioddate is set)',
1712 `enrolmentperioddate` date DEFAULT NULL COMMENT 'date the patron is enrolled until (will be NULL if enrolmentperiod is set)',
1713 `password_expiry_days` smallint(6) DEFAULT NULL COMMENT 'number of days after which the patron must reset their password',
1714 `upperagelimit` smallint(6) DEFAULT NULL COMMENT 'age limit for the patron',
1715 `dateofbirthrequired` tinyint(1) DEFAULT NULL COMMENT 'the minimum age required for the patron category',
1716 `finetype` varchar(30) DEFAULT NULL COMMENT 'unused in Koha',
1717 `bulk` tinyint(1) DEFAULT NULL,
1718 `enrolmentfee` decimal(28,6) DEFAULT NULL COMMENT 'enrollment fee for the patron',
1719 `overduenoticerequired` tinyint(1) DEFAULT NULL COMMENT 'are overdue notices sent to this patron category (1 for yes, 0 for no)',
1720 `issuelimit` smallint(6) DEFAULT NULL COMMENT 'unused in Koha',
1721 `reservefee` decimal(28,6) DEFAULT NULL COMMENT 'cost to place holds',
1722 `hidelostitems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'are lost items shown to this category (1 for yes, 0 for no)',
1723 `category_type` varchar(1) NOT NULL DEFAULT 'A' COMMENT 'type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)',
1724 `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',
1725 `default_privacy` enum('default','never','forever') NOT NULL DEFAULT 'default' COMMENT 'Default privacy setting for this patron category',
1726 `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''.',
1727 `can_be_guarantee` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if patrons of this category can be guarantees',
1728 `reset_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can do the password reset flow,',
1729 `change_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can change their passwords in the OAPC',
1730 `min_password_length` smallint(6) DEFAULT NULL COMMENT 'set minimum password length for patrons in this category',
1731 `require_strong_password` tinyint(1) DEFAULT NULL COMMENT 'set required password strength for patrons in this category',
1732 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude patrons of this category from local holds priority',
1733 PRIMARY KEY (`categorycode`),
1734 UNIQUE KEY `categorycode` (`categorycode`)
1735 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1736 /*!40101 SET character_set_client = @saved_cs_client */;
1739 -- Table structure for table `categories_branches`
1742 DROP TABLE IF EXISTS `categories_branches`;
1743 /*!40101 SET @saved_cs_client = @@character_set_client */;
1744 /*!40101 SET character_set_client = utf8 */;
1745 CREATE TABLE `categories_branches` (
1746 `categorycode` varchar(10) DEFAULT NULL,
1747 `branchcode` varchar(10) DEFAULT NULL,
1748 KEY `categorycode` (`categorycode`),
1749 KEY `branchcode` (`branchcode`),
1750 CONSTRAINT `categories_branches_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE,
1751 CONSTRAINT `categories_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1752 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1753 /*!40101 SET character_set_client = @saved_cs_client */;
1756 -- Table structure for table `checkout_renewals`
1759 DROP TABLE IF EXISTS `checkout_renewals`;
1760 /*!40101 SET @saved_cs_client = @@character_set_client */;
1761 /*!40101 SET character_set_client = utf8 */;
1762 CREATE TABLE `checkout_renewals` (
1763 `renewal_id` int(11) NOT NULL AUTO_INCREMENT,
1764 `checkout_id` int(11) DEFAULT NULL COMMENT 'the id of the checkout this renewal pertains to',
1765 `renewer_id` int(11) DEFAULT NULL COMMENT 'the id of the user who processed the renewal',
1766 `seen` tinyint(1) DEFAULT 0 COMMENT 'boolean denoting whether the item was present or not',
1767 `interface` varchar(16) NOT NULL COMMENT 'the interface this renewal took place on',
1768 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the renewal took place',
1769 `renewal_type` enum('Automatic','Manual') NOT NULL DEFAULT 'Manual' COMMENT 'whether the renewal was an automatic or manual renewal',
1770 PRIMARY KEY (`renewal_id`),
1771 KEY `renewer_id` (`renewer_id`),
1772 CONSTRAINT `renewals_renewer_id` FOREIGN KEY (`renewer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
1773 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1774 /*!40101 SET character_set_client = @saved_cs_client */;
1777 -- Table structure for table `circulation_rules`
1780 DROP TABLE IF EXISTS `circulation_rules`;
1781 /*!40101 SET @saved_cs_client = @@character_set_client */;
1782 /*!40101 SET character_set_client = utf8 */;
1783 CREATE TABLE `circulation_rules` (
1784 `id` int(11) NOT NULL AUTO_INCREMENT,
1785 `branchcode` varchar(10) DEFAULT NULL,
1786 `categorycode` varchar(10) DEFAULT NULL,
1787 `itemtype` varchar(10) DEFAULT NULL,
1788 `rule_name` varchar(32) NOT NULL,
1789 `rule_value` varchar(32) NOT NULL,
1791 UNIQUE KEY `branchcode` (`branchcode`,`categorycode`,`itemtype`,`rule_name`),
1792 KEY `circ_rules_ibfk_2` (`categorycode`),
1793 KEY `circ_rules_ibfk_3` (`itemtype`),
1794 KEY `rule_name` (`rule_name`),
1795 CONSTRAINT `circ_rules_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1796 CONSTRAINT `circ_rules_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
1797 CONSTRAINT `circ_rules_ibfk_3` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
1798 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1799 /*!40101 SET character_set_client = @saved_cs_client */;
1802 -- Table structure for table `cities`
1805 DROP TABLE IF EXISTS `cities`;
1806 /*!40101 SET @saved_cs_client = @@character_set_client */;
1807 /*!40101 SET character_set_client = utf8 */;
1808 CREATE TABLE `cities` (
1809 `cityid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier added by Koha',
1810 `city_name` varchar(100) NOT NULL DEFAULT '' COMMENT 'name of the city',
1811 `city_state` varchar(100) DEFAULT NULL COMMENT 'name of the state/province',
1812 `city_country` varchar(100) DEFAULT NULL COMMENT 'name of the country',
1813 `city_zipcode` varchar(20) DEFAULT NULL COMMENT 'zip or postal code',
1814 PRIMARY KEY (`cityid`)
1815 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1816 /*!40101 SET character_set_client = @saved_cs_client */;
1819 -- Table structure for table `class_sort_rules`
1822 DROP TABLE IF EXISTS `class_sort_rules`;
1823 /*!40101 SET @saved_cs_client = @@character_set_client */;
1824 /*!40101 SET character_set_client = utf8 */;
1825 CREATE TABLE `class_sort_rules` (
1826 `class_sort_rule` varchar(10) NOT NULL DEFAULT '',
1827 `description` longtext DEFAULT NULL,
1828 `sort_routine` varchar(30) NOT NULL DEFAULT '',
1829 PRIMARY KEY (`class_sort_rule`),
1830 UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
1831 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1832 /*!40101 SET character_set_client = @saved_cs_client */;
1835 -- Table structure for table `class_sources`
1838 DROP TABLE IF EXISTS `class_sources`;
1839 /*!40101 SET @saved_cs_client = @@character_set_client */;
1840 /*!40101 SET character_set_client = utf8 */;
1841 CREATE TABLE `class_sources` (
1842 `cn_source` varchar(10) NOT NULL DEFAULT '',
1843 `description` longtext DEFAULT NULL,
1844 `used` tinyint(4) NOT NULL DEFAULT 0,
1845 `class_sort_rule` varchar(10) NOT NULL DEFAULT '',
1846 `class_split_rule` varchar(10) NOT NULL DEFAULT '',
1847 PRIMARY KEY (`cn_source`),
1848 UNIQUE KEY `cn_source_idx` (`cn_source`),
1849 KEY `used_idx` (`used`),
1850 KEY `class_source_ibfk_1` (`class_sort_rule`),
1851 KEY `class_source_ibfk_2` (`class_split_rule`),
1852 CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`),
1853 CONSTRAINT `class_source_ibfk_2` FOREIGN KEY (`class_split_rule`) REFERENCES `class_split_rules` (`class_split_rule`)
1854 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1855 /*!40101 SET character_set_client = @saved_cs_client */;
1858 -- Table structure for table `class_split_rules`
1861 DROP TABLE IF EXISTS `class_split_rules`;
1862 /*!40101 SET @saved_cs_client = @@character_set_client */;
1863 /*!40101 SET character_set_client = utf8 */;
1864 CREATE TABLE `class_split_rules` (
1865 `class_split_rule` varchar(10) NOT NULL DEFAULT '',
1866 `description` longtext DEFAULT NULL,
1867 `split_routine` varchar(30) NOT NULL DEFAULT '',
1868 `split_regex` varchar(255) NOT NULL DEFAULT '',
1869 PRIMARY KEY (`class_split_rule`),
1870 UNIQUE KEY `class_split_rule_idx` (`class_split_rule`)
1871 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1872 /*!40101 SET character_set_client = @saved_cs_client */;
1875 -- Table structure for table `club_enrollment_fields`
1878 DROP TABLE IF EXISTS `club_enrollment_fields`;
1879 /*!40101 SET @saved_cs_client = @@character_set_client */;
1880 /*!40101 SET character_set_client = utf8 */;
1881 CREATE TABLE `club_enrollment_fields` (
1882 `id` int(11) NOT NULL AUTO_INCREMENT,
1883 `club_enrollment_id` int(11) NOT NULL,
1884 `club_template_enrollment_field_id` int(11) NOT NULL,
1885 `value` mediumtext NOT NULL,
1887 KEY `club_enrollment_id` (`club_enrollment_id`),
1888 KEY `club_template_enrollment_field_id` (`club_template_enrollment_field_id`),
1889 CONSTRAINT `club_enrollment_fields_ibfk_1` FOREIGN KEY (`club_enrollment_id`) REFERENCES `club_enrollments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1890 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
1891 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1892 /*!40101 SET character_set_client = @saved_cs_client */;
1895 -- Table structure for table `club_enrollments`
1898 DROP TABLE IF EXISTS `club_enrollments`;
1899 /*!40101 SET @saved_cs_client = @@character_set_client */;
1900 /*!40101 SET character_set_client = utf8 */;
1901 CREATE TABLE `club_enrollments` (
1902 `id` int(11) NOT NULL AUTO_INCREMENT,
1903 `club_id` int(11) NOT NULL,
1904 `borrowernumber` int(11) NOT NULL,
1905 `date_enrolled` timestamp NOT NULL DEFAULT current_timestamp(),
1906 `date_canceled` timestamp NULL DEFAULT NULL,
1907 `date_created` timestamp NULL DEFAULT NULL,
1908 `date_updated` timestamp NULL DEFAULT NULL,
1909 `branchcode` varchar(10) DEFAULT NULL,
1911 KEY `club_id` (`club_id`),
1912 KEY `borrowernumber` (`borrowernumber`),
1913 KEY `branchcode` (`branchcode`),
1914 CONSTRAINT `club_enrollments_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1915 CONSTRAINT `club_enrollments_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1916 CONSTRAINT `club_enrollments_ibfk_3` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
1917 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1918 /*!40101 SET character_set_client = @saved_cs_client */;
1921 -- Table structure for table `club_fields`
1924 DROP TABLE IF EXISTS `club_fields`;
1925 /*!40101 SET @saved_cs_client = @@character_set_client */;
1926 /*!40101 SET character_set_client = utf8 */;
1927 CREATE TABLE `club_fields` (
1928 `id` int(11) NOT NULL AUTO_INCREMENT,
1929 `club_template_field_id` int(11) NOT NULL,
1930 `club_id` int(11) NOT NULL,
1931 `value` mediumtext DEFAULT NULL,
1933 KEY `club_template_field_id` (`club_template_field_id`),
1934 KEY `club_id` (`club_id`),
1935 CONSTRAINT `club_fields_ibfk_3` FOREIGN KEY (`club_template_field_id`) REFERENCES `club_template_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1936 CONSTRAINT `club_fields_ibfk_4` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1937 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1938 /*!40101 SET character_set_client = @saved_cs_client */;
1941 -- Table structure for table `club_holds`
1944 DROP TABLE IF EXISTS `club_holds`;
1945 /*!40101 SET @saved_cs_client = @@character_set_client */;
1946 /*!40101 SET character_set_client = utf8 */;
1947 CREATE TABLE `club_holds` (
1948 `id` int(11) NOT NULL AUTO_INCREMENT,
1949 `club_id` int(11) NOT NULL COMMENT 'id for the club the hold was generated for',
1950 `biblio_id` int(11) NOT NULL COMMENT 'id for the bibliographic record the hold has been placed against',
1951 `item_id` int(11) DEFAULT NULL COMMENT 'If item-level, the id for the item the hold has been placed agains',
1952 `date_created` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Timestamp for the placed hold',
1954 KEY `clubs_holds_ibfk_1` (`club_id`),
1955 KEY `clubs_holds_ibfk_2` (`biblio_id`),
1956 KEY `clubs_holds_ibfk_3` (`item_id`),
1957 CONSTRAINT `clubs_holds_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1958 CONSTRAINT `clubs_holds_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1959 CONSTRAINT `clubs_holds_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1960 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1961 /*!40101 SET character_set_client = @saved_cs_client */;
1964 -- Table structure for table `club_holds_to_patron_holds`
1967 DROP TABLE IF EXISTS `club_holds_to_patron_holds`;
1968 /*!40101 SET @saved_cs_client = @@character_set_client */;
1969 /*!40101 SET character_set_client = utf8 */;
1970 CREATE TABLE `club_holds_to_patron_holds` (
1971 `id` int(11) NOT NULL AUTO_INCREMENT,
1972 `club_hold_id` int(11) NOT NULL,
1973 `patron_id` int(11) NOT NULL,
1974 `hold_id` int(11) DEFAULT NULL,
1975 `error_code` enum('damaged','ageRestricted','itemAlreadyOnHold','tooManyHoldsForThisRecord','tooManyReservesToday','tooManyReserves','notReservable','cannotReserveFromOtherBranches','libraryNotFound','libraryNotPickupLocation','cannotBeTransferred','noReservesAllowed') DEFAULT NULL,
1976 `error_message` varchar(100) DEFAULT NULL,
1978 KEY `clubs_holds_paton_holds_ibfk_1` (`club_hold_id`),
1979 KEY `clubs_holds_paton_holds_ibfk_2` (`patron_id`),
1980 KEY `clubs_holds_paton_holds_ibfk_3` (`hold_id`),
1981 CONSTRAINT `clubs_holds_paton_holds_ibfk_1` FOREIGN KEY (`club_hold_id`) REFERENCES `club_holds` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1982 CONSTRAINT `clubs_holds_paton_holds_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1983 CONSTRAINT `clubs_holds_paton_holds_ibfk_3` FOREIGN KEY (`hold_id`) REFERENCES `reserves` (`reserve_id`) ON DELETE CASCADE ON UPDATE CASCADE
1984 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1985 /*!40101 SET character_set_client = @saved_cs_client */;
1988 -- Table structure for table `club_template_enrollment_fields`
1991 DROP TABLE IF EXISTS `club_template_enrollment_fields`;
1992 /*!40101 SET @saved_cs_client = @@character_set_client */;
1993 /*!40101 SET character_set_client = utf8 */;
1994 CREATE TABLE `club_template_enrollment_fields` (
1995 `id` int(11) NOT NULL AUTO_INCREMENT,
1996 `club_template_id` int(11) NOT NULL,
1997 `name` text NOT NULL,
1998 `description` mediumtext DEFAULT NULL,
1999 `authorised_value_category` varchar(32) DEFAULT NULL,
2001 KEY `club_template_id` (`club_template_id`),
2002 CONSTRAINT `club_template_enrollment_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`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_fields`
2010 DROP TABLE IF EXISTS `club_template_fields`;
2011 /*!40101 SET @saved_cs_client = @@character_set_client */;
2012 /*!40101 SET character_set_client = utf8 */;
2013 CREATE TABLE `club_template_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_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_templates`
2029 DROP TABLE IF EXISTS `club_templates`;
2030 /*!40101 SET @saved_cs_client = @@character_set_client */;
2031 /*!40101 SET character_set_client = utf8 */;
2032 CREATE TABLE `club_templates` (
2033 `id` int(11) NOT NULL AUTO_INCREMENT,
2034 `name` text NOT NULL,
2035 `description` mediumtext DEFAULT NULL,
2036 `is_enrollable_from_opac` tinyint(1) NOT NULL DEFAULT 0,
2037 `is_email_required` tinyint(1) NOT NULL DEFAULT 0,
2038 `branchcode` varchar(10) DEFAULT NULL,
2039 `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
2040 `date_updated` timestamp NULL DEFAULT NULL,
2041 `is_deletable` tinyint(1) NOT NULL DEFAULT 1,
2043 KEY `ct_branchcode` (`branchcode`),
2044 CONSTRAINT `club_templates_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2045 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2046 /*!40101 SET character_set_client = @saved_cs_client */;
2049 -- Table structure for table `clubs`
2052 DROP TABLE IF EXISTS `clubs`;
2053 /*!40101 SET @saved_cs_client = @@character_set_client */;
2054 /*!40101 SET character_set_client = utf8 */;
2055 CREATE TABLE `clubs` (
2056 `id` int(11) NOT NULL AUTO_INCREMENT,
2057 `club_template_id` int(11) NOT NULL,
2058 `name` text NOT NULL,
2059 `description` mediumtext DEFAULT NULL,
2060 `date_start` date DEFAULT NULL,
2061 `date_end` date DEFAULT NULL,
2062 `branchcode` varchar(10) DEFAULT NULL,
2063 `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
2064 `date_updated` timestamp NULL DEFAULT NULL,
2066 KEY `club_template_id` (`club_template_id`),
2067 KEY `branchcode` (`branchcode`),
2068 CONSTRAINT `clubs_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2069 CONSTRAINT `clubs_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
2070 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2071 /*!40101 SET character_set_client = @saved_cs_client */;
2074 -- Table structure for table `collections`
2077 DROP TABLE IF EXISTS `collections`;
2078 /*!40101 SET @saved_cs_client = @@character_set_client */;
2079 /*!40101 SET character_set_client = utf8 */;
2080 CREATE TABLE `collections` (
2081 `colId` int(11) NOT NULL AUTO_INCREMENT,
2082 `colTitle` varchar(100) NOT NULL DEFAULT '',
2083 `colDesc` mediumtext NOT NULL,
2084 `colBranchcode` varchar(10) DEFAULT NULL COMMENT '''branchcode for branch where item should be held.''',
2085 PRIMARY KEY (`colId`),
2086 KEY `collections_ibfk_1` (`colBranchcode`),
2087 CONSTRAINT `collections_ibfk_1` FOREIGN KEY (`colBranchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2088 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2089 /*!40101 SET character_set_client = @saved_cs_client */;
2092 -- Table structure for table `collections_tracking`
2095 DROP TABLE IF EXISTS `collections_tracking`;
2096 /*!40101 SET @saved_cs_client = @@character_set_client */;
2097 /*!40101 SET character_set_client = utf8 */;
2098 CREATE TABLE `collections_tracking` (
2099 `collections_tracking_id` int(11) NOT NULL AUTO_INCREMENT,
2100 `colId` int(11) NOT NULL DEFAULT 0 COMMENT 'collections.colId',
2101 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'items.itemnumber',
2102 PRIMARY KEY (`collections_tracking_id`),
2103 KEY `collectionst_ibfk_1` (`colId`),
2104 CONSTRAINT `collectionst_ibfk_1` FOREIGN KEY (`colId`) REFERENCES `collections` (`colId`) ON DELETE CASCADE ON UPDATE CASCADE
2105 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2106 /*!40101 SET character_set_client = @saved_cs_client */;
2109 -- Table structure for table `columns_settings`
2112 DROP TABLE IF EXISTS `columns_settings`;
2113 /*!40101 SET @saved_cs_client = @@character_set_client */;
2114 /*!40101 SET character_set_client = utf8 */;
2115 CREATE TABLE `columns_settings` (
2116 `module` varchar(255) NOT NULL,
2117 `page` varchar(255) NOT NULL,
2118 `tablename` varchar(255) NOT NULL,
2119 `columnname` varchar(255) NOT NULL,
2120 `cannot_be_toggled` int(1) NOT NULL DEFAULT 0,
2121 `is_hidden` int(1) NOT NULL DEFAULT 0,
2122 PRIMARY KEY (`module`(191),`page`(191),`tablename`(191),`columnname`(191))
2123 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2124 /*!40101 SET character_set_client = @saved_cs_client */;
2127 -- Table structure for table `course_instructors`
2130 DROP TABLE IF EXISTS `course_instructors`;
2131 /*!40101 SET @saved_cs_client = @@character_set_client */;
2132 /*!40101 SET character_set_client = utf8 */;
2133 CREATE TABLE `course_instructors` (
2134 `course_id` int(11) NOT NULL COMMENT 'foreign key to link to courses.course_id',
2135 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key to link to borrowers.borrowernumber for instructor information',
2136 PRIMARY KEY (`course_id`,`borrowernumber`),
2137 KEY `borrowernumber` (`borrowernumber`),
2138 CONSTRAINT `course_instructors_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2139 CONSTRAINT `course_instructors_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`)
2140 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2141 /*!40101 SET character_set_client = @saved_cs_client */;
2144 -- Table structure for table `course_items`
2147 DROP TABLE IF EXISTS `course_items`;
2148 /*!40101 SET @saved_cs_client = @@character_set_client */;
2149 /*!40101 SET character_set_client = utf8 */;
2150 CREATE TABLE `course_items` (
2151 `ci_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'course item id',
2152 `itemnumber` int(11) DEFAULT NULL COMMENT 'items.itemnumber for the item on reserve',
2153 `biblionumber` int(11) NOT NULL COMMENT 'biblio.biblionumber for the bibliographic record on reserve',
2154 `itype` varchar(10) DEFAULT NULL COMMENT 'new itemtype for the item to have while on reserve (optional)',
2155 `itype_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2156 `itype_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the itype when item is on course reserve',
2157 `ccode` varchar(80) DEFAULT NULL COMMENT 'new category code for the item to have while on reserve (optional)',
2158 `ccode_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if ccode should be changed while on course reserve',
2159 `ccode_storage` varchar(80) DEFAULT NULL COMMENT 'a place to store the ccode when item is on course reserve',
2160 `homebranch` varchar(10) DEFAULT NULL COMMENT 'new home branch for the item to have while on reserve (optional)',
2161 `homebranch_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if homebranch should be changed while on course reserve',
2162 `homebranch_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the homebranch when item is on course reserve',
2163 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'new holding branch for the item to have while on reserve (optional)',
2164 `holdingbranch_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2165 `holdingbranch_storage` varchar(10) DEFAULT NULL COMMENT 'a place to store the holdingbranch when item is on course reserve',
2166 `location` varchar(80) DEFAULT NULL COMMENT 'new shelving location for the item to have while on reseve (optional)',
2167 `location_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2168 `location_storage` varchar(80) DEFAULT NULL COMMENT 'a place to store the location when the item is on course reserve',
2169 `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''',
2170 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2171 PRIMARY KEY (`ci_id`),
2172 UNIQUE KEY `itemnumber` (`itemnumber`),
2173 KEY `holdingbranch` (`holdingbranch`),
2174 KEY `fk_course_items_homebranch` (`homebranch`),
2175 KEY `fk_course_items_homebranch_storage` (`homebranch_storage`),
2176 KEY `fk_course_items_biblionumber` (`biblionumber`),
2177 CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2178 CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2179 CONSTRAINT `fk_course_items_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2180 CONSTRAINT `fk_course_items_homebranch` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2181 CONSTRAINT `fk_course_items_homebranch_storage` FOREIGN KEY (`homebranch_storage`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2182 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2183 /*!40101 SET character_set_client = @saved_cs_client */;
2186 -- Table structure for table `course_reserves`
2189 DROP TABLE IF EXISTS `course_reserves`;
2190 /*!40101 SET @saved_cs_client = @@character_set_client */;
2191 /*!40101 SET character_set_client = utf8 */;
2192 CREATE TABLE `course_reserves` (
2193 `cr_id` int(11) NOT NULL AUTO_INCREMENT,
2194 `course_id` int(11) NOT NULL COMMENT 'foreign key to link to courses.course_id',
2195 `ci_id` int(11) NOT NULL COMMENT 'foreign key to link to courses_items.ci_id',
2196 `staff_note` longtext DEFAULT NULL COMMENT 'staff only note',
2197 `public_note` longtext DEFAULT NULL COMMENT 'public, OPAC visible note',
2198 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2199 PRIMARY KEY (`cr_id`),
2200 UNIQUE KEY `pseudo_key` (`course_id`,`ci_id`),
2201 KEY `course_id` (`course_id`),
2202 KEY `course_reserves_ibfk_2` (`ci_id`),
2203 CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`),
2204 CONSTRAINT `course_reserves_ibfk_2` FOREIGN KEY (`ci_id`) REFERENCES `course_items` (`ci_id`) ON DELETE CASCADE ON UPDATE CASCADE
2205 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2206 /*!40101 SET character_set_client = @saved_cs_client */;
2209 -- Table structure for table `courses`
2212 DROP TABLE IF EXISTS `courses`;
2213 /*!40101 SET @saved_cs_client = @@character_set_client */;
2214 /*!40101 SET character_set_client = utf8 */;
2215 CREATE TABLE `courses` (
2216 `course_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the course',
2217 `department` varchar(80) DEFAULT NULL COMMENT 'the authorised value for the DEPARTMENT',
2218 `course_number` varchar(255) DEFAULT NULL COMMENT 'the ''course number'' assigned to a course',
2219 `section` varchar(255) DEFAULT NULL COMMENT 'the ''section'' of a course',
2220 `course_name` varchar(255) DEFAULT NULL COMMENT 'the name of the course',
2221 `term` varchar(80) DEFAULT NULL COMMENT 'the authorised value for the TERM',
2222 `staff_note` longtext DEFAULT NULL COMMENT 'the text of the staff only note',
2223 `public_note` longtext DEFAULT NULL COMMENT 'the text of the public / opac note',
2224 `students_count` varchar(20) DEFAULT NULL COMMENT 'how many students will be taking this course/section',
2225 `enabled` enum('yes','no') NOT NULL DEFAULT 'yes' COMMENT 'determines whether the course is active',
2226 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2227 PRIMARY KEY (`course_id`)
2228 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2229 /*!40101 SET character_set_client = @saved_cs_client */;
2232 -- Table structure for table `cover_images`
2235 DROP TABLE IF EXISTS `cover_images`;
2236 /*!40101 SET @saved_cs_client = @@character_set_client */;
2237 /*!40101 SET character_set_client = utf8 */;
2238 CREATE TABLE `cover_images` (
2239 `imagenumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the image',
2240 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from biblio table to link to biblionumber',
2241 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from item table to link to itemnumber',
2242 `mimetype` varchar(15) NOT NULL COMMENT 'image type',
2243 `imagefile` mediumblob NOT NULL COMMENT 'image file contents',
2244 `thumbnail` mediumblob NOT NULL COMMENT 'thumbnail file contents',
2245 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'image creation/update time',
2246 PRIMARY KEY (`imagenumber`),
2247 KEY `bibliocoverimage_fk1` (`biblionumber`),
2248 KEY `bibliocoverimage_fk2` (`itemnumber`),
2249 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2250 CONSTRAINT `bibliocoverimage_fk2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
2251 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2252 /*!40101 SET character_set_client = @saved_cs_client */;
2255 -- Table structure for table `creator_batches`
2258 DROP TABLE IF EXISTS `creator_batches`;
2259 /*!40101 SET @saved_cs_client = @@character_set_client */;
2260 /*!40101 SET character_set_client = utf8 */;
2261 CREATE TABLE `creator_batches` (
2262 `label_id` int(11) NOT NULL AUTO_INCREMENT,
2263 `batch_id` int(10) NOT NULL DEFAULT 1,
2264 `description` mediumtext DEFAULT NULL,
2265 `item_number` int(11) DEFAULT NULL,
2266 `borrower_number` int(11) DEFAULT NULL,
2267 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2268 `branch_code` varchar(10) NOT NULL DEFAULT 'NB',
2269 `creator` char(15) NOT NULL DEFAULT 'Labels',
2270 PRIMARY KEY (`label_id`),
2271 KEY `branch_fk_constraint` (`branch_code`),
2272 KEY `item_fk_constraint` (`item_number`),
2273 KEY `borrower_fk_constraint` (`borrower_number`),
2274 CONSTRAINT `creator_batches_ibfk_1` FOREIGN KEY (`borrower_number`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2275 CONSTRAINT `creator_batches_ibfk_2` FOREIGN KEY (`branch_code`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
2276 CONSTRAINT `creator_batches_ibfk_3` FOREIGN KEY (`item_number`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE
2277 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2278 /*!40101 SET character_set_client = @saved_cs_client */;
2281 -- Table structure for table `creator_images`
2284 DROP TABLE IF EXISTS `creator_images`;
2285 /*!40101 SET @saved_cs_client = @@character_set_client */;
2286 /*!40101 SET character_set_client = utf8 */;
2287 CREATE TABLE `creator_images` (
2288 `image_id` int(4) NOT NULL AUTO_INCREMENT,
2289 `imagefile` mediumblob DEFAULT NULL,
2290 `image_name` char(20) NOT NULL DEFAULT 'DEFAULT',
2291 PRIMARY KEY (`image_id`),
2292 UNIQUE KEY `image_name_index` (`image_name`)
2293 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2294 /*!40101 SET character_set_client = @saved_cs_client */;
2297 -- Table structure for table `creator_layouts`
2300 DROP TABLE IF EXISTS `creator_layouts`;
2301 /*!40101 SET @saved_cs_client = @@character_set_client */;
2302 /*!40101 SET character_set_client = utf8 */;
2303 CREATE TABLE `creator_layouts` (
2304 `layout_id` int(4) NOT NULL AUTO_INCREMENT,
2305 `barcode_type` char(100) NOT NULL DEFAULT 'CODE39',
2306 `start_label` int(2) NOT NULL DEFAULT 1,
2307 `printing_type` char(32) NOT NULL DEFAULT 'BAR',
2308 `layout_name` char(25) NOT NULL DEFAULT 'DEFAULT',
2309 `guidebox` int(1) DEFAULT 0,
2310 `oblique_title` int(1) DEFAULT 1,
2311 `font` char(10) NOT NULL DEFAULT 'TR',
2312 `font_size` int(4) NOT NULL DEFAULT 10,
2313 `units` char(20) NOT NULL DEFAULT 'POINT',
2314 `callnum_split` int(1) DEFAULT 0,
2315 `text_justify` char(1) NOT NULL DEFAULT 'L',
2316 `format_string` varchar(210) NOT NULL DEFAULT 'barcode',
2317 `layout_xml` mediumtext NOT NULL,
2318 `creator` char(15) NOT NULL DEFAULT 'Labels',
2319 PRIMARY KEY (`layout_id`)
2320 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2321 /*!40101 SET character_set_client = @saved_cs_client */;
2324 -- Table structure for table `creator_templates`
2327 DROP TABLE IF EXISTS `creator_templates`;
2328 /*!40101 SET @saved_cs_client = @@character_set_client */;
2329 /*!40101 SET character_set_client = utf8 */;
2330 CREATE TABLE `creator_templates` (
2331 `template_id` int(4) NOT NULL AUTO_INCREMENT,
2332 `profile_id` int(4) DEFAULT NULL,
2333 `template_code` char(100) NOT NULL DEFAULT 'DEFAULT TEMPLATE',
2334 `template_desc` char(100) NOT NULL DEFAULT 'Default description',
2335 `page_width` float NOT NULL DEFAULT 0,
2336 `page_height` float NOT NULL DEFAULT 0,
2337 `label_width` float NOT NULL DEFAULT 0,
2338 `label_height` float NOT NULL DEFAULT 0,
2339 `top_text_margin` float NOT NULL DEFAULT 0,
2340 `left_text_margin` float NOT NULL DEFAULT 0,
2341 `top_margin` float NOT NULL DEFAULT 0,
2342 `left_margin` float NOT NULL DEFAULT 0,
2343 `cols` int(2) NOT NULL DEFAULT 0,
2344 `rows` int(2) NOT NULL DEFAULT 0,
2345 `col_gap` float NOT NULL DEFAULT 0,
2346 `row_gap` float NOT NULL DEFAULT 0,
2347 `units` char(20) NOT NULL DEFAULT 'POINT',
2348 `creator` char(15) NOT NULL DEFAULT 'Labels',
2349 PRIMARY KEY (`template_id`),
2350 KEY `template_profile_fk_constraint` (`profile_id`)
2351 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2352 /*!40101 SET character_set_client = @saved_cs_client */;
2355 -- Table structure for table `curbside_pickup_issues`
2358 DROP TABLE IF EXISTS `curbside_pickup_issues`;
2359 /*!40101 SET @saved_cs_client = @@character_set_client */;
2360 /*!40101 SET character_set_client = utf8 */;
2361 CREATE TABLE `curbside_pickup_issues` (
2362 `id` int(11) NOT NULL AUTO_INCREMENT,
2363 `curbside_pickup_id` int(11) NOT NULL,
2364 `issue_id` int(11) NOT NULL,
2365 `reserve_id` int(11) NOT NULL,
2367 KEY `curbside_pickup_id` (`curbside_pickup_id`),
2368 CONSTRAINT `curbside_pickup_issues_ibfk_1` FOREIGN KEY (`curbside_pickup_id`) REFERENCES `curbside_pickups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2369 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2370 /*!40101 SET character_set_client = @saved_cs_client */;
2373 -- Table structure for table `curbside_pickup_opening_slots`
2376 DROP TABLE IF EXISTS `curbside_pickup_opening_slots`;
2377 /*!40101 SET @saved_cs_client = @@character_set_client */;
2378 /*!40101 SET character_set_client = utf8 */;
2379 CREATE TABLE `curbside_pickup_opening_slots` (
2380 `id` int(11) NOT NULL AUTO_INCREMENT,
2381 `curbside_pickup_policy_id` int(11) NOT NULL,
2382 `day` tinyint(1) NOT NULL,
2383 `start_hour` int(2) NOT NULL,
2384 `start_minute` int(2) NOT NULL,
2385 `end_hour` int(2) NOT NULL,
2386 `end_minute` int(2) NOT NULL,
2388 KEY `curbside_pickup_policy_id` (`curbside_pickup_policy_id`),
2389 CONSTRAINT `curbside_pickup_opening_slots_ibfk_1` FOREIGN KEY (`curbside_pickup_policy_id`) REFERENCES `curbside_pickup_policy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2390 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2391 /*!40101 SET character_set_client = @saved_cs_client */;
2394 -- Table structure for table `curbside_pickup_policy`
2397 DROP TABLE IF EXISTS `curbside_pickup_policy`;
2398 /*!40101 SET @saved_cs_client = @@character_set_client */;
2399 /*!40101 SET character_set_client = utf8 */;
2400 CREATE TABLE `curbside_pickup_policy` (
2401 `id` int(11) NOT NULL AUTO_INCREMENT,
2402 `branchcode` varchar(10) NOT NULL,
2403 `enabled` tinyint(1) NOT NULL DEFAULT 0,
2404 `enable_waiting_holds_only` tinyint(1) NOT NULL DEFAULT 0,
2405 `pickup_interval` int(2) NOT NULL DEFAULT 0,
2406 `patrons_per_interval` int(2) NOT NULL DEFAULT 0,
2407 `patron_scheduled_pickup` tinyint(1) NOT NULL DEFAULT 0,
2409 UNIQUE KEY `branchcode` (`branchcode`),
2410 CONSTRAINT `curbside_pickup_policy_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2411 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2412 /*!40101 SET character_set_client = @saved_cs_client */;
2415 -- Table structure for table `curbside_pickups`
2418 DROP TABLE IF EXISTS `curbside_pickups`;
2419 /*!40101 SET @saved_cs_client = @@character_set_client */;
2420 /*!40101 SET character_set_client = utf8 */;
2421 CREATE TABLE `curbside_pickups` (
2422 `id` int(11) NOT NULL AUTO_INCREMENT,
2423 `borrowernumber` int(11) NOT NULL,
2424 `branchcode` varchar(10) NOT NULL,
2425 `scheduled_pickup_datetime` datetime NOT NULL,
2426 `staged_datetime` datetime DEFAULT NULL,
2427 `staged_by` int(11) DEFAULT NULL,
2428 `arrival_datetime` datetime DEFAULT NULL,
2429 `delivered_datetime` datetime DEFAULT NULL,
2430 `delivered_by` int(11) DEFAULT NULL,
2431 `notes` text DEFAULT NULL,
2433 KEY `branchcode` (`branchcode`),
2434 KEY `borrowernumber` (`borrowernumber`),
2435 KEY `staged_by` (`staged_by`),
2436 CONSTRAINT `curbside_pickups_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2437 CONSTRAINT `curbside_pickups_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2438 CONSTRAINT `curbside_pickups_ibfk_3` FOREIGN KEY (`staged_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
2439 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2440 /*!40101 SET character_set_client = @saved_cs_client */;
2443 -- Table structure for table `currency`
2446 DROP TABLE IF EXISTS `currency`;
2447 /*!40101 SET @saved_cs_client = @@character_set_client */;
2448 /*!40101 SET character_set_client = utf8 */;
2449 CREATE TABLE `currency` (
2450 `currency` varchar(10) NOT NULL DEFAULT '',
2451 `symbol` varchar(5) DEFAULT NULL,
2452 `isocode` varchar(5) DEFAULT NULL,
2453 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2454 `rate` float(15,5) DEFAULT NULL,
2455 `active` tinyint(1) DEFAULT NULL,
2456 `archived` tinyint(1) DEFAULT 0,
2457 `p_sep_by_space` tinyint(1) DEFAULT 0,
2458 PRIMARY KEY (`currency`)
2459 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2460 /*!40101 SET character_set_client = @saved_cs_client */;
2463 -- Table structure for table `deletedbiblio`
2466 DROP TABLE IF EXISTS `deletedbiblio`;
2467 /*!40101 SET @saved_cs_client = @@character_set_client */;
2468 /*!40101 SET character_set_client = utf8 */;
2469 CREATE TABLE `deletedbiblio` (
2470 `biblionumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned to each bibliographic record',
2471 `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'foriegn key from the biblio_framework table to identify which framework was used in cataloging this record',
2472 `author` longtext DEFAULT NULL COMMENT 'statement of responsibility from MARC record (100$a in MARC21)',
2473 `title` longtext DEFAULT NULL COMMENT 'title (without the subtitle) from the MARC record (245$a in MARC21)',
2474 `medium` longtext DEFAULT NULL COMMENT 'medium from the MARC record (245$h in MARC21)',
2475 `subtitle` longtext DEFAULT NULL COMMENT 'remainder of the title from the MARC record (245$b in MARC21)',
2476 `part_number` longtext DEFAULT NULL COMMENT 'part number from the MARC record (245$n in MARC21)',
2477 `part_name` longtext DEFAULT NULL COMMENT 'part name from the MARC record (245$p in MARC21)',
2478 `unititle` longtext DEFAULT NULL COMMENT 'uniform title (without the subtitle) from the MARC record (240$a in MARC21)',
2479 `notes` longtext DEFAULT NULL COMMENT 'values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)',
2480 `serial` tinyint(1) DEFAULT NULL COMMENT 'Boolean indicating whether biblio is for a serial',
2481 `seriestitle` longtext DEFAULT NULL,
2482 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'publication or copyright date from the MARC record',
2483 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
2484 `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
2485 `abstract` longtext DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
2486 PRIMARY KEY (`biblionumber`),
2487 KEY `blbnoidx` (`biblionumber`)
2488 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2489 /*!40101 SET character_set_client = @saved_cs_client */;
2492 -- Table structure for table `deletedbiblio_metadata`
2495 DROP TABLE IF EXISTS `deletedbiblio_metadata`;
2496 /*!40101 SET @saved_cs_client = @@character_set_client */;
2497 /*!40101 SET character_set_client = utf8 */;
2498 CREATE TABLE `deletedbiblio_metadata` (
2499 `id` int(11) NOT NULL AUTO_INCREMENT,
2500 `biblionumber` int(11) NOT NULL,
2501 `format` varchar(16) NOT NULL,
2502 `schema` varchar(16) NOT NULL,
2503 `metadata` longtext NOT NULL,
2504 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2506 UNIQUE KEY `deletedbiblio_metadata_uniq_key` (`biblionumber`,`format`,`schema`),
2507 KEY `timestamp` (`timestamp`),
2508 CONSTRAINT `deletedrecord_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `deletedbiblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2509 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2510 /*!40101 SET character_set_client = @saved_cs_client */;
2513 -- Table structure for table `deletedbiblioitems`
2516 DROP TABLE IF EXISTS `deletedbiblioitems`;
2517 /*!40101 SET @saved_cs_client = @@character_set_client */;
2518 /*!40101 SET character_set_client = utf8 */;
2519 CREATE TABLE `deletedbiblioitems` (
2520 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key, unique identifier assigned by Koha',
2521 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the biblio table',
2522 `volume` longtext DEFAULT NULL,
2523 `number` longtext DEFAULT NULL,
2524 `itemtype` varchar(10) DEFAULT NULL COMMENT 'biblio level item type (MARC21 942$c)',
2525 `isbn` longtext DEFAULT NULL COMMENT 'ISBN (MARC21 020$a)',
2526 `issn` longtext DEFAULT NULL COMMENT 'ISSN (MARC21 022$a)',
2527 `ean` longtext DEFAULT NULL,
2528 `publicationyear` mediumtext DEFAULT NULL,
2529 `publishercode` text DEFAULT NULL COMMENT 'publisher (MARC21 260$b and 264$b)',
2530 `volumedate` date DEFAULT NULL,
2531 `volumedesc` mediumtext DEFAULT NULL COMMENT 'volume information (MARC21 362$a)',
2532 `collectiontitle` longtext DEFAULT NULL,
2533 `collectionissn` mediumtext DEFAULT NULL,
2534 `collectionvolume` longtext DEFAULT NULL,
2535 `editionstatement` mediumtext DEFAULT NULL,
2536 `editionresponsibility` mediumtext DEFAULT NULL,
2537 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2538 `illus` text DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)',
2539 `pages` text DEFAULT NULL COMMENT 'number of pages (MARC21 300$a)',
2540 `notes` longtext DEFAULT NULL,
2541 `size` text DEFAULT NULL COMMENT 'material size (MARC21 300$c)',
2542 `place` text DEFAULT NULL COMMENT 'publication place (MARC21 260$a and 264$a)',
2543 `lccn` longtext DEFAULT NULL COMMENT 'library of congress control number (MARC21 010$a)',
2544 `url` mediumtext DEFAULT NULL COMMENT 'url (MARC21 856$u)',
2545 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source (MARC21 942$2)',
2546 `cn_class` varchar(30) DEFAULT NULL,
2547 `cn_item` varchar(10) DEFAULT NULL,
2548 `cn_suffix` varchar(10) DEFAULT NULL,
2549 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized version of the call number used for sorting',
2550 `agerestriction` varchar(255) DEFAULT NULL COMMENT 'target audience/age restriction from the bib record (MARC21 521$a)',
2551 `totalissues` int(10) DEFAULT NULL,
2552 PRIMARY KEY (`biblioitemnumber`),
2553 KEY `bibinoidx` (`biblioitemnumber`),
2554 KEY `bibnoidx` (`biblionumber`),
2555 KEY `itemtype_idx` (`itemtype`),
2556 KEY `isbn` (`isbn`(191)),
2557 KEY `ean` (`ean`(191)),
2558 KEY `publishercode` (`publishercode`(191)),
2559 KEY `timestamp` (`timestamp`)
2560 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2561 /*!40101 SET character_set_client = @saved_cs_client */;
2564 -- Table structure for table `deletedborrowers`
2567 DROP TABLE IF EXISTS `deletedborrowers`;
2568 /*!40101 SET @saved_cs_client = @@character_set_client */;
2569 /*!40101 SET character_set_client = utf8 */;
2570 CREATE TABLE `deletedborrowers` (
2571 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key, Koha assigned ID number for patrons/borrowers',
2572 `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
2573 `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2574 `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
2575 `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
2576 `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2577 `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
2578 `initials` mediumtext DEFAULT NULL COMMENT 'initials for your patron/borrower',
2579 `pronouns` longtext DEFAULT NULL COMMENT 'patron/borrower pronouns',
2580 `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',
2581 `streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s primary address',
2582 `address` longtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s primary address',
2583 `address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s primary address',
2584 `city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s primary address',
2585 `state` mediumtext DEFAULT NULL COMMENT 'the state or province for your patron/borrower''s primary address',
2586 `zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s primary address',
2587 `country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s primary address',
2588 `email` longtext DEFAULT NULL COMMENT 'the primary email address for your patron/borrower''s primary address',
2589 `phone` mediumtext DEFAULT NULL COMMENT 'the primary phone number for your patron/borrower''s primary address',
2590 `mobile` tinytext DEFAULT NULL COMMENT 'the other phone number for your patron/borrower''s primary address',
2591 `fax` longtext DEFAULT NULL COMMENT 'the fax number for your patron/borrower''s primary address',
2592 `emailpro` mediumtext DEFAULT NULL COMMENT 'the secondary email addres for your patron/borrower''s primary address',
2593 `phonepro` mediumtext DEFAULT NULL COMMENT 'the secondary phone number for your patron/borrower''s primary address',
2594 `B_streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address',
2595 `B_streettype` tinytext DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s alternate address',
2596 `B_address` mediumtext DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s alternate address',
2597 `B_address2` mediumtext DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s alternate address',
2598 `B_city` longtext DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s alternate address',
2599 `B_state` mediumtext DEFAULT NULL COMMENT 'the state for your patron/borrower''s alternate address',
2600 `B_zipcode` tinytext DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s alternate address',
2601 `B_country` mediumtext DEFAULT NULL COMMENT 'the country for your patron/borrower''s alternate address',
2602 `B_email` mediumtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate email address',
2603 `B_phone` longtext DEFAULT NULL COMMENT 'the patron/borrower''s alternate phone number',
2604 `dateofbirth` date DEFAULT NULL COMMENT 'the patron/borrower''s date of birth (YYYY-MM-DD)',
2605 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table, includes the code of the patron/borrower''s home branch',
2606 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category',
2607 `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)',
2608 `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)',
2609 `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)',
2610 `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed',
2611 `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',
2612 `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',
2613 `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)',
2614 `debarredcomment` varchar(255) DEFAULT NULL COMMENT 'comment on the stop of patron',
2615 `contactname` longtext DEFAULT NULL COMMENT 'used for children and profesionals to include surname or last name of guarantor or organization name',
2616 `contactfirstname` mediumtext DEFAULT NULL COMMENT 'used for children to include first name of guarantor',
2617 `contacttitle` mediumtext DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor',
2618 `borrowernotes` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface',
2619 `relationship` varchar(100) DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor',
2620 `sex` varchar(1) DEFAULT NULL COMMENT 'patron/borrower''s gender',
2621 `password` varchar(60) DEFAULT NULL COMMENT 'patron/borrower''s encrypted password',
2622 `secret` mediumtext DEFAULT NULL COMMENT 'Secret for 2FA',
2623 `auth_method` enum('password','two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method',
2624 `flags` bigint(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions',
2625 `userid` varchar(75) DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in',
2626 `opacnote` longtext DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface',
2627 `contactnote` varchar(255) DEFAULT NULL COMMENT 'a note related to the patron/borrower''s alternate address',
2628 `sort1` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
2629 `sort2` varchar(80) DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
2630 `altcontactfirstname` mediumtext DEFAULT NULL COMMENT 'first name of alternate contact for the patron/borrower',
2631 `altcontactsurname` mediumtext DEFAULT NULL COMMENT 'surname or last name of the alternate contact for the patron/borrower',
2632 `altcontactaddress1` mediumtext DEFAULT NULL COMMENT 'the first address line for the alternate contact for the patron/borrower',
2633 `altcontactaddress2` mediumtext DEFAULT NULL COMMENT 'the second address line for the alternate contact for the patron/borrower',
2634 `altcontactaddress3` mediumtext DEFAULT NULL COMMENT 'the city for the alternate contact for the patron/borrower',
2635 `altcontactstate` mediumtext DEFAULT NULL COMMENT 'the state for the alternate contact for the patron/borrower',
2636 `altcontactzipcode` mediumtext DEFAULT NULL COMMENT 'the zipcode for the alternate contact for the patron/borrower',
2637 `altcontactcountry` mediumtext DEFAULT NULL COMMENT 'the country for the alternate contact for the patron/borrower',
2638 `altcontactphone` mediumtext DEFAULT NULL COMMENT 'the phone number for the alternate contact for the patron/borrower',
2639 `smsalertnumber` varchar(50) DEFAULT NULL COMMENT 'the mobile phone number where the patron/borrower would like to receive notices (if SMS turned on)',
2640 `sms_provider_id` int(11) DEFAULT NULL COMMENT 'the provider of the mobile phone number defined in smsalertnumber',
2641 `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history KEY `borrowernumber` (`borrowernumber`),',
2642 `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines',
2643 `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
2644 `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''.',
2645 `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)',
2646 `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
2647 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
2648 `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
2649 `overdrive_auth_token` mediumtext DEFAULT NULL COMMENT 'persist OverDrive auth token',
2650 `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2651 `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2652 `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
2653 KEY `borrowernumber` (`borrowernumber`),
2654 KEY `cardnumber` (`cardnumber`),
2655 KEY `sms_provider_id` (`sms_provider_id`)
2656 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2657 /*!40101 SET character_set_client = @saved_cs_client */;
2660 -- Table structure for table `deleteditems`
2663 DROP TABLE IF EXISTS `deleteditems`;
2664 /*!40101 SET @saved_cs_client = @@character_set_client */;
2665 /*!40101 SET character_set_client = utf8 */;
2666 CREATE TABLE `deleteditems` (
2667 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key and unique identifier added by Koha',
2668 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
2669 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
2670 `barcode` varchar(20) DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
2671 `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
2672 `booksellerid` longtext DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
2673 `homebranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
2674 `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
2675 `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
2676 `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
2677 `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out',
2678 `datelastseen` datetime DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
2679 `stack` tinyint(1) DEFAULT NULL,
2680 `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
2681 `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
2682 `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
2683 `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
2684 `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
2685 `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
2686 `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
2687 `itemcallnumber` varchar(255) DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
2688 `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
2689 `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out',
2690 `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
2691 `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
2692 `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
2693 `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
2694 `itemnotes_nonpublic` longtext DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
2695 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
2696 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
2697 `deleted_on` datetime DEFAULT NULL COMMENT 'date/time of deletion',
2698 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
2699 `permanent_location` varchar(80) DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
2700 `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
2701 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
2702 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
2703 `ccode` varchar(80) DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
2704 `materials` mediumtext DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
2705 `uri` mediumtext DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
2706 `itype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
2707 `more_subfields_xml` longtext DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
2708 `enumchron` mediumtext DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
2709 `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
2710 `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
2711 `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.',
2712 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
2713 PRIMARY KEY (`itemnumber`),
2714 KEY `delitembarcodeidx` (`barcode`),
2715 KEY `delitemstocknumberidx` (`stocknumber`),
2716 KEY `delitembinoidx` (`biblioitemnumber`),
2717 KEY `delitembibnoidx` (`biblionumber`),
2718 KEY `delhomebranch` (`homebranch`),
2719 KEY `delholdingbranch` (`holdingbranch`),
2720 KEY `itype_idx` (`itype`),
2721 KEY `timestamp` (`timestamp`)
2722 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2723 /*!40101 SET character_set_client = @saved_cs_client */;
2726 -- Table structure for table `desks`
2729 DROP TABLE IF EXISTS `desks`;
2730 /*!40101 SET @saved_cs_client = @@character_set_client */;
2731 /*!40101 SET character_set_client = utf8 */;
2732 CREATE TABLE `desks` (
2733 `desk_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
2734 `desk_name` varchar(100) NOT NULL DEFAULT '' COMMENT 'name of the desk',
2735 `branchcode` varchar(10) NOT NULL COMMENT 'library the desk is located at',
2736 PRIMARY KEY (`desk_id`),
2737 KEY `fk_desks_branchcode` (`branchcode`),
2738 CONSTRAINT `fk_desks_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2739 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2740 /*!40101 SET character_set_client = @saved_cs_client */;
2743 -- Table structure for table `discharges`
2746 DROP TABLE IF EXISTS `discharges`;
2747 /*!40101 SET @saved_cs_client = @@character_set_client */;
2748 /*!40101 SET character_set_client = utf8 */;
2749 CREATE TABLE `discharges` (
2750 `discharge_id` int(11) NOT NULL AUTO_INCREMENT,
2751 `borrower` int(11) DEFAULT NULL,
2752 `needed` timestamp NULL DEFAULT NULL,
2753 `validated` timestamp NULL DEFAULT NULL,
2754 PRIMARY KEY (`discharge_id`),
2755 KEY `borrower_discharges_ibfk1` (`borrower`),
2756 CONSTRAINT `borrower_discharges_ibfk1` FOREIGN KEY (`borrower`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2757 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2758 /*!40101 SET character_set_client = @saved_cs_client */;
2761 -- Table structure for table `edifact_ean`
2764 DROP TABLE IF EXISTS `edifact_ean`;
2765 /*!40101 SET @saved_cs_client = @@character_set_client */;
2766 /*!40101 SET character_set_client = utf8 */;
2767 CREATE TABLE `edifact_ean` (
2768 `ee_id` int(11) NOT NULL AUTO_INCREMENT,
2769 `description` varchar(128) DEFAULT NULL,
2770 `branchcode` varchar(10) DEFAULT NULL,
2771 `ean` varchar(15) NOT NULL,
2772 `id_code_qualifier` varchar(3) NOT NULL DEFAULT '14',
2773 PRIMARY KEY (`ee_id`),
2774 KEY `efk_branchcode` (`branchcode`),
2775 CONSTRAINT `efk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
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_messages`
2783 DROP TABLE IF EXISTS `edifact_messages`;
2784 /*!40101 SET @saved_cs_client = @@character_set_client */;
2785 /*!40101 SET character_set_client = utf8 */;
2786 CREATE TABLE `edifact_messages` (
2787 `id` int(11) NOT NULL AUTO_INCREMENT,
2788 `message_type` varchar(10) NOT NULL,
2789 `transfer_date` date DEFAULT NULL,
2790 `vendor_id` int(11) DEFAULT NULL,
2791 `edi_acct` int(11) DEFAULT NULL,
2792 `status` mediumtext DEFAULT NULL,
2793 `basketno` int(11) DEFAULT NULL,
2794 `raw_msg` longtext DEFAULT NULL,
2795 `filename` mediumtext DEFAULT NULL,
2796 `deleted` tinyint(1) NOT NULL DEFAULT 0,
2798 KEY `vendorid` (`vendor_id`),
2799 KEY `ediacct` (`edi_acct`),
2800 KEY `basketno` (`basketno`),
2801 CONSTRAINT `emfk_basketno` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2802 CONSTRAINT `emfk_edi_acct` FOREIGN KEY (`edi_acct`) REFERENCES `vendor_edi_accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2803 CONSTRAINT `emfk_vendor` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2804 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2805 /*!40101 SET character_set_client = @saved_cs_client */;
2808 -- Table structure for table `erm_agreement_licenses`
2811 DROP TABLE IF EXISTS `erm_agreement_licenses`;
2812 /*!40101 SET @saved_cs_client = @@character_set_client */;
2813 /*!40101 SET character_set_client = utf8 */;
2814 CREATE TABLE `erm_agreement_licenses` (
2815 `agreement_license_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2816 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2817 `license_id` int(11) NOT NULL COMMENT 'link to the license',
2818 `status` varchar(80) NOT NULL COMMENT 'current status of the license',
2819 `physical_location` varchar(80) DEFAULT NULL COMMENT 'physical location of the license',
2820 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this license',
2821 `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the license',
2822 PRIMARY KEY (`agreement_license_id`),
2823 UNIQUE KEY `erm_agreement_licenses_uniq` (`agreement_id`,`license_id`),
2824 KEY `erm_agreement_licenses_ibfk_2` (`license_id`),
2825 CONSTRAINT `erm_agreement_licenses_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2826 CONSTRAINT `erm_agreement_licenses_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE
2827 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2828 /*!40101 SET character_set_client = @saved_cs_client */;
2831 -- Table structure for table `erm_agreement_periods`
2834 DROP TABLE IF EXISTS `erm_agreement_periods`;
2835 /*!40101 SET @saved_cs_client = @@character_set_client */;
2836 /*!40101 SET character_set_client = utf8 */;
2837 CREATE TABLE `erm_agreement_periods` (
2838 `agreement_period_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2839 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2840 `started_on` date NOT NULL COMMENT 'start of the agreement period',
2841 `ended_on` date DEFAULT NULL COMMENT 'end of the agreement period',
2842 `cancellation_deadline` date DEFAULT NULL COMMENT 'Deadline for the cancellation',
2843 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this period',
2844 PRIMARY KEY (`agreement_period_id`),
2845 KEY `erm_agreement_periods_ibfk_1` (`agreement_id`),
2846 CONSTRAINT `erm_agreement_periods_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2847 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2848 /*!40101 SET character_set_client = @saved_cs_client */;
2851 -- Table structure for table `erm_agreement_relationships`
2854 DROP TABLE IF EXISTS `erm_agreement_relationships`;
2855 /*!40101 SET @saved_cs_client = @@character_set_client */;
2856 /*!40101 SET character_set_client = utf8 */;
2857 CREATE TABLE `erm_agreement_relationships` (
2858 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2859 `related_agreement_id` int(11) NOT NULL COMMENT 'link to the related agreement',
2860 `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',
2861 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
2862 PRIMARY KEY (`agreement_id`,`related_agreement_id`),
2863 KEY `erm_agreement_relationships_ibfk_2` (`related_agreement_id`),
2864 CONSTRAINT `erm_agreement_relationships_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2865 CONSTRAINT `erm_agreement_relationships_ibfk_2` FOREIGN KEY (`related_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_agreements`
2873 DROP TABLE IF EXISTS `erm_agreements`;
2874 /*!40101 SET @saved_cs_client = @@character_set_client */;
2875 /*!40101 SET character_set_client = utf8 */;
2876 CREATE TABLE `erm_agreements` (
2877 `agreement_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2878 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2879 `name` varchar(255) NOT NULL COMMENT 'name of the agreement',
2880 `description` longtext DEFAULT NULL COMMENT 'description of the agreement',
2881 `status` varchar(80) NOT NULL COMMENT 'current status of the agreement',
2882 `closure_reason` varchar(80) DEFAULT NULL COMMENT 'reason of the closure',
2883 `is_perpetual` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the agreement perpetual',
2884 `renewal_priority` varchar(80) DEFAULT NULL COMMENT 'priority of the renewal',
2885 `license_info` varchar(80) DEFAULT NULL COMMENT 'info about the license',
2886 PRIMARY KEY (`agreement_id`),
2887 KEY `erm_agreements_ibfk_1` (`vendor_id`),
2888 CONSTRAINT `erm_agreements_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2889 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2890 /*!40101 SET character_set_client = @saved_cs_client */;
2893 -- Table structure for table `erm_documents`
2896 DROP TABLE IF EXISTS `erm_documents`;
2897 /*!40101 SET @saved_cs_client = @@character_set_client */;
2898 /*!40101 SET character_set_client = utf8 */;
2899 CREATE TABLE `erm_documents` (
2900 `document_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2901 `agreement_id` int(11) DEFAULT NULL COMMENT 'link to the agreement',
2902 `license_id` int(11) DEFAULT NULL COMMENT 'link to the license',
2903 `file_name` varchar(255) DEFAULT NULL COMMENT 'name of the file',
2904 `file_type` varchar(255) DEFAULT NULL COMMENT 'type of the file',
2905 `file_description` varchar(255) DEFAULT NULL COMMENT 'description of the file',
2906 `file_content` longblob DEFAULT NULL COMMENT 'the content of the file',
2907 `uploaded_on` datetime DEFAULT NULL COMMENT 'datetime when the file as attached',
2908 `physical_location` varchar(255) DEFAULT NULL COMMENT 'physical location of the document',
2909 `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the document',
2910 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
2911 PRIMARY KEY (`document_id`),
2912 KEY `erm_documents_ibfk_1` (`agreement_id`),
2913 KEY `erm_documents_ibfk_2` (`license_id`),
2914 CONSTRAINT `erm_documents_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2915 CONSTRAINT `erm_documents_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE
2916 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2917 /*!40101 SET character_set_client = @saved_cs_client */;
2920 -- Table structure for table `erm_eholdings_packages`
2923 DROP TABLE IF EXISTS `erm_eholdings_packages`;
2924 /*!40101 SET @saved_cs_client = @@character_set_client */;
2925 /*!40101 SET character_set_client = utf8 */;
2926 CREATE TABLE `erm_eholdings_packages` (
2927 `package_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2928 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2929 `name` varchar(255) NOT NULL COMMENT 'name of the package',
2930 `external_id` varchar(255) DEFAULT NULL COMMENT 'External key',
2931 `provider` enum('ebsco') DEFAULT NULL COMMENT 'External provider',
2932 `package_type` varchar(80) DEFAULT NULL COMMENT 'type of the package',
2933 `content_type` varchar(80) DEFAULT NULL COMMENT 'type of the package',
2934 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this package',
2935 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date of creation of the package',
2936 PRIMARY KEY (`package_id`),
2937 KEY `erm_eholdings_packages_ibfk_1` (`vendor_id`),
2938 CONSTRAINT `erm_eholdings_packages_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2939 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2940 /*!40101 SET character_set_client = @saved_cs_client */;
2943 -- Table structure for table `erm_eholdings_packages_agreements`
2946 DROP TABLE IF EXISTS `erm_eholdings_packages_agreements`;
2947 /*!40101 SET @saved_cs_client = @@character_set_client */;
2948 /*!40101 SET character_set_client = utf8 */;
2949 CREATE TABLE `erm_eholdings_packages_agreements` (
2950 `package_id` int(11) NOT NULL COMMENT 'link to the package',
2951 `agreement_id` int(11) NOT NULL COMMENT 'link to the agreement',
2952 PRIMARY KEY (`package_id`,`agreement_id`),
2953 KEY `erm_eholdings_packages_agreements_ibfk_2` (`agreement_id`),
2954 CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2955 CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2956 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2957 /*!40101 SET character_set_client = @saved_cs_client */;
2960 -- Table structure for table `erm_eholdings_resources`
2963 DROP TABLE IF EXISTS `erm_eholdings_resources`;
2964 /*!40101 SET @saved_cs_client = @@character_set_client */;
2965 /*!40101 SET character_set_client = utf8 */;
2966 CREATE TABLE `erm_eholdings_resources` (
2967 `resource_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2968 `title_id` int(11) NOT NULL,
2969 `package_id` int(11) NOT NULL,
2970 `vendor_id` int(11) DEFAULT NULL,
2971 `started_on` date DEFAULT NULL,
2972 `ended_on` date DEFAULT NULL,
2973 `proxy` varchar(80) DEFAULT NULL,
2974 PRIMARY KEY (`resource_id`),
2975 UNIQUE KEY `erm_eholdings_resources_uniq` (`title_id`,`package_id`),
2976 KEY `erm_eholdings_resources_ibfk_2` (`package_id`),
2977 KEY `erm_eholdings_resources_ibfk_3` (`vendor_id`),
2978 CONSTRAINT `erm_eholdings_resources_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_eholdings_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2979 CONSTRAINT `erm_eholdings_resources_ibfk_2` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2980 CONSTRAINT `erm_eholdings_resources_ibfk_3` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
2981 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2982 /*!40101 SET character_set_client = @saved_cs_client */;
2985 -- Table structure for table `erm_eholdings_titles`
2988 DROP TABLE IF EXISTS `erm_eholdings_titles`;
2989 /*!40101 SET @saved_cs_client = @@character_set_client */;
2990 /*!40101 SET character_set_client = utf8 */;
2991 CREATE TABLE `erm_eholdings_titles` (
2992 `title_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2993 `biblio_id` int(11) DEFAULT NULL,
2994 `publication_title` varchar(255) DEFAULT NULL,
2995 `external_id` varchar(255) DEFAULT NULL,
2996 `print_identifier` varchar(255) DEFAULT NULL,
2997 `online_identifier` varchar(255) DEFAULT NULL,
2998 `date_first_issue_online` varchar(255) DEFAULT NULL,
2999 `num_first_vol_online` varchar(255) DEFAULT NULL,
3000 `num_first_issue_online` varchar(255) DEFAULT NULL,
3001 `date_last_issue_online` varchar(255) DEFAULT NULL,
3002 `num_last_vol_online` varchar(255) DEFAULT NULL,
3003 `num_last_issue_online` varchar(255) DEFAULT NULL,
3004 `title_url` varchar(255) DEFAULT NULL,
3005 `first_author` varchar(255) DEFAULT NULL,
3006 `embargo_info` varchar(255) DEFAULT NULL,
3007 `coverage_depth` varchar(255) DEFAULT NULL,
3008 `notes` varchar(255) DEFAULT NULL,
3009 `publisher_name` varchar(255) DEFAULT NULL,
3010 `publication_type` varchar(80) DEFAULT NULL,
3011 `date_monograph_published_print` varchar(255) DEFAULT NULL,
3012 `date_monograph_published_online` varchar(255) DEFAULT NULL,
3013 `monograph_volume` varchar(255) DEFAULT NULL,
3014 `monograph_edition` varchar(255) DEFAULT NULL,
3015 `first_editor` varchar(255) DEFAULT NULL,
3016 `parent_publication_title_id` varchar(255) DEFAULT NULL,
3017 `preceeding_publication_title_id` varchar(255) DEFAULT NULL,
3018 `access_type` varchar(255) DEFAULT NULL,
3019 PRIMARY KEY (`title_id`),
3020 KEY `erm_eholdings_titles_ibfk_2` (`biblio_id`),
3021 CONSTRAINT `erm_eholdings_titles_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE
3022 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3023 /*!40101 SET character_set_client = @saved_cs_client */;
3026 -- Table structure for table `erm_licenses`
3029 DROP TABLE IF EXISTS `erm_licenses`;
3030 /*!40101 SET @saved_cs_client = @@character_set_client */;
3031 /*!40101 SET character_set_client = utf8 */;
3032 CREATE TABLE `erm_licenses` (
3033 `license_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3034 `vendor_id` int(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
3035 `name` varchar(255) NOT NULL COMMENT 'name of the license',
3036 `description` longtext DEFAULT NULL COMMENT 'description of the license',
3037 `type` varchar(80) NOT NULL COMMENT 'type of the license',
3038 `status` varchar(80) NOT NULL COMMENT 'current status of the license',
3039 `started_on` date DEFAULT NULL COMMENT 'start of the license',
3040 `ended_on` date DEFAULT NULL COMMENT 'end of the license',
3041 PRIMARY KEY (`license_id`),
3042 KEY `erm_licenses_ibfk_1` (`vendor_id`),
3043 CONSTRAINT `erm_licenses_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
3044 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3045 /*!40101 SET character_set_client = @saved_cs_client */;
3048 -- Table structure for table `erm_user_roles`
3051 DROP TABLE IF EXISTS `erm_user_roles`;
3052 /*!40101 SET @saved_cs_client = @@character_set_client */;
3053 /*!40101 SET character_set_client = utf8 */;
3054 CREATE TABLE `erm_user_roles` (
3055 `user_role_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3056 `agreement_id` int(11) DEFAULT NULL COMMENT 'link to the agreement',
3057 `license_id` int(11) DEFAULT NULL COMMENT 'link to the license',
3058 `user_id` int(11) NOT NULL COMMENT 'link to the user',
3059 `role` varchar(80) NOT NULL COMMENT 'role of the user',
3060 PRIMARY KEY (`user_role_id`),
3061 KEY `erm_user_roles_ibfk_1` (`agreement_id`),
3062 KEY `erm_user_roles_ibfk_2` (`license_id`),
3063 KEY `erm_user_roles_ibfk_3` (`user_id`),
3064 CONSTRAINT `erm_user_roles_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3065 CONSTRAINT `erm_user_roles_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3066 CONSTRAINT `erm_user_roles_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3067 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3068 /*!40101 SET character_set_client = @saved_cs_client */;
3071 -- Table structure for table `export_format`
3074 DROP TABLE IF EXISTS `export_format`;
3075 /*!40101 SET @saved_cs_client = @@character_set_client */;
3076 /*!40101 SET character_set_client = utf8 */;
3077 CREATE TABLE `export_format` (
3078 `export_format_id` int(11) NOT NULL AUTO_INCREMENT,
3079 `profile` varchar(255) NOT NULL,
3080 `description` longtext NOT NULL,
3081 `content` longtext NOT NULL,
3082 `csv_separator` varchar(2) NOT NULL DEFAULT ',',
3083 `field_separator` varchar(2) DEFAULT NULL,
3084 `subfield_separator` varchar(2) DEFAULT NULL,
3085 `encoding` varchar(255) NOT NULL DEFAULT 'utf8',
3086 `type` varchar(255) DEFAULT 'marc',
3087 `used_for` varchar(255) DEFAULT 'export_records',
3088 `staff_only` tinyint(1) NOT NULL DEFAULT 0,
3089 PRIMARY KEY (`export_format_id`),
3090 KEY `used_for_idx` (`used_for`(191)),
3091 KEY `staff_only_idx` (`staff_only`)
3092 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Used for CSV export';
3093 /*!40101 SET character_set_client = @saved_cs_client */;
3096 -- Table structure for table `hold_cancellation_requests`
3099 DROP TABLE IF EXISTS `hold_cancellation_requests`;
3100 /*!40101 SET @saved_cs_client = @@character_set_client */;
3101 /*!40101 SET character_set_client = utf8 */;
3102 CREATE TABLE `hold_cancellation_requests` (
3103 `hold_cancellation_request_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the cancellation request',
3104 `hold_id` int(11) NOT NULL COMMENT 'ID of the hold',
3105 `creation_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Time and date the cancellation request was created',
3106 PRIMARY KEY (`hold_cancellation_request_id`)
3107 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3108 /*!40101 SET character_set_client = @saved_cs_client */;
3111 -- Table structure for table `hold_fill_targets`
3114 DROP TABLE IF EXISTS `hold_fill_targets`;
3115 /*!40101 SET @saved_cs_client = @@character_set_client */;
3116 /*!40101 SET character_set_client = utf8 */;
3117 CREATE TABLE `hold_fill_targets` (
3118 `borrowernumber` int(11) NOT NULL,
3119 `biblionumber` int(11) NOT NULL,
3120 `itemnumber` int(11) NOT NULL,
3121 `source_branchcode` varchar(10) DEFAULT NULL,
3122 `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
3123 `reserve_id` int(11) DEFAULT NULL,
3124 PRIMARY KEY (`itemnumber`),
3125 KEY `bib_branch` (`biblionumber`,`source_branchcode`),
3126 KEY `hold_fill_targets_ibfk_1` (`borrowernumber`),
3127 KEY `hold_fill_targets_ibfk_4` (`source_branchcode`),
3128 CONSTRAINT `hold_fill_targets_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3129 CONSTRAINT `hold_fill_targets_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3130 CONSTRAINT `hold_fill_targets_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3131 CONSTRAINT `hold_fill_targets_ibfk_4` FOREIGN KEY (`source_branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
3132 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3133 /*!40101 SET character_set_client = @saved_cs_client */;
3136 -- Table structure for table `housebound_profile`
3139 DROP TABLE IF EXISTS `housebound_profile`;
3140 /*!40101 SET @saved_cs_client = @@character_set_client */;
3141 /*!40101 SET character_set_client = utf8 */;
3142 CREATE TABLE `housebound_profile` (
3143 `borrowernumber` int(11) NOT NULL COMMENT 'Number of the borrower associated with this profile.',
3144 `day` mediumtext NOT NULL COMMENT 'The preferred day of the week for delivery.',
3145 `frequency` mediumtext NOT NULL COMMENT 'The Authorised_Value definining the pattern for delivery.',
3146 `fav_itemtypes` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred itemtypes.',
3147 `fav_subjects` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred subjects.',
3148 `fav_authors` mediumtext DEFAULT NULL COMMENT 'Free text describing preferred authors.',
3149 `referral` mediumtext DEFAULT NULL COMMENT 'Free text indicating how the borrower was added to the service.',
3150 `notes` mediumtext DEFAULT NULL COMMENT 'Free text for additional notes.',
3151 PRIMARY KEY (`borrowernumber`),
3152 CONSTRAINT `housebound_profile_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3153 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3154 /*!40101 SET character_set_client = @saved_cs_client */;
3157 -- Table structure for table `housebound_role`
3160 DROP TABLE IF EXISTS `housebound_role`;
3161 /*!40101 SET @saved_cs_client = @@character_set_client */;
3162 /*!40101 SET character_set_client = utf8 */;
3163 CREATE TABLE `housebound_role` (
3164 `borrowernumber_id` int(11) NOT NULL COMMENT 'borrowernumber link',
3165 `housebound_chooser` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'set to 1 to indicate this patron is a housebound chooser volunteer',
3166 `housebound_deliverer` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'set to 1 to indicate this patron is a housebound deliverer volunteer',
3167 PRIMARY KEY (`borrowernumber_id`),
3168 CONSTRAINT `houseboundrole_bnfk` FOREIGN KEY (`borrowernumber_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3169 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3170 /*!40101 SET character_set_client = @saved_cs_client */;
3173 -- Table structure for table `housebound_visit`
3176 DROP TABLE IF EXISTS `housebound_visit`;
3177 /*!40101 SET @saved_cs_client = @@character_set_client */;
3178 /*!40101 SET character_set_client = utf8 */;
3179 CREATE TABLE `housebound_visit` (
3180 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the visit.',
3181 `borrowernumber` int(11) NOT NULL COMMENT 'Number of the borrower, & the profile, linked to this visit.',
3182 `appointment_date` date DEFAULT NULL COMMENT 'Date of visit.',
3183 `day_segment` varchar(10) DEFAULT NULL COMMENT 'Rough time frame: ''morning'', ''afternoon'' ''evening''',
3184 `chooser_brwnumber` int(11) DEFAULT NULL COMMENT 'Number of the borrower to choose items for delivery.',
3185 `deliverer_brwnumber` int(11) DEFAULT NULL COMMENT 'Number of the borrower to deliver items.',
3187 KEY `houseboundvisit_bnfk` (`borrowernumber`),
3188 KEY `houseboundvisit_bnfk_1` (`chooser_brwnumber`),
3189 KEY `houseboundvisit_bnfk_2` (`deliverer_brwnumber`),
3190 CONSTRAINT `houseboundvisit_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `housebound_profile` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3191 CONSTRAINT `houseboundvisit_bnfk_1` FOREIGN KEY (`chooser_brwnumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3192 CONSTRAINT `houseboundvisit_bnfk_2` FOREIGN KEY (`deliverer_brwnumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3193 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3194 /*!40101 SET character_set_client = @saved_cs_client */;
3197 -- Table structure for table `identity_provider_domains`
3200 DROP TABLE IF EXISTS `identity_provider_domains`;
3201 /*!40101 SET @saved_cs_client = @@character_set_client */;
3202 /*!40101 SET character_set_client = utf8 */;
3203 CREATE TABLE `identity_provider_domains` (
3204 `identity_provider_domain_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify providers domain',
3205 `identity_provider_id` int(11) NOT NULL COMMENT 'Reference to provider',
3206 `domain` varchar(100) DEFAULT NULL COMMENT 'Domain name. If null means all domains',
3207 `auto_register` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Allow user auto register',
3208 `update_on_auth` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Update user data on auth login',
3209 `default_library_id` varchar(10) DEFAULT NULL COMMENT 'Default library to create user if auto register is enabled',
3210 `default_category_id` varchar(10) DEFAULT NULL COMMENT 'Default category to create user if auto register is enabled',
3211 `allow_opac` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Allow provider from opac interface',
3212 `allow_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Allow provider from staff interface',
3213 PRIMARY KEY (`identity_provider_domain_id`),
3214 UNIQUE KEY `identity_provider_id` (`identity_provider_id`,`domain`),
3215 KEY `domain` (`domain`),
3216 KEY `allow_opac` (`allow_opac`),
3217 KEY `allow_staff` (`allow_staff`),
3218 KEY `identity_provider_domain_ibfk_2` (`default_library_id`),
3219 KEY `identity_provider_domain_ibfk_3` (`default_category_id`),
3220 CONSTRAINT `identity_provider_domain_ibfk_1` FOREIGN KEY (`identity_provider_id`) REFERENCES `identity_providers` (`identity_provider_id`) ON DELETE CASCADE,
3221 CONSTRAINT `identity_provider_domain_ibfk_2` FOREIGN KEY (`default_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
3222 CONSTRAINT `identity_provider_domain_ibfk_3` FOREIGN KEY (`default_category_id`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE
3223 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3224 /*!40101 SET character_set_client = @saved_cs_client */;
3227 -- Table structure for table `identity_providers`
3230 DROP TABLE IF EXISTS `identity_providers`;
3231 /*!40101 SET @saved_cs_client = @@character_set_client */;
3232 /*!40101 SET character_set_client = utf8 */;
3233 CREATE TABLE `identity_providers` (
3234 `identity_provider_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify the provider',
3235 `code` varchar(20) NOT NULL COMMENT 'Provider code',
3236 `description` varchar(255) NOT NULL COMMENT 'Description for the provider',
3237 `protocol` enum('OAuth','OIDC','LDAP','CAS') NOT NULL COMMENT 'Protocol provider speaks',
3238 `config` longtext NOT NULL COMMENT 'Configuration of the provider in JSON format',
3239 `mapping` longtext NOT NULL COMMENT 'Configuration to map provider data to Koha user',
3240 `matchpoint` enum('email','userid','cardnumber') NOT NULL COMMENT 'The patron attribute to be used as matchpoint',
3241 `icon_url` varchar(255) DEFAULT NULL COMMENT 'Provider icon URL',
3242 PRIMARY KEY (`identity_provider_id`),
3243 UNIQUE KEY `code` (`code`),
3244 KEY `protocol` (`protocol`)
3245 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3246 /*!40101 SET character_set_client = @saved_cs_client */;
3249 -- Table structure for table `illcomments`
3252 DROP TABLE IF EXISTS `illcomments`;
3253 /*!40101 SET @saved_cs_client = @@character_set_client */;
3254 /*!40101 SET character_set_client = utf8 */;
3255 CREATE TABLE `illcomments` (
3256 `illcomment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the comment',
3257 `illrequest_id` bigint(20) unsigned NOT NULL COMMENT 'ILL request number',
3258 `borrowernumber` int(11) DEFAULT NULL COMMENT 'Link to the user who made the comment (could be librarian, patron or ILL partner library)',
3259 `comment` text DEFAULT NULL COMMENT 'The text of the comment',
3260 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date and time when the comment was made',
3261 PRIMARY KEY (`illcomment_id`),
3262 KEY `illcomments_bnfk` (`borrowernumber`),
3263 KEY `illcomments_ifk` (`illrequest_id`),
3264 CONSTRAINT `illcomments_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3265 CONSTRAINT `illcomments_ifk` FOREIGN KEY (`illrequest_id`) REFERENCES `illrequests` (`illrequest_id`) ON DELETE CASCADE ON UPDATE CASCADE
3266 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3267 /*!40101 SET character_set_client = @saved_cs_client */;
3270 -- Table structure for table `illrequestattributes`
3273 DROP TABLE IF EXISTS `illrequestattributes`;
3274 /*!40101 SET @saved_cs_client = @@character_set_client */;
3275 /*!40101 SET character_set_client = utf8 */;
3276 CREATE TABLE `illrequestattributes` (
3277 `illrequest_id` bigint(20) unsigned NOT NULL COMMENT 'ILL request number',
3278 `type` varchar(200) NOT NULL COMMENT 'API ILL property name',
3279 `value` mediumtext NOT NULL COMMENT 'API ILL property value',
3280 `readonly` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Is this attribute read only',
3281 PRIMARY KEY (`illrequest_id`,`type`(191)),
3282 CONSTRAINT `illrequestattributes_ifk` FOREIGN KEY (`illrequest_id`) REFERENCES `illrequests` (`illrequest_id`) ON DELETE CASCADE ON UPDATE CASCADE
3283 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3284 /*!40101 SET character_set_client = @saved_cs_client */;
3287 -- Table structure for table `illrequests`
3290 DROP TABLE IF EXISTS `illrequests`;
3291 /*!40101 SET @saved_cs_client = @@character_set_client */;
3292 /*!40101 SET character_set_client = utf8 */;
3293 CREATE TABLE `illrequests` (
3294 `illrequest_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ILL request number',
3295 `borrowernumber` int(11) DEFAULT NULL COMMENT 'Patron associated with request',
3296 `biblio_id` int(11) DEFAULT NULL COMMENT 'Potential bib linked to request',
3297 `deleted_biblio_id` int(11) DEFAULT NULL COMMENT 'Deleted bib linked to request',
3298 `due_date` datetime DEFAULT NULL COMMENT 'Custom date due specified by backend, leave NULL for default date_due calculation',
3299 `branchcode` varchar(50) NOT NULL COMMENT 'The branch associated with the request',
3300 `status` varchar(50) DEFAULT NULL COMMENT 'Current Koha status of request',
3301 `status_alias` varchar(80) DEFAULT NULL COMMENT 'Foreign key to relevant authorised_values.authorised_value',
3302 `placed` date DEFAULT NULL COMMENT 'Date the request was placed',
3303 `replied` date DEFAULT NULL COMMENT 'Last API response',
3304 `updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
3305 `completed` date DEFAULT NULL COMMENT 'Date the request was completed',
3306 `medium` varchar(30) DEFAULT NULL COMMENT 'The Koha request type',
3307 `accessurl` varchar(500) DEFAULT NULL COMMENT 'Potential URL for accessing item',
3308 `cost` varchar(20) DEFAULT NULL COMMENT 'Quotes cost of request',
3309 `price_paid` varchar(20) DEFAULT NULL COMMENT 'Final cost of request',
3310 `notesopac` mediumtext DEFAULT NULL COMMENT 'Patron notes attached to request',
3311 `notesstaff` mediumtext DEFAULT NULL COMMENT 'Staff notes attached to request',
3312 `orderid` varchar(50) DEFAULT NULL COMMENT 'Backend id attached to request',
3313 `backend` varchar(20) DEFAULT NULL COMMENT 'The backend used to create request',
3314 PRIMARY KEY (`illrequest_id`),
3315 KEY `illrequests_bnfk` (`borrowernumber`),
3316 KEY `illrequests_bcfk_2` (`branchcode`),
3317 KEY `illrequests_safk` (`status_alias`),
3318 KEY `illrequests_bibfk` (`biblio_id`),
3319 CONSTRAINT `illrequests_bcfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3320 CONSTRAINT `illrequests_bibfk` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
3321 CONSTRAINT `illrequests_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3322 CONSTRAINT `illrequests_safk` FOREIGN KEY (`status_alias`) REFERENCES `authorised_values` (`authorised_value`) ON DELETE SET NULL ON UPDATE CASCADE
3323 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3324 /*!40101 SET character_set_client = @saved_cs_client */;
3327 -- Table structure for table `import_auths`
3330 DROP TABLE IF EXISTS `import_auths`;
3331 /*!40101 SET @saved_cs_client = @@character_set_client */;
3332 /*!40101 SET character_set_client = utf8 */;
3333 CREATE TABLE `import_auths` (
3334 `import_record_id` int(11) NOT NULL,
3335 `matched_authid` int(11) DEFAULT NULL,
3336 `control_number` varchar(25) DEFAULT NULL,
3337 `authorized_heading` varchar(128) DEFAULT NULL,
3338 `original_source` varchar(25) DEFAULT NULL,
3339 PRIMARY KEY (`import_record_id`),
3340 KEY `import_auths_ibfk_1` (`import_record_id`),
3341 KEY `matched_authid` (`matched_authid`),
3342 CONSTRAINT `import_auths_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3343 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3344 /*!40101 SET character_set_client = @saved_cs_client */;
3347 -- Table structure for table `import_batch_profiles`
3350 DROP TABLE IF EXISTS `import_batch_profiles`;
3351 /*!40101 SET @saved_cs_client = @@character_set_client */;
3352 /*!40101 SET character_set_client = utf8 */;
3353 CREATE TABLE `import_batch_profiles` (
3354 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3355 `name` varchar(100) NOT NULL COMMENT 'name of this profile',
3356 `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3357 `template_id` int(11) DEFAULT NULL COMMENT 'the id of the marc modification template',
3358 `overlay_action` varchar(50) DEFAULT NULL COMMENT 'how to handle duplicate records',
3359 `nomatch_action` varchar(50) DEFAULT NULL COMMENT 'how to handle records where no match is found',
3360 `item_action` varchar(50) DEFAULT NULL COMMENT 'what to do with item records',
3361 `parse_items` tinyint(1) DEFAULT NULL COMMENT 'should items be parsed',
3362 `record_type` varchar(50) DEFAULT NULL COMMENT 'type of record in the batch',
3363 `encoding` varchar(50) DEFAULT NULL COMMENT 'file encoding',
3364 `format` varchar(50) DEFAULT NULL COMMENT 'marc format',
3365 `comments` longtext DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3367 UNIQUE KEY `u_import_batch_profiles__name` (`name`)
3368 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3369 /*!40101 SET character_set_client = @saved_cs_client */;
3372 -- Table structure for table `import_batches`
3375 DROP TABLE IF EXISTS `import_batches`;
3376 /*!40101 SET @saved_cs_client = @@character_set_client */;
3377 /*!40101 SET character_set_client = utf8 */;
3378 CREATE TABLE `import_batches` (
3379 `import_batch_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3380 `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3381 `template_id` int(11) DEFAULT NULL,
3382 `branchcode` varchar(10) DEFAULT NULL,
3383 `num_records` int(11) NOT NULL DEFAULT 0 COMMENT 'number of records in the file',
3384 `num_items` int(11) NOT NULL DEFAULT 0 COMMENT 'number of items in the file',
3385 `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was uploaded',
3386 `overlay_action` enum('replace','create_new','use_template','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle duplicate records',
3387 `nomatch_action` enum('create_new','ignore') NOT NULL DEFAULT 'create_new' COMMENT 'how to handle records where no match is found',
3388 `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',
3389 `import_status` enum('staging','staged','importing','imported','reverting','reverted','cleaned') NOT NULL DEFAULT 'staging' COMMENT 'the status of the imported file',
3390 `batch_type` enum('batch','z3950','webservice') NOT NULL DEFAULT 'batch' COMMENT 'where this batch has come from',
3391 `record_type` enum('biblio','auth','holdings') NOT NULL DEFAULT 'biblio' COMMENT 'type of record in the batch',
3392 `file_name` varchar(100) DEFAULT NULL COMMENT 'the name of the file uploaded',
3393 `comments` longtext DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3394 `profile_id` int(11) DEFAULT NULL,
3395 PRIMARY KEY (`import_batch_id`),
3396 KEY `branchcode` (`branchcode`),
3397 KEY `import_batches_ibfk_1` (`profile_id`),
3398 CONSTRAINT `import_batches_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `import_batch_profiles` (`id`) ON DELETE SET NULL ON UPDATE SET NULL
3399 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3400 /*!40101 SET character_set_client = @saved_cs_client */;
3403 -- Table structure for table `import_biblios`
3406 DROP TABLE IF EXISTS `import_biblios`;
3407 /*!40101 SET @saved_cs_client = @@character_set_client */;
3408 /*!40101 SET character_set_client = utf8 */;
3409 CREATE TABLE `import_biblios` (
3410 `import_record_id` int(11) NOT NULL,
3411 `matched_biblionumber` int(11) DEFAULT NULL,
3412 `control_number` varchar(25) DEFAULT NULL,
3413 `original_source` varchar(25) DEFAULT NULL,
3414 `title` longtext DEFAULT NULL,
3415 `author` longtext DEFAULT NULL,
3416 `isbn` longtext DEFAULT NULL,
3417 `issn` longtext DEFAULT NULL,
3418 `has_items` tinyint(1) NOT NULL DEFAULT 0,
3419 PRIMARY KEY (`import_record_id`),
3420 KEY `import_biblios_ibfk_1` (`import_record_id`),
3421 KEY `matched_biblionumber` (`matched_biblionumber`),
3422 KEY `title` (`title`(191)),
3423 KEY `isbn` (`isbn`(191)),
3424 CONSTRAINT `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3425 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3426 /*!40101 SET character_set_client = @saved_cs_client */;
3429 -- Table structure for table `import_items`
3432 DROP TABLE IF EXISTS `import_items`;
3433 /*!40101 SET @saved_cs_client = @@character_set_client */;
3434 /*!40101 SET character_set_client = utf8 */;
3435 CREATE TABLE `import_items` (
3436 `import_items_id` int(11) NOT NULL AUTO_INCREMENT,
3437 `import_record_id` int(11) NOT NULL,
3438 `itemnumber` int(11) DEFAULT NULL,
3439 `branchcode` varchar(10) DEFAULT NULL,
3440 `status` enum('error','staged','imported','reverted','ignored') NOT NULL DEFAULT 'staged',
3441 `marcxml` longtext NOT NULL,
3442 `import_error` longtext DEFAULT NULL,
3443 PRIMARY KEY (`import_items_id`),
3444 KEY `import_items_ibfk_1` (`import_record_id`),
3445 KEY `itemnumber` (`itemnumber`),
3446 KEY `branchcode` (`branchcode`),
3447 CONSTRAINT `import_items_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3448 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3449 /*!40101 SET character_set_client = @saved_cs_client */;
3452 -- Table structure for table `import_record_matches`
3455 DROP TABLE IF EXISTS `import_record_matches`;
3456 /*!40101 SET @saved_cs_client = @@character_set_client */;
3457 /*!40101 SET character_set_client = utf8 */;
3458 CREATE TABLE `import_record_matches` (
3459 `import_record_id` int(11) NOT NULL COMMENT 'the id given to the imported bib record (import_records.import_record_id)',
3460 `candidate_match_id` int(11) NOT NULL COMMENT 'the biblio the imported record matches (biblio.biblionumber)',
3461 `score` int(11) NOT NULL DEFAULT 0 COMMENT 'the match score',
3462 `chosen` tinyint(1) DEFAULT NULL COMMENT 'whether this match has been allowed or denied',
3463 PRIMARY KEY (`import_record_id`,`candidate_match_id`),
3464 KEY `record_score` (`import_record_id`,`score`),
3465 CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3466 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3467 /*!40101 SET character_set_client = @saved_cs_client */;
3470 -- Table structure for table `import_records`
3473 DROP TABLE IF EXISTS `import_records`;
3474 /*!40101 SET @saved_cs_client = @@character_set_client */;
3475 /*!40101 SET character_set_client = utf8 */;
3476 CREATE TABLE `import_records` (
3477 `import_record_id` int(11) NOT NULL AUTO_INCREMENT,
3478 `import_batch_id` int(11) NOT NULL,
3479 `branchcode` varchar(10) DEFAULT NULL,
3480 `record_sequence` int(11) NOT NULL DEFAULT 0,
3481 `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
3482 `import_date` date DEFAULT NULL,
3483 `marc` longblob NOT NULL,
3484 `marcxml` longtext NOT NULL,
3485 `marcxml_old` longtext NOT NULL,
3486 `record_type` enum('biblio','auth','holdings') NOT NULL DEFAULT 'biblio',
3487 `overlay_status` enum('no_match','auto_match','manual_match','match_applied') NOT NULL DEFAULT 'no_match',
3488 `status` enum('error','staged','imported','reverted','items_reverted','ignored') NOT NULL DEFAULT 'staged',
3489 `import_error` longtext DEFAULT NULL,
3490 `encoding` varchar(40) NOT NULL DEFAULT '',
3491 PRIMARY KEY (`import_record_id`),
3492 KEY `branchcode` (`branchcode`),
3493 KEY `batch_sequence` (`import_batch_id`,`record_sequence`),
3494 KEY `batch_id_record_type` (`import_batch_id`,`record_type`),
3495 CONSTRAINT `import_records_ifbk_1` FOREIGN KEY (`import_batch_id`) REFERENCES `import_batches` (`import_batch_id`) ON DELETE CASCADE ON UPDATE CASCADE
3496 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3497 /*!40101 SET character_set_client = @saved_cs_client */;
3500 -- Table structure for table `issues`
3503 DROP TABLE IF EXISTS `issues`;
3504 /*!40101 SET @saved_cs_client = @@character_set_client */;
3505 /*!40101 SET character_set_client = utf8 */;
3506 CREATE TABLE `issues` (
3507 `issue_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key for issues table',
3508 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
3509 `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
3510 `itemnumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
3511 `date_due` datetime DEFAULT NULL COMMENT 'datetime the item is due (yyyy-mm-dd hh:mm::ss)',
3512 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
3513 `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned, will be NULL until moved to old_issues',
3514 `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
3515 `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
3516 `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
3517 `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
3518 `auto_renew_error` varchar(32) DEFAULT NULL COMMENT 'automatic renewal error',
3519 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
3520 `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
3521 `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
3522 `note` longtext DEFAULT NULL COMMENT 'issue note text',
3523 `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
3524 `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
3525 PRIMARY KEY (`issue_id`),
3526 UNIQUE KEY `itemnumber` (`itemnumber`),
3527 KEY `issuesborridx` (`borrowernumber`),
3528 KEY `itemnumber_idx` (`itemnumber`),
3529 KEY `branchcode_idx` (`branchcode`),
3530 KEY `bordate` (`borrowernumber`,`timestamp`),
3531 KEY `issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
3532 CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE,
3533 CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE,
3534 CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3535 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3536 /*!40101 SET character_set_client = @saved_cs_client */;
3539 -- Table structure for table `item_bundles`
3542 DROP TABLE IF EXISTS `item_bundles`;
3543 /*!40101 SET @saved_cs_client = @@character_set_client */;
3544 /*!40101 SET character_set_client = utf8 */;
3545 CREATE TABLE `item_bundles` (
3546 `item` int(11) NOT NULL,
3547 `host` int(11) NOT NULL,
3548 PRIMARY KEY (`host`,`item`),
3549 UNIQUE KEY `item_bundles_uniq_1` (`item`),
3550 CONSTRAINT `item_bundles_ibfk_1` FOREIGN KEY (`item`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3551 CONSTRAINT `item_bundles_ibfk_2` FOREIGN KEY (`host`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3552 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3553 /*!40101 SET character_set_client = @saved_cs_client */;
3556 -- Table structure for table `item_circulation_alert_preferences`
3559 DROP TABLE IF EXISTS `item_circulation_alert_preferences`;
3560 /*!40101 SET @saved_cs_client = @@character_set_client */;
3561 /*!40101 SET character_set_client = utf8 */;
3562 CREATE TABLE `item_circulation_alert_preferences` (
3563 `id` int(11) NOT NULL AUTO_INCREMENT,
3564 `branchcode` varchar(10) NOT NULL,
3565 `categorycode` varchar(10) NOT NULL,
3566 `item_type` varchar(10) NOT NULL,
3567 `notification` varchar(16) NOT NULL,
3569 KEY `branchcode` (`branchcode`,`categorycode`,`item_type`,`notification`)
3570 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3571 /*!40101 SET character_set_client = @saved_cs_client */;
3574 -- Table structure for table `item_editor_templates`
3577 DROP TABLE IF EXISTS `item_editor_templates`;
3578 /*!40101 SET @saved_cs_client = @@character_set_client */;
3579 /*!40101 SET character_set_client = utf8 */;
3580 CREATE TABLE `item_editor_templates` (
3581 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the template',
3582 `patron_id` int(11) DEFAULT NULL COMMENT 'creator of this template',
3583 `name` mediumtext NOT NULL COMMENT 'template name',
3584 `is_shared` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if template is shared',
3585 `contents` longtext NOT NULL COMMENT 'json encoded template data',
3587 KEY `bn` (`patron_id`),
3588 CONSTRAINT `bn` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3589 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3590 /*!40101 SET character_set_client = @saved_cs_client */;
3593 -- Table structure for table `item_group_items`
3596 DROP TABLE IF EXISTS `item_group_items`;
3597 /*!40101 SET @saved_cs_client = @@character_set_client */;
3598 /*!40101 SET character_set_client = utf8 */;
3599 CREATE TABLE `item_group_items` (
3600 `item_group_items_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the group/item link',
3601 `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',
3602 `item_id` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the items table',
3603 PRIMARY KEY (`item_group_items_id`),
3604 UNIQUE KEY `item_id` (`item_id`),
3605 KEY `item_group_items_gifk_1` (`item_group_id`),
3606 CONSTRAINT `item_group_items_gifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3607 CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3608 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3609 /*!40101 SET character_set_client = @saved_cs_client */;
3612 -- Table structure for table `item_groups`
3615 DROP TABLE IF EXISTS `item_groups`;
3616 /*!40101 SET @saved_cs_client = @@character_set_client */;
3617 /*!40101 SET character_set_client = utf8 */;
3618 CREATE TABLE `item_groups` (
3619 `item_group_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the items group',
3620 `biblio_id` int(11) NOT NULL COMMENT 'id for the bibliographic record the group belongs to',
3621 `display_order` int(4) NOT NULL DEFAULT 0 COMMENT 'The ''sort order'' for item_groups',
3622 `description` mediumtext DEFAULT NULL COMMENT 'A group description',
3623 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the group was created',
3624 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the group',
3625 PRIMARY KEY (`item_group_id`),
3626 KEY `item_groups_ibfk_1` (`biblio_id`),
3627 CONSTRAINT `item_groups_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
3628 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3629 /*!40101 SET character_set_client = @saved_cs_client */;
3632 -- Table structure for table `items`
3635 DROP TABLE IF EXISTS `items`;
3636 /*!40101 SET @saved_cs_client = @@character_set_client */;
3637 /*!40101 SET character_set_client = utf8 */;
3638 CREATE TABLE `items` (
3639 `itemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier added by Koha',
3640 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
3641 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
3642 `barcode` varchar(20) DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
3643 `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
3644 `booksellerid` longtext DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
3645 `homebranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
3646 `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
3647 `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
3648 `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
3649 `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out/issued',
3650 `datelastseen` datetime DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
3651 `stack` tinyint(1) DEFAULT NULL,
3652 `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
3653 `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
3654 `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
3655 `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
3656 `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
3657 `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
3658 `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
3659 `itemcallnumber` varchar(255) DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
3660 `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
3661 `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out/issued',
3662 `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
3663 `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
3664 `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
3665 `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
3666 `itemnotes_nonpublic` longtext DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
3667 `holdingbranch` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
3668 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
3669 `deleted_on` datetime DEFAULT NULL COMMENT 'date/time of deletion',
3670 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
3671 `permanent_location` varchar(80) DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
3672 `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
3673 `cn_source` varchar(10) DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
3674 `cn_sort` varchar(255) DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
3675 `ccode` varchar(80) DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
3676 `materials` mediumtext DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
3677 `uri` mediumtext DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
3678 `itype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
3679 `more_subfields_xml` longtext DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
3680 `enumchron` mediumtext DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
3681 `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
3682 `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
3683 `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.',
3684 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
3685 PRIMARY KEY (`itemnumber`),
3686 UNIQUE KEY `itembarcodeidx` (`barcode`),
3687 KEY `itemstocknumberidx` (`stocknumber`),
3688 KEY `itembinoidx` (`biblioitemnumber`),
3689 KEY `itembibnoidx` (`biblionumber`),
3690 KEY `homebranch` (`homebranch`),
3691 KEY `holdingbranch` (`holdingbranch`),
3692 KEY `itemcallnumber` (`itemcallnumber`(191)),
3693 KEY `items_location` (`location`),
3694 KEY `items_ccode` (`ccode`),
3695 KEY `itype_idx` (`itype`),
3696 KEY `timestamp` (`timestamp`),
3697 CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3698 CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
3699 CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
3700 CONSTRAINT `items_ibfk_4` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
3701 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3702 /*!40101 SET character_set_client = @saved_cs_client */;
3705 -- Table structure for table `items_last_borrower`
3708 DROP TABLE IF EXISTS `items_last_borrower`;
3709 /*!40101 SET @saved_cs_client = @@character_set_client */;
3710 /*!40101 SET character_set_client = utf8 */;
3711 CREATE TABLE `items_last_borrower` (
3712 `id` int(11) NOT NULL AUTO_INCREMENT,
3713 `itemnumber` int(11) NOT NULL,
3714 `borrowernumber` int(11) NOT NULL,
3715 `created_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
3717 UNIQUE KEY `itemnumber` (`itemnumber`),
3718 KEY `borrowernumber` (`borrowernumber`),
3719 CONSTRAINT `items_last_borrower_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3720 CONSTRAINT `items_last_borrower_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3721 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3722 /*!40101 SET character_set_client = @saved_cs_client */;
3725 -- Table structure for table `items_search_fields`
3728 DROP TABLE IF EXISTS `items_search_fields`;
3729 /*!40101 SET @saved_cs_client = @@character_set_client */;
3730 /*!40101 SET character_set_client = utf8 */;
3731 CREATE TABLE `items_search_fields` (
3732 `name` varchar(255) NOT NULL,
3733 `label` varchar(255) NOT NULL,
3734 `tagfield` char(3) NOT NULL,
3735 `tagsubfield` char(1) DEFAULT NULL,
3736 `authorised_values_category` varchar(32) DEFAULT NULL,
3737 PRIMARY KEY (`name`(191)),
3738 KEY `items_search_fields_authorised_values_category` (`authorised_values_category`),
3739 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
3740 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3741 /*!40101 SET character_set_client = @saved_cs_client */;
3744 -- Table structure for table `itemtypes`
3747 DROP TABLE IF EXISTS `itemtypes`;
3748 /*!40101 SET @saved_cs_client = @@character_set_client */;
3749 /*!40101 SET character_set_client = utf8 */;
3750 CREATE TABLE `itemtypes` (
3751 `itemtype` varchar(10) NOT NULL DEFAULT '' COMMENT 'unique key, a code associated with the item type',
3752 `parent_type` varchar(10) DEFAULT NULL COMMENT 'unique key, a code associated with the item type',
3753 `description` longtext DEFAULT NULL COMMENT 'a plain text explanation of the item type',
3754 `rentalcharge` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged when this item is checked out/issued',
3755 `rentalcharge_daily` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each day between checkout date and due date',
3756 `rentalcharge_daily_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the daily rental fee is calculated directly or using finesCalendar',
3757 `rentalcharge_hourly` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each hour between checkout date and due date',
3758 `rentalcharge_hourly_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the hourly rental fee is calculated directly or using finesCalendar',
3759 `defaultreplacecost` decimal(28,6) DEFAULT NULL COMMENT 'default replacement cost',
3760 `processfee` decimal(28,6) DEFAULT NULL COMMENT 'default text be recorded in the column note when the processing fee is applied',
3761 `notforloan` smallint(6) DEFAULT NULL COMMENT '1 if the item is not for loan, 0 if the item is available for loan',
3762 `imageurl` varchar(200) DEFAULT NULL COMMENT 'URL for the item type icon',
3763 `summary` mediumtext DEFAULT NULL COMMENT 'information from the summary field, may include HTML',
3764 `checkinmsg` varchar(255) DEFAULT NULL COMMENT 'message that is displayed when an item with the given item type is checked in',
3765 `checkinmsgtype` char(16) NOT NULL DEFAULT 'message' COMMENT 'type (CSS class) for the checkinmsg, can be ''alert'' or ''message''',
3766 `sip_media_type` varchar(3) DEFAULT NULL COMMENT 'SIP2 protocol media type for this itemtype',
3767 `hideinopac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Hide the item type from the search options in OPAC',
3768 `searchcategory` varchar(80) DEFAULT NULL COMMENT 'Group this item type with others with the same value on OPAC search options',
3769 `automatic_checkin` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If automatic checkin is enabled for items of this type',
3770 PRIMARY KEY (`itemtype`),
3771 UNIQUE KEY `itemtype` (`itemtype`),
3772 KEY `itemtypes_ibfk_1` (`parent_type`),
3773 CONSTRAINT `itemtypes_ibfk_1` FOREIGN KEY (`parent_type`) REFERENCES `itemtypes` (`itemtype`)
3774 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3775 /*!40101 SET character_set_client = @saved_cs_client */;
3778 -- Table structure for table `itemtypes_branches`
3781 DROP TABLE IF EXISTS `itemtypes_branches`;
3782 /*!40101 SET @saved_cs_client = @@character_set_client */;
3783 /*!40101 SET character_set_client = utf8 */;
3784 CREATE TABLE `itemtypes_branches` (
3785 `itemtype` varchar(10) NOT NULL,
3786 `branchcode` varchar(10) NOT NULL,
3787 KEY `itemtype` (`itemtype`),
3788 KEY `branchcode` (`branchcode`),
3789 CONSTRAINT `itemtypes_branches_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE,
3790 CONSTRAINT `itemtypes_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE 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 `keyboard_shortcuts`
3798 DROP TABLE IF EXISTS `keyboard_shortcuts`;
3799 /*!40101 SET @saved_cs_client = @@character_set_client */;
3800 /*!40101 SET character_set_client = utf8 */;
3801 CREATE TABLE `keyboard_shortcuts` (
3802 `shortcut_name` varchar(80) NOT NULL,
3803 `shortcut_keys` varchar(80) NOT NULL,
3804 PRIMARY KEY (`shortcut_name`)
3805 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3806 /*!40101 SET character_set_client = @saved_cs_client */;
3809 -- Table structure for table `language_descriptions`
3812 DROP TABLE IF EXISTS `language_descriptions`;
3813 /*!40101 SET @saved_cs_client = @@character_set_client */;
3814 /*!40101 SET character_set_client = utf8 */;
3815 CREATE TABLE `language_descriptions` (
3816 `subtag` varchar(25) DEFAULT NULL,
3817 `type` varchar(25) DEFAULT NULL,
3818 `lang` varchar(25) DEFAULT NULL,
3819 `description` varchar(255) DEFAULT NULL,
3820 `id` int(11) NOT NULL AUTO_INCREMENT,
3822 UNIQUE KEY `uniq_desc` (`subtag`,`type`,`lang`),
3824 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3825 /*!40101 SET character_set_client = @saved_cs_client */;
3828 -- Table structure for table `language_rfc4646_to_iso639`
3831 DROP TABLE IF EXISTS `language_rfc4646_to_iso639`;
3832 /*!40101 SET @saved_cs_client = @@character_set_client */;
3833 /*!40101 SET character_set_client = utf8 */;
3834 CREATE TABLE `language_rfc4646_to_iso639` (
3835 `rfc4646_subtag` varchar(25) DEFAULT NULL,
3836 `iso639_2_code` varchar(25) DEFAULT NULL,
3837 `id` int(11) NOT NULL AUTO_INCREMENT,
3839 UNIQUE KEY `uniq_code` (`rfc4646_subtag`,`iso639_2_code`),
3840 KEY `rfc4646_subtag` (`rfc4646_subtag`)
3841 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3842 /*!40101 SET character_set_client = @saved_cs_client */;
3845 -- Table structure for table `language_script_bidi`
3848 DROP TABLE IF EXISTS `language_script_bidi`;
3849 /*!40101 SET @saved_cs_client = @@character_set_client */;
3850 /*!40101 SET character_set_client = utf8 */;
3851 CREATE TABLE `language_script_bidi` (
3852 `rfc4646_subtag` varchar(25) DEFAULT NULL COMMENT 'script subtag, Arab, Hebr, etc.',
3853 `bidi` varchar(3) DEFAULT NULL COMMENT 'rtl ltr',
3854 KEY `rfc4646_subtag` (`rfc4646_subtag`)
3855 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3856 /*!40101 SET character_set_client = @saved_cs_client */;
3859 -- Table structure for table `language_script_mapping`
3862 DROP TABLE IF EXISTS `language_script_mapping`;
3863 /*!40101 SET @saved_cs_client = @@character_set_client */;
3864 /*!40101 SET character_set_client = utf8 */;
3865 CREATE TABLE `language_script_mapping` (
3866 `language_subtag` varchar(25) NOT NULL,
3867 `script_subtag` varchar(25) DEFAULT NULL,
3868 PRIMARY KEY (`language_subtag`)
3869 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3870 /*!40101 SET character_set_client = @saved_cs_client */;
3873 -- Table structure for table `language_subtag_registry`
3876 DROP TABLE IF EXISTS `language_subtag_registry`;
3877 /*!40101 SET @saved_cs_client = @@character_set_client */;
3878 /*!40101 SET character_set_client = utf8 */;
3879 CREATE TABLE `language_subtag_registry` (
3880 `subtag` varchar(25) DEFAULT NULL,
3881 `type` varchar(25) DEFAULT NULL COMMENT 'language-script-region-variant-extension-privateuse',
3882 `description` varchar(255) DEFAULT NULL COMMENT 'only one of the possible descriptions for ease of reference, see language_descriptions for the complete list',
3883 `added` date DEFAULT NULL,
3884 `id` int(11) NOT NULL AUTO_INCREMENT,
3886 UNIQUE KEY `uniq_lang` (`subtag`,`type`),
3887 KEY `subtag` (`subtag`)
3888 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3889 /*!40101 SET character_set_client = @saved_cs_client */;
3892 -- Table structure for table `letter`
3895 DROP TABLE IF EXISTS `letter`;
3896 /*!40101 SET @saved_cs_client = @@character_set_client */;
3897 /*!40101 SET character_set_client = utf8 */;
3898 CREATE TABLE `letter` (
3899 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
3900 `module` varchar(20) NOT NULL DEFAULT '' COMMENT 'Koha module that triggers this notice or slip',
3901 `code` varchar(20) NOT NULL DEFAULT '' COMMENT 'unique identifier for this notice or slip',
3902 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch this notice or slip is used at (branches.branchcode)',
3903 `name` varchar(100) NOT NULL DEFAULT '' COMMENT 'plain text name for this notice or slip',
3904 `is_html` tinyint(1) DEFAULT 0 COMMENT 'does this notice or slip use HTML (1 for yes, 0 for no)',
3905 `title` varchar(200) NOT NULL DEFAULT '' COMMENT 'subject line of the notice',
3906 `content` mediumtext DEFAULT NULL COMMENT 'body text for the notice or slip',
3907 `message_transport_type` varchar(20) NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3908 `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3909 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3911 UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3912 KEY `message_transport_type_fk` (`message_transport_type`),
3913 CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
3914 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3915 /*!40101 SET character_set_client = @saved_cs_client */;
3918 -- Table structure for table `library_groups`
3921 DROP TABLE IF EXISTS `library_groups`;
3922 /*!40101 SET @saved_cs_client = @@character_set_client */;
3923 /*!40101 SET character_set_client = utf8 */;
3924 CREATE TABLE `library_groups` (
3925 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for each group',
3926 `parent_id` int(11) DEFAULT NULL COMMENT 'if this is a child group, the id of the parent group',
3927 `branchcode` varchar(10) DEFAULT NULL COMMENT 'The branchcode of a branch belonging to the parent group',
3928 `title` varchar(100) DEFAULT NULL COMMENT 'Short description of the goup',
3929 `description` mediumtext DEFAULT NULL COMMENT 'Longer explanation of the group, if necessary',
3930 `ft_hide_patron_info` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Turn on the feature ''Hide patron''s info'' for this group',
3931 `ft_limit_item_editing` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Turn on the feature "Limit item editing by group" for this group',
3932 `ft_search_groups_opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for staff side search groups',
3933 `ft_search_groups_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for opac side search groups',
3934 `ft_local_hold_group` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group to identify libraries as pick up location for holds',
3935 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Date and time of creation',
3936 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time of last',
3938 UNIQUE KEY `title` (`title`),
3939 UNIQUE KEY `library_groups_uniq_2` (`parent_id`,`branchcode`),
3940 KEY `branchcode` (`branchcode`),
3941 CONSTRAINT `library_groups_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `library_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
3942 CONSTRAINT `library_groups_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
3943 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3944 /*!40101 SET character_set_client = @saved_cs_client */;
3947 -- Table structure for table `library_smtp_servers`
3950 DROP TABLE IF EXISTS `library_smtp_servers`;
3951 /*!40101 SET @saved_cs_client = @@character_set_client */;
3952 /*!40101 SET character_set_client = utf8 */;
3953 CREATE TABLE `library_smtp_servers` (
3954 `id` int(11) NOT NULL AUTO_INCREMENT,
3955 `library_id` varchar(10) NOT NULL,
3956 `smtp_server_id` int(11) NOT NULL,
3958 UNIQUE KEY `library_id_idx` (`library_id`),
3959 KEY `smtp_server_id_idx` (`smtp_server_id`),
3960 CONSTRAINT `library_smtp_servers_library_fk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3961 CONSTRAINT `library_smtp_servers_smtp_servers_fk` FOREIGN KEY (`smtp_server_id`) REFERENCES `smtp_servers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
3962 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3963 /*!40101 SET character_set_client = @saved_cs_client */;
3966 -- Table structure for table `linktracker`
3969 DROP TABLE IF EXISTS `linktracker`;
3970 /*!40101 SET @saved_cs_client = @@character_set_client */;
3971 /*!40101 SET character_set_client = utf8 */;
3972 CREATE TABLE `linktracker` (
3973 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
3974 `biblionumber` int(11) DEFAULT NULL COMMENT 'biblionumber of the record the link is from',
3975 `itemnumber` int(11) DEFAULT NULL COMMENT 'itemnumber if applicable that the link was from',
3976 `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrowernumber who clicked the link',
3977 `url` mediumtext DEFAULT NULL COMMENT 'the link itself',
3978 `timeclicked` datetime DEFAULT NULL COMMENT 'the date and time the link was clicked',
3980 KEY `bibidx` (`biblionumber`),
3981 KEY `itemidx` (`itemnumber`),
3982 KEY `borridx` (`borrowernumber`),
3983 KEY `dateidx` (`timeclicked`),
3984 CONSTRAINT `linktracker_biblio_ibfk` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3985 CONSTRAINT `linktracker_borrower_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3986 CONSTRAINT `linktracker_item_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL
3987 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3988 /*!40101 SET character_set_client = @saved_cs_client */;
3991 -- Table structure for table `localization`
3994 DROP TABLE IF EXISTS `localization`;
3995 /*!40101 SET @saved_cs_client = @@character_set_client */;
3996 /*!40101 SET character_set_client = utf8 */;
3997 CREATE TABLE `localization` (
3998 `localization_id` int(11) NOT NULL AUTO_INCREMENT,
3999 `entity` varchar(16) NOT NULL,
4000 `code` varchar(64) NOT NULL,
4001 `lang` varchar(25) NOT NULL COMMENT 'could be a foreign key',
4002 `translation` mediumtext DEFAULT NULL,
4003 PRIMARY KEY (`localization_id`),
4004 UNIQUE KEY `entity_code_lang` (`entity`,`code`,`lang`)
4005 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4006 /*!40101 SET character_set_client = @saved_cs_client */;
4009 -- Table structure for table `marc_matchers`
4012 DROP TABLE IF EXISTS `marc_matchers`;
4013 /*!40101 SET @saved_cs_client = @@character_set_client */;
4014 /*!40101 SET character_set_client = utf8 */;
4015 CREATE TABLE `marc_matchers` (
4016 `matcher_id` int(11) NOT NULL AUTO_INCREMENT,
4017 `code` varchar(10) NOT NULL DEFAULT '',
4018 `description` varchar(255) NOT NULL DEFAULT '',
4019 `record_type` varchar(10) NOT NULL DEFAULT 'biblio',
4020 `threshold` int(11) NOT NULL DEFAULT 0,
4021 PRIMARY KEY (`matcher_id`),
4022 KEY `code` (`code`),
4023 KEY `record_type` (`record_type`)
4024 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4025 /*!40101 SET character_set_client = @saved_cs_client */;
4028 -- Table structure for table `marc_modification_template_actions`
4031 DROP TABLE IF EXISTS `marc_modification_template_actions`;
4032 /*!40101 SET @saved_cs_client = @@character_set_client */;
4033 /*!40101 SET character_set_client = utf8 */;
4034 CREATE TABLE `marc_modification_template_actions` (
4035 `mmta_id` int(11) NOT NULL AUTO_INCREMENT,
4036 `template_id` int(11) NOT NULL,
4037 `ordering` int(3) NOT NULL,
4038 `action` enum('delete_field','add_field','update_field','move_field','copy_field','copy_and_replace_field') NOT NULL,
4039 `field_number` smallint(6) NOT NULL DEFAULT 0,
4040 `from_field` varchar(3) NOT NULL,
4041 `from_subfield` varchar(1) DEFAULT NULL,
4042 `field_value` text DEFAULT NULL,
4043 `to_field` varchar(3) DEFAULT NULL,
4044 `to_subfield` varchar(1) DEFAULT NULL,
4045 `to_regex_search` mediumtext DEFAULT NULL,
4046 `to_regex_replace` mediumtext DEFAULT NULL,
4047 `to_regex_modifiers` varchar(8) DEFAULT '',
4048 `conditional` enum('if','unless') DEFAULT NULL,
4049 `conditional_field` varchar(3) DEFAULT NULL,
4050 `conditional_subfield` varchar(1) DEFAULT NULL,
4051 `conditional_comparison` enum('exists','not_exists','equals','not_equals') DEFAULT NULL,
4052 `conditional_value` mediumtext DEFAULT NULL,
4053 `conditional_regex` tinyint(1) NOT NULL DEFAULT 0,
4054 `description` mediumtext DEFAULT NULL,
4055 PRIMARY KEY (`mmta_id`),
4056 KEY `mmta_ibfk_1` (`template_id`),
4057 CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
4058 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4059 /*!40101 SET character_set_client = @saved_cs_client */;
4062 -- Table structure for table `marc_modification_templates`
4065 DROP TABLE IF EXISTS `marc_modification_templates`;
4066 /*!40101 SET @saved_cs_client = @@character_set_client */;
4067 /*!40101 SET character_set_client = utf8 */;
4068 CREATE TABLE `marc_modification_templates` (
4069 `template_id` int(11) NOT NULL AUTO_INCREMENT,
4070 `name` mediumtext NOT NULL,
4071 PRIMARY KEY (`template_id`)
4072 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4073 /*!40101 SET character_set_client = @saved_cs_client */;
4076 -- Table structure for table `marc_overlay_rules`
4079 DROP TABLE IF EXISTS `marc_overlay_rules`;
4080 /*!40101 SET @saved_cs_client = @@character_set_client */;
4081 /*!40101 SET character_set_client = utf8 */;
4082 CREATE TABLE `marc_overlay_rules` (
4083 `id` int(11) NOT NULL AUTO_INCREMENT,
4084 `tag` varchar(255) NOT NULL,
4085 `module` varchar(127) NOT NULL,
4086 `filter` varchar(255) NOT NULL,
4087 `add` tinyint(1) NOT NULL DEFAULT 0,
4088 `append` tinyint(1) NOT NULL DEFAULT 0,
4089 `remove` tinyint(1) NOT NULL DEFAULT 0,
4090 `delete` tinyint(1) NOT NULL DEFAULT 0,
4092 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4093 /*!40101 SET character_set_client = @saved_cs_client */;
4096 -- Table structure for table `marc_subfield_structure`
4099 DROP TABLE IF EXISTS `marc_subfield_structure`;
4100 /*!40101 SET @saved_cs_client = @@character_set_client */;
4101 /*!40101 SET character_set_client = utf8 */;
4102 CREATE TABLE `marc_subfield_structure` (
4103 `tagfield` varchar(3) NOT NULL DEFAULT '',
4104 `tagsubfield` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
4105 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
4106 `libopac` varchar(255) NOT NULL DEFAULT '',
4107 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
4108 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4109 `important` tinyint(4) NOT NULL DEFAULT 0,
4110 `kohafield` varchar(40) DEFAULT NULL,
4111 `tab` tinyint(1) DEFAULT NULL,
4112 `authorised_value` varchar(32) DEFAULT NULL,
4113 `authtypecode` varchar(20) DEFAULT NULL,
4114 `value_builder` varchar(80) DEFAULT NULL,
4115 `isurl` tinyint(1) DEFAULT NULL,
4116 `hidden` tinyint(1) NOT NULL DEFAULT 8,
4117 `frameworkcode` varchar(4) NOT NULL DEFAULT '',
4118 `seealso` varchar(1100) DEFAULT NULL,
4119 `link` varchar(80) DEFAULT NULL,
4120 `defaultvalue` mediumtext DEFAULT NULL,
4121 `maxlength` int(4) NOT NULL DEFAULT 9999,
4122 `display_order` int(2) NOT NULL DEFAULT 0,
4123 PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`),
4124 KEY `kohafield_2` (`kohafield`),
4125 KEY `tab` (`frameworkcode`,`tab`),
4126 KEY `kohafield` (`frameworkcode`,`kohafield`),
4127 KEY `marc_subfield_structure_ibfk_1` (`authorised_value`),
4128 CONSTRAINT `marc_subfield_structure_ibfk_1` FOREIGN KEY (`authorised_value`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE SET NULL ON UPDATE CASCADE
4129 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4130 /*!40101 SET character_set_client = @saved_cs_client */;
4133 -- Table structure for table `marc_tag_structure`
4136 DROP TABLE IF EXISTS `marc_tag_structure`;
4137 /*!40101 SET @saved_cs_client = @@character_set_client */;
4138 /*!40101 SET character_set_client = utf8 */;
4139 CREATE TABLE `marc_tag_structure` (
4140 `tagfield` varchar(3) NOT NULL DEFAULT '',
4141 `liblibrarian` varchar(255) NOT NULL DEFAULT '',
4142 `libopac` varchar(255) NOT NULL DEFAULT '',
4143 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
4144 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4145 `important` tinyint(4) NOT NULL DEFAULT 0,
4146 `authorised_value` varchar(32) DEFAULT NULL,
4147 `ind1_defaultvalue` varchar(1) NOT NULL DEFAULT '',
4148 `ind2_defaultvalue` varchar(1) NOT NULL DEFAULT '',
4149 `frameworkcode` varchar(4) NOT NULL DEFAULT '',
4150 PRIMARY KEY (`frameworkcode`,`tagfield`)
4151 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4152 /*!40101 SET character_set_client = @saved_cs_client */;
4155 -- Table structure for table `matchchecks`
4158 DROP TABLE IF EXISTS `matchchecks`;
4159 /*!40101 SET @saved_cs_client = @@character_set_client */;
4160 /*!40101 SET character_set_client = utf8 */;
4161 CREATE TABLE `matchchecks` (
4162 `matcher_id` int(11) NOT NULL,
4163 `matchcheck_id` int(11) NOT NULL AUTO_INCREMENT,
4164 `source_matchpoint_id` int(11) NOT NULL,
4165 `target_matchpoint_id` int(11) NOT NULL,
4166 PRIMARY KEY (`matchcheck_id`),
4167 KEY `matcher_matchchecks_ifbk_1` (`matcher_id`),
4168 KEY `matcher_matchchecks_ifbk_2` (`source_matchpoint_id`),
4169 KEY `matcher_matchchecks_ifbk_3` (`target_matchpoint_id`),
4170 CONSTRAINT `matcher_matchchecks_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4171 CONSTRAINT `matcher_matchchecks_ifbk_2` FOREIGN KEY (`source_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4172 CONSTRAINT `matcher_matchchecks_ifbk_3` FOREIGN KEY (`target_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4173 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4174 /*!40101 SET character_set_client = @saved_cs_client */;
4177 -- Table structure for table `matcher_matchpoints`
4180 DROP TABLE IF EXISTS `matcher_matchpoints`;
4181 /*!40101 SET @saved_cs_client = @@character_set_client */;
4182 /*!40101 SET character_set_client = utf8 */;
4183 CREATE TABLE `matcher_matchpoints` (
4184 `matcher_id` int(11) NOT NULL,
4185 `matchpoint_id` int(11) NOT NULL,
4186 KEY `matcher_matchpoints_ifbk_1` (`matcher_id`),
4187 KEY `matcher_matchpoints_ifbk_2` (`matchpoint_id`),
4188 CONSTRAINT `matcher_matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4189 CONSTRAINT `matcher_matchpoints_ifbk_2` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4190 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4191 /*!40101 SET character_set_client = @saved_cs_client */;
4194 -- Table structure for table `matchpoint_component_norms`
4197 DROP TABLE IF EXISTS `matchpoint_component_norms`;
4198 /*!40101 SET @saved_cs_client = @@character_set_client */;
4199 /*!40101 SET character_set_client = utf8 */;
4200 CREATE TABLE `matchpoint_component_norms` (
4201 `matchpoint_component_id` int(11) NOT NULL,
4202 `sequence` int(11) NOT NULL DEFAULT 0,
4203 `norm_routine` varchar(50) NOT NULL DEFAULT '',
4204 KEY `matchpoint_component_norms` (`matchpoint_component_id`,`sequence`),
4205 CONSTRAINT `matchpoint_component_norms_ifbk_1` FOREIGN KEY (`matchpoint_component_id`) REFERENCES `matchpoint_components` (`matchpoint_component_id`) ON DELETE CASCADE ON UPDATE CASCADE
4206 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4207 /*!40101 SET character_set_client = @saved_cs_client */;
4210 -- Table structure for table `matchpoint_components`
4213 DROP TABLE IF EXISTS `matchpoint_components`;
4214 /*!40101 SET @saved_cs_client = @@character_set_client */;
4215 /*!40101 SET character_set_client = utf8 */;
4216 CREATE TABLE `matchpoint_components` (
4217 `matchpoint_id` int(11) NOT NULL,
4218 `matchpoint_component_id` int(11) NOT NULL AUTO_INCREMENT,
4219 `sequence` int(11) NOT NULL DEFAULT 0,
4220 `tag` varchar(3) NOT NULL DEFAULT '',
4221 `subfields` varchar(40) NOT NULL DEFAULT '',
4222 `offset` int(4) NOT NULL DEFAULT 0,
4223 `length` int(4) NOT NULL DEFAULT 0,
4224 PRIMARY KEY (`matchpoint_component_id`),
4225 KEY `by_sequence` (`matchpoint_id`,`sequence`),
4226 CONSTRAINT `matchpoint_components_ifbk_1` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4227 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4228 /*!40101 SET character_set_client = @saved_cs_client */;
4231 -- Table structure for table `matchpoints`
4234 DROP TABLE IF EXISTS `matchpoints`;
4235 /*!40101 SET @saved_cs_client = @@character_set_client */;
4236 /*!40101 SET character_set_client = utf8 */;
4237 CREATE TABLE `matchpoints` (
4238 `matcher_id` int(11) NOT NULL,
4239 `matchpoint_id` int(11) NOT NULL AUTO_INCREMENT,
4240 `search_index` varchar(30) NOT NULL DEFAULT '',
4241 `score` int(11) NOT NULL DEFAULT 0,
4242 PRIMARY KEY (`matchpoint_id`),
4243 KEY `matchpoints_ifbk_1` (`matcher_id`),
4244 CONSTRAINT `matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE
4245 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4246 /*!40101 SET character_set_client = @saved_cs_client */;
4249 -- Table structure for table `message_attributes`
4252 DROP TABLE IF EXISTS `message_attributes`;
4253 /*!40101 SET @saved_cs_client = @@character_set_client */;
4254 /*!40101 SET character_set_client = utf8 */;
4255 CREATE TABLE `message_attributes` (
4256 `message_attribute_id` int(11) NOT NULL AUTO_INCREMENT,
4257 `message_name` varchar(40) NOT NULL DEFAULT '',
4258 `takes_days` tinyint(1) NOT NULL DEFAULT 0,
4259 PRIMARY KEY (`message_attribute_id`),
4260 UNIQUE KEY `message_name` (`message_name`)
4261 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4262 /*!40101 SET character_set_client = @saved_cs_client */;
4265 -- Table structure for table `message_queue`
4268 DROP TABLE IF EXISTS `message_queue`;
4269 /*!40101 SET @saved_cs_client = @@character_set_client */;
4270 /*!40101 SET character_set_client = utf8 */;
4271 CREATE TABLE `message_queue` (
4272 `message_id` int(11) NOT NULL AUTO_INCREMENT,
4273 `letter_id` int(11) DEFAULT NULL COMMENT 'Foreign key to the letters table',
4274 `borrowernumber` int(11) DEFAULT NULL,
4275 `subject` mediumtext DEFAULT NULL,
4276 `content` mediumtext DEFAULT NULL,
4277 `metadata` mediumtext DEFAULT NULL,
4278 `letter_code` varchar(64) DEFAULT NULL,
4279 `message_transport_type` varchar(20) NOT NULL,
4280 `status` enum('sent','pending','failed','deleted') NOT NULL DEFAULT 'pending',
4281 `time_queued` timestamp NULL DEFAULT NULL,
4282 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
4283 `to_address` longtext DEFAULT NULL,
4284 `from_address` longtext DEFAULT NULL,
4285 `reply_address` longtext DEFAULT NULL,
4286 `content_type` mediumtext DEFAULT NULL,
4287 `failure_code` mediumtext DEFAULT NULL,
4288 PRIMARY KEY (`message_id`),
4289 KEY `borrowernumber` (`borrowernumber`),
4290 KEY `message_transport_type` (`message_transport_type`),
4291 KEY `letter_fk` (`letter_id`),
4292 CONSTRAINT `letter_fk` FOREIGN KEY (`letter_id`) REFERENCES `letter` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
4293 CONSTRAINT `messageq_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4294 CONSTRAINT `messageq_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON UPDATE CASCADE
4295 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4296 /*!40101 SET character_set_client = @saved_cs_client */;
4299 -- Table structure for table `message_transport_types`
4302 DROP TABLE IF EXISTS `message_transport_types`;
4303 /*!40101 SET @saved_cs_client = @@character_set_client */;
4304 /*!40101 SET character_set_client = utf8 */;
4305 CREATE TABLE `message_transport_types` (
4306 `message_transport_type` varchar(20) NOT NULL,
4307 PRIMARY KEY (`message_transport_type`)
4308 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4309 /*!40101 SET character_set_client = @saved_cs_client */;
4312 -- Table structure for table `message_transports`
4315 DROP TABLE IF EXISTS `message_transports`;
4316 /*!40101 SET @saved_cs_client = @@character_set_client */;
4317 /*!40101 SET character_set_client = utf8 */;
4318 CREATE TABLE `message_transports` (
4319 `message_attribute_id` int(11) NOT NULL,
4320 `message_transport_type` varchar(20) NOT NULL,
4321 `is_digest` tinyint(1) NOT NULL DEFAULT 0,
4322 `letter_module` varchar(20) NOT NULL DEFAULT '',
4323 `letter_code` varchar(20) NOT NULL DEFAULT '',
4324 `branchcode` varchar(10) NOT NULL DEFAULT '',
4325 PRIMARY KEY (`message_attribute_id`,`message_transport_type`,`is_digest`),
4326 KEY `message_transport_type` (`message_transport_type`),
4327 KEY `letter_module` (`letter_module`,`letter_code`),
4328 CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4329 CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
4330 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4331 /*!40101 SET character_set_client = @saved_cs_client */;
4334 -- Table structure for table `messages`
4337 DROP TABLE IF EXISTS `messages`;
4338 /*!40101 SET @saved_cs_client = @@character_set_client */;
4339 /*!40101 SET character_set_client = utf8 */;
4340 CREATE TABLE `messages` (
4341 `message_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4342 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking this message to the borrowers table',
4343 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key linking the message to the branches table',
4344 `message_type` varchar(1) NOT NULL COMMENT 'whether the message is for the librarians (L) or the patron (B)',
4345 `message` mediumtext NOT NULL COMMENT 'the text of the message',
4346 `message_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the message was written',
4347 `manager_id` int(11) DEFAULT NULL COMMENT 'creator of message',
4348 `patron_read_date` timestamp NULL DEFAULT NULL COMMENT 'the date and time the patron dismissed the message',
4349 PRIMARY KEY (`message_id`),
4350 KEY `messages_ibfk_1` (`manager_id`),
4351 KEY `messages_borrowernumber` (`borrowernumber`),
4352 CONSTRAINT `messages_borrowernumber` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4353 CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL
4354 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4355 /*!40101 SET character_set_client = @saved_cs_client */;
4358 -- Table structure for table `misc_files`
4361 DROP TABLE IF EXISTS `misc_files`;
4362 /*!40101 SET @saved_cs_client = @@character_set_client */;
4363 /*!40101 SET character_set_client = utf8 */;
4364 CREATE TABLE `misc_files` (
4365 `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the file record',
4366 `table_tag` varchar(255) NOT NULL COMMENT 'usually table name, or arbitrary unique tag',
4367 `record_id` int(11) NOT NULL COMMENT 'record id from the table this file is associated to',
4368 `file_name` varchar(255) NOT NULL COMMENT 'file name',
4369 `file_type` varchar(255) NOT NULL COMMENT 'MIME type of the file',
4370 `file_description` varchar(255) DEFAULT NULL COMMENT 'description given to the file',
4371 `file_content` longblob NOT NULL COMMENT 'file content',
4372 `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
4373 PRIMARY KEY (`file_id`),
4374 KEY `table_tag` (`table_tag`(191)),
4375 KEY `record_id` (`record_id`)
4376 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4377 /*!40101 SET character_set_client = @saved_cs_client */;
4380 -- Table structure for table `need_merge_authorities`
4383 DROP TABLE IF EXISTS `need_merge_authorities`;
4384 /*!40101 SET @saved_cs_client = @@character_set_client */;
4385 /*!40101 SET character_set_client = utf8 */;
4386 CREATE TABLE `need_merge_authorities` (
4387 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id',
4388 `authid` bigint(20) NOT NULL COMMENT 'reference to original authority record',
4389 `authid_new` bigint(20) DEFAULT NULL COMMENT 'reference to optional new authority record',
4390 `reportxml` mediumtext DEFAULT NULL COMMENT 'xml showing original reporting tag',
4391 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time last modified',
4392 `done` tinyint(4) DEFAULT 0,
4394 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4395 /*!40101 SET character_set_client = @saved_cs_client */;
4398 -- Table structure for table `oai_sets`
4401 DROP TABLE IF EXISTS `oai_sets`;
4402 /*!40101 SET @saved_cs_client = @@character_set_client */;
4403 /*!40101 SET character_set_client = utf8 */;
4404 CREATE TABLE `oai_sets` (
4405 `id` int(11) NOT NULL AUTO_INCREMENT,
4406 `spec` varchar(80) NOT NULL,
4407 `name` varchar(80) NOT NULL,
4409 UNIQUE KEY `spec` (`spec`)
4410 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4411 /*!40101 SET character_set_client = @saved_cs_client */;
4414 -- Table structure for table `oai_sets_biblios`
4417 DROP TABLE IF EXISTS `oai_sets_biblios`;
4418 /*!40101 SET @saved_cs_client = @@character_set_client */;
4419 /*!40101 SET character_set_client = utf8 */;
4420 CREATE TABLE `oai_sets_biblios` (
4421 `biblionumber` int(11) NOT NULL,
4422 `set_id` int(11) NOT NULL,
4423 PRIMARY KEY (`biblionumber`,`set_id`),
4424 KEY `oai_sets_biblios_ibfk_2` (`set_id`),
4425 CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4426 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4427 /*!40101 SET character_set_client = @saved_cs_client */;
4430 -- Table structure for table `oai_sets_descriptions`
4433 DROP TABLE IF EXISTS `oai_sets_descriptions`;
4434 /*!40101 SET @saved_cs_client = @@character_set_client */;
4435 /*!40101 SET character_set_client = utf8 */;
4436 CREATE TABLE `oai_sets_descriptions` (
4437 `set_id` int(11) NOT NULL,
4438 `description` varchar(255) NOT NULL,
4439 KEY `oai_sets_descriptions_ibfk_1` (`set_id`),
4440 CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4441 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4442 /*!40101 SET character_set_client = @saved_cs_client */;
4445 -- Table structure for table `oai_sets_mappings`
4448 DROP TABLE IF EXISTS `oai_sets_mappings`;
4449 /*!40101 SET @saved_cs_client = @@character_set_client */;
4450 /*!40101 SET character_set_client = utf8 */;
4451 CREATE TABLE `oai_sets_mappings` (
4452 `set_id` int(11) NOT NULL,
4453 `rule_order` int(11) DEFAULT NULL,
4454 `rule_operator` varchar(3) DEFAULT NULL,
4455 `marcfield` char(3) NOT NULL,
4456 `marcsubfield` char(1) NOT NULL,
4457 `operator` varchar(8) NOT NULL DEFAULT 'equal',
4458 `marcvalue` varchar(80) NOT NULL,
4459 KEY `oai_sets_mappings_ibfk_1` (`set_id`),
4460 CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4461 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4462 /*!40101 SET character_set_client = @saved_cs_client */;
4465 -- Table structure for table `oauth_access_tokens`
4468 DROP TABLE IF EXISTS `oauth_access_tokens`;
4469 /*!40101 SET @saved_cs_client = @@character_set_client */;
4470 /*!40101 SET character_set_client = utf8 */;
4471 CREATE TABLE `oauth_access_tokens` (
4472 `access_token` varchar(191) NOT NULL COMMENT 'generarated access token',
4473 `client_id` varchar(191) NOT NULL COMMENT 'the client id the access token belongs to',
4474 `expires` int(11) NOT NULL COMMENT 'expiration time in seconds',
4475 PRIMARY KEY (`access_token`)
4476 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4477 /*!40101 SET character_set_client = @saved_cs_client */;
4480 -- Table structure for table `old_issues`
4483 DROP TABLE IF EXISTS `old_issues`;
4484 /*!40101 SET @saved_cs_client = @@character_set_client */;
4485 /*!40101 SET character_set_client = utf8 */;
4486 CREATE TABLE `old_issues` (
4487 `issue_id` int(11) NOT NULL COMMENT 'primary key for issues table',
4488 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
4489 `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
4490 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
4491 `date_due` datetime DEFAULT NULL COMMENT 'date the item is due (yyyy-mm-dd)',
4492 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
4493 `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned',
4494 `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
4495 `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
4496 `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
4497 `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
4498 `auto_renew_error` varchar(32) DEFAULT NULL COMMENT 'automatic renewal error',
4499 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
4500 `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
4501 `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
4502 `note` longtext DEFAULT NULL COMMENT 'issue note text',
4503 `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
4504 `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
4505 PRIMARY KEY (`issue_id`),
4506 KEY `old_issuesborridx` (`borrowernumber`),
4507 KEY `old_issuesitemidx` (`itemnumber`),
4508 KEY `branchcode_idx` (`branchcode`),
4509 KEY `old_bordate` (`borrowernumber`,`timestamp`),
4510 KEY `old_issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
4511 CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4512 CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4513 CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL 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 `old_reserves`
4521 DROP TABLE IF EXISTS `old_reserves`;
4522 /*!40101 SET @saved_cs_client = @@character_set_client */;
4523 /*!40101 SET character_set_client = utf8 */;
4524 CREATE TABLE `old_reserves` (
4525 `reserve_id` int(11) NOT NULL COMMENT 'primary key',
4526 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4527 `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places',
4528 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4529 `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
4530 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
4531 `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4532 `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4533 `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4534 `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4535 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4536 `reservenotes` longtext DEFAULT NULL COMMENT 'notes related to this hold',
4537 `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4538 `found` varchar(1) DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
4539 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4540 `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',
4541 `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4542 `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)',
4543 `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',
4544 `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)',
4545 `suspend` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'in this hold suspended (1 for yes, 0 for no)',
4546 `suspend_until` datetime DEFAULT NULL COMMENT 'the date this hold is suspended until (NULL for infinitely)',
4547 `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4548 `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
4549 `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4550 PRIMARY KEY (`reserve_id`),
4551 KEY `old_reserves_borrowernumber` (`borrowernumber`),
4552 KEY `old_reserves_biblionumber` (`biblionumber`),
4553 KEY `old_reserves_itemnumber` (`itemnumber`),
4554 KEY `old_reserves_branchcode` (`branchcode`),
4555 KEY `old_reserves_itemtype` (`itemtype`),
4556 KEY `old_reserves_ibfk_ig` (`item_group_id`),
4557 CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4558 CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4559 CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4560 CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL,
4561 CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL
4562 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4563 /*!40101 SET character_set_client = @saved_cs_client */;
4566 -- Table structure for table `overduerules`
4569 DROP TABLE IF EXISTS `overduerules`;
4570 /*!40101 SET @saved_cs_client = @@character_set_client */;
4571 /*!40101 SET character_set_client = utf8 */;
4572 CREATE TABLE `overduerules` (
4573 `overduerules_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the overduerules',
4574 `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)',
4575 `categorycode` varchar(10) NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table to define which patron category this rule is for',
4576 `delay1` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the first notice is sent',
4577 `letter1` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the first notice',
4578 `debarred1` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the first notice is sent (1 for yes, 0 for no)',
4579 `delay2` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the second notice is sent',
4580 `debarred2` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the second notice is sent (1 for yes, 0 for no)',
4581 `letter2` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the second notice',
4582 `delay3` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the third notice is sent',
4583 `letter3` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the third notice',
4584 `debarred3` int(1) DEFAULT 0 COMMENT 'is the patron restricted when the third notice is sent (1 for yes, 0 for no)',
4585 PRIMARY KEY (`overduerules_id`),
4586 UNIQUE KEY `overduerules_branch_cat` (`branchcode`,`categorycode`)
4587 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4588 /*!40101 SET character_set_client = @saved_cs_client */;
4591 -- Table structure for table `overduerules_transport_types`
4594 DROP TABLE IF EXISTS `overduerules_transport_types`;
4595 /*!40101 SET @saved_cs_client = @@character_set_client */;
4596 /*!40101 SET character_set_client = utf8 */;
4597 CREATE TABLE `overduerules_transport_types` (
4598 `id` int(11) NOT NULL AUTO_INCREMENT,
4599 `letternumber` int(1) NOT NULL DEFAULT 1,
4600 `message_transport_type` varchar(20) NOT NULL DEFAULT 'email',
4601 `overduerules_id` int(11) NOT NULL,
4603 KEY `overduerules_fk` (`overduerules_id`),
4604 KEY `mtt_fk` (`message_transport_type`),
4605 CONSTRAINT `mtt_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
4606 CONSTRAINT `overduerules_fk` FOREIGN KEY (`overduerules_id`) REFERENCES `overduerules` (`overduerules_id`) ON DELETE CASCADE ON UPDATE CASCADE
4607 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4608 /*!40101 SET character_set_client = @saved_cs_client */;
4611 -- Table structure for table `patron_consent`
4614 DROP TABLE IF EXISTS `patron_consent`;
4615 /*!40101 SET @saved_cs_client = @@character_set_client */;
4616 /*!40101 SET character_set_client = utf8 */;
4617 CREATE TABLE `patron_consent` (
4618 `id` int(11) NOT NULL AUTO_INCREMENT,
4619 `borrowernumber` int(11) NOT NULL,
4620 `type` enum('GDPR_PROCESSING') DEFAULT NULL COMMENT 'allows for future extension',
4621 `given_on` datetime DEFAULT NULL,
4622 `refused_on` datetime DEFAULT NULL,
4624 KEY `borrowernumber` (`borrowernumber`),
4625 CONSTRAINT `patron_consent_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4626 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4627 /*!40101 SET character_set_client = @saved_cs_client */;
4630 -- Table structure for table `patron_list_patrons`
4633 DROP TABLE IF EXISTS `patron_list_patrons`;
4634 /*!40101 SET @saved_cs_client = @@character_set_client */;
4635 /*!40101 SET character_set_client = utf8 */;
4636 CREATE TABLE `patron_list_patrons` (
4637 `patron_list_patron_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
4638 `patron_list_id` int(11) NOT NULL COMMENT 'the list this entry is part of',
4639 `borrowernumber` int(11) NOT NULL COMMENT 'the borrower that is part of this list',
4640 PRIMARY KEY (`patron_list_patron_id`),
4641 KEY `patron_list_id` (`patron_list_id`),
4642 KEY `borrowernumber` (`borrowernumber`),
4643 CONSTRAINT `patron_list_patrons_ibfk_1` FOREIGN KEY (`patron_list_id`) REFERENCES `patron_lists` (`patron_list_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4644 CONSTRAINT `patron_list_patrons_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4645 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4646 /*!40101 SET character_set_client = @saved_cs_client */;
4649 -- Table structure for table `patron_lists`
4652 DROP TABLE IF EXISTS `patron_lists`;
4653 /*!40101 SET @saved_cs_client = @@character_set_client */;
4654 /*!40101 SET character_set_client = utf8 */;
4655 CREATE TABLE `patron_lists` (
4656 `patron_list_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
4657 `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'the list''s name',
4658 `owner` int(11) NOT NULL COMMENT 'borrowernumber of the list creator',
4659 `shared` tinyint(1) DEFAULT 0,
4660 PRIMARY KEY (`patron_list_id`),
4661 KEY `owner` (`owner`),
4662 CONSTRAINT `patron_lists_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4663 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4664 /*!40101 SET character_set_client = @saved_cs_client */;
4667 -- Table structure for table `patronimage`
4670 DROP TABLE IF EXISTS `patronimage`;
4671 /*!40101 SET @saved_cs_client = @@character_set_client */;
4672 /*!40101 SET character_set_client = utf8 */;
4673 CREATE TABLE `patronimage` (
4674 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron this image is attached to (borrowers.borrowernumber)',
4675 `mimetype` varchar(15) NOT NULL COMMENT 'the format of the image (png, jpg, etc)',
4676 `imagefile` mediumblob NOT NULL COMMENT 'the image',
4677 PRIMARY KEY (`borrowernumber`),
4678 CONSTRAINT `patronimage_fk1` 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 `pending_offline_operations`
4686 DROP TABLE IF EXISTS `pending_offline_operations`;
4687 /*!40101 SET @saved_cs_client = @@character_set_client */;
4688 /*!40101 SET character_set_client = utf8 */;
4689 CREATE TABLE `pending_offline_operations` (
4690 `operationid` int(11) NOT NULL AUTO_INCREMENT,
4691 `userid` varchar(30) NOT NULL,
4692 `branchcode` varchar(10) NOT NULL,
4693 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
4694 `action` varchar(10) NOT NULL,
4695 `barcode` varchar(20) DEFAULT NULL,
4696 `cardnumber` varchar(32) DEFAULT NULL,
4697 `amount` decimal(28,6) DEFAULT NULL,
4698 PRIMARY KEY (`operationid`)
4699 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4700 /*!40101 SET character_set_client = @saved_cs_client */;
4703 -- Table structure for table `permissions`
4706 DROP TABLE IF EXISTS `permissions`;
4707 /*!40101 SET @saved_cs_client = @@character_set_client */;
4708 /*!40101 SET character_set_client = utf8 */;
4709 CREATE TABLE `permissions` (
4710 `module_bit` int(11) NOT NULL DEFAULT 0,
4711 `code` varchar(64) NOT NULL DEFAULT '',
4712 `description` varchar(255) DEFAULT NULL,
4713 PRIMARY KEY (`module_bit`,`code`),
4714 CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`) ON DELETE CASCADE ON UPDATE CASCADE
4715 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4716 /*!40101 SET character_set_client = @saved_cs_client */;
4719 -- Table structure for table `plugin_data`
4722 DROP TABLE IF EXISTS `plugin_data`;
4723 /*!40101 SET @saved_cs_client = @@character_set_client */;
4724 /*!40101 SET character_set_client = utf8 */;
4725 CREATE TABLE `plugin_data` (
4726 `plugin_class` varchar(255) NOT NULL,
4727 `plugin_key` varchar(255) NOT NULL,
4728 `plugin_value` mediumtext DEFAULT NULL,
4729 PRIMARY KEY (`plugin_class`(191),`plugin_key`(191))
4730 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4731 /*!40101 SET character_set_client = @saved_cs_client */;
4734 -- Table structure for table `plugin_methods`
4737 DROP TABLE IF EXISTS `plugin_methods`;
4738 /*!40101 SET @saved_cs_client = @@character_set_client */;
4739 /*!40101 SET character_set_client = utf8 */;
4740 CREATE TABLE `plugin_methods` (
4741 `plugin_class` varchar(255) NOT NULL,
4742 `plugin_method` varchar(255) NOT NULL,
4743 PRIMARY KEY (`plugin_class`(191),`plugin_method`(191))
4744 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4745 /*!40101 SET character_set_client = @saved_cs_client */;
4748 -- Table structure for table `printers_profile`
4751 DROP TABLE IF EXISTS `printers_profile`;
4752 /*!40101 SET @saved_cs_client = @@character_set_client */;
4753 /*!40101 SET character_set_client = utf8 */;
4754 CREATE TABLE `printers_profile` (
4755 `profile_id` int(4) NOT NULL AUTO_INCREMENT,
4756 `printer_name` varchar(40) NOT NULL DEFAULT 'Default Printer',
4757 `template_id` int(4) NOT NULL DEFAULT 0,
4758 `paper_bin` varchar(20) NOT NULL DEFAULT 'Bypass',
4759 `offset_horz` float NOT NULL DEFAULT 0,
4760 `offset_vert` float NOT NULL DEFAULT 0,
4761 `creep_horz` float NOT NULL DEFAULT 0,
4762 `creep_vert` float NOT NULL DEFAULT 0,
4763 `units` char(20) NOT NULL DEFAULT 'POINT',
4764 `creator` char(15) NOT NULL DEFAULT 'Labels',
4765 PRIMARY KEY (`profile_id`),
4766 UNIQUE KEY `printername` (`printer_name`,`template_id`,`paper_bin`,`creator`)
4767 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4768 /*!40101 SET character_set_client = @saved_cs_client */;
4771 -- Table structure for table `problem_reports`
4774 DROP TABLE IF EXISTS `problem_reports`;
4775 /*!40101 SET @saved_cs_client = @@character_set_client */;
4776 /*!40101 SET character_set_client = utf8 */;
4777 CREATE TABLE `problem_reports` (
4778 `reportid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4779 `title` varchar(40) NOT NULL DEFAULT '' COMMENT 'report subject line',
4780 `content` text NOT NULL COMMENT 'report message content',
4781 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the user who created the problem report',
4782 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'borrower''s branch',
4783 `username` varchar(75) DEFAULT NULL COMMENT 'OPAC username',
4784 `problempage` text DEFAULT NULL COMMENT 'page the user triggered the problem report form from',
4785 `recipient` enum('admin','library') NOT NULL DEFAULT 'library' COMMENT 'the ''to-address'' of the problem report',
4786 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'timestamp of report submission',
4787 `status` varchar(6) NOT NULL DEFAULT 'New' COMMENT 'status of the report. New, Viewed, Closed',
4788 PRIMARY KEY (`reportid`),
4789 KEY `problem_reports_ibfk1` (`borrowernumber`),
4790 KEY `problem_reports_ibfk2` (`branchcode`),
4791 CONSTRAINT `problem_reports_ibfk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4792 CONSTRAINT `problem_reports_ibfk2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4793 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4794 /*!40101 SET character_set_client = @saved_cs_client */;
4797 -- Table structure for table `pseudonymized_borrower_attributes`
4800 DROP TABLE IF EXISTS `pseudonymized_borrower_attributes`;
4801 /*!40101 SET @saved_cs_client = @@character_set_client */;
4802 /*!40101 SET character_set_client = utf8 */;
4803 CREATE TABLE `pseudonymized_borrower_attributes` (
4804 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
4805 `transaction_id` int(11) NOT NULL,
4806 `code` varchar(10) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
4807 `attribute` varchar(255) DEFAULT NULL COMMENT 'custom patron field value',
4809 KEY `pseudonymized_borrower_attributes_ibfk_1` (`transaction_id`),
4810 KEY `anonymized_borrower_attributes_ibfk_2` (`code`),
4811 CONSTRAINT `anonymized_borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
4812 CONSTRAINT `pseudonymized_borrower_attributes_ibfk_1` FOREIGN KEY (`transaction_id`) REFERENCES `pseudonymized_transactions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4813 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4814 /*!40101 SET character_set_client = @saved_cs_client */;
4817 -- Table structure for table `pseudonymized_transactions`
4820 DROP TABLE IF EXISTS `pseudonymized_transactions`;
4821 /*!40101 SET @saved_cs_client = @@character_set_client */;
4822 /*!40101 SET character_set_client = utf8 */;
4823 CREATE TABLE `pseudonymized_transactions` (
4824 `id` int(11) NOT NULL AUTO_INCREMENT,
4825 `hashed_borrowernumber` varchar(60) NOT NULL,
4826 `has_cardnumber` tinyint(1) NOT NULL DEFAULT 0,
4827 `title` longtext DEFAULT NULL,
4828 `city` longtext DEFAULT NULL,
4829 `state` mediumtext DEFAULT NULL,
4830 `zipcode` varchar(25) DEFAULT NULL,
4831 `country` mediumtext DEFAULT NULL,
4832 `branchcode` varchar(10) NOT NULL DEFAULT '',
4833 `categorycode` varchar(10) NOT NULL DEFAULT '',
4834 `dateenrolled` date DEFAULT NULL,
4835 `sex` varchar(1) DEFAULT NULL,
4836 `sort1` varchar(80) DEFAULT NULL,
4837 `sort2` varchar(80) DEFAULT NULL,
4838 `datetime` datetime DEFAULT NULL,
4839 `transaction_branchcode` varchar(10) DEFAULT NULL,
4840 `transaction_type` varchar(16) DEFAULT NULL,
4841 `itemnumber` int(11) DEFAULT NULL,
4842 `itemtype` varchar(10) DEFAULT NULL,
4843 `holdingbranch` varchar(10) DEFAULT NULL,
4844 `homebranch` varchar(10) DEFAULT NULL,
4845 `location` varchar(80) DEFAULT NULL,
4846 `itemcallnumber` varchar(255) DEFAULT NULL,
4847 `ccode` varchar(80) DEFAULT NULL,
4849 KEY `pseudonymized_transactions_ibfk_1` (`categorycode`),
4850 KEY `pseudonymized_transactions_borrowers_ibfk_2` (`branchcode`),
4851 KEY `pseudonymized_transactions_borrowers_ibfk_3` (`transaction_branchcode`)
4852 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4853 /*!40101 SET character_set_client = @saved_cs_client */;
4856 -- Table structure for table `quotes`
4859 DROP TABLE IF EXISTS `quotes`;
4860 /*!40101 SET @saved_cs_client = @@character_set_client */;
4861 /*!40101 SET character_set_client = utf8 */;
4862 CREATE TABLE `quotes` (
4863 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the quote',
4864 `source` mediumtext DEFAULT NULL COMMENT 'source/credit for the quote',
4865 `text` longtext NOT NULL COMMENT 'text of the quote',
4866 `timestamp` datetime DEFAULT NULL COMMENT 'date and time that the quote last appeared in the opac',
4868 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4869 /*!40101 SET character_set_client = @saved_cs_client */;
4872 -- Table structure for table `ratings`
4875 DROP TABLE IF EXISTS `ratings`;
4876 /*!40101 SET @saved_cs_client = @@character_set_client */;
4877 /*!40101 SET character_set_client = utf8 */;
4878 CREATE TABLE `ratings` (
4879 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron who left this rating (borrowers.borrowernumber)',
4880 `biblionumber` int(11) NOT NULL COMMENT 'the biblio this rating is for (biblio.biblionumber)',
4881 `rating_value` tinyint(1) NOT NULL COMMENT 'the rating, from 1 to 5',
4882 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
4883 PRIMARY KEY (`borrowernumber`,`biblionumber`),
4884 KEY `ratings_ibfk_2` (`biblionumber`),
4885 CONSTRAINT `ratings_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4886 CONSTRAINT `ratings_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
4887 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4888 /*!40101 SET character_set_client = @saved_cs_client */;
4891 -- Table structure for table `recalls`
4894 DROP TABLE IF EXISTS `recalls`;
4895 /*!40101 SET @saved_cs_client = @@character_set_client */;
4896 /*!40101 SET character_set_client = utf8 */;
4897 CREATE TABLE `recalls` (
4898 `recall_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier for this recall',
4899 `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Identifier for patron who requested recall',
4900 `created_date` datetime DEFAULT NULL COMMENT 'Date the recall was requested',
4901 `biblio_id` int(11) NOT NULL COMMENT 'Identifier for bibliographic record that has been recalled',
4902 `pickup_library_id` varchar(10) DEFAULT NULL COMMENT 'Identifier for recall pickup library',
4903 `completed_date` datetime DEFAULT NULL COMMENT 'Date the recall is completed (fulfilled, cancelled or expired)',
4904 `notes` mediumtext DEFAULT NULL COMMENT 'Notes related to the recall',
4905 `priority` smallint(6) DEFAULT NULL COMMENT 'Where in the queue the patron sits',
4906 `status` enum('requested','overdue','waiting','in_transit','cancelled','expired','fulfilled') DEFAULT 'requested' COMMENT 'Status of recall',
4907 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time the recall was last updated',
4908 `item_id` int(11) DEFAULT NULL COMMENT 'Identifier for item record that was recalled, if an item-level recall',
4909 `waiting_date` datetime DEFAULT NULL COMMENT 'Date an item was marked as waiting for the patron at the library',
4910 `expiration_date` datetime DEFAULT NULL COMMENT 'Date recall is no longer required, or date recall will expire after waiting on shelf for pickup',
4911 `completed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is old and no longer active, i.e. expired, cancelled or completed',
4912 `item_level` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is for a specific item',
4913 PRIMARY KEY (`recall_id`),
4914 KEY `recalls_ibfk_1` (`patron_id`),
4915 KEY `recalls_ibfk_2` (`biblio_id`),
4916 KEY `recalls_ibfk_3` (`item_id`),
4917 KEY `recalls_ibfk_4` (`pickup_library_id`),
4918 CONSTRAINT `recalls_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4919 CONSTRAINT `recalls_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4920 CONSTRAINT `recalls_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4921 CONSTRAINT `recalls_ibfk_4` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4922 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Information related to recalls in Koha';
4923 /*!40101 SET character_set_client = @saved_cs_client */;
4926 -- Table structure for table `repeatable_holidays`
4929 DROP TABLE IF EXISTS `repeatable_holidays`;
4930 /*!40101 SET @saved_cs_client = @@character_set_client */;
4931 /*!40101 SET character_set_client = utf8 */;
4932 CREATE TABLE `repeatable_holidays` (
4933 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4934 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
4935 `weekday` smallint(6) DEFAULT NULL COMMENT 'day of the week (0=Sunday, 1=Monday, etc) this closing is repeated on',
4936 `day` smallint(6) DEFAULT NULL COMMENT 'day of the month this closing is on',
4937 `month` smallint(6) DEFAULT NULL COMMENT 'month this closing is in',
4938 `title` varchar(50) NOT NULL DEFAULT '' COMMENT 'title of this closing',
4939 `description` mediumtext NOT NULL COMMENT 'description for this closing',
4941 KEY `repeatable_holidays_ibfk_1` (`branchcode`),
4942 CONSTRAINT `repeatable_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4943 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4944 /*!40101 SET character_set_client = @saved_cs_client */;
4947 -- Table structure for table `reports_dictionary`
4950 DROP TABLE IF EXISTS `reports_dictionary`;
4951 /*!40101 SET @saved_cs_client = @@character_set_client */;
4952 /*!40101 SET character_set_client = utf8 */;
4953 CREATE TABLE `reports_dictionary` (
4954 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4955 `name` varchar(255) DEFAULT NULL COMMENT 'name for this definition',
4956 `description` mediumtext DEFAULT NULL COMMENT 'description for this definition',
4957 `date_created` datetime DEFAULT NULL COMMENT 'date and time this definition was created',
4958 `date_modified` datetime DEFAULT NULL COMMENT 'date and time this definition was last modified',
4959 `saved_sql` mediumtext DEFAULT NULL COMMENT 'SQL snippet for us in reports',
4960 `report_area` varchar(6) DEFAULT NULL COMMENT 'Koha module this definition is for Circulation, Catalog, Patrons, Acquistions, Accounts)',
4962 KEY `dictionary_area_idx` (`report_area`)
4963 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4964 /*!40101 SET character_set_client = @saved_cs_client */;
4967 -- Table structure for table `reserves`
4970 DROP TABLE IF EXISTS `reserves`;
4971 /*!40101 SET @saved_cs_client = @@character_set_client */;
4972 /*!40101 SET character_set_client = utf8 */;
4973 CREATE TABLE `reserves` (
4974 `reserve_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4975 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4976 `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
4977 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4978 `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
4979 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
4980 `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4981 `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4982 `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4983 `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4984 `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4985 `reservenotes` longtext DEFAULT NULL COMMENT 'notes related to this hold',
4986 `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4987 `found` varchar(1) DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
4988 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4989 `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',
4990 `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4991 `expirationdate` date DEFAULT NULL COMMENT 'the date the hold expires (calculated value)',
4992 `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',
4993 `lowestPriority` tinyint(1) NOT NULL DEFAULT 0,
4994 `suspend` tinyint(1) NOT NULL DEFAULT 0,
4995 `suspend_until` datetime DEFAULT NULL,
4996 `itemtype` varchar(10) DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4997 `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold placed at item level',
4998 `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4999 PRIMARY KEY (`reserve_id`),
5000 KEY `priorityfoundidx` (`priority`,`found`),
5001 KEY `borrowernumber` (`borrowernumber`),
5002 KEY `biblionumber` (`biblionumber`),
5003 KEY `itemnumber` (`itemnumber`),
5004 KEY `branchcode` (`branchcode`),
5005 KEY `desk_id` (`desk_id`),
5006 KEY `itemtype` (`itemtype`),
5007 KEY `reserves_ibfk_ig` (`item_group_id`),
5008 CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5009 CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5010 CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5011 CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5012 CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
5013 CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5014 CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE
5015 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5016 /*!40101 SET character_set_client = @saved_cs_client */;
5019 -- Table structure for table `restriction_types`
5022 DROP TABLE IF EXISTS `restriction_types`;
5023 /*!40101 SET @saved_cs_client = @@character_set_client */;
5024 /*!40101 SET character_set_client = utf8 */;
5025 CREATE TABLE `restriction_types` (
5026 `code` varchar(50) NOT NULL,
5027 `display_text` text NOT NULL,
5028 `is_system` tinyint(1) NOT NULL DEFAULT 0,
5029 `is_default` tinyint(1) NOT NULL DEFAULT 0,
5030 PRIMARY KEY (`code`)
5031 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5032 /*!40101 SET character_set_client = @saved_cs_client */;
5035 -- Table structure for table `return_claims`
5038 DROP TABLE IF EXISTS `return_claims`;
5039 /*!40101 SET @saved_cs_client = @@character_set_client */;
5040 /*!40101 SET character_set_client = utf8 */;
5041 CREATE TABLE `return_claims` (
5042 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the return claim',
5043 `itemnumber` int(11) NOT NULL COMMENT 'ID of the item',
5044 `issue_id` int(11) DEFAULT NULL COMMENT 'ID of the checkout that triggered the claim',
5045 `borrowernumber` int(11) NOT NULL COMMENT 'ID of the patron',
5046 `notes` mediumtext DEFAULT NULL COMMENT 'Notes about the claim',
5047 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was created',
5048 `created_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that registered the claim',
5049 `updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the claim (notes)',
5050 `updated_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that updated the claim',
5051 `resolution` varchar(80) DEFAULT NULL COMMENT 'Resolution code (RETURN_CLAIM_RESOLUTION AVs)',
5052 `resolved_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was resolved',
5053 `resolved_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that resolved the claim',
5055 UNIQUE KEY `item_issue` (`itemnumber`,`issue_id`),
5056 KEY `itemnumber` (`itemnumber`),
5057 KEY `rc_borrowers_ibfk` (`borrowernumber`),
5058 KEY `rc_created_by_ibfk` (`created_by`),
5059 KEY `rc_updated_by_ibfk` (`updated_by`),
5060 KEY `rc_resolved_by_ibfk` (`resolved_by`),
5061 CONSTRAINT `rc_borrowers_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5062 CONSTRAINT `rc_created_by_ibfk` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5063 CONSTRAINT `rc_items_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5064 CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5065 CONSTRAINT `rc_updated_by_ibfk` FOREIGN KEY (`updated_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5066 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5067 /*!40101 SET character_set_client = @saved_cs_client */;
5070 -- Table structure for table `reviews`
5073 DROP TABLE IF EXISTS `reviews`;
5074 /*!40101 SET @saved_cs_client = @@character_set_client */;
5075 /*!40101 SET character_set_client = utf8 */;
5076 CREATE TABLE `reviews` (
5077 `reviewid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for this comment',
5078 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron left this comment',
5079 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bibliographic record this comment is for',
5080 `review` mediumtext DEFAULT NULL COMMENT 'the body of the comment',
5081 `approved` tinyint(4) DEFAULT 0 COMMENT 'whether this comment has been approved by a librarian (1 for yes, 0 for no)',
5082 `datereviewed` datetime DEFAULT NULL COMMENT 'the date the comment was left',
5083 PRIMARY KEY (`reviewid`),
5084 KEY `reviews_ibfk_1` (`borrowernumber`),
5085 KEY `reviews_ibfk_2` (`biblionumber`),
5086 CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5087 CONSTRAINT `reviews_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5088 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5089 /*!40101 SET character_set_client = @saved_cs_client */;
5092 -- Table structure for table `saved_reports`
5095 DROP TABLE IF EXISTS `saved_reports`;
5096 /*!40101 SET @saved_cs_client = @@character_set_client */;
5097 /*!40101 SET character_set_client = utf8 */;
5098 CREATE TABLE `saved_reports` (
5099 `id` int(11) NOT NULL AUTO_INCREMENT,
5100 `report_id` int(11) DEFAULT NULL,
5101 `report` longtext DEFAULT NULL,
5102 `date_run` datetime DEFAULT NULL,
5104 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5105 /*!40101 SET character_set_client = @saved_cs_client */;
5108 -- Table structure for table `saved_sql`
5111 DROP TABLE IF EXISTS `saved_sql`;
5112 /*!40101 SET @saved_cs_client = @@character_set_client */;
5113 /*!40101 SET character_set_client = utf8 */;
5114 CREATE TABLE `saved_sql` (
5115 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key assigned by Koha',
5116 `borrowernumber` int(11) DEFAULT NULL COMMENT 'the staff member who created this report (borrowers.borrowernumber)',
5117 `date_created` datetime DEFAULT NULL COMMENT 'the date this report was created',
5118 `last_modified` datetime DEFAULT NULL COMMENT 'the date this report was last edited',
5119 `savedsql` mediumtext DEFAULT NULL COMMENT 'the SQL for this report',
5120 `last_run` datetime DEFAULT NULL,
5121 `report_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'the name of this report',
5122 `type` varchar(255) DEFAULT NULL COMMENT 'always 1 for tabular',
5123 `notes` mediumtext DEFAULT NULL COMMENT 'the notes or description given to this report',
5124 `cache_expiry` int(11) NOT NULL DEFAULT 300,
5125 `public` tinyint(1) NOT NULL DEFAULT 0,
5126 `report_area` varchar(6) DEFAULT NULL,
5127 `report_group` varchar(80) DEFAULT NULL,
5128 `report_subgroup` varchar(80) DEFAULT NULL,
5129 `mana_id` int(11) DEFAULT NULL,
5131 KEY `sql_area_group_idx` (`report_group`,`report_subgroup`),
5132 KEY `boridx` (`borrowernumber`)
5133 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5134 /*!40101 SET character_set_client = @saved_cs_client */;
5137 -- Table structure for table `search_field`
5140 DROP TABLE IF EXISTS `search_field`;
5141 /*!40101 SET @saved_cs_client = @@character_set_client */;
5142 /*!40101 SET character_set_client = utf8 */;
5143 CREATE TABLE `search_field` (
5144 `id` int(11) NOT NULL AUTO_INCREMENT,
5145 `name` varchar(255) NOT NULL COMMENT 'the name of the field as it will be stored in the search engine',
5146 `label` varchar(255) NOT NULL COMMENT 'the human readable name of the field, for display',
5147 `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',
5148 `weight` decimal(5,2) DEFAULT NULL,
5149 `facet_order` tinyint(4) DEFAULT NULL COMMENT 'the order place of the field in facet list if faceted',
5150 `staff_client` tinyint(1) NOT NULL DEFAULT 1,
5151 `opac` tinyint(1) NOT NULL DEFAULT 1,
5152 `mandatory` tinyint(1) DEFAULT NULL COMMENT 'if marked this field is not editable or removable',
5154 UNIQUE KEY `name` (`name`(191))
5155 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5156 /*!40101 SET character_set_client = @saved_cs_client */;
5159 -- Table structure for table `search_filters`
5162 DROP TABLE IF EXISTS `search_filters`;
5163 /*!40101 SET @saved_cs_client = @@character_set_client */;
5164 /*!40101 SET character_set_client = utf8 */;
5165 CREATE TABLE `search_filters` (
5166 `search_filter_id` int(11) NOT NULL AUTO_INCREMENT,
5167 `name` varchar(255) NOT NULL COMMENT 'filter name',
5168 `query` mediumtext DEFAULT NULL COMMENT 'filter query part',
5169 `limits` mediumtext DEFAULT NULL COMMENT 'filter limits part',
5170 `opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown on OPAC',
5171 `staff_client` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown in staff client',
5172 PRIMARY KEY (`search_filter_id`)
5173 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5174 /*!40101 SET character_set_client = @saved_cs_client */;
5177 -- Table structure for table `search_history`
5180 DROP TABLE IF EXISTS `search_history`;
5181 /*!40101 SET @saved_cs_client = @@character_set_client */;
5182 /*!40101 SET character_set_client = utf8 */;
5183 CREATE TABLE `search_history` (
5184 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'search history id',
5185 `userid` int(11) NOT NULL COMMENT 'the patron who performed the search (borrowers.borrowernumber)',
5186 `sessionid` varchar(32) NOT NULL COMMENT 'a system generated session id',
5187 `query_desc` varchar(255) NOT NULL COMMENT 'the search that was performed',
5188 `query_cgi` mediumtext NOT NULL COMMENT 'the string to append to the search url to rerun the search',
5189 `type` varchar(16) NOT NULL DEFAULT 'biblio' COMMENT 'search type, must be ''biblio'' or ''authority''',
5190 `total` int(11) NOT NULL COMMENT 'the total of results found',
5191 `time` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the search was run',
5193 KEY `userid` (`userid`),
5194 KEY `sessionid` (`sessionid`)
5195 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Opac search history results';
5196 /*!40101 SET character_set_client = @saved_cs_client */;
5199 -- Table structure for table `search_marc_map`
5202 DROP TABLE IF EXISTS `search_marc_map`;
5203 /*!40101 SET @saved_cs_client = @@character_set_client */;
5204 /*!40101 SET character_set_client = utf8 */;
5205 CREATE TABLE `search_marc_map` (
5206 `id` int(11) NOT NULL AUTO_INCREMENT,
5207 `index_name` enum('biblios','authorities') NOT NULL COMMENT 'what storage index this map is for',
5208 `marc_type` enum('marc21','unimarc') NOT NULL COMMENT 'what MARC type this map is for',
5209 `marc_field` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the MARC specifier for this field',
5211 UNIQUE KEY `index_name` (`index_name`,`marc_field`(191),`marc_type`),
5212 KEY `index_name_2` (`index_name`)
5213 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5214 /*!40101 SET character_set_client = @saved_cs_client */;
5217 -- Table structure for table `search_marc_to_field`
5220 DROP TABLE IF EXISTS `search_marc_to_field`;
5221 /*!40101 SET @saved_cs_client = @@character_set_client */;
5222 /*!40101 SET character_set_client = utf8 */;
5223 CREATE TABLE `search_marc_to_field` (
5224 `search` tinyint(1) NOT NULL DEFAULT 1,
5225 `search_marc_map_id` int(11) NOT NULL,
5226 `search_field_id` int(11) NOT NULL,
5227 `facet` tinyint(1) DEFAULT 0 COMMENT 'true if a facet field should be generated for this',
5228 `suggestible` tinyint(1) DEFAULT 0 COMMENT 'true if this field can be used to generate suggestions for browse',
5229 `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',
5230 PRIMARY KEY (`search_marc_map_id`,`search_field_id`),
5231 KEY `search_field_id` (`search_field_id`),
5232 CONSTRAINT `search_marc_to_field_ibfk_1` FOREIGN KEY (`search_marc_map_id`) REFERENCES `search_marc_map` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
5233 CONSTRAINT `search_marc_to_field_ibfk_2` FOREIGN KEY (`search_field_id`) REFERENCES `search_field` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
5234 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5235 /*!40101 SET character_set_client = @saved_cs_client */;
5238 -- Table structure for table `serial`
5241 DROP TABLE IF EXISTS `serial`;
5242 /*!40101 SET @saved_cs_client = @@character_set_client */;
5243 /*!40101 SET character_set_client = utf8 */;
5244 CREATE TABLE `serial` (
5245 `serialid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the issue',
5246 `biblionumber` int(11) NOT NULL COMMENT 'foreign key for the biblio.biblionumber that this issue is attached to',
5247 `subscriptionid` int(11) NOT NULL COMMENT 'foreign key to the subscription.subscriptionid that this issue is part of',
5248 `serialseq` varchar(100) NOT NULL DEFAULT '' COMMENT 'issue information (volume, number, etc)',
5249 `serialseq_x` varchar(100) DEFAULT NULL COMMENT 'first part of issue information',
5250 `serialseq_y` varchar(100) DEFAULT NULL COMMENT 'second part of issue information',
5251 `serialseq_z` varchar(100) DEFAULT NULL COMMENT 'third part of issue information',
5252 `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'status code for this issue (see manual for full descriptions)',
5253 `planneddate` date DEFAULT NULL COMMENT 'date expected',
5254 `notes` mediumtext DEFAULT NULL COMMENT 'notes',
5255 `publisheddate` date DEFAULT NULL COMMENT 'date published',
5256 `publisheddatetext` varchar(100) DEFAULT NULL COMMENT 'date published (descriptive)',
5257 `claimdate` date DEFAULT NULL COMMENT 'date claimed',
5258 `claims_count` int(11) DEFAULT 0 COMMENT 'number of claims made related to this issue',
5259 `routingnotes` mediumtext DEFAULT NULL COMMENT 'notes from the routing list',
5260 PRIMARY KEY (`serialid`),
5261 KEY `serial_ibfk_1` (`biblionumber`),
5262 KEY `serial_ibfk_2` (`subscriptionid`),
5263 CONSTRAINT `serial_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5264 CONSTRAINT `serial_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5265 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5266 /*!40101 SET character_set_client = @saved_cs_client */;
5269 -- Table structure for table `serialitems`
5272 DROP TABLE IF EXISTS `serialitems`;
5273 /*!40101 SET @saved_cs_client = @@character_set_client */;
5274 /*!40101 SET character_set_client = utf8 */;
5275 CREATE TABLE `serialitems` (
5276 `itemnumber` int(11) NOT NULL,
5277 `serialid` int(11) NOT NULL,
5278 PRIMARY KEY (`itemnumber`),
5279 KEY `serialitems_sfk_1` (`serialid`),
5280 CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE,
5281 CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
5282 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5283 /*!40101 SET character_set_client = @saved_cs_client */;
5286 -- Table structure for table `sessions`
5289 DROP TABLE IF EXISTS `sessions`;
5290 /*!40101 SET @saved_cs_client = @@character_set_client */;
5291 /*!40101 SET character_set_client = utf8 */;
5292 CREATE TABLE `sessions` (
5293 `id` varchar(32) NOT NULL,
5294 `a_session` longblob NOT NULL,
5296 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5297 /*!40101 SET character_set_client = @saved_cs_client */;
5300 -- Table structure for table `sms_providers`
5303 DROP TABLE IF EXISTS `sms_providers`;
5304 /*!40101 SET @saved_cs_client = @@character_set_client */;
5305 /*!40101 SET character_set_client = utf8 */;
5306 CREATE TABLE `sms_providers` (
5307 `id` int(11) NOT NULL AUTO_INCREMENT,
5308 `name` varchar(255) NOT NULL,
5309 `domain` varchar(255) NOT NULL,
5311 UNIQUE KEY `name` (`name`(191))
5312 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5313 /*!40101 SET character_set_client = @saved_cs_client */;
5316 -- Table structure for table `smtp_servers`
5319 DROP TABLE IF EXISTS `smtp_servers`;
5320 /*!40101 SET @saved_cs_client = @@character_set_client */;
5321 /*!40101 SET character_set_client = utf8 */;
5322 CREATE TABLE `smtp_servers` (
5323 `id` int(11) NOT NULL AUTO_INCREMENT,
5324 `name` varchar(80) NOT NULL,
5325 `host` varchar(80) NOT NULL DEFAULT 'localhost',
5326 `port` int(11) NOT NULL DEFAULT 25,
5327 `timeout` int(11) NOT NULL DEFAULT 120,
5328 `ssl_mode` enum('disabled','ssl','starttls') NOT NULL,
5329 `user_name` varchar(80) DEFAULT NULL,
5330 `password` varchar(80) DEFAULT NULL,
5331 `debug` tinyint(1) NOT NULL DEFAULT 0,
5332 `is_default` tinyint(1) NOT NULL DEFAULT 0,
5334 KEY `host_idx` (`host`)
5335 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5336 /*!40101 SET character_set_client = @saved_cs_client */;
5339 -- Table structure for table `social_data`
5342 DROP TABLE IF EXISTS `social_data`;
5343 /*!40101 SET @saved_cs_client = @@character_set_client */;
5344 /*!40101 SET character_set_client = utf8 */;
5345 CREATE TABLE `social_data` (
5346 `isbn` varchar(30) NOT NULL DEFAULT '',
5347 `num_critics` int(11) DEFAULT NULL,
5348 `num_critics_pro` int(11) DEFAULT NULL,
5349 `num_quotations` int(11) DEFAULT NULL,
5350 `num_videos` int(11) DEFAULT NULL,
5351 `score_avg` decimal(5,2) DEFAULT NULL,
5352 `num_scores` int(11) DEFAULT NULL,
5353 PRIMARY KEY (`isbn`)
5354 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5355 /*!40101 SET character_set_client = @saved_cs_client */;
5358 -- Table structure for table `special_holidays`
5361 DROP TABLE IF EXISTS `special_holidays`;
5362 /*!40101 SET @saved_cs_client = @@character_set_client */;
5363 /*!40101 SET character_set_client = utf8 */;
5364 CREATE TABLE `special_holidays` (
5365 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5366 `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
5367 `day` smallint(6) NOT NULL DEFAULT 0 COMMENT 'day of the month this closing is on',
5368 `month` smallint(6) NOT NULL DEFAULT 0 COMMENT 'month this closing is in',
5369 `year` smallint(6) NOT NULL DEFAULT 0 COMMENT 'year this closing is in',
5370 `isexception` smallint(1) NOT NULL DEFAULT 1 COMMENT 'is this a holiday exception to a repeatable holiday (1 for yes, 0 for no)',
5371 `title` varchar(50) NOT NULL DEFAULT '' COMMENT 'title for this closing',
5372 `description` mediumtext NOT NULL COMMENT 'description of this closing',
5374 KEY `special_holidays_ibfk_1` (`branchcode`),
5375 CONSTRAINT `special_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5376 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5377 /*!40101 SET character_set_client = @saved_cs_client */;
5380 -- Table structure for table `statistics`
5383 DROP TABLE IF EXISTS `statistics`;
5384 /*!40101 SET @saved_cs_client = @@character_set_client */;
5385 /*!40101 SET character_set_client = utf8 */;
5386 CREATE TABLE `statistics` (
5387 `datetime` datetime DEFAULT NULL COMMENT 'date and time of the transaction',
5388 `branch` varchar(10) DEFAULT NULL COMMENT 'foreign key, branch where the transaction occurred',
5389 `value` double(16,4) DEFAULT NULL COMMENT 'monetary value associated with the transaction',
5390 `type` varchar(16) DEFAULT NULL COMMENT 'transaction type (localuse, issue, return, renew, writeoff, payment)',
5391 `other` longtext DEFAULT NULL COMMENT 'used by SIP',
5392 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific item',
5393 `itemtype` varchar(10) DEFAULT NULL COMMENT 'foreign key from the itemtypes table, links transaction to a specific item type',
5394 `location` varchar(80) DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
5395 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower',
5396 `ccode` varchar(80) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific collection code',
5397 `categorycode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower category',
5398 `interface` varchar(30) DEFAULT NULL COMMENT 'the context this action was taken in',
5399 KEY `timeidx` (`datetime`),
5400 KEY `branch_idx` (`branch`),
5401 KEY `type_idx` (`type`),
5402 KEY `itemnumber_idx` (`itemnumber`),
5403 KEY `itemtype_idx` (`itemtype`),
5404 KEY `borrowernumber_idx` (`borrowernumber`),
5405 KEY `ccode_idx` (`ccode`)
5406 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5407 /*!40101 SET character_set_client = @saved_cs_client */;
5410 -- Table structure for table `stockrotationitems`
5413 DROP TABLE IF EXISTS `stockrotationitems`;
5414 /*!40101 SET @saved_cs_client = @@character_set_client */;
5415 /*!40101 SET character_set_client = utf8 */;
5416 CREATE TABLE `stockrotationitems` (
5417 `itemnumber_id` int(11) NOT NULL COMMENT 'Itemnumber to link to a stage & rota',
5418 `stage_id` int(11) NOT NULL COMMENT 'stage ID to link the item to',
5419 `indemand` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should this item be skipped for rotation?',
5420 `fresh` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag showing item is only just added to rota',
5421 PRIMARY KEY (`itemnumber_id`),
5422 KEY `stockrotationitems_sifk` (`stage_id`),
5423 CONSTRAINT `stockrotationitems_iifk` FOREIGN KEY (`itemnumber_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5424 CONSTRAINT `stockrotationitems_sifk` FOREIGN KEY (`stage_id`) REFERENCES `stockrotationstages` (`stage_id`) ON DELETE CASCADE ON UPDATE CASCADE
5425 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5426 /*!40101 SET character_set_client = @saved_cs_client */;
5429 -- Table structure for table `stockrotationrotas`
5432 DROP TABLE IF EXISTS `stockrotationrotas`;
5433 /*!40101 SET @saved_cs_client = @@character_set_client */;
5434 /*!40101 SET character_set_client = utf8 */;
5435 CREATE TABLE `stockrotationrotas` (
5436 `rota_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Stockrotation rota ID',
5437 `title` varchar(100) NOT NULL COMMENT 'Title for this rota',
5438 `description` text NOT NULL COMMENT 'Description for this rota',
5439 `cyclical` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should items on this rota keep cycling?',
5440 `active` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this rota currently active?',
5441 PRIMARY KEY (`rota_id`),
5442 UNIQUE KEY `stockrotationrotas_title` (`title`)
5443 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5444 /*!40101 SET character_set_client = @saved_cs_client */;
5447 -- Table structure for table `stockrotationstages`
5450 DROP TABLE IF EXISTS `stockrotationstages`;
5451 /*!40101 SET @saved_cs_client = @@character_set_client */;
5452 /*!40101 SET character_set_client = utf8 */;
5453 CREATE TABLE `stockrotationstages` (
5454 `stage_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique stage ID',
5455 `position` int(11) NOT NULL COMMENT 'The position of this stage within its rota',
5456 `rota_id` int(11) NOT NULL COMMENT 'The rota this stage belongs to',
5457 `branchcode_id` varchar(10) NOT NULL COMMENT 'Branch this stage relates to',
5458 `duration` int(11) NOT NULL DEFAULT 4 COMMENT 'The number of days items shoud occupy this stage',
5459 PRIMARY KEY (`stage_id`),
5460 KEY `stockrotationstages_rifk` (`rota_id`),
5461 KEY `stockrotationstages_bifk` (`branchcode_id`),
5462 CONSTRAINT `stockrotationstages_bifk` FOREIGN KEY (`branchcode_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5463 CONSTRAINT `stockrotationstages_rifk` FOREIGN KEY (`rota_id`) REFERENCES `stockrotationrotas` (`rota_id`) ON DELETE CASCADE ON UPDATE CASCADE
5464 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5465 /*!40101 SET character_set_client = @saved_cs_client */;
5468 -- Table structure for table `subscription`
5471 DROP TABLE IF EXISTS `subscription`;
5472 /*!40101 SET @saved_cs_client = @@character_set_client */;
5473 /*!40101 SET character_set_client = utf8 */;
5474 CREATE TABLE `subscription` (
5475 `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
5476 `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
5477 `librarian` varchar(100) DEFAULT '' COMMENT 'the librarian''s username from borrowers.userid',
5478 `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
5479 `aqbooksellerid` int(11) DEFAULT 0 COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
5480 `cost` int(11) DEFAULT 0,
5481 `aqbudgetid` int(11) DEFAULT 0,
5482 `weeklength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or numberlength is set)',
5483 `monthlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if weeklength or numberlength is set)',
5484 `numberlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or weeklength is set)',
5485 `periodicity` int(11) DEFAULT NULL COMMENT 'frequency type links to subscription_frequencies.id',
5486 `countissuesperunit` int(11) NOT NULL DEFAULT 1,
5487 `notes` longtext DEFAULT NULL COMMENT 'notes',
5488 `status` varchar(100) NOT NULL DEFAULT '' COMMENT 'status of this subscription',
5489 `lastvalue1` int(11) DEFAULT NULL,
5490 `innerloop1` int(11) DEFAULT 0,
5491 `lastvalue2` int(11) DEFAULT NULL,
5492 `innerloop2` int(11) DEFAULT 0,
5493 `lastvalue3` int(11) DEFAULT NULL,
5494 `innerloop3` int(11) DEFAULT 0,
5495 `firstacquidate` date DEFAULT NULL COMMENT 'first issue received date',
5496 `manualhistory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes or no to managing the history manually',
5497 `irregularity` mediumtext DEFAULT NULL COMMENT 'any irregularities in the subscription',
5498 `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
5499 `letter` varchar(20) DEFAULT NULL,
5500 `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
5501 `locale` varchar(80) DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
5502 `distributedto` mediumtext DEFAULT NULL,
5503 `internalnotes` longtext DEFAULT NULL,
5504 `callnumber` mediumtext DEFAULT NULL COMMENT 'default call number',
5505 `location` varchar(80) DEFAULT '' COMMENT 'default shelving location (items.location)',
5506 `branchcode` varchar(10) NOT NULL DEFAULT '' COMMENT 'default branches (items.homebranch)',
5507 `lastbranch` varchar(10) DEFAULT NULL,
5508 `serialsadditems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'does receiving this serial create an item record',
5509 `staffdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the staff',
5510 `opacdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the public',
5511 `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
5512 `enddate` date DEFAULT NULL COMMENT 'subscription end date',
5513 `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
5514 `reneweddate` date DEFAULT NULL COMMENT 'date of last renewal for the subscription',
5515 `itemtype` varchar(10) DEFAULT NULL,
5516 `previousitemtype` varchar(10) DEFAULT NULL,
5517 `mana_id` int(11) DEFAULT NULL,
5518 `ccode` varchar(80) DEFAULT NULL COMMENT 'collection code to assign to serial items',
5519 `published_on_template` TEXT DEFAULT NULL COMMENT 'Template Toolkit syntax to generate the default "Published on (text)" field when receiving an issue this serial',
5520 PRIMARY KEY (`subscriptionid`),
5521 KEY `subscription_ibfk_1` (`periodicity`),
5522 KEY `subscription_ibfk_2` (`numberpattern`),
5523 KEY `subscription_ibfk_3` (`biblionumber`),
5524 CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5525 CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5526 CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5527 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5528 /*!40101 SET character_set_client = @saved_cs_client */;
5531 -- Table structure for table `subscription_frequencies`
5534 DROP TABLE IF EXISTS `subscription_frequencies`;
5535 /*!40101 SET @saved_cs_client = @@character_set_client */;
5536 /*!40101 SET character_set_client = utf8 */;
5537 CREATE TABLE `subscription_frequencies` (
5538 `id` int(11) NOT NULL AUTO_INCREMENT,
5539 `description` mediumtext NOT NULL,
5540 `displayorder` int(11) DEFAULT NULL,
5541 `unit` enum('day','week','month','year') DEFAULT NULL,
5542 `unitsperissue` int(11) NOT NULL DEFAULT 1,
5543 `issuesperunit` int(11) NOT NULL DEFAULT 1,
5545 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5546 /*!40101 SET character_set_client = @saved_cs_client */;
5549 -- Table structure for table `subscription_numberpatterns`
5552 DROP TABLE IF EXISTS `subscription_numberpatterns`;
5553 /*!40101 SET @saved_cs_client = @@character_set_client */;
5554 /*!40101 SET character_set_client = utf8 */;
5555 CREATE TABLE `subscription_numberpatterns` (
5556 `id` int(11) NOT NULL AUTO_INCREMENT,
5557 `label` varchar(255) NOT NULL,
5558 `displayorder` int(11) DEFAULT NULL,
5559 `description` mediumtext NOT NULL,
5560 `numberingmethod` varchar(255) NOT NULL,
5561 `label1` varchar(255) DEFAULT NULL,
5562 `add1` int(11) DEFAULT NULL,
5563 `every1` int(11) DEFAULT NULL,
5564 `whenmorethan1` int(11) DEFAULT NULL,
5565 `setto1` int(11) DEFAULT NULL,
5566 `numbering1` varchar(255) DEFAULT NULL,
5567 `label2` varchar(255) DEFAULT NULL,
5568 `add2` int(11) DEFAULT NULL,
5569 `every2` int(11) DEFAULT NULL,
5570 `whenmorethan2` int(11) DEFAULT NULL,
5571 `setto2` int(11) DEFAULT NULL,
5572 `numbering2` varchar(255) DEFAULT NULL,
5573 `label3` varchar(255) DEFAULT NULL,
5574 `add3` int(11) DEFAULT NULL,
5575 `every3` int(11) DEFAULT NULL,
5576 `whenmorethan3` int(11) DEFAULT NULL,
5577 `setto3` int(11) DEFAULT NULL,
5578 `numbering3` varchar(255) DEFAULT NULL,
5580 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5581 /*!40101 SET character_set_client = @saved_cs_client */;
5584 -- Table structure for table `subscriptionhistory`
5587 DROP TABLE IF EXISTS `subscriptionhistory`;
5588 /*!40101 SET @saved_cs_client = @@character_set_client */;
5589 /*!40101 SET character_set_client = utf8 */;
5590 CREATE TABLE `subscriptionhistory` (
5591 `biblionumber` int(11) NOT NULL,
5592 `subscriptionid` int(11) NOT NULL,
5593 `histstartdate` date DEFAULT NULL,
5594 `histenddate` date DEFAULT NULL,
5595 `missinglist` longtext NOT NULL,
5596 `recievedlist` longtext NOT NULL,
5597 `opacnote` longtext DEFAULT NULL,
5598 `librariannote` longtext DEFAULT NULL,
5599 PRIMARY KEY (`subscriptionid`),
5600 KEY `subscription_history_ibfk_1` (`biblionumber`),
5601 CONSTRAINT `subscription_history_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5602 CONSTRAINT `subscription_history_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5603 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5604 /*!40101 SET character_set_client = @saved_cs_client */;
5607 -- Table structure for table `subscriptionroutinglist`
5610 DROP TABLE IF EXISTS `subscriptionroutinglist`;
5611 /*!40101 SET @saved_cs_client = @@character_set_client */;
5612 /*!40101 SET character_set_client = utf8 */;
5613 CREATE TABLE `subscriptionroutinglist` (
5614 `routingid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5615 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines with patron is on the routing list',
5616 `ranking` int(11) DEFAULT NULL COMMENT 'where the patron stands in line to receive the serial',
5617 `subscriptionid` int(11) NOT NULL COMMENT 'foreign key from the subscription table, defines which subscription this routing list is for',
5618 PRIMARY KEY (`routingid`),
5619 UNIQUE KEY `subscriptionid` (`subscriptionid`,`borrowernumber`),
5620 KEY `subscriptionroutinglist_ibfk_1` (`borrowernumber`),
5621 CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5622 CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5623 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5624 /*!40101 SET character_set_client = @saved_cs_client */;
5627 -- Table structure for table `suggestions`
5630 DROP TABLE IF EXISTS `suggestions`;
5631 /*!40101 SET @saved_cs_client = @@character_set_client */;
5632 /*!40101 SET character_set_client = utf8 */;
5633 CREATE TABLE `suggestions` (
5634 `suggestionid` int(8) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned automatically by Koha',
5635 `suggestedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the person making the suggestion, foreign key linking to the borrowers table',
5636 `suggesteddate` date NOT NULL COMMENT 'date the suggestion was submitted',
5637 `managedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian managing the suggestion, foreign key linking to the borrowers table',
5638 `manageddate` date DEFAULT NULL COMMENT 'date the suggestion was updated',
5639 `acceptedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who accepted the suggestion, foreign key linking to the borrowers table',
5640 `accepteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as accepted',
5641 `rejectedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table',
5642 `rejecteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as rejected',
5643 `lastmodificationby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who edit the suggestion for the last time',
5644 `lastmodificationdate` date DEFAULT NULL COMMENT 'date of the last modification',
5645 `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)',
5646 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the suggestion archived?',
5647 `note` longtext DEFAULT NULL COMMENT 'note entered on the suggestion',
5648 `staff_note` longtext DEFAULT NULL COMMENT 'non-public note entered on the suggestion',
5649 `author` varchar(80) DEFAULT NULL COMMENT 'author of the suggested item',
5650 `title` varchar(255) DEFAULT NULL COMMENT 'title of the suggested item',
5651 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'copyright date of the suggested item',
5652 `publishercode` varchar(255) DEFAULT NULL COMMENT 'publisher of the suggested item',
5653 `date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the suggestion was updated',
5654 `volumedesc` varchar(255) DEFAULT NULL,
5655 `publicationyear` smallint(6) DEFAULT 0,
5656 `place` varchar(255) DEFAULT NULL COMMENT 'publication place of the suggested item',
5657 `isbn` varchar(30) DEFAULT NULL COMMENT 'isbn of the suggested item',
5658 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggestion to the biblio table after the suggestion has been ordered',
5659 `reason` mediumtext DEFAULT NULL COMMENT 'reason for accepting or rejecting the suggestion',
5660 `patronreason` mediumtext DEFAULT NULL COMMENT 'reason for making the suggestion',
5661 `budgetid` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggested budget to the aqbudgets table',
5662 `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key linking the suggested branch to the branches table',
5663 `collectiontitle` mediumtext DEFAULT NULL COMMENT 'collection name for the suggested item',
5664 `itemtype` varchar(30) DEFAULT NULL COMMENT 'suggested item type',
5665 `quantity` smallint(6) DEFAULT NULL COMMENT 'suggested quantity to be purchased',
5666 `currency` varchar(10) DEFAULT NULL COMMENT 'suggested currency for the suggested price',
5667 `price` decimal(28,6) DEFAULT NULL COMMENT 'suggested price',
5668 `total` decimal(28,6) DEFAULT NULL COMMENT 'suggested total cost (price*quantity updated for currency)',
5669 PRIMARY KEY (`suggestionid`),
5670 KEY `suggestedby` (`suggestedby`),
5671 KEY `managedby` (`managedby`),
5672 KEY `acceptedby` (`acceptedby`),
5673 KEY `rejectedby` (`rejectedby`),
5674 KEY `biblionumber` (`biblionumber`),
5675 KEY `budgetid` (`budgetid`),
5676 KEY `branchcode` (`branchcode`),
5677 KEY `status` (`STATUS`),
5678 KEY `suggestions_ibfk_lastmodificationby` (`lastmodificationby`),
5679 CONSTRAINT `suggestions_budget_id_fk` FOREIGN KEY (`budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5680 CONSTRAINT `suggestions_ibfk_acceptedby` FOREIGN KEY (`acceptedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5681 CONSTRAINT `suggestions_ibfk_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5682 CONSTRAINT `suggestions_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
5683 CONSTRAINT `suggestions_ibfk_lastmodificationby` FOREIGN KEY (`lastmodificationby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5684 CONSTRAINT `suggestions_ibfk_managedby` FOREIGN KEY (`managedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5685 CONSTRAINT `suggestions_ibfk_rejectedby` FOREIGN KEY (`rejectedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5686 CONSTRAINT `suggestions_ibfk_suggestedby` FOREIGN KEY (`suggestedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5687 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5688 /*!40101 SET character_set_client = @saved_cs_client */;
5691 -- Table structure for table `systempreferences`
5694 DROP TABLE IF EXISTS `systempreferences`;
5695 /*!40101 SET @saved_cs_client = @@character_set_client */;
5696 /*!40101 SET character_set_client = utf8 */;
5697 CREATE TABLE `systempreferences` (
5698 `variable` varchar(50) NOT NULL DEFAULT '' COMMENT 'system preference name',
5699 `value` mediumtext DEFAULT NULL COMMENT 'system preference values',
5700 `options` longtext DEFAULT NULL COMMENT 'options for multiple choice system preferences',
5701 `explanation` mediumtext DEFAULT NULL COMMENT 'descriptive text for the system preference',
5702 `type` varchar(20) DEFAULT NULL COMMENT 'type of question this preference asks (multiple choice, plain text, yes or no, etc)',
5703 PRIMARY KEY (`variable`)
5704 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5705 /*!40101 SET character_set_client = @saved_cs_client */;
5708 -- Table structure for table `tables_settings`
5711 DROP TABLE IF EXISTS `tables_settings`;
5712 /*!40101 SET @saved_cs_client = @@character_set_client */;
5713 /*!40101 SET character_set_client = utf8 */;
5714 CREATE TABLE `tables_settings` (
5715 `module` varchar(255) NOT NULL,
5716 `page` varchar(255) NOT NULL,
5717 `tablename` varchar(255) NOT NULL,
5718 `default_display_length` smallint(6) DEFAULT NULL,
5719 `default_sort_order` varchar(255) DEFAULT NULL,
5720 PRIMARY KEY (`module`(191),`page`(191),`tablename`(191))
5721 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5722 /*!40101 SET character_set_client = @saved_cs_client */;
5725 -- Table structure for table `tags`
5728 DROP TABLE IF EXISTS `tags`;
5729 /*!40101 SET @saved_cs_client = @@character_set_client */;
5730 /*!40101 SET character_set_client = utf8 */;
5731 CREATE TABLE `tags` (
5732 `entry` varchar(255) NOT NULL DEFAULT '',
5733 `weight` bigint(20) NOT NULL DEFAULT 0,
5734 PRIMARY KEY (`entry`(191))
5735 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5736 /*!40101 SET character_set_client = @saved_cs_client */;
5739 -- Table structure for table `tags_all`
5742 DROP TABLE IF EXISTS `tags_all`;
5743 /*!40101 SET @saved_cs_client = @@character_set_client */;
5744 /*!40101 SET character_set_client = utf8 */;
5745 CREATE TABLE `tags_all` (
5746 `tag_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key',
5747 `borrowernumber` int(11) DEFAULT NULL COMMENT 'the patron who added the tag (borrowers.borrowernumber)',
5748 `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was left on (biblio.biblionumber)',
5749 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5750 `language` int(4) DEFAULT NULL COMMENT 'the language the tag was left in',
5751 `date_created` datetime NOT NULL COMMENT 'the date the tag was added',
5752 PRIMARY KEY (`tag_id`),
5753 KEY `tags_borrowers_fk_1` (`borrowernumber`),
5754 KEY `tags_biblionumber_fk_1` (`biblionumber`),
5755 CONSTRAINT `tags_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5756 CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5757 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5758 /*!40101 SET character_set_client = @saved_cs_client */;
5761 -- Table structure for table `tags_approval`
5764 DROP TABLE IF EXISTS `tags_approval`;
5765 /*!40101 SET @saved_cs_client = @@character_set_client */;
5766 /*!40101 SET character_set_client = utf8 */;
5767 CREATE TABLE `tags_approval` (
5768 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5769 `approved` int(1) NOT NULL DEFAULT 0 COMMENT 'whether the tag is approved or not (1=yes, 0=pending, -1=rejected)',
5770 `date_approved` datetime DEFAULT NULL COMMENT 'the date this tag was approved',
5771 `approved_by` int(11) DEFAULT NULL COMMENT 'the librarian who approved the tag (borrowers.borrowernumber)',
5772 `weight_total` int(9) NOT NULL DEFAULT 1 COMMENT 'the total number of times this tag was used',
5773 PRIMARY KEY (`term`),
5774 KEY `tags_approval_borrowers_fk_1` (`approved_by`),
5775 CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
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_index`
5783 DROP TABLE IF EXISTS `tags_index`;
5784 /*!40101 SET @saved_cs_client = @@character_set_client */;
5785 /*!40101 SET character_set_client = utf8 */;
5786 CREATE TABLE `tags_index` (
5787 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5788 `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was used on (biblio.biblionumber)',
5789 `weight` int(9) NOT NULL DEFAULT 1 COMMENT 'the number of times this term was used on this bib record',
5790 PRIMARY KEY (`term`,`biblionumber`),
5791 KEY `tags_index_biblionumber_fk_1` (`biblionumber`),
5792 CONSTRAINT `tags_index_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5793 CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`) REFERENCES `tags_approval` (`term`) ON DELETE CASCADE ON UPDATE CASCADE
5794 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5795 /*!40101 SET character_set_client = @saved_cs_client */;
5798 -- Table structure for table `ticket_updates`
5801 DROP TABLE IF EXISTS `ticket_updates`;
5802 /*!40101 SET @saved_cs_client = @@character_set_client */;
5803 /*!40101 SET character_set_client = utf8 */;
5804 CREATE TABLE `ticket_updates` (
5805 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
5806 `ticket_id` int(11) NOT NULL COMMENT 'id of catalog ticket the update relates to',
5807 `user_id` int(11) NOT NULL DEFAULT 0 COMMENT 'id of the user who logged the update',
5808 `public` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote whether this update is public',
5809 `date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time this update was logged',
5810 `message` text NOT NULL COMMENT 'update message content',
5812 KEY `ticket_updates_ibfk_1` (`ticket_id`),
5813 KEY `ticket_updates_ibfk_2` (`user_id`),
5814 CONSTRAINT `ticket_updates_ibfk_1` FOREIGN KEY (`ticket_id`) REFERENCES `tickets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
5815 CONSTRAINT `ticket_updates_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
5816 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5817 /*!40101 SET character_set_client = @saved_cs_client */;
5820 -- Table structure for table `tickets`
5823 DROP TABLE IF EXISTS `tickets`;
5824 /*!40101 SET @saved_cs_client = @@character_set_client */;
5825 /*!40101 SET character_set_client = utf8 */;
5826 CREATE TABLE `tickets` (
5827 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
5828 `reporter_id` int(11) NOT NULL DEFAULT 0 COMMENT 'id of the patron who reported the ticket',
5829 `reported_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time this ticket was reported',
5830 `title` text NOT NULL COMMENT 'ticket title',
5831 `body` text NOT NULL COMMENT 'ticket details',
5832 `resolver_id` int(11) DEFAULT NULL COMMENT 'id of the user who resolved the ticket',
5833 `resolved_date` datetime DEFAULT NULL COMMENT 'date and time this ticket was resolved',
5834 `biblio_id` int(11) DEFAULT NULL COMMENT 'id of biblio linked',
5836 KEY `tickets_ibfk_1` (`reporter_id`),
5837 KEY `tickets_ibfk_2` (`resolver_id`),
5838 KEY `tickets_ibfk_3` (`biblio_id`),
5839 CONSTRAINT `tickets_ibfk_1` FOREIGN KEY (`reporter_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5840 CONSTRAINT `tickets_ibfk_2` FOREIGN KEY (`resolver_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5841 CONSTRAINT `tickets_ibfk_3` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5842 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5843 /*!40101 SET character_set_client = @saved_cs_client */;
5846 -- Table structure for table `tmp_holdsqueue`
5849 DROP TABLE IF EXISTS `tmp_holdsqueue`;
5850 /*!40101 SET @saved_cs_client = @@character_set_client */;
5851 /*!40101 SET character_set_client = utf8 */;
5852 CREATE TABLE `tmp_holdsqueue` (
5853 `biblionumber` int(11) DEFAULT NULL,
5854 `itemnumber` int(11) DEFAULT NULL,
5855 `barcode` varchar(20) DEFAULT NULL,
5856 `surname` longtext NOT NULL,
5857 `firstname` mediumtext DEFAULT NULL,
5858 `phone` mediumtext DEFAULT NULL,
5859 `borrowernumber` int(11) NOT NULL,
5860 `cardnumber` varchar(32) DEFAULT NULL,
5861 `reservedate` date DEFAULT NULL,
5862 `title` longtext DEFAULT NULL,
5863 `itemcallnumber` varchar(255) DEFAULT NULL,
5864 `holdingbranch` varchar(10) DEFAULT NULL,
5865 `pickbranch` varchar(10) DEFAULT NULL,
5866 `notes` mediumtext DEFAULT NULL,
5867 `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
5868 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this entry as added/last updated',
5869 KEY `tmp_holdsqueue_ibfk_1` (`itemnumber`),
5870 KEY `tmp_holdsqueue_ibfk_2` (`biblionumber`),
5871 KEY `tmp_holdsqueue_ibfk_3` (`borrowernumber`),
5872 CONSTRAINT `tmp_holdsqueue_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5873 CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5874 CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
5875 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5876 /*!40101 SET character_set_client = @saved_cs_client */;
5879 -- Table structure for table `transport_cost`
5882 DROP TABLE IF EXISTS `transport_cost`;
5883 /*!40101 SET @saved_cs_client = @@character_set_client */;
5884 /*!40101 SET character_set_client = utf8 */;
5885 CREATE TABLE `transport_cost` (
5886 `frombranch` varchar(10) NOT NULL,
5887 `tobranch` varchar(10) NOT NULL,
5888 `cost` decimal(6,2) NOT NULL,
5889 `disable_transfer` tinyint(1) NOT NULL DEFAULT 0,
5890 PRIMARY KEY (`frombranch`,`tobranch`),
5891 KEY `transport_cost_ibfk_2` (`tobranch`),
5892 CONSTRAINT `transport_cost_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5893 CONSTRAINT `transport_cost_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5894 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5895 /*!40101 SET character_set_client = @saved_cs_client */;
5898 -- Table structure for table `uploaded_files`
5901 DROP TABLE IF EXISTS `uploaded_files`;
5902 /*!40101 SET @saved_cs_client = @@character_set_client */;
5903 /*!40101 SET character_set_client = utf8 */;
5904 CREATE TABLE `uploaded_files` (
5905 `id` int(11) NOT NULL AUTO_INCREMENT,
5906 `hashvalue` char(40) NOT NULL,
5907 `filename` mediumtext NOT NULL,
5908 `dir` mediumtext NOT NULL,
5909 `filesize` int(11) DEFAULT NULL,
5910 `dtcreated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
5911 `uploadcategorycode` text DEFAULT NULL,
5912 `owner` int(11) DEFAULT NULL,
5913 `public` tinyint(4) DEFAULT NULL,
5914 `permanent` tinyint(4) DEFAULT NULL,
5916 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5917 /*!40101 SET character_set_client = @saved_cs_client */;
5920 -- Table structure for table `user_permissions`
5923 DROP TABLE IF EXISTS `user_permissions`;
5924 /*!40101 SET @saved_cs_client = @@character_set_client */;
5925 /*!40101 SET character_set_client = utf8 */;
5926 CREATE TABLE `user_permissions` (
5927 `borrowernumber` int(11) NOT NULL DEFAULT 0,
5928 `module_bit` int(11) NOT NULL DEFAULT 0,
5929 `code` varchar(64) NOT NULL,
5930 PRIMARY KEY (`borrowernumber`,`module_bit`,`code`),
5931 KEY `user_permissions_ibfk_1` (`borrowernumber`),
5932 KEY `user_permissions_ibfk_2` (`module_bit`,`code`),
5933 CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5934 CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`) ON DELETE CASCADE ON UPDATE CASCADE
5935 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5936 /*!40101 SET character_set_client = @saved_cs_client */;
5939 -- Table structure for table `userflags`
5942 DROP TABLE IF EXISTS `userflags`;
5943 /*!40101 SET @saved_cs_client = @@character_set_client */;
5944 /*!40101 SET character_set_client = utf8 */;
5945 CREATE TABLE `userflags` (
5946 `bit` int(11) NOT NULL DEFAULT 0,
5947 `flag` varchar(30) DEFAULT NULL,
5948 `flagdesc` varchar(255) DEFAULT NULL,
5949 `defaulton` int(11) DEFAULT NULL,
5951 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5952 /*!40101 SET character_set_client = @saved_cs_client */;
5955 -- Table structure for table `vendor_edi_accounts`
5958 DROP TABLE IF EXISTS `vendor_edi_accounts`;
5959 /*!40101 SET @saved_cs_client = @@character_set_client */;
5960 /*!40101 SET character_set_client = utf8 */;
5961 CREATE TABLE `vendor_edi_accounts` (
5962 `id` int(11) NOT NULL AUTO_INCREMENT,
5963 `description` mediumtext NOT NULL,
5964 `host` varchar(40) DEFAULT NULL,
5965 `username` varchar(40) DEFAULT NULL,
5966 `password` mediumtext DEFAULT NULL,
5967 `last_activity` date DEFAULT NULL,
5968 `vendor_id` int(11) DEFAULT NULL,
5969 `download_directory` mediumtext DEFAULT NULL,
5970 `upload_directory` mediumtext DEFAULT NULL,
5971 `san` varchar(20) DEFAULT NULL,
5972 `standard` varchar(3) DEFAULT 'EUR',
5973 `id_code_qualifier` varchar(3) DEFAULT '14',
5974 `transport` varchar(6) DEFAULT 'FTP',
5975 `quotes_enabled` tinyint(1) NOT NULL DEFAULT 0,
5976 `invoices_enabled` tinyint(1) NOT NULL DEFAULT 0,
5977 `orders_enabled` tinyint(1) NOT NULL DEFAULT 0,
5978 `responses_enabled` tinyint(1) NOT NULL DEFAULT 0,
5979 `auto_orders` tinyint(1) NOT NULL DEFAULT 0,
5980 `shipment_budget` int(11) DEFAULT NULL,
5981 `plugin` varchar(256) NOT NULL DEFAULT '',
5983 KEY `vendorid` (`vendor_id`),
5984 KEY `shipmentbudget` (`shipment_budget`),
5985 CONSTRAINT `vfk_shipment_budget` FOREIGN KEY (`shipment_budget`) REFERENCES `aqbudgets` (`budget_id`),
5986 CONSTRAINT `vfk_vendor_id` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`)
5987 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5988 /*!40101 SET character_set_client = @saved_cs_client */;
5991 -- Table structure for table `virtualshelfcontents`
5994 DROP TABLE IF EXISTS `virtualshelfcontents`;
5995 /*!40101 SET @saved_cs_client = @@character_set_client */;
5996 /*!40101 SET character_set_client = utf8 */;
5997 CREATE TABLE `virtualshelfcontents` (
5998 `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',
5999 `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',
6000 `flags` int(11) DEFAULT NULL,
6001 `dateadded` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this bib record was added to the list',
6002 `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)',
6003 KEY `shelfnumber` (`shelfnumber`),
6004 KEY `biblionumber` (`biblionumber`),
6005 KEY `shelfcontents_ibfk_3` (`borrowernumber`),
6006 CONSTRAINT `shelfcontents_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6007 CONSTRAINT `shelfcontents_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
6008 CONSTRAINT `virtualshelfcontents_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE
6009 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6010 /*!40101 SET character_set_client = @saved_cs_client */;
6013 -- Table structure for table `virtualshelfshares`
6016 DROP TABLE IF EXISTS `virtualshelfshares`;
6017 /*!40101 SET @saved_cs_client = @@character_set_client */;
6018 /*!40101 SET character_set_client = utf8 */;
6019 CREATE TABLE `virtualshelfshares` (
6020 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
6021 `shelfnumber` int(11) NOT NULL COMMENT 'foreign key for virtualshelves',
6022 `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrower that accepted access to this list',
6023 `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',
6024 `sharedate` datetime DEFAULT NULL COMMENT 'date of invitation or acceptance of invitation',
6026 KEY `virtualshelfshares_ibfk_1` (`shelfnumber`),
6027 KEY `virtualshelfshares_ibfk_2` (`borrowernumber`),
6028 CONSTRAINT `virtualshelfshares_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6029 CONSTRAINT `virtualshelfshares_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
6030 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6031 /*!40101 SET character_set_client = @saved_cs_client */;
6034 -- Table structure for table `virtualshelves`
6037 DROP TABLE IF EXISTS `virtualshelves`;
6038 /*!40101 SET @saved_cs_client = @@character_set_client */;
6039 /*!40101 SET character_set_client = utf8 */;
6040 CREATE TABLE `virtualshelves` (
6041 `shelfnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
6042 `shelfname` varchar(255) DEFAULT NULL COMMENT 'name of the list',
6043 `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)',
6044 `public` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If the list is public',
6045 `sortfield` varchar(16) DEFAULT 'title' COMMENT 'the field this list is sorted on',
6046 `lastmodified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the list was last modified',
6047 `created_on` datetime NOT NULL COMMENT 'creation time',
6048 `allow_change_from_owner` tinyint(1) DEFAULT 1 COMMENT 'can owner change contents?',
6049 `allow_change_from_others` tinyint(1) DEFAULT 0 COMMENT 'can others change contents?',
6050 `allow_change_from_staff` tinyint(1) DEFAULT 0 COMMENT 'can staff change contents?',
6051 `allow_change_from_permitted_staff` tinyint(1) DEFAULT 0 COMMENT 'can staff with edit_public_list_contents permission change contents?',
6052 PRIMARY KEY (`shelfnumber`),
6053 KEY `virtualshelves_ibfk_1` (`owner`),
6054 CONSTRAINT `virtualshelves_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
6055 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6056 /*!40101 SET character_set_client = @saved_cs_client */;
6059 -- Table structure for table `z3950servers`
6062 DROP TABLE IF EXISTS `z3950servers`;
6063 /*!40101 SET @saved_cs_client = @@character_set_client */;
6064 /*!40101 SET character_set_client = utf8 */;
6065 CREATE TABLE `z3950servers` (
6066 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
6067 `host` varchar(255) NOT NULL COMMENT 'target''s host name',
6068 `port` int(11) DEFAULT NULL COMMENT 'port number used to connect to target',
6069 `db` varchar(255) DEFAULT NULL COMMENT 'target''s database name',
6070 `userid` varchar(255) DEFAULT NULL COMMENT 'username needed to log in to target',
6071 `password` varchar(255) DEFAULT NULL COMMENT 'password needed to log in to target',
6072 `servername` longtext NOT NULL COMMENT 'name given to the target by the library',
6073 `checked` smallint(6) DEFAULT NULL COMMENT 'whether this target is checked by default (1 for yes, 0 for no)',
6074 `rank` int(11) DEFAULT NULL COMMENT 'where this target appears in the list of targets',
6075 `syntax` varchar(80) NOT NULL COMMENT 'MARC format provided by this target',
6076 `timeout` int(11) NOT NULL DEFAULT 0 COMMENT 'number of seconds before Koha stops trying to access this server',
6077 `servertype` enum('zed','sru') NOT NULL DEFAULT 'zed' COMMENT 'zed means z39.50 server',
6078 `encoding` mediumtext NOT NULL COMMENT 'characters encoding provided by this target',
6079 `recordtype` enum('authority','biblio') NOT NULL DEFAULT 'biblio' COMMENT 'server contains bibliographic or authority records',
6080 `sru_options` varchar(255) DEFAULT NULL COMMENT 'options like sru=get, sru_version=1.1; will be passed to the server via ZOOM',
6081 `sru_fields` longtext DEFAULT NULL COMMENT 'contains the mapping between the Z3950 search fields and the specific SRU server indexes',
6082 `add_xslt` longtext DEFAULT NULL COMMENT 'zero or more paths to XSLT files to be processed on the search results',
6083 `attributes` varchar(255) DEFAULT NULL COMMENT 'additional attributes passed to PQF queries',
6085 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6086 /*!40101 SET character_set_client = @saved_cs_client */;
6089 -- Table structure for table `zebraqueue`
6092 DROP TABLE IF EXISTS `zebraqueue`;
6093 /*!40101 SET @saved_cs_client = @@character_set_client */;
6094 /*!40101 SET character_set_client = utf8 */;
6095 CREATE TABLE `zebraqueue` (
6096 `id` int(11) NOT NULL AUTO_INCREMENT,
6097 `biblio_auth_number` bigint(20) unsigned NOT NULL DEFAULT 0,
6098 `operation` char(20) NOT NULL DEFAULT '',
6099 `server` char(20) NOT NULL DEFAULT '',
6100 `done` int(11) NOT NULL DEFAULT 0,
6101 `time` timestamp NOT NULL DEFAULT current_timestamp(),
6103 KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
6104 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6105 /*!40101 SET character_set_client = @saved_cs_client */;
6106 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
6108 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
6109 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
6110 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
6111 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
6112 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
6113 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
6114 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
6116 -- Dump completed on 2023-05-31 12:31:12