1 -- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64)
3 -- Host: db Database: koha_kohadev
4 -- ------------------------------------------------------
5 -- Server version 10.8.3-MariaDB-1:10.8.3+maria~jammy
8 -- The lines with /*! are silently IGNORED when the web installer runs this
9 -- file (in C4::Installer, using DBIx::RunSQL).
10 -- The lines only work when you run this sql script directly with mysql.
12 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
13 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
14 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
15 /*!40101 SET NAMES utf8mb4 */;
16 /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
17 /*!40103 SET TIME_ZONE='+00:00' */;
18 /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
19 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
20 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
21 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
24 -- Table structure for table `account_credit_types`
27 DROP TABLE IF EXISTS `account_credit_types`;
28 /*!40101 SET @saved_cs_client = @@character_set_client */;
29 /*!40101 SET character_set_client = utf8 */;
30 CREATE TABLE `account_credit_types` (
31 `code` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL,
32 `description` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
33 `can_be_added_manually` tinyint(4) NOT NULL DEFAULT 1,
34 `credit_number_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is autogeneration of credit number enabled for this credit type',
35 `is_system` tinyint(1) NOT NULL DEFAULT 0,
36 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote if this till is archived or not',
38 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
39 /*!40101 SET character_set_client = @saved_cs_client */;
42 -- Table structure for table `account_credit_types_branches`
45 DROP TABLE IF EXISTS `account_credit_types_branches`;
46 /*!40101 SET @saved_cs_client = @@character_set_client */;
47 /*!40101 SET character_set_client = utf8 */;
48 CREATE TABLE `account_credit_types_branches` (
49 `credit_type_code` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
50 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
51 KEY `credit_type_code` (`credit_type_code`),
52 KEY `branchcode` (`branchcode`),
53 CONSTRAINT `account_credit_types_branches_ibfk_1` FOREIGN KEY (`credit_type_code`) REFERENCES `account_credit_types` (`code`) ON DELETE CASCADE,
54 CONSTRAINT `account_credit_types_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
55 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
56 /*!40101 SET character_set_client = @saved_cs_client */;
59 -- Table structure for table `account_debit_types`
62 DROP TABLE IF EXISTS `account_debit_types`;
63 /*!40101 SET @saved_cs_client = @@character_set_client */;
64 /*!40101 SET character_set_client = utf8 */;
65 CREATE TABLE `account_debit_types` (
66 `code` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL,
67 `description` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
68 `can_be_invoiced` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'boolean flag to denote if this debit type is available for manual invoicing',
69 `can_be_sold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote if this debit type is available at point of sale',
70 `default_amount` decimal(28,6) DEFAULT NULL,
71 `is_system` tinyint(1) NOT NULL DEFAULT 0,
72 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote if this till is archived or not',
74 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
75 /*!40101 SET character_set_client = @saved_cs_client */;
78 -- Table structure for table `account_debit_types_branches`
81 DROP TABLE IF EXISTS `account_debit_types_branches`;
82 /*!40101 SET @saved_cs_client = @@character_set_client */;
83 /*!40101 SET character_set_client = utf8 */;
84 CREATE TABLE `account_debit_types_branches` (
85 `debit_type_code` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
86 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
87 KEY `debit_type_code` (`debit_type_code`),
88 KEY `branchcode` (`branchcode`),
89 CONSTRAINT `account_debit_types_branches_ibfk_1` FOREIGN KEY (`debit_type_code`) REFERENCES `account_debit_types` (`code`) ON DELETE CASCADE,
90 CONSTRAINT `account_debit_types_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
91 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
92 /*!40101 SET character_set_client = @saved_cs_client */;
95 -- Table structure for table `account_offsets`
98 DROP TABLE IF EXISTS `account_offsets`;
99 /*!40101 SET @saved_cs_client = @@character_set_client */;
100 /*!40101 SET character_set_client = utf8 */;
101 CREATE TABLE `account_offsets` (
102 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each offset',
103 `credit_id` int(11) DEFAULT NULL COMMENT 'The id of the accountline the increased the patron''s balance',
104 `debit_id` int(11) DEFAULT NULL COMMENT 'The id of the accountline that decreased the patron''s balance',
105 `type` enum('CREATE','APPLY','VOID','OVERDUE_INCREASE','OVERDUE_DECREASE') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The type of offset this is',
106 `amount` decimal(26,6) NOT NULL COMMENT 'The amount of the change',
107 `created_on` timestamp NOT NULL DEFAULT current_timestamp(),
109 KEY `account_offsets_ibfk_p` (`credit_id`),
110 KEY `account_offsets_ibfk_f` (`debit_id`),
111 CONSTRAINT `account_offsets_ibfk_f` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE,
112 CONSTRAINT `account_offsets_ibfk_p` FOREIGN KEY (`credit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE
113 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
114 /*!40101 SET character_set_client = @saved_cs_client */;
117 -- Table structure for table `accountlines`
120 DROP TABLE IF EXISTS `accountlines`;
121 /*!40101 SET @saved_cs_client = @@character_set_client */;
122 /*!40101 SET character_set_client = utf8 */;
123 CREATE TABLE `accountlines` (
124 `accountlines_id` int(11) NOT NULL AUTO_INCREMENT,
125 `issue_id` int(11) DEFAULT NULL,
126 `borrowernumber` int(11) DEFAULT NULL,
127 `itemnumber` int(11) DEFAULT NULL,
128 `date` timestamp NULL DEFAULT NULL,
129 `amount` decimal(28,6) DEFAULT NULL,
130 `description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
131 `credit_type_code` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
132 `debit_type_code` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
133 `credit_number` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'autogenerated number for credits',
134 `status` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
135 `payment_type` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value PAYMENT_TYPE',
136 `amountoutstanding` decimal(28,6) DEFAULT NULL,
137 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
138 `note` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
139 `manager_id` int(11) DEFAULT NULL,
140 `register_id` int(11) DEFAULT NULL,
141 `interface` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
142 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the branchcode of the library where a payment was made, a manual invoice created, etc.',
143 PRIMARY KEY (`accountlines_id`),
144 KEY `acctsborridx` (`borrowernumber`),
145 KEY `timeidx` (`timestamp`),
146 KEY `credit_type_code` (`credit_type_code`),
147 KEY `debit_type_code` (`debit_type_code`),
148 KEY `itemnumber` (`itemnumber`),
149 KEY `branchcode` (`branchcode`),
150 KEY `manager_id` (`manager_id`),
151 KEY `accountlines_ibfk_registers` (`register_id`),
152 CONSTRAINT `accountlines_ibfk_borrowers` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
153 CONSTRAINT `accountlines_ibfk_borrowers_2` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
154 CONSTRAINT `accountlines_ibfk_branches` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
155 CONSTRAINT `accountlines_ibfk_credit_type` FOREIGN KEY (`credit_type_code`) REFERENCES `account_credit_types` (`code`) ON UPDATE CASCADE,
156 CONSTRAINT `accountlines_ibfk_debit_type` FOREIGN KEY (`debit_type_code`) REFERENCES `account_debit_types` (`code`) ON UPDATE CASCADE,
157 CONSTRAINT `accountlines_ibfk_items` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
158 CONSTRAINT `accountlines_ibfk_registers` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
159 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
160 /*!40101 SET character_set_client = @saved_cs_client */;
163 -- Table structure for table `action_logs`
166 DROP TABLE IF EXISTS `action_logs`;
167 /*!40101 SET @saved_cs_client = @@character_set_client */;
168 /*!40101 SET character_set_client = utf8 */;
169 CREATE TABLE `action_logs` (
170 `action_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each action',
171 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the action took place',
172 `user` int(11) NOT NULL DEFAULT 0 COMMENT 'the staff member who performed the action (borrowers.borrowernumber)',
173 `module` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the module this action was taken against',
174 `action` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the action (includes things like DELETED, ADDED, MODIFY, etc)',
175 `object` int(11) DEFAULT NULL COMMENT 'the object that the action was taken against (could be a borrowernumber, itemnumber, etc)',
176 `info` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'information about the action (usually includes SQL statement)',
177 `interface` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the context this action was taken in',
178 `script` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the name of the cron script that caused this change',
179 PRIMARY KEY (`action_id`),
180 KEY `timestamp_idx` (`timestamp`),
181 KEY `user_idx` (`user`),
182 KEY `module_idx` (`module`(191)),
183 KEY `action_idx` (`action`(191)),
184 KEY `object_idx` (`object`),
185 KEY `info_idx` (`info`(191)),
186 KEY `interface` (`interface`)
187 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
188 /*!40101 SET character_set_client = @saved_cs_client */;
191 -- Table structure for table `additional_contents`
194 DROP TABLE IF EXISTS `additional_contents`;
195 /*!40101 SET @saved_cs_client = @@character_set_client */;
196 /*!40101 SET character_set_client = utf8 */;
197 CREATE TABLE `additional_contents` (
198 `idnew` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the additional content',
199 `category` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'category for the additional content',
200 `code` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'code to group content per lang',
201 `location` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'location of the additional content',
202 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'branch code users to create branch specific additional content, NULL is every branch.',
203 `title` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'title of the additional content',
204 `content` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the body of your additional content',
205 `lang` varchar(50) COLLATE utf8mb4_unicode_ci 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)',
206 `published_on` date DEFAULT NULL COMMENT 'publication date',
207 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
208 `expirationdate` date DEFAULT NULL COMMENT 'date the additional content is set to expire or no longer be visible',
209 `number` int(11) DEFAULT NULL COMMENT 'the order in which this additional content appears in that specific location',
210 `borrowernumber` int(11) DEFAULT NULL COMMENT 'The user who created the additional content',
211 PRIMARY KEY (`idnew`),
212 UNIQUE KEY `additional_contents_uniq` (`category`,`code`,`branchcode`,`lang`),
213 KEY `additional_contents_borrowernumber_fk` (`borrowernumber`),
214 KEY `additional_contents_branchcode_ibfk` (`branchcode`),
215 CONSTRAINT `additional_contents_branchcode_ibfk` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
216 CONSTRAINT `borrowernumber_fk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
217 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
218 /*!40101 SET character_set_client = @saved_cs_client */;
221 -- Table structure for table `additional_field_values`
224 DROP TABLE IF EXISTS `additional_field_values`;
225 /*!40101 SET @saved_cs_client = @@character_set_client */;
226 /*!40101 SET character_set_client = utf8 */;
227 CREATE TABLE `additional_field_values` (
228 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
229 `field_id` int(11) NOT NULL COMMENT 'foreign key references additional_fields(id)',
230 `record_id` int(11) NOT NULL COMMENT 'record_id',
231 `value` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'value for this field',
233 UNIQUE KEY `field_record` (`field_id`,`record_id`),
234 CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
235 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
236 /*!40101 SET character_set_client = @saved_cs_client */;
239 -- Table structure for table `additional_fields`
242 DROP TABLE IF EXISTS `additional_fields`;
243 /*!40101 SET @saved_cs_client = @@character_set_client */;
244 /*!40101 SET character_set_client = utf8 */;
245 CREATE TABLE `additional_fields` (
246 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
247 `tablename` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'tablename of the new field',
248 `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'name of the field',
249 `authorised_value_category` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'is an authorised value category',
250 `marcfield` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'contains the marc field to copied into the record',
251 `searchable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the field searchable?',
253 UNIQUE KEY `fields_uniq` (`tablename`(191),`name`(191))
254 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
255 /*!40101 SET character_set_client = @saved_cs_client */;
258 -- Table structure for table `advanced_editor_macros`
261 DROP TABLE IF EXISTS `advanced_editor_macros`;
262 /*!40101 SET @saved_cs_client = @@character_set_client */;
263 /*!40101 SET character_set_client = utf8 */;
264 CREATE TABLE `advanced_editor_macros` (
265 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the macro',
266 `name` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Name of the macro',
267 `macro` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'The macro code itself',
268 `borrowernumber` int(11) DEFAULT NULL COMMENT 'ID of the borrower who created this macro',
269 `shared` tinyint(1) DEFAULT 0 COMMENT 'Bit to define if shared or private macro',
271 KEY `borrower_macro_fk` (`borrowernumber`),
272 CONSTRAINT `borrower_macro_fk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
273 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
274 /*!40101 SET character_set_client = @saved_cs_client */;
277 -- Table structure for table `alert`
280 DROP TABLE IF EXISTS `alert`;
281 /*!40101 SET @saved_cs_client = @@character_set_client */;
282 /*!40101 SET character_set_client = utf8 */;
283 CREATE TABLE `alert` (
284 `alertid` int(11) NOT NULL AUTO_INCREMENT,
285 `borrowernumber` int(11) NOT NULL DEFAULT 0,
286 `type` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
287 `externalid` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
288 PRIMARY KEY (`alertid`),
289 KEY `borrowernumber` (`borrowernumber`),
290 KEY `type` (`type`,`externalid`),
291 CONSTRAINT `alert_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
292 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
293 /*!40101 SET character_set_client = @saved_cs_client */;
296 -- Table structure for table `api_keys`
299 DROP TABLE IF EXISTS `api_keys`;
300 /*!40101 SET @saved_cs_client = @@character_set_client */;
301 /*!40101 SET character_set_client = utf8 */;
302 CREATE TABLE `api_keys` (
303 `client_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'API client ID',
304 `secret` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'API client secret used for API authentication',
305 `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'API client description',
306 `patron_id` int(11) NOT NULL COMMENT 'Foreign key to the borrowers table',
307 `active` tinyint(1) NOT NULL DEFAULT 1 COMMENT '0 means this API key is revoked',
308 PRIMARY KEY (`client_id`),
309 UNIQUE KEY `secret` (`secret`),
310 KEY `patron_id` (`patron_id`),
311 CONSTRAINT `api_keys_fk_patron_id` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
312 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
313 /*!40101 SET character_set_client = @saved_cs_client */;
316 -- Table structure for table `aqbasket`
319 DROP TABLE IF EXISTS `aqbasket`;
320 /*!40101 SET @saved_cs_client = @@character_set_client */;
321 /*!40101 SET character_set_client = utf8 */;
322 CREATE TABLE `aqbasket` (
323 `basketno` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, Koha defined number',
324 `basketname` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'name given to the basket at creation',
325 `note` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the internal note added at basket creation',
326 `booksellernote` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the vendor note added at basket creation',
327 `contractnumber` int(11) DEFAULT NULL COMMENT 'links this basket to the aqcontract table (aqcontract.contractnumber)',
328 `creationdate` date DEFAULT NULL COMMENT 'the date the basket was created',
329 `closedate` date DEFAULT NULL COMMENT 'the date the basket was closed',
330 `booksellerid` int(11) NOT NULL DEFAULT 1 COMMENT 'the Koha assigned ID for the vendor (aqbooksellers.id)',
331 `authorisedby` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the borrowernumber of the person who created the basket',
332 `booksellerinvoicenumber` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'appears to always be NULL',
333 `basketgroupid` int(11) DEFAULT NULL COMMENT 'links this basket to its group (aqbasketgroups.id)',
334 `deliveryplace` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'basket delivery place',
335 `billingplace` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'basket billing place',
336 `branch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'basket branch',
337 `is_standing` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'orders in this basket are standing',
338 `create_items` enum('ordering','receiving','cataloguing') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'when items should be created for orders in this basket',
339 PRIMARY KEY (`basketno`),
340 KEY `booksellerid` (`booksellerid`),
341 KEY `basketgroupid` (`basketgroupid`),
342 KEY `contractnumber` (`contractnumber`),
343 KEY `authorisedby` (`authorisedby`),
344 KEY `aqbasket_ibfk_4` (`branch`),
345 CONSTRAINT `aqbasket_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE,
346 CONSTRAINT `aqbasket_ibfk_2` FOREIGN KEY (`contractnumber`) REFERENCES `aqcontract` (`contractnumber`),
347 CONSTRAINT `aqbasket_ibfk_3` FOREIGN KEY (`basketgroupid`) REFERENCES `aqbasketgroups` (`id`) ON UPDATE CASCADE,
348 CONSTRAINT `aqbasket_ibfk_4` FOREIGN KEY (`branch`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
349 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
350 /*!40101 SET character_set_client = @saved_cs_client */;
353 -- Table structure for table `aqbasketgroups`
356 DROP TABLE IF EXISTS `aqbasketgroups`;
357 /*!40101 SET @saved_cs_client = @@character_set_client */;
358 /*!40101 SET character_set_client = utf8 */;
359 CREATE TABLE `aqbasketgroups` (
360 `id` int(11) NOT NULL AUTO_INCREMENT,
361 `name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
362 `closed` tinyint(1) DEFAULT NULL,
363 `booksellerid` int(11) NOT NULL,
364 `deliveryplace` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
365 `freedeliveryplace` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
366 `deliverycomment` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
367 `billingplace` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
369 KEY `booksellerid` (`booksellerid`),
370 CONSTRAINT `aqbasketgroups_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
371 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
372 /*!40101 SET character_set_client = @saved_cs_client */;
375 -- Table structure for table `aqbasketusers`
378 DROP TABLE IF EXISTS `aqbasketusers`;
379 /*!40101 SET @saved_cs_client = @@character_set_client */;
380 /*!40101 SET character_set_client = utf8 */;
381 CREATE TABLE `aqbasketusers` (
382 `basketno` int(11) NOT NULL,
383 `borrowernumber` int(11) NOT NULL,
384 PRIMARY KEY (`basketno`,`borrowernumber`),
385 KEY `aqbasketusers_ibfk_2` (`borrowernumber`),
386 CONSTRAINT `aqbasketusers_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
387 CONSTRAINT `aqbasketusers_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
388 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
389 /*!40101 SET character_set_client = @saved_cs_client */;
392 -- Table structure for table `aqbooksellers`
395 DROP TABLE IF EXISTS `aqbooksellers`;
396 /*!40101 SET @saved_cs_client = @@character_set_client */;
397 /*!40101 SET character_set_client = utf8 */;
398 CREATE TABLE `aqbooksellers` (
399 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha',
400 `name` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'vendor name',
401 `address1` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'first line of vendor physical address',
402 `address2` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'second line of vendor physical address',
403 `address3` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'third line of vendor physical address',
404 `address4` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'fourth line of vendor physical address',
405 `phone` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'vendor phone number',
406 `accountnumber` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'vendor account number',
407 `type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
408 `notes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'order notes',
409 `postal` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'vendor postal address (all lines)',
410 `url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'vendor web address',
411 `active` tinyint(4) DEFAULT NULL COMMENT 'is this vendor active (1 for yes, 0 for no)',
412 `listprice` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'currency code for list prices',
413 `invoiceprice` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'currency code for invoice prices',
414 `gstreg` tinyint(4) DEFAULT NULL COMMENT 'is your library charged tax (1 for yes, 0 for no)',
415 `listincgst` tinyint(4) DEFAULT NULL COMMENT 'is tax included in list prices (1 for yes, 0 for no)',
416 `invoiceincgst` tinyint(4) DEFAULT NULL COMMENT 'is tax included in invoice prices (1 for yes, 0 for no)',
417 `tax_rate` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate the library is charged',
418 `discount` float(6,4) DEFAULT NULL COMMENT 'discount offered on all items ordered from this vendor',
419 `fax` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'vendor fax number',
420 `deliverytime` int(11) DEFAULT NULL COMMENT 'vendor delivery time',
421 `external_id` VARCHAR(255) DEFAULT NULL COMMENT 'external id of the vendor',
423 KEY `listprice` (`listprice`),
424 KEY `invoiceprice` (`invoiceprice`),
425 KEY `name` (`name`(191)),
426 CONSTRAINT `aqbooksellers_ibfk_1` FOREIGN KEY (`listprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE,
427 CONSTRAINT `aqbooksellers_ibfk_2` FOREIGN KEY (`invoiceprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE
428 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
429 /*!40101 SET character_set_client = @saved_cs_client */;
432 -- Table structure for table `aqbudgetborrowers`
435 DROP TABLE IF EXISTS `aqbudgetborrowers`;
436 /*!40101 SET @saved_cs_client = @@character_set_client */;
437 /*!40101 SET character_set_client = utf8 */;
438 CREATE TABLE `aqbudgetborrowers` (
439 `budget_id` int(11) NOT NULL,
440 `borrowernumber` int(11) NOT NULL,
441 PRIMARY KEY (`budget_id`,`borrowernumber`),
442 KEY `aqbudgetborrowers_ibfk_2` (`borrowernumber`),
443 CONSTRAINT `aqbudgetborrowers_ibfk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
444 CONSTRAINT `aqbudgetborrowers_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
445 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
446 /*!40101 SET character_set_client = @saved_cs_client */;
449 -- Table structure for table `aqbudgetperiods`
452 DROP TABLE IF EXISTS `aqbudgetperiods`;
453 /*!40101 SET @saved_cs_client = @@character_set_client */;
454 /*!40101 SET character_set_client = utf8 */;
455 CREATE TABLE `aqbudgetperiods` (
456 `budget_period_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned by Koha',
457 `budget_period_startdate` date NOT NULL COMMENT 'date when the budget starts',
458 `budget_period_enddate` date NOT NULL COMMENT 'date when the budget ends',
459 `budget_period_active` tinyint(1) DEFAULT 0 COMMENT 'whether this budget is active or not (1 for yes, 0 for no)',
460 `budget_period_description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'description assigned to this budget',
461 `budget_period_total` decimal(28,6) DEFAULT NULL COMMENT 'total amount available in this budget',
462 `budget_period_locked` tinyint(1) DEFAULT NULL COMMENT 'whether this budget is locked or not (1 for yes, 0 for no)',
463 `sort1_authcat` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'statistical category for this budget',
464 `sort2_authcat` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'second statistical category for this budget',
465 PRIMARY KEY (`budget_period_id`)
466 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
467 /*!40101 SET character_set_client = @saved_cs_client */;
470 -- Table structure for table `aqbudgets`
473 DROP TABLE IF EXISTS `aqbudgets`;
474 /*!40101 SET @saved_cs_client = @@character_set_client */;
475 /*!40101 SET character_set_client = utf8 */;
476 CREATE TABLE `aqbudgets` (
477 `budget_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned to each fund by Koha',
478 `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)',
479 `budget_code` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'code assigned to the fund by the user',
480 `budget_name` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'name assigned to the fund by the user',
481 `budget_branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'branch that this fund belongs to (branches.branchcode)',
482 `budget_amount` decimal(28,6) DEFAULT 0.000000 COMMENT 'total amount for this fund',
483 `budget_encumb` decimal(28,6) DEFAULT 0.000000 COMMENT 'budget warning at percentage',
484 `budget_expend` decimal(28,6) DEFAULT 0.000000 COMMENT 'budget warning at amount',
485 `budget_notes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes related to this fund',
486 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this fund was last touched (created or modified)',
487 `budget_period_id` int(11) DEFAULT NULL COMMENT 'id of the budget that this fund belongs to (aqbudgetperiods.budget_period_id)',
488 `sort1_authcat` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'statistical category for this fund',
489 `sort2_authcat` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'second statistical category for this fund',
490 `budget_owner_id` int(11) DEFAULT NULL COMMENT 'borrowernumber of the person who owns this fund (borrowers.borrowernumber)',
491 `budget_permission` int(1) DEFAULT 0 COMMENT 'level of permission for this fund (used only by the owner, only by the library, or anyone)',
492 PRIMARY KEY (`budget_id`),
493 KEY `budget_parent_id` (`budget_parent_id`),
494 KEY `budget_code` (`budget_code`),
495 KEY `budget_branchcode` (`budget_branchcode`),
496 KEY `budget_period_id` (`budget_period_id`),
497 KEY `budget_owner_id` (`budget_owner_id`),
498 CONSTRAINT `aqbudgetperiods_ibfk_1` FOREIGN KEY (`budget_period_id`) REFERENCES `aqbudgetperiods` (`budget_period_id`) ON DELETE CASCADE ON UPDATE CASCADE
499 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
500 /*!40101 SET character_set_client = @saved_cs_client */;
503 -- Table structure for table `aqbudgets_planning`
506 DROP TABLE IF EXISTS `aqbudgets_planning`;
507 /*!40101 SET @saved_cs_client = @@character_set_client */;
508 /*!40101 SET character_set_client = utf8 */;
509 CREATE TABLE `aqbudgets_planning` (
510 `plan_id` int(11) NOT NULL AUTO_INCREMENT,
511 `budget_id` int(11) NOT NULL,
512 `budget_period_id` int(11) NOT NULL,
513 `estimated_amount` decimal(28,6) DEFAULT NULL,
514 `authcat` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
515 `authvalue` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
516 `display` tinyint(1) DEFAULT 1,
517 PRIMARY KEY (`plan_id`),
518 KEY `budget_period_id` (`budget_period_id`),
519 KEY `aqbudgets_planning_ifbk_1` (`budget_id`),
520 CONSTRAINT `aqbudgets_planning_ifbk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE
521 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
522 /*!40101 SET character_set_client = @saved_cs_client */;
525 -- Table structure for table `aqcontacts`
528 DROP TABLE IF EXISTS `aqcontacts`;
529 /*!40101 SET @saved_cs_client = @@character_set_client */;
530 /*!40101 SET character_set_client = utf8 */;
531 CREATE TABLE `aqcontacts` (
532 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique number assigned by Koha',
533 `name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'name of contact at vendor',
534 `position` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'contact person''s position',
535 `phone` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'contact''s phone number',
536 `altphone` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'contact''s alternate phone number',
537 `fax` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'contact''s fax number',
538 `email` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'contact''s email address',
539 `notes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes related to the contact',
540 `orderacquisition` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive acquisition orders',
541 `claimacquisition` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive acquisitions claims',
542 `claimissues` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'should this contact receive serial claims',
543 `acqprimary` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is this the primary contact for acquisitions messages',
544 `serialsprimary` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is this the primary contact for serials messages',
545 `booksellerid` int(11) NOT NULL,
547 KEY `booksellerid_aqcontacts_fk` (`booksellerid`),
548 CONSTRAINT `booksellerid_aqcontacts_fk` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
549 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
550 /*!40101 SET character_set_client = @saved_cs_client */;
553 -- Table structure for table `aqcontract`
556 DROP TABLE IF EXISTS `aqcontract`;
557 /*!40101 SET @saved_cs_client = @@character_set_client */;
558 /*!40101 SET character_set_client = utf8 */;
559 CREATE TABLE `aqcontract` (
560 `contractnumber` int(11) NOT NULL AUTO_INCREMENT,
561 `contractstartdate` date DEFAULT NULL,
562 `contractenddate` date DEFAULT NULL,
563 `contractname` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
564 `contractdescription` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
565 `booksellerid` int(11) NOT NULL,
566 PRIMARY KEY (`contractnumber`),
567 KEY `booksellerid_fk1` (`booksellerid`),
568 CONSTRAINT `booksellerid_fk1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
569 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
570 /*!40101 SET character_set_client = @saved_cs_client */;
573 -- Table structure for table `aqinvoice_adjustments`
576 DROP TABLE IF EXISTS `aqinvoice_adjustments`;
577 /*!40101 SET @saved_cs_client = @@character_set_client */;
578 /*!40101 SET character_set_client = utf8 */;
579 CREATE TABLE `aqinvoice_adjustments` (
580 `adjustment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key for adjustments',
581 `invoiceid` int(11) NOT NULL COMMENT 'foreign key to link an adjustment to an invoice',
582 `adjustment` decimal(28,6) DEFAULT NULL COMMENT 'amount of adjustment',
583 `reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'reason for adjustment defined by authorised values in ADJ_REASON category',
584 `note` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'text to explain adjustment',
585 `budget_id` int(11) DEFAULT NULL COMMENT 'optional link to budget to apply adjustment to',
586 `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',
587 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'timestamp of last adjustment to adjustment',
588 PRIMARY KEY (`adjustment_id`),
589 KEY `aqinvoice_adjustments_fk_invoiceid` (`invoiceid`),
590 KEY `aqinvoice_adjustments_fk_budget_id` (`budget_id`),
591 CONSTRAINT `aqinvoice_adjustments_fk_budget_id` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
592 CONSTRAINT `aqinvoice_adjustments_fk_invoiceid` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE CASCADE ON UPDATE CASCADE
593 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
594 /*!40101 SET character_set_client = @saved_cs_client */;
597 -- Table structure for table `aqinvoices`
600 DROP TABLE IF EXISTS `aqinvoices`;
601 /*!40101 SET @saved_cs_client = @@character_set_client */;
602 /*!40101 SET character_set_client = utf8 */;
603 CREATE TABLE `aqinvoices` (
604 `invoiceid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the invoice, primary key',
605 `invoicenumber` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Name of invoice',
606 `booksellerid` int(11) NOT NULL COMMENT 'foreign key to aqbooksellers',
607 `shipmentdate` date DEFAULT NULL COMMENT 'date of shipment',
608 `billingdate` date DEFAULT NULL COMMENT 'date of billing',
609 `closedate` date DEFAULT NULL COMMENT 'invoice close date, NULL means the invoice is open',
610 `shipmentcost` decimal(28,6) DEFAULT NULL COMMENT 'shipment cost',
611 `shipmentcost_budgetid` int(11) DEFAULT NULL COMMENT 'foreign key to aqbudgets, link the shipment cost to a budget',
612 `message_id` int(11) DEFAULT NULL COMMENT 'foreign key to edifact invoice message',
613 PRIMARY KEY (`invoiceid`),
614 KEY `aqinvoices_fk_aqbooksellerid` (`booksellerid`),
615 KEY `edifact_msg_fk` (`message_id`),
616 KEY `aqinvoices_fk_shipmentcost_budgetid` (`shipmentcost_budgetid`),
617 CONSTRAINT `aqinvoices_fk_aqbooksellerid` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
618 CONSTRAINT `aqinvoices_fk_shipmentcost_budgetid` FOREIGN KEY (`shipmentcost_budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
619 CONSTRAINT `edifact_msg_fk` FOREIGN KEY (`message_id`) REFERENCES `edifact_messages` (`id`) ON DELETE SET NULL
620 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
621 /*!40101 SET character_set_client = @saved_cs_client */;
624 -- Table structure for table `aqorder_users`
627 DROP TABLE IF EXISTS `aqorder_users`;
628 /*!40101 SET @saved_cs_client = @@character_set_client */;
629 /*!40101 SET character_set_client = utf8 */;
630 CREATE TABLE `aqorder_users` (
631 `ordernumber` int(11) NOT NULL COMMENT 'the order this patrons receive notifications from (aqorders.ordernumber)',
632 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber for the patron receiving notifications for this order (borrowers.borrowernumber)',
633 PRIMARY KEY (`ordernumber`,`borrowernumber`),
634 KEY `aqorder_users_ibfk_2` (`borrowernumber`),
635 CONSTRAINT `aqorder_users_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
636 CONSTRAINT `aqorder_users_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
637 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
638 /*!40101 SET character_set_client = @saved_cs_client */;
641 -- Table structure for table `aqorders`
644 DROP TABLE IF EXISTS `aqorders`;
645 /*!40101 SET @saved_cs_client = @@character_set_client */;
646 /*!40101 SET character_set_client = utf8 */;
647 CREATE TABLE `aqorders` (
648 `ordernumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha to each line',
649 `biblionumber` int(11) DEFAULT NULL COMMENT 'links the order to the biblio being ordered (biblio.biblionumber)',
650 `entrydate` date DEFAULT NULL COMMENT 'the date the bib was added to the basket',
651 `quantity` smallint(6) DEFAULT NULL COMMENT 'the quantity ordered',
652 `currency` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the currency used for the purchase',
653 `listprice` decimal(28,6) DEFAULT NULL COMMENT 'the vendor price for this line item',
654 `datereceived` date DEFAULT NULL COMMENT 'the date this order was received',
655 `invoiceid` int(11) DEFAULT NULL COMMENT 'id of invoice',
656 `freight` decimal(28,6) DEFAULT NULL COMMENT 'shipping costs (not used)',
657 `unitprice` decimal(28,6) DEFAULT NULL COMMENT 'the actual cost entered when receiving this line item',
658 `unitprice_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the unit price excluding tax (on receiving)',
659 `unitprice_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the unit price including tax (on receiving)',
660 `quantityreceived` smallint(6) NOT NULL DEFAULT 0 COMMENT 'the quantity that have been received so far',
661 `created_by` int(11) DEFAULT NULL COMMENT 'the borrowernumber of order line''s creator',
662 `datecancellationprinted` date DEFAULT NULL COMMENT 'the date the line item was deleted',
663 `cancellationreason` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'reason of cancellation',
664 `order_internalnote` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes related to this order line, made for staff',
665 `order_vendornote` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes related to this order line, made for vendor',
666 `purchaseordernumber` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'not used? always NULL',
667 `basketno` int(11) DEFAULT NULL COMMENT 'links this order line to a specific basket (aqbasket.basketno)',
668 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this order line was last modified',
669 `rrp` decimal(13,2) DEFAULT NULL COMMENT 'the retail cost for this line item',
670 `replacementprice` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost for this line item',
671 `rrp_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost excluding tax',
672 `rrp_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the replacement cost including tax',
673 `ecost` decimal(13,2) DEFAULT NULL COMMENT 'the replacement cost for this line item',
674 `ecost_tax_excluded` decimal(28,6) DEFAULT NULL COMMENT 'the estimated cost excluding tax',
675 `ecost_tax_included` decimal(28,6) DEFAULT NULL COMMENT 'the estimated cost including tax',
676 `tax_rate_bak` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate for this line item (%)',
677 `tax_rate_on_ordering` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate on ordering for this line item (%)',
678 `tax_rate_on_receiving` decimal(6,4) DEFAULT NULL COMMENT 'the tax rate on receiving for this line item (%)',
679 `tax_value_bak` decimal(28,6) DEFAULT NULL COMMENT 'the tax value for this line item',
680 `tax_value_on_ordering` decimal(28,6) DEFAULT NULL COMMENT 'the tax value on ordering for this line item',
681 `tax_value_on_receiving` decimal(28,6) DEFAULT NULL COMMENT 'the tax value on receiving for this line item',
682 `discount` float(6,4) DEFAULT NULL COMMENT 'the discount for this line item (%)',
683 `budget_id` int(11) NOT NULL COMMENT 'the fund this order goes against (aqbudgets.budget_id)',
684 `budgetdate` date DEFAULT NULL COMMENT 'not used? always NULL',
685 `sort1` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'statistical field',
686 `sort2` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'second statistical field',
687 `sort1_authcat` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
688 `sort2_authcat` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
689 `uncertainprice` tinyint(1) DEFAULT NULL COMMENT 'was this price uncertain (1 for yes, 0 for no)',
690 `subscriptionid` int(11) DEFAULT NULL COMMENT 'links this order line to a subscription (subscription.subscriptionid)',
691 `parent_ordernumber` int(11) DEFAULT NULL COMMENT 'ordernumber of parent order line, or same as ordernumber if no parent',
692 `orderstatus` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT 'new' COMMENT 'the current status for this line item. Can be ''new'', ''ordered'', ''partial'', ''complete'' or ''cancelled''',
693 `line_item_id` varchar(35) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Supplier''s article id for Edifact orderline',
694 `suppliers_reference_number` varchar(35) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Suppliers unique edifact quote ref',
695 `suppliers_reference_qualifier` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Type of number above usually ''QLI''',
696 `suppliers_report` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'reports received from suppliers',
697 `estimated_delivery_date` date DEFAULT NULL COMMENT 'Estimated delivery date',
698 PRIMARY KEY (`ordernumber`),
699 KEY `basketno` (`basketno`),
700 KEY `biblionumber` (`biblionumber`),
701 KEY `budget_id` (`budget_id`),
702 KEY `parent_ordernumber` (`parent_ordernumber`),
703 KEY `orderstatus` (`orderstatus`),
704 KEY `aqorders_created_by` (`created_by`),
705 KEY `aqorders_ibfk_3` (`invoiceid`),
706 KEY `aqorders_subscriptionid` (`subscriptionid`),
707 KEY `aqorders_currency` (`currency`),
708 CONSTRAINT `aqorders_budget_id_fk` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
709 CONSTRAINT `aqorders_created_by` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
710 CONSTRAINT `aqorders_currency` FOREIGN KEY (`currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
711 CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
712 CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
713 CONSTRAINT `aqorders_ibfk_3` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE SET NULL ON UPDATE CASCADE,
714 CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
715 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
716 /*!40101 SET character_set_client = @saved_cs_client */;
719 -- Table structure for table `aqorders_claims`
722 DROP TABLE IF EXISTS `aqorders_claims`;
723 /*!40101 SET @saved_cs_client = @@character_set_client */;
724 /*!40101 SET character_set_client = utf8 */;
725 CREATE TABLE `aqorders_claims` (
726 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the claims',
727 `ordernumber` int(11) NOT NULL COMMENT 'order linked to this claim',
728 `claimed_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date of the claims',
730 KEY `aqorders_claims_ibfk_1` (`ordernumber`),
731 CONSTRAINT `aqorders_claims_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE
732 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
733 /*!40101 SET character_set_client = @saved_cs_client */;
736 -- Table structure for table `aqorders_items`
739 DROP TABLE IF EXISTS `aqorders_items`;
740 /*!40101 SET @saved_cs_client = @@character_set_client */;
741 /*!40101 SET character_set_client = utf8 */;
742 CREATE TABLE `aqorders_items` (
743 `ordernumber` int(11) NOT NULL COMMENT 'the order this item is attached to (aqorders.ordernumber)',
744 `itemnumber` int(11) NOT NULL COMMENT 'the item number for this item (items.itemnumber)',
745 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this order item was last touched',
746 PRIMARY KEY (`itemnumber`),
747 KEY `ordernumber` (`ordernumber`),
748 CONSTRAINT `aqorders_items_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders` (`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE
749 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
750 /*!40101 SET character_set_client = @saved_cs_client */;
753 -- Table structure for table `aqorders_transfers`
756 DROP TABLE IF EXISTS `aqorders_transfers`;
757 /*!40101 SET @saved_cs_client = @@character_set_client */;
758 /*!40101 SET character_set_client = utf8 */;
759 CREATE TABLE `aqorders_transfers` (
760 `ordernumber_from` int(11) DEFAULT NULL,
761 `ordernumber_to` int(11) DEFAULT NULL,
762 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
763 UNIQUE KEY `ordernumber_from` (`ordernumber_from`),
764 UNIQUE KEY `ordernumber_to` (`ordernumber_to`),
765 CONSTRAINT `aqorders_transfers_ordernumber_from` FOREIGN KEY (`ordernumber_from`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
766 CONSTRAINT `aqorders_transfers_ordernumber_to` FOREIGN KEY (`ordernumber_to`) REFERENCES `aqorders` (`ordernumber`) ON DELETE SET NULL ON UPDATE CASCADE
767 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
768 /*!40101 SET character_set_client = @saved_cs_client */;
771 -- Table structure for table `article_requests`
774 DROP TABLE IF EXISTS `article_requests`;
775 /*!40101 SET @saved_cs_client = @@character_set_client */;
776 /*!40101 SET character_set_client = utf8 */;
777 CREATE TABLE `article_requests` (
778 `id` int(11) NOT NULL AUTO_INCREMENT,
779 `borrowernumber` int(11) NOT NULL,
780 `biblionumber` int(11) NOT NULL,
781 `itemnumber` int(11) DEFAULT NULL,
782 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
783 `title` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
784 `author` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
785 `volume` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
786 `issue` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
787 `date` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
788 `pages` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
789 `chapters` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
790 `patron_notes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
791 `status` enum('REQUESTED','PENDING','PROCESSING','COMPLETED','CANCELED') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'REQUESTED',
792 `notes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
793 `format` enum('PHOTOCOPY','SCAN') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PHOTOCOPY',
794 `urls` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
795 `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value AR_CANCELLATION',
796 `debit_id` int(11) DEFAULT NULL COMMENT 'Debit line with cost for article scan request',
797 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Be careful with two timestamps in one table not allowing NULL',
798 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
799 `toc_request` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'borrower requested table of contents',
801 KEY `borrowernumber` (`borrowernumber`),
802 KEY `biblionumber` (`biblionumber`),
803 KEY `itemnumber` (`itemnumber`),
804 KEY `branchcode` (`branchcode`),
805 KEY `debit_id` (`debit_id`),
806 CONSTRAINT `article_requests_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
807 CONSTRAINT `article_requests_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
808 CONSTRAINT `article_requests_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
809 CONSTRAINT `article_requests_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
810 CONSTRAINT `article_requests_ibfk_5` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE SET NULL ON UPDATE CASCADE
811 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
812 /*!40101 SET character_set_client = @saved_cs_client */;
815 -- Table structure for table `audio_alerts`
818 DROP TABLE IF EXISTS `audio_alerts`;
819 /*!40101 SET @saved_cs_client = @@character_set_client */;
820 /*!40101 SET character_set_client = utf8 */;
821 CREATE TABLE `audio_alerts` (
822 `id` int(11) NOT NULL AUTO_INCREMENT,
823 `precedence` smallint(5) unsigned NOT NULL,
824 `selector` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
825 `sound` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
827 KEY `precedence` (`precedence`)
828 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
829 /*!40101 SET character_set_client = @saved_cs_client */;
832 -- Table structure for table `auth_header`
835 DROP TABLE IF EXISTS `auth_header`;
836 /*!40101 SET @saved_cs_client = @@character_set_client */;
837 /*!40101 SET character_set_client = utf8 */;
838 CREATE TABLE `auth_header` (
839 `authid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
840 `authtypecode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
841 `datecreated` date DEFAULT NULL,
842 `modification_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
843 `origincode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
844 `authtrees` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
845 `marc` blob DEFAULT NULL,
846 `linkid` bigint(20) DEFAULT NULL,
847 `marcxml` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
848 PRIMARY KEY (`authid`),
849 KEY `origincode` (`origincode`)
850 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
851 /*!40101 SET character_set_client = @saved_cs_client */;
854 -- Table structure for table `identity_provider`
857 DROP TABLE IF EXISTS `identity_providers`;
858 /*!40101 SET @saved_cs_client = @@character_set_client */;
859 /*!40101 SET character_set_client = utf8 */;
860 CREATE TABLE `identity_providers` (
861 `identity_provider_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify the provider',
862 `code` varchar(20) NOT NULL COMMENT 'Provider code',
863 `description` varchar(255) NOT NULL COMMENT 'Description for the provider',
864 `protocol` enum('OAuth', 'OIDC', 'LDAP', 'CAS') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Protocol provider speaks',
865 `config` longtext NOT NULL COMMENT 'Configuration of the provider in JSON format',
866 `mapping` longtext NOT NULL COMMENT 'Configuration to map provider data to Koha user',
867 `matchpoint` enum('email','userid','cardnumber') NOT NULL COMMENT 'The patron attribute to be used as matchpoint',
868 `icon_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Provider icon URL',
869 PRIMARY KEY (`identity_provider_id`),
871 KEY `protocol` (`protocol`)
872 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
873 /*!40101 SET character_set_client = @saved_cs_client */;
876 -- Table structure for table `identity_provider`
879 DROP TABLE IF EXISTS `identity_provider_domains`;
880 /*!40101 SET @saved_cs_client = @@character_set_client */;
881 /*!40101 SET character_set_client = utf8 */;
882 CREATE TABLE `identity_provider_domains` (
883 `identity_provider_domain_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify providers domain',
884 `identity_provider_id` int(11) NOT NULL COMMENT 'Reference to provider',
885 `domain` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Domain name. If null means all domains',
886 `auto_register` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Allow user auto register',
887 `update_on_auth` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Update user data on auth login',
888 `default_library_id` varchar(10) DEFAULT NULL COMMENT 'Default library to create user if auto register is enabled',
889 `default_category_id` varchar(10) DEFAULT NULL COMMENT 'Default category to create user if auto register is enabled',
890 `allow_opac` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Allow provider from opac interface',
891 `allow_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Allow provider from staff interface',
892 PRIMARY KEY (`identity_provider_domain_id`),
893 UNIQUE KEY (`identity_provider_id`, `domain`),
894 KEY `domain` (`domain`),
895 KEY `allow_opac` (`allow_opac`),
896 KEY `allow_staff` (`allow_staff`),
897 CONSTRAINT `identity_provider_domain_ibfk_1` FOREIGN KEY (`identity_provider_id`) REFERENCES `identity_providers` (`identity_provider_id`) ON DELETE CASCADE,
898 CONSTRAINT `identity_provider_domain_ibfk_2` FOREIGN KEY (`default_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
899 CONSTRAINT `identity_provider_domain_ibfk_3` FOREIGN KEY (`default_category_id`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE
900 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
903 -- Table structure for table `auth_subfield_structure`
906 DROP TABLE IF EXISTS `auth_subfield_structure`;
907 /*!40101 SET @saved_cs_client = @@character_set_client */;
908 /*!40101 SET character_set_client = utf8 */;
909 CREATE TABLE `auth_subfield_structure` (
910 `authtypecode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
911 `tagfield` varchar(3) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
912 `tagsubfield` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
913 `liblibrarian` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
914 `libopac` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
915 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
916 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
917 `tab` tinyint(1) DEFAULT NULL,
918 `authorised_value` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
919 `value_builder` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
920 `seealso` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
921 `isurl` tinyint(1) DEFAULT NULL,
922 `hidden` tinyint(3) NOT NULL DEFAULT 0,
923 `linkid` tinyint(1) NOT NULL DEFAULT 0,
924 `kohafield` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT '',
925 `frameworkcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
926 `defaultvalue` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
927 `display_order` int(2) NOT NULL DEFAULT 0,
928 PRIMARY KEY (`authtypecode`,`tagfield`,`tagsubfield`),
929 KEY `tab` (`authtypecode`,`tab`),
930 CONSTRAINT `auth_subfield_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
931 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
932 /*!40101 SET character_set_client = @saved_cs_client */;
935 -- Table structure for table `auth_tag_structure`
938 DROP TABLE IF EXISTS `auth_tag_structure`;
939 /*!40101 SET @saved_cs_client = @@character_set_client */;
940 /*!40101 SET character_set_client = utf8 */;
941 CREATE TABLE `auth_tag_structure` (
942 `authtypecode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
943 `tagfield` varchar(3) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
944 `liblibrarian` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
945 `libopac` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
946 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
947 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
948 `authorised_value` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
949 PRIMARY KEY (`authtypecode`,`tagfield`),
950 CONSTRAINT `auth_tag_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
951 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
952 /*!40101 SET character_set_client = @saved_cs_client */;
955 -- Table structure for table `auth_types`
958 DROP TABLE IF EXISTS `auth_types`;
959 /*!40101 SET @saved_cs_client = @@character_set_client */;
960 /*!40101 SET character_set_client = utf8 */;
961 CREATE TABLE `auth_types` (
962 `authtypecode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
963 `authtypetext` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
964 `auth_tag_to_report` varchar(3) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
965 `summary` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
966 PRIMARY KEY (`authtypecode`)
967 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
968 /*!40101 SET character_set_client = @saved_cs_client */;
971 -- Table structure for table `authorised_value_categories`
974 DROP TABLE IF EXISTS `authorised_value_categories`;
975 /*!40101 SET @saved_cs_client = @@character_set_client */;
976 /*!40101 SET character_set_client = utf8 */;
977 CREATE TABLE `authorised_value_categories` (
978 `category_name` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
979 `is_system` tinyint(1) DEFAULT 0,
980 PRIMARY KEY (`category_name`)
981 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
982 /*!40101 SET character_set_client = @saved_cs_client */;
985 -- Table structure for table `authorised_values`
988 DROP TABLE IF EXISTS `authorised_values`;
989 /*!40101 SET @saved_cs_client = @@character_set_client */;
990 /*!40101 SET character_set_client = utf8 */;
991 CREATE TABLE `authorised_values` (
992 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key, used to identify the authorized value',
993 `category` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'key used to identify the authorized value category',
994 `authorised_value` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'code use to identify the authorized value',
995 `lib` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'authorized value description as printed in the staff interface',
996 `lib_opac` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'authorized value description as printed in the OPAC',
997 `imageurl` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'authorized value URL',
999 UNIQUE KEY `av_uniq` (`category`,`authorised_value`),
1000 KEY `name` (`category`),
1001 KEY `lib` (`lib`(191)),
1002 KEY `auth_value_idx` (`authorised_value`),
1003 CONSTRAINT `authorised_values_authorised_values_category` FOREIGN KEY (`category`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE CASCADE ON UPDATE CASCADE
1004 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1005 /*!40101 SET character_set_client = @saved_cs_client */;
1008 -- Table structure for table `authorised_values_branches`
1011 DROP TABLE IF EXISTS `authorised_values_branches`;
1012 /*!40101 SET @saved_cs_client = @@character_set_client */;
1013 /*!40101 SET character_set_client = utf8 */;
1014 CREATE TABLE `authorised_values_branches` (
1015 `av_id` int(11) NOT NULL,
1016 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
1017 KEY `av_id` (`av_id`),
1018 KEY `branchcode` (`branchcode`),
1019 CONSTRAINT `authorised_values_branches_ibfk_1` FOREIGN KEY (`av_id`) REFERENCES `authorised_values` (`id`) ON DELETE CASCADE,
1020 CONSTRAINT `authorised_values_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1021 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1022 /*!40101 SET character_set_client = @saved_cs_client */;
1025 -- Table structure for table `background_jobs`
1028 DROP TABLE IF EXISTS `background_jobs`;
1029 /*!40101 SET @saved_cs_client = @@character_set_client */;
1030 /*!40101 SET character_set_client = utf8 */;
1031 CREATE TABLE `background_jobs` (
1032 `id` int(11) NOT NULL AUTO_INCREMENT,
1033 `status` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1034 `progress` int(11) DEFAULT NULL,
1035 `size` int(11) DEFAULT NULL,
1036 `borrowernumber` int(11) DEFAULT NULL,
1037 `type` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1038 `queue` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT 'Name of the queue the job is sent to',
1039 `data` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1040 `context` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'JSON-serialized context information for the job',
1041 `enqueued_on` datetime DEFAULT NULL,
1042 `started_on` datetime DEFAULT NULL,
1043 `ended_on` datetime DEFAULT NULL,
1045 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1046 /*!40101 SET character_set_client = @saved_cs_client */;
1049 -- Table structure for table `biblio`
1052 DROP TABLE IF EXISTS `biblio`;
1053 /*!40101 SET @saved_cs_client = @@character_set_client */;
1054 /*!40101 SET character_set_client = utf8 */;
1055 CREATE TABLE `biblio` (
1056 `biblionumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned to each bibliographic record',
1057 `frameworkcode` varchar(4) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'foreign key from the biblio_framework table to identify which framework was used in cataloging this record',
1058 `author` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'statement of responsibility from MARC record (100$a in MARC21)',
1059 `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'title (without the subtitle) from the MARC record (245$a in MARC21)',
1060 `medium` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'medium from the MARC record (245$h in MARC21)',
1061 `subtitle` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'remainder of the title from the MARC record (245$b in MARC21)',
1062 `part_number` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'part number from the MARC record (245$n in MARC21)',
1063 `part_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'part name from the MARC record (245$p in MARC21)',
1064 `unititle` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'uniform title (without the subtitle) from the MARC record (240$a in MARC21)',
1065 `notes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)',
1066 `serial` tinyint(1) DEFAULT NULL COMMENT 'Boolean indicating whether biblio is for a serial',
1067 `seriestitle` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1068 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'publication or copyright date from the MARC record',
1069 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
1070 `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
1071 `abstract` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
1072 PRIMARY KEY (`biblionumber`),
1073 KEY `blbnoidx` (`biblionumber`)
1074 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1075 /*!40101 SET character_set_client = @saved_cs_client */;
1078 -- Table structure for table `biblio_framework`
1081 DROP TABLE IF EXISTS `biblio_framework`;
1082 /*!40101 SET @saved_cs_client = @@character_set_client */;
1083 /*!40101 SET character_set_client = utf8 */;
1084 CREATE TABLE `biblio_framework` (
1085 `frameworkcode` varchar(4) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'the unique code assigned to the framework',
1086 `frameworktext` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'the description/name given to the framework',
1087 PRIMARY KEY (`frameworkcode`)
1088 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1089 /*!40101 SET character_set_client = @saved_cs_client */;
1092 -- Table structure for table `biblio_metadata`
1095 DROP TABLE IF EXISTS `biblio_metadata`;
1096 /*!40101 SET @saved_cs_client = @@character_set_client */;
1097 /*!40101 SET character_set_client = utf8 */;
1098 CREATE TABLE `biblio_metadata` (
1099 `id` int(11) NOT NULL AUTO_INCREMENT,
1100 `biblionumber` int(11) NOT NULL,
1101 `format` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
1102 `schema` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
1103 `metadata` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
1104 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1106 UNIQUE KEY `biblio_metadata_uniq_key` (`biblionumber`,`format`,`schema`),
1107 KEY `timestamp` (`timestamp`),
1108 CONSTRAINT `record_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1109 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1110 /*!40101 SET character_set_client = @saved_cs_client */;
1113 -- Table structure for table `biblioitems`
1116 DROP TABLE IF EXISTS `biblioitems`;
1117 /*!40101 SET @saved_cs_client = @@character_set_client */;
1118 /*!40101 SET character_set_client = utf8 */;
1119 CREATE TABLE `biblioitems` (
1120 `biblioitemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, unique identifier assigned by Koha',
1121 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the biblio table',
1122 `volume` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1123 `number` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1124 `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'biblio level item type (MARC21 942$c)',
1125 `isbn` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'ISBN (MARC21 020$a)',
1126 `issn` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'ISSN (MARC21 022$a)',
1127 `ean` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1128 `publicationyear` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1129 `publishercode` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'publisher (MARC21 260$b)',
1130 `volumedate` date DEFAULT NULL,
1131 `volumedesc` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'volume information (MARC21 362$a)',
1132 `collectiontitle` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1133 `collectionissn` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1134 `collectionvolume` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1135 `editionstatement` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1136 `editionresponsibility` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1137 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1138 `illus` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)',
1139 `pages` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'number of pages (MARC21 300$c)',
1140 `notes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1141 `size` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'material size (MARC21 300$c)',
1142 `place` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'publication place (MARC21 260$a)',
1143 `lccn` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'library of congress control number (MARC21 010$a)',
1144 `url` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'url (MARC21 856$u)',
1145 `cn_source` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'classification source (MARC21 942$2)',
1146 `cn_class` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1147 `cn_item` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1148 `cn_suffix` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1149 `cn_sort` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'normalized version of the call number used for sorting',
1150 `agerestriction` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'target audience/age restriction from the bib record (MARC21 521$a)',
1151 `totalissues` int(10) DEFAULT NULL,
1152 PRIMARY KEY (`biblioitemnumber`),
1153 KEY `bibinoidx` (`biblioitemnumber`),
1154 KEY `bibnoidx` (`biblionumber`),
1155 KEY `itemtype_idx` (`itemtype`),
1156 KEY `isbn` (`isbn`(191)),
1157 KEY `issn` (`issn`(191)),
1158 KEY `ean` (`ean`(191)),
1159 KEY `publishercode` (`publishercode`(191)),
1160 KEY `timestamp` (`timestamp`),
1161 CONSTRAINT `biblioitems_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1162 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1163 /*!40101 SET character_set_client = @saved_cs_client */;
1166 -- Table structure for table `borrower_attribute_types`
1169 DROP TABLE IF EXISTS `borrower_attribute_types`;
1170 /*!40101 SET @saved_cs_client = @@character_set_client */;
1171 /*!40101 SET character_set_client = utf8 */;
1172 CREATE TABLE `borrower_attribute_types` (
1173 `code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'unique key used to identify each custom field',
1174 `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'description for each custom field',
1175 `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)',
1176 `unique_id` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this value needs to be unique (1 for yes, 0 for no)',
1177 `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)',
1178 `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)',
1179 `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)',
1180 `authorised_value_category` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from authorised_values that links this custom field to an authorized value category',
1181 `display_checkout` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field displays in checkout screens',
1182 `category_code` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'defines a category for an attribute_type',
1183 `class` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1184 `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)',
1185 `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1186 PRIMARY KEY (`code`),
1187 KEY `auth_val_cat_idx` (`authorised_value_category`),
1188 KEY `category_code` (`category_code`),
1189 CONSTRAINT `borrower_attribute_types_ibfk_1` FOREIGN KEY (`category_code`) REFERENCES `categories` (`categorycode`)
1190 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1191 /*!40101 SET character_set_client = @saved_cs_client */;
1194 -- Table structure for table `borrower_attribute_types_branches`
1197 DROP TABLE IF EXISTS `borrower_attribute_types_branches`;
1198 /*!40101 SET @saved_cs_client = @@character_set_client */;
1199 /*!40101 SET character_set_client = utf8 */;
1200 CREATE TABLE `borrower_attribute_types_branches` (
1201 `bat_code` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1202 `b_branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1203 KEY `bat_code` (`bat_code`),
1204 KEY `b_branchcode` (`b_branchcode`),
1205 CONSTRAINT `borrower_attribute_types_branches_ibfk_1` FOREIGN KEY (`bat_code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE,
1206 CONSTRAINT `borrower_attribute_types_branches_ibfk_2` FOREIGN KEY (`b_branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1207 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1208 /*!40101 SET character_set_client = @saved_cs_client */;
1211 -- Table structure for table `borrower_attributes`
1214 DROP TABLE IF EXISTS `borrower_attributes`;
1215 /*!40101 SET @saved_cs_client = @@character_set_client */;
1216 /*!40101 SET character_set_client = utf8 */;
1217 CREATE TABLE `borrower_attributes` (
1218 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
1219 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines which patron/borrower has this attribute',
1220 `code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
1221 `attribute` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'custom patron field value',
1223 KEY `borrowernumber` (`borrowernumber`),
1224 KEY `code_attribute` (`code`,`attribute`(191)),
1225 CONSTRAINT `borrower_attributes_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1226 CONSTRAINT `borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE
1227 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1228 /*!40101 SET character_set_client = @saved_cs_client */;
1231 -- Table structure for table `borrower_debarments`
1234 DROP TABLE IF EXISTS `borrower_debarments`;
1235 /*!40101 SET @saved_cs_client = @@character_set_client */;
1236 /*!40101 SET character_set_client = utf8 */;
1237 CREATE TABLE `borrower_debarments` (
1238 `borrower_debarment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the restriction',
1239 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key for borrowers.borrowernumber for patron who is restricted',
1240 `expiration` date DEFAULT NULL COMMENT 'expiration date of the restriction',
1241 `type` varchar(50) NOT NULL COMMENT 'type of restriction, FK to restriction_types.code',
1242 `comment` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'comments about the restriction',
1243 `manager_id` int(11) DEFAULT NULL COMMENT 'foreign key for borrowers.borrowernumber for the librarian managing the restriction',
1244 `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date the restriction was added',
1245 `updated` timestamp NULL DEFAULT NULL COMMENT 'date the restriction was updated',
1246 PRIMARY KEY (`borrower_debarment_id`),
1247 KEY `borrowernumber` (`borrowernumber`),
1248 CONSTRAINT `borrower_debarments_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1249 CONSTRAINT `borrower_debarments_ibfk_2` FOREIGN KEY (`type`) REFERENCES `restriction_types` (`code`) ON DELETE NO ACTION ON UPDATE CASCADE
1250 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1251 /*!40101 SET character_set_client = @saved_cs_client */;
1254 -- Table structure for table `borrower_files`
1257 DROP TABLE IF EXISTS `borrower_files`;
1258 /*!40101 SET @saved_cs_client = @@character_set_client */;
1259 /*!40101 SET character_set_client = utf8 */;
1260 CREATE TABLE `borrower_files` (
1261 `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
1262 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking to the patron via the borrowernumber',
1263 `file_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'file name',
1264 `file_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'type of file',
1265 `file_description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'description given to the file',
1266 `file_content` longblob NOT NULL COMMENT 'the file',
1267 `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
1268 PRIMARY KEY (`file_id`),
1269 KEY `borrowernumber` (`borrowernumber`),
1270 CONSTRAINT `borrower_files_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1271 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1272 /*!40101 SET character_set_client = @saved_cs_client */;
1275 -- Table structure for table `borrower_message_preferences`
1278 DROP TABLE IF EXISTS `borrower_message_preferences`;
1279 /*!40101 SET @saved_cs_client = @@character_set_client */;
1280 /*!40101 SET character_set_client = utf8 */;
1281 CREATE TABLE `borrower_message_preferences` (
1282 `borrower_message_preference_id` int(11) NOT NULL AUTO_INCREMENT,
1283 `borrowernumber` int(11) DEFAULT NULL,
1284 `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1285 `message_attribute_id` int(11) DEFAULT 0,
1286 `days_in_advance` int(11) DEFAULT 0,
1287 `wants_digest` tinyint(1) NOT NULL DEFAULT 0,
1288 PRIMARY KEY (`borrower_message_preference_id`),
1289 KEY `borrowernumber` (`borrowernumber`),
1290 KEY `categorycode` (`categorycode`),
1291 KEY `message_attribute_id` (`message_attribute_id`),
1292 CONSTRAINT `borrower_message_preferences_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1293 CONSTRAINT `borrower_message_preferences_ibfk_2` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1294 CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
1295 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1296 /*!40101 SET character_set_client = @saved_cs_client */;
1299 -- Table structure for table `borrower_message_transport_preferences`
1302 DROP TABLE IF EXISTS `borrower_message_transport_preferences`;
1303 /*!40101 SET @saved_cs_client = @@character_set_client */;
1304 /*!40101 SET character_set_client = utf8 */;
1305 CREATE TABLE `borrower_message_transport_preferences` (
1306 `borrower_message_preference_id` int(11) NOT NULL DEFAULT 0,
1307 `message_transport_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0',
1308 PRIMARY KEY (`borrower_message_preference_id`,`message_transport_type`),
1309 KEY `message_transport_type` (`message_transport_type`),
1310 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,
1311 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
1312 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1313 /*!40101 SET character_set_client = @saved_cs_client */;
1316 -- Table structure for table `borrower_modifications`
1319 DROP TABLE IF EXISTS `borrower_modifications`;
1320 /*!40101 SET @saved_cs_client = @@character_set_client */;
1321 /*!40101 SET character_set_client = utf8 */;
1322 CREATE TABLE `borrower_modifications` (
1323 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1324 `verification_token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1325 `changed_fields` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1326 `borrowernumber` int(11) NOT NULL DEFAULT 0,
1327 `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1328 `surname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1329 `firstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1330 `middle_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1331 `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1332 `othernames` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1333 `initials` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1334 `pronouns` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1335 `streetnumber` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1336 `streettype` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1337 `address` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1338 `address2` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1339 `city` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1340 `state` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1341 `zipcode` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1342 `country` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1343 `email` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1344 `phone` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1345 `mobile` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1346 `fax` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1347 `emailpro` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1348 `phonepro` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1349 `B_streetnumber` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1350 `B_streettype` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1351 `B_address` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1352 `B_address2` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1353 `B_city` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1354 `B_state` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1355 `B_zipcode` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1356 `B_country` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1357 `B_email` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1358 `B_phone` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1359 `dateofbirth` date DEFAULT NULL,
1360 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1361 `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1362 `dateenrolled` date DEFAULT NULL,
1363 `dateexpiry` date DEFAULT NULL,
1364 `date_renewed` date DEFAULT NULL,
1365 `gonenoaddress` tinyint(1) DEFAULT NULL,
1366 `lost` tinyint(1) DEFAULT NULL,
1367 `debarred` date DEFAULT NULL,
1368 `debarredcomment` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1369 `contactname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1370 `contactfirstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1371 `contacttitle` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1372 `borrowernotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1373 `relationship` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1374 `sex` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1375 `password` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1376 `flags` int(11) DEFAULT NULL,
1377 `userid` varchar(75) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1378 `opacnote` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1379 `contactnote` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1380 `sort1` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1381 `sort2` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1382 `altcontactfirstname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1383 `altcontactsurname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1384 `altcontactaddress1` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1385 `altcontactaddress2` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1386 `altcontactaddress3` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1387 `altcontactstate` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1388 `altcontactzipcode` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1389 `altcontactcountry` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1390 `altcontactphone` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1391 `smsalertnumber` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1392 `privacy` int(11) DEFAULT NULL,
1393 `extended_attributes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1394 `gdpr_proc_consent` datetime DEFAULT NULL COMMENT 'data processing consent',
1395 `primary_contact_method` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'useful for reporting purposes',
1396 PRIMARY KEY (`verification_token`(191),`borrowernumber`),
1397 KEY `verification_token` (`verification_token`(191)),
1398 KEY `borrowernumber` (`borrowernumber`)
1399 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1400 /*!40101 SET character_set_client = @saved_cs_client */;
1403 -- Table structure for table `borrower_password_recovery`
1406 DROP TABLE IF EXISTS `borrower_password_recovery`;
1407 /*!40101 SET @saved_cs_client = @@character_set_client */;
1408 /*!40101 SET character_set_client = utf8 */;
1409 CREATE TABLE `borrower_password_recovery` (
1410 `borrowernumber` int(11) NOT NULL COMMENT 'the user asking a password recovery',
1411 `uuid` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'a unique string to identify a password recovery attempt',
1412 `valid_until` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'a time limit on the password recovery attempt',
1413 PRIMARY KEY (`borrowernumber`),
1414 KEY `borrowernumber` (`borrowernumber`)
1415 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1416 /*!40101 SET character_set_client = @saved_cs_client */;
1419 -- Table structure for table `borrower_relationships`
1422 DROP TABLE IF EXISTS `borrower_relationships`;
1423 /*!40101 SET @saved_cs_client = @@character_set_client */;
1424 /*!40101 SET character_set_client = utf8 */;
1425 CREATE TABLE `borrower_relationships` (
1426 `id` int(11) NOT NULL AUTO_INCREMENT,
1427 `guarantor_id` int(11) NOT NULL,
1428 `guarantee_id` int(11) NOT NULL,
1429 `relationship` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
1431 UNIQUE KEY `guarantor_guarantee_idx` (`guarantor_id`,`guarantee_id`),
1432 KEY `r_guarantee` (`guarantee_id`),
1433 CONSTRAINT `r_guarantee` FOREIGN KEY (`guarantee_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1434 CONSTRAINT `r_guarantor` FOREIGN KEY (`guarantor_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1435 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1436 /*!40101 SET character_set_client = @saved_cs_client */;
1439 -- Table structure for table `borrowers`
1442 DROP TABLE IF EXISTS `borrowers`;
1443 /*!40101 SET @saved_cs_client = @@character_set_client */;
1444 /*!40101 SET character_set_client = utf8 */;
1445 CREATE TABLE `borrowers` (
1446 `borrowernumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key, Koha assigned ID number for patrons/borrowers',
1447 `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
1448 `surname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1449 `firstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s first name',
1450 `middle_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1451 `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1452 `othernames` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
1453 `initials` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'initials for your patron/borrower',
1454 `pronouns` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower pronouns',
1455 `streetnumber` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',
1456 `streettype` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s primary address',
1457 `address` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s primary address',
1458 `address2` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s primary address',
1459 `city` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s primary address',
1460 `state` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the state or province for your patron/borrower''s primary address',
1461 `zipcode` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s primary address',
1462 `country` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the country for your patron/borrower''s primary address',
1463 `email` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the primary email address for your patron/borrower''s primary address',
1464 `phone` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the primary phone number for your patron/borrower''s primary address',
1465 `mobile` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the other phone number for your patron/borrower''s primary address',
1466 `fax` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the fax number for your patron/borrower''s primary address',
1467 `emailpro` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the secondary email addres for your patron/borrower''s primary address',
1468 `phonepro` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the secondary phone number for your patron/borrower''s primary address',
1469 `B_streetnumber` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address',
1470 `B_streettype` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s alternate address',
1471 `B_address` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s alternate address',
1472 `B_address2` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s alternate address',
1473 `B_city` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s alternate address',
1474 `B_state` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the state for your patron/borrower''s alternate address',
1475 `B_zipcode` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s alternate address',
1476 `B_country` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the country for your patron/borrower''s alternate address',
1477 `B_email` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the patron/borrower''s alternate email address',
1478 `B_phone` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the patron/borrower''s alternate phone number',
1479 `dateofbirth` date DEFAULT NULL COMMENT 'the patron/borrower''s date of birth (YYYY-MM-DD)',
1480 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table, includes the code of the patron/borrower''s home branch',
1481 `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category',
1482 `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)',
1483 `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)',
1484 `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)',
1485 `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed',
1486 `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',
1487 `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',
1488 `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)',
1489 `debarredcomment` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'comment on the stop of the patron',
1490 `contactname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children and profesionals to include surname or last name of guarantor or organization name',
1491 `contactfirstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include first name of guarantor',
1492 `contacttitle` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor',
1493 `borrowernotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface',
1494 `relationship` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor',
1495 `sex` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s gender',
1496 `password` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s Bcrypt encrypted password',
1497 `secret` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Secret for 2FA',
1498 `auth_method` enum('password','two-factor') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'password' COMMENT 'Authentication method',
1499 `flags` int(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions',
1500 `userid` varchar(75) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in',
1501 `opacnote` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface',
1502 `contactnote` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a note related to the patron/borrower''s alternate address',
1503 `sort1` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
1504 `sort2` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
1505 `altcontactfirstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'first name of alternate contact for the patron/borrower',
1506 `altcontactsurname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'surname or last name of the alternate contact for the patron/borrower',
1507 `altcontactaddress1` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the first address line for the alternate contact for the patron/borrower',
1508 `altcontactaddress2` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the second address line for the alternate contact for the patron/borrower',
1509 `altcontactaddress3` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the city for the alternate contact for the patron/borrower',
1510 `altcontactstate` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the state for the alternate contact for the patron/borrower',
1511 `altcontactzipcode` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the zipcode for the alternate contact for the patron/borrower',
1512 `altcontactcountry` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the country for the alternate contact for the patron/borrower',
1513 `altcontactphone` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the phone number for the alternate contact for the patron/borrower',
1514 `smsalertnumber` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the mobile phone number where the patron/borrower would like to receive notices (if SMS turned on)',
1515 `sms_provider_id` int(11) DEFAULT NULL COMMENT 'the provider of the mobile phone number defined in smsalertnumber',
1516 `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history',
1517 `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines',
1518 `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
1519 `checkprevcheckout` varchar(7) COLLATE utf8mb4_unicode_ci 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''.',
1520 `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)',
1521 `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
1522 `lang` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
1523 `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
1524 `overdrive_auth_token` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'persist OverDrive auth token',
1525 `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1526 `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1527 `primary_contact_method` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'useful for reporting purposes',
1528 PRIMARY KEY (`borrowernumber`),
1529 UNIQUE KEY `cardnumber` (`cardnumber`),
1530 UNIQUE KEY `userid` (`userid`),
1531 KEY `categorycode` (`categorycode`),
1532 KEY `branchcode` (`branchcode`),
1533 KEY `surname_idx` (`surname`(191)),
1534 KEY `firstname_idx` (`firstname`(191)),
1535 KEY `othernames_idx` (`othernames`(191)),
1536 KEY `sms_provider_id` (`sms_provider_id`),
1537 CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
1538 CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`),
1539 CONSTRAINT `borrowers_ibfk_3` FOREIGN KEY (`sms_provider_id`) REFERENCES `sms_providers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
1540 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1541 /*!40101 SET character_set_client = @saved_cs_client */;
1544 -- Table structure for table `branch_transfer_limits`
1547 DROP TABLE IF EXISTS `branch_transfer_limits`;
1548 /*!40101 SET @saved_cs_client = @@character_set_client */;
1549 /*!40101 SET character_set_client = utf8 */;
1550 CREATE TABLE `branch_transfer_limits` (
1551 `limitId` int(8) NOT NULL AUTO_INCREMENT,
1552 `toBranch` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
1553 `fromBranch` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
1554 `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1555 `ccode` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1556 PRIMARY KEY (`limitId`)
1557 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1558 /*!40101 SET character_set_client = @saved_cs_client */;
1561 -- Table structure for table `branches`
1564 DROP TABLE IF EXISTS `branches`;
1565 /*!40101 SET @saved_cs_client = @@character_set_client */;
1566 /*!40101 SET character_set_client = utf8 */;
1567 CREATE TABLE `branches` (
1568 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'a unique key assigned to each branch',
1569 `branchname` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the name of your library or branch',
1570 `branchaddress1` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the first address line of for your library or branch',
1571 `branchaddress2` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the second address line of for your library or branch',
1572 `branchaddress3` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the third address line of for your library or branch',
1573 `branchzip` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the zip or postal code for your library or branch',
1574 `branchcity` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the city or province for your library or branch',
1575 `branchstate` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the state for your library or branch',
1576 `branchcountry` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the county for your library or branch',
1577 `branchphone` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the primary phone for your library or branch',
1578 `branchfax` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the fax number for your library or branch',
1579 `branchemail` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the primary email address for your library or branch',
1580 `branchillemail` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the ILL staff email address for your library or branch',
1581 `branchreplyto` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the email to be used as a Reply-To',
1582 `branchreturnpath` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the email to be used as Return-Path',
1583 `branchurl` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the URL for your library or branch''s website',
1584 `issuing` tinyint(4) DEFAULT NULL COMMENT 'unused in Koha',
1585 `branchip` varchar(15) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the IP address for your library or branch',
1586 `branchnotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes related to your library or branch',
1587 `geolocation` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'geolocation of your library',
1588 `marcorgcode` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'MARC Organization Code, see http://www.loc.gov/marc/organizations/orgshome.html, when empty defaults to syspref MARCOrgCode',
1589 `pickup_location` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'the ability to act as a pickup location',
1590 `public` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'whether this library should show in the opac',
1591 PRIMARY KEY (`branchcode`)
1592 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1593 /*!40101 SET character_set_client = @saved_cs_client */;
1596 -- Table structure for table `branches_overdrive`
1599 DROP TABLE IF EXISTS `branches_overdrive`;
1600 /*!40101 SET @saved_cs_client = @@character_set_client */;
1601 /*!40101 SET character_set_client = utf8 */;
1602 CREATE TABLE `branches_overdrive` (
1603 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
1604 `authname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
1605 PRIMARY KEY (`branchcode`),
1606 CONSTRAINT `branches_overdrive_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1607 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1608 /*!40101 SET character_set_client = @saved_cs_client */;
1611 -- Table structure for table `branchtransfers`
1614 DROP TABLE IF EXISTS `branchtransfers`;
1615 /*!40101 SET @saved_cs_client = @@character_set_client */;
1616 /*!40101 SET character_set_client = utf8 */;
1617 CREATE TABLE `branchtransfers` (
1618 `branchtransfer_id` int(12) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
1619 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the itemnumber that it is in transit (items.itemnumber)',
1620 `daterequested` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date the transfer was requested',
1621 `datesent` datetime DEFAULT NULL COMMENT 'the date the transfer was initialized',
1622 `frombranch` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'the branch the transfer is coming from',
1623 `datearrived` datetime DEFAULT NULL COMMENT 'the date the transfer arrived at its destination',
1624 `datecancelled` datetime DEFAULT NULL COMMENT 'the date the transfer was cancelled',
1625 `tobranch` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'the branch the transfer was going to',
1626 `comments` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any comments related to the transfer',
1627 `reason` ENUM('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation','Recall','RecallCancellation') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'what triggered the transfer',
1628 `cancellation_reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','ItemLost','WrongTransfer','RecallCancellation') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'what triggered the transfer cancellation',
1629 PRIMARY KEY (`branchtransfer_id`),
1630 KEY `frombranch` (`frombranch`),
1631 KEY `tobranch` (`tobranch`),
1632 KEY `itemnumber` (`itemnumber`),
1633 CONSTRAINT `branchtransfers_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1634 CONSTRAINT `branchtransfers_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1635 CONSTRAINT `branchtransfers_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1636 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1637 /*!40101 SET character_set_client = @saved_cs_client */;
1640 -- Table structure for table `browser`
1643 DROP TABLE IF EXISTS `browser`;
1644 /*!40101 SET @saved_cs_client = @@character_set_client */;
1645 /*!40101 SET character_set_client = utf8 */;
1646 CREATE TABLE `browser` (
1647 `level` int(11) NOT NULL,
1648 `classification` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
1649 `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
1650 `number` bigint(20) NOT NULL,
1651 `endnode` tinyint(4) NOT NULL
1652 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1653 /*!40101 SET character_set_client = @saved_cs_client */;
1656 -- Table structure for table `cash_register_actions`
1659 DROP TABLE IF EXISTS `cash_register_actions`;
1660 /*!40101 SET @saved_cs_client = @@character_set_client */;
1661 /*!40101 SET character_set_client = utf8 */;
1662 CREATE TABLE `cash_register_actions` (
1663 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each account register action',
1664 `code` varchar(24) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'action code denoting the type of action recorded (enum),',
1665 `register_id` int(11) NOT NULL COMMENT 'id of cash_register this action belongs to,',
1666 `manager_id` int(11) NOT NULL COMMENT 'staff member performing the action',
1667 `amount` decimal(28,6) DEFAULT NULL COMMENT 'amount recorded in action (signed)',
1668 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
1670 KEY `cash_register_actions_manager` (`manager_id`),
1671 KEY `cash_register_actions_register` (`register_id`),
1672 CONSTRAINT `cash_register_actions_manager` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1673 CONSTRAINT `cash_register_actions_register` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1674 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1675 /*!40101 SET character_set_client = @saved_cs_client */;
1678 -- Table structure for table `cash_registers`
1681 DROP TABLE IF EXISTS `cash_registers`;
1682 /*!40101 SET @saved_cs_client = @@character_set_client */;
1683 /*!40101 SET character_set_client = utf8 */;
1684 CREATE TABLE `cash_registers` (
1685 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for each account register',
1686 `name` varchar(24) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the user friendly identifier for each account register',
1687 `description` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the user friendly description for each account register',
1688 `branch` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the foreign key the library this account register belongs',
1689 `branch_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote that this till is the branch default',
1690 `starting_float` decimal(28,6) DEFAULT NULL COMMENT 'the starting float this account register should be assigned',
1691 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to denote if this till is archived or not',
1693 UNIQUE KEY `name` (`name`,`branch`),
1694 KEY `cash_registers_branch` (`branch`),
1695 CONSTRAINT `cash_registers_branch` FOREIGN KEY (`branch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1696 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1697 /*!40101 SET character_set_client = @saved_cs_client */;
1700 -- Table structure for table `categories`
1703 DROP TABLE IF EXISTS `categories`;
1704 /*!40101 SET @saved_cs_client = @@character_set_client */;
1705 /*!40101 SET character_set_client = utf8 */;
1706 CREATE TABLE `categories` (
1707 `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'unique primary key used to idenfity the patron category',
1708 `description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'description of the patron category',
1709 `enrolmentperiod` smallint(6) DEFAULT NULL COMMENT 'number of months the patron is enrolled for (will be NULL if enrolmentperioddate is set)',
1710 `enrolmentperioddate` date DEFAULT NULL COMMENT 'date the patron is enrolled until (will be NULL if enrolmentperiod is set)',
1711 `password_expiry_days` smallint(6) DEFAULT NULL COMMENT 'number of days after which the patron must reset their password',
1712 `upperagelimit` smallint(6) DEFAULT NULL COMMENT 'age limit for the patron',
1713 `dateofbirthrequired` tinyint(1) DEFAULT NULL COMMENT 'the minimum age required for the patron category',
1714 `finetype` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'unused in Koha',
1715 `bulk` tinyint(1) DEFAULT NULL,
1716 `enrolmentfee` decimal(28,6) DEFAULT NULL COMMENT 'enrollment fee for the patron',
1717 `overduenoticerequired` tinyint(1) DEFAULT NULL COMMENT 'are overdue notices sent to this patron category (1 for yes, 0 for no)',
1718 `issuelimit` smallint(6) DEFAULT NULL COMMENT 'unused in Koha',
1719 `reservefee` decimal(28,6) DEFAULT NULL COMMENT 'cost to place holds',
1720 `hidelostitems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'are lost items shown to this category (1 for yes, 0 for no)',
1721 `category_type` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'A' COMMENT 'type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)',
1722 `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',
1723 `default_privacy` enum('default','never','forever') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT 'Default privacy setting for this patron category',
1724 `checkprevcheckout` varchar(7) COLLATE utf8mb4_unicode_ci 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''.',
1725 `can_be_guarantee` tinyint(1) NOT NULL default 0 COMMENT 'if patrons of this category can be guarantees',
1726 `reset_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can do the password reset flow,',
1727 `change_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can change their passwords in the OAPC',
1728 `min_password_length` smallint(6) DEFAULT NULL COMMENT 'set minimum password length for patrons in this category',
1729 `require_strong_password` tinyint(1) DEFAULT NULL COMMENT 'set required password strength for patrons in this category',
1730 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude patrons of this category from local holds priority',
1731 PRIMARY KEY (`categorycode`),
1732 UNIQUE KEY `categorycode` (`categorycode`)
1733 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1734 /*!40101 SET character_set_client = @saved_cs_client */;
1737 -- Table structure for table `categories_branches`
1740 DROP TABLE IF EXISTS `categories_branches`;
1741 /*!40101 SET @saved_cs_client = @@character_set_client */;
1742 /*!40101 SET character_set_client = utf8 */;
1743 CREATE TABLE `categories_branches` (
1744 `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1745 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1746 KEY `categorycode` (`categorycode`),
1747 KEY `branchcode` (`branchcode`),
1748 CONSTRAINT `categories_branches_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE,
1749 CONSTRAINT `categories_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
1750 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1751 /*!40101 SET character_set_client = @saved_cs_client */;
1754 -- Table structure for table `checkout_renewals`
1757 DROP TABLE IF EXISTS `checkout_renewals`;
1758 /*!40101 SET @saved_cs_client = @@character_set_client */;
1759 /*!40101 SET character_set_client = utf8 */;
1760 CREATE TABLE `checkout_renewals` (
1761 `renewal_id` int(11) NOT NULL AUTO_INCREMENT,
1762 `checkout_id` int(11) DEFAULT NULL COMMENT 'the id of the checkout this renewal pertains to',
1763 `renewer_id` int(11) DEFAULT NULL COMMENT 'the id of the user who processed the renewal',
1764 `seen` tinyint(1) DEFAULT 0 COMMENT 'boolean denoting whether the item was present or not',
1765 `interface` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the interface this renewal took place on',
1766 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the renewal took place',
1767 PRIMARY KEY (`renewal_id`),
1768 KEY `renewer_id` (`renewer_id`),
1769 CONSTRAINT `renewals_renewer_id` FOREIGN KEY (`renewer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
1770 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1771 /*!40101 SET character_set_client = @saved_cs_client */;
1774 -- Table structure for table `circulation_rules`
1777 DROP TABLE IF EXISTS `circulation_rules`;
1778 /*!40101 SET @saved_cs_client = @@character_set_client */;
1779 /*!40101 SET character_set_client = utf8 */;
1780 CREATE TABLE `circulation_rules` (
1781 `id` int(11) NOT NULL AUTO_INCREMENT,
1782 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1783 `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1784 `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1785 `rule_name` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
1786 `rule_value` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
1788 UNIQUE KEY `branchcode` (`branchcode`,`categorycode`,`itemtype`,`rule_name`),
1789 KEY `circ_rules_ibfk_2` (`categorycode`),
1790 KEY `circ_rules_ibfk_3` (`itemtype`),
1791 KEY `rule_name` (`rule_name`),
1792 CONSTRAINT `circ_rules_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
1793 CONSTRAINT `circ_rules_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
1794 CONSTRAINT `circ_rules_ibfk_3` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
1795 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1796 /*!40101 SET character_set_client = @saved_cs_client */;
1799 -- Table structure for table `cities`
1802 DROP TABLE IF EXISTS `cities`;
1803 /*!40101 SET @saved_cs_client = @@character_set_client */;
1804 /*!40101 SET character_set_client = utf8 */;
1805 CREATE TABLE `cities` (
1806 `cityid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier added by Koha',
1807 `city_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'name of the city',
1808 `city_state` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'name of the state/province',
1809 `city_country` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'name of the country',
1810 `city_zipcode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'zip or postal code',
1811 PRIMARY KEY (`cityid`)
1812 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1813 /*!40101 SET character_set_client = @saved_cs_client */;
1816 -- Table structure for table `class_sort_rules`
1819 DROP TABLE IF EXISTS `class_sort_rules`;
1820 /*!40101 SET @saved_cs_client = @@character_set_client */;
1821 /*!40101 SET character_set_client = utf8 */;
1822 CREATE TABLE `class_sort_rules` (
1823 `class_sort_rule` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1824 `description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1825 `sort_routine` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1826 PRIMARY KEY (`class_sort_rule`),
1827 UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
1828 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1829 /*!40101 SET character_set_client = @saved_cs_client */;
1832 -- Table structure for table `class_sources`
1835 DROP TABLE IF EXISTS `class_sources`;
1836 /*!40101 SET @saved_cs_client = @@character_set_client */;
1837 /*!40101 SET character_set_client = utf8 */;
1838 CREATE TABLE `class_sources` (
1839 `cn_source` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1840 `description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1841 `used` tinyint(4) NOT NULL DEFAULT 0,
1842 `class_sort_rule` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1843 `class_split_rule` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1844 PRIMARY KEY (`cn_source`),
1845 UNIQUE KEY `cn_source_idx` (`cn_source`),
1846 KEY `used_idx` (`used`),
1847 KEY `class_source_ibfk_1` (`class_sort_rule`),
1848 KEY `class_source_ibfk_2` (`class_split_rule`),
1849 CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`),
1850 CONSTRAINT `class_source_ibfk_2` FOREIGN KEY (`class_split_rule`) REFERENCES `class_split_rules` (`class_split_rule`)
1851 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1852 /*!40101 SET character_set_client = @saved_cs_client */;
1855 -- Table structure for table `class_split_rules`
1858 DROP TABLE IF EXISTS `class_split_rules`;
1859 /*!40101 SET @saved_cs_client = @@character_set_client */;
1860 /*!40101 SET character_set_client = utf8 */;
1861 CREATE TABLE `class_split_rules` (
1862 `class_split_rule` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1863 `description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1864 `split_routine` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1865 `split_regex` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1866 PRIMARY KEY (`class_split_rule`),
1867 UNIQUE KEY `class_split_rule_idx` (`class_split_rule`)
1868 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1869 /*!40101 SET character_set_client = @saved_cs_client */;
1872 -- Table structure for table `club_enrollment_fields`
1875 DROP TABLE IF EXISTS `club_enrollment_fields`;
1876 /*!40101 SET @saved_cs_client = @@character_set_client */;
1877 /*!40101 SET character_set_client = utf8 */;
1878 CREATE TABLE `club_enrollment_fields` (
1879 `id` int(11) NOT NULL AUTO_INCREMENT,
1880 `club_enrollment_id` int(11) NOT NULL,
1881 `club_template_enrollment_field_id` int(11) NOT NULL,
1882 `value` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
1884 KEY `club_enrollment_id` (`club_enrollment_id`),
1885 KEY `club_template_enrollment_field_id` (`club_template_enrollment_field_id`),
1886 CONSTRAINT `club_enrollment_fields_ibfk_1` FOREIGN KEY (`club_enrollment_id`) REFERENCES `club_enrollments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1887 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
1888 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1889 /*!40101 SET character_set_client = @saved_cs_client */;
1892 -- Table structure for table `club_enrollments`
1895 DROP TABLE IF EXISTS `club_enrollments`;
1896 /*!40101 SET @saved_cs_client = @@character_set_client */;
1897 /*!40101 SET character_set_client = utf8 */;
1898 CREATE TABLE `club_enrollments` (
1899 `id` int(11) NOT NULL AUTO_INCREMENT,
1900 `club_id` int(11) NOT NULL,
1901 `borrowernumber` int(11) NOT NULL,
1902 `date_enrolled` timestamp NOT NULL DEFAULT current_timestamp(),
1903 `date_canceled` timestamp NULL DEFAULT NULL,
1904 `date_created` timestamp NULL DEFAULT NULL,
1905 `date_updated` timestamp NULL DEFAULT NULL,
1906 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1908 KEY `club_id` (`club_id`),
1909 KEY `borrowernumber` (`borrowernumber`),
1910 KEY `branchcode` (`branchcode`),
1911 CONSTRAINT `club_enrollments_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1912 CONSTRAINT `club_enrollments_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1913 CONSTRAINT `club_enrollments_ibfk_3` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
1914 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1915 /*!40101 SET character_set_client = @saved_cs_client */;
1918 -- Table structure for table `club_fields`
1921 DROP TABLE IF EXISTS `club_fields`;
1922 /*!40101 SET @saved_cs_client = @@character_set_client */;
1923 /*!40101 SET character_set_client = utf8 */;
1924 CREATE TABLE `club_fields` (
1925 `id` int(11) NOT NULL AUTO_INCREMENT,
1926 `club_template_field_id` int(11) NOT NULL,
1927 `club_id` int(11) NOT NULL,
1928 `value` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1930 KEY `club_template_field_id` (`club_template_field_id`),
1931 KEY `club_id` (`club_id`),
1932 CONSTRAINT `club_fields_ibfk_3` FOREIGN KEY (`club_template_field_id`) REFERENCES `club_template_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1933 CONSTRAINT `club_fields_ibfk_4` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1934 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1935 /*!40101 SET character_set_client = @saved_cs_client */;
1938 -- Table structure for table `item_groups`
1941 DROP TABLE IF EXISTS `item_groups`;
1942 CREATE TABLE `item_groups` (
1943 `item_group_id` INT(11) NOT NULL auto_increment COMMENT "id for the items group",
1944 `biblio_id` INT(11) NOT NULL DEFAULT 0 COMMENT "id for the bibliographic record the group belongs to",
1945 `display_order` INT(4) NOT NULL DEFAULT 0 COMMENT "The 'sort order' for item_groups",
1946 `description` MEDIUMTEXT default NULL COMMENT "A group description",
1947 `created_on` TIMESTAMP NULL COMMENT "Time and date the group was created",
1948 `updated_on` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT "Time and date of the latest change on the group",
1949 PRIMARY KEY (`item_group_id`),
1950 CONSTRAINT `item_groups_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1951 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1954 -- Table structure for table `item_group_items`
1957 DROP TABLE IF EXISTS `item_group_items`;
1958 CREATE TABLE `item_group_items` (
1959 `item_group_items_id` int(11) NOT NULL auto_increment COMMENT "id for the group/item link",
1960 `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",
1961 `item_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key linking this table to the items table",
1962 PRIMARY KEY (`item_group_items_id`),
1963 UNIQUE KEY (`item_id`),
1964 CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1965 CONSTRAINT `item_group_items_gifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE
1966 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1969 -- Table structure for table `item_editor_templates`
1972 DROP TABLE IF EXISTS `item_editor_templates`;
1973 CREATE TABLE `item_editor_templates` (
1974 `id` INT(11) NOT NULL auto_increment COMMENT "id for the template",
1975 `patron_id` int(11) DEFAULT NULL COMMENT "creator of this template",
1976 `name` MEDIUMTEXT NOT NULL COMMENT "template name",
1977 `is_shared` TINYINT(1) NOT NULL DEFAULT 0 COMMENT "controls if template is shared",
1978 `contents` LONGTEXT NOT NULL COMMENT "json encoded template data",
1980 CONSTRAINT `bn` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
1981 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1984 -- Table structure for table `club_holds`
1987 DROP TABLE IF EXISTS `club_holds`;
1988 /*!40101 SET @saved_cs_client = @@character_set_client */;
1989 /*!40101 SET character_set_client = utf8 */;
1990 CREATE TABLE `club_holds` (
1991 `id` int(11) NOT NULL AUTO_INCREMENT,
1992 `club_id` int(11) NOT NULL COMMENT 'id for the club the hold was generated for',
1993 `biblio_id` int(11) NOT NULL COMMENT 'id for the bibliographic record the hold has been placed against',
1994 `item_id` int(11) DEFAULT NULL COMMENT 'If item-level, the id for the item the hold has been placed agains',
1995 `date_created` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Timestamp for the placed hold',
1997 KEY `clubs_holds_ibfk_1` (`club_id`),
1998 KEY `clubs_holds_ibfk_2` (`biblio_id`),
1999 KEY `clubs_holds_ibfk_3` (`item_id`),
2000 CONSTRAINT `clubs_holds_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2001 CONSTRAINT `clubs_holds_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2002 CONSTRAINT `clubs_holds_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) 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_holds_to_patron_holds`
2010 DROP TABLE IF EXISTS `club_holds_to_patron_holds`;
2011 /*!40101 SET @saved_cs_client = @@character_set_client */;
2012 /*!40101 SET character_set_client = utf8 */;
2013 CREATE TABLE `club_holds_to_patron_holds` (
2014 `id` int(11) NOT NULL AUTO_INCREMENT,
2015 `club_hold_id` int(11) NOT NULL,
2016 `patron_id` int(11) NOT NULL,
2017 `hold_id` int(11) DEFAULT NULL,
2018 `error_code` enum('damaged','ageRestricted','itemAlreadyOnHold','tooManyHoldsForThisRecord','tooManyReservesToday','tooManyReserves','notReservable','cannotReserveFromOtherBranches','libraryNotFound','libraryNotPickupLocation','cannotBeTransferred','noReservesAllowed') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2019 `error_message` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2021 KEY `clubs_holds_paton_holds_ibfk_1` (`club_hold_id`),
2022 KEY `clubs_holds_paton_holds_ibfk_2` (`patron_id`),
2023 KEY `clubs_holds_paton_holds_ibfk_3` (`hold_id`),
2024 CONSTRAINT `clubs_holds_paton_holds_ibfk_1` FOREIGN KEY (`club_hold_id`) REFERENCES `club_holds` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2025 CONSTRAINT `clubs_holds_paton_holds_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2026 CONSTRAINT `clubs_holds_paton_holds_ibfk_3` FOREIGN KEY (`hold_id`) REFERENCES `reserves` (`reserve_id`) ON DELETE CASCADE ON UPDATE CASCADE
2027 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2028 /*!40101 SET character_set_client = @saved_cs_client */;
2031 -- Table structure for table `club_template_enrollment_fields`
2034 DROP TABLE IF EXISTS `club_template_enrollment_fields`;
2035 /*!40101 SET @saved_cs_client = @@character_set_client */;
2036 /*!40101 SET character_set_client = utf8 */;
2037 CREATE TABLE `club_template_enrollment_fields` (
2038 `id` int(11) NOT NULL AUTO_INCREMENT,
2039 `club_template_id` int(11) NOT NULL,
2040 `name` text COLLATE utf8mb4_unicode_ci NOT NULL,
2041 `description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2042 `authorised_value_category` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2044 KEY `club_template_id` (`club_template_id`),
2045 CONSTRAINT `club_template_enrollment_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2046 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2047 /*!40101 SET character_set_client = @saved_cs_client */;
2050 -- Table structure for table `club_template_fields`
2053 DROP TABLE IF EXISTS `club_template_fields`;
2054 /*!40101 SET @saved_cs_client = @@character_set_client */;
2055 /*!40101 SET character_set_client = utf8 */;
2056 CREATE TABLE `club_template_fields` (
2057 `id` int(11) NOT NULL AUTO_INCREMENT,
2058 `club_template_id` int(11) NOT NULL,
2059 `name` text COLLATE utf8mb4_unicode_ci NOT NULL,
2060 `description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2061 `authorised_value_category` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2063 KEY `club_template_id` (`club_template_id`),
2064 CONSTRAINT `club_template_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2065 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2066 /*!40101 SET character_set_client = @saved_cs_client */;
2069 -- Table structure for table `club_templates`
2072 DROP TABLE IF EXISTS `club_templates`;
2073 /*!40101 SET @saved_cs_client = @@character_set_client */;
2074 /*!40101 SET character_set_client = utf8 */;
2075 CREATE TABLE `club_templates` (
2076 `id` int(11) NOT NULL AUTO_INCREMENT,
2077 `name` text COLLATE utf8mb4_unicode_ci NOT NULL,
2078 `description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2079 `is_enrollable_from_opac` tinyint(1) NOT NULL DEFAULT 0,
2080 `is_email_required` tinyint(1) NOT NULL DEFAULT 0,
2081 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2082 `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
2083 `date_updated` timestamp NULL DEFAULT NULL,
2084 `is_deletable` tinyint(1) NOT NULL DEFAULT 1,
2086 KEY `ct_branchcode` (`branchcode`),
2087 CONSTRAINT `club_templates_ibfk_1` FOREIGN KEY (`branchcode`) 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 `clubs`
2095 DROP TABLE IF EXISTS `clubs`;
2096 /*!40101 SET @saved_cs_client = @@character_set_client */;
2097 /*!40101 SET character_set_client = utf8 */;
2098 CREATE TABLE `clubs` (
2099 `id` int(11) NOT NULL AUTO_INCREMENT,
2100 `club_template_id` int(11) NOT NULL,
2101 `name` text COLLATE utf8mb4_unicode_ci NOT NULL,
2102 `description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2103 `date_start` date DEFAULT NULL,
2104 `date_end` date DEFAULT NULL,
2105 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2106 `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
2107 `date_updated` timestamp NULL DEFAULT NULL,
2109 KEY `club_template_id` (`club_template_id`),
2110 KEY `branchcode` (`branchcode`),
2111 CONSTRAINT `clubs_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2112 CONSTRAINT `clubs_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
2113 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2114 /*!40101 SET character_set_client = @saved_cs_client */;
2117 -- Table structure for table `collections`
2120 DROP TABLE IF EXISTS `collections`;
2121 /*!40101 SET @saved_cs_client = @@character_set_client */;
2122 /*!40101 SET character_set_client = utf8 */;
2123 CREATE TABLE `collections` (
2124 `colId` int(11) NOT NULL AUTO_INCREMENT,
2125 `colTitle` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
2126 `colDesc` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
2127 `colBranchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '''branchcode for branch where item should be held.''',
2128 PRIMARY KEY (`colId`),
2129 KEY `collections_ibfk_1` (`colBranchcode`),
2130 CONSTRAINT `collections_ibfk_1` FOREIGN KEY (`colBranchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2131 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2132 /*!40101 SET character_set_client = @saved_cs_client */;
2135 -- Table structure for table `collections_tracking`
2138 DROP TABLE IF EXISTS `collections_tracking`;
2139 /*!40101 SET @saved_cs_client = @@character_set_client */;
2140 /*!40101 SET character_set_client = utf8 */;
2141 CREATE TABLE `collections_tracking` (
2142 `collections_tracking_id` int(11) NOT NULL AUTO_INCREMENT,
2143 `colId` int(11) NOT NULL DEFAULT 0 COMMENT 'collections.colId',
2144 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'items.itemnumber',
2145 PRIMARY KEY (`collections_tracking_id`),
2146 KEY `collectionst_ibfk_1` (`colId`),
2147 CONSTRAINT `collectionst_ibfk_1` FOREIGN KEY (`colId`) REFERENCES `collections` (`colId`) ON DELETE CASCADE ON UPDATE CASCADE
2148 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2149 /*!40101 SET character_set_client = @saved_cs_client */;
2151 DROP TABLE IF EXISTS `restriction_types`;
2152 CREATE TABLE `restriction_types` (
2153 `code` varchar(50) NOT NULL,
2154 `display_text` text NOT NULL,
2155 `is_system` tinyint(1) NOT NULL DEFAULT 0,
2156 `is_default` tinyint(1) NOT NULL DEFAULT 0,
2157 PRIMARY KEY (`code`)
2158 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2161 -- Table structure for table `columns_settings`
2164 DROP TABLE IF EXISTS `columns_settings`;
2165 /*!40101 SET @saved_cs_client = @@character_set_client */;
2166 /*!40101 SET character_set_client = utf8 */;
2167 CREATE TABLE `columns_settings` (
2168 `module` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
2169 `page` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
2170 `tablename` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
2171 `columnname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
2172 `cannot_be_toggled` int(1) NOT NULL DEFAULT 0,
2173 `is_hidden` int(1) NOT NULL DEFAULT 0,
2174 PRIMARY KEY (`module`(191),`page`(191),`tablename`(191),`columnname`(191))
2175 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2176 /*!40101 SET character_set_client = @saved_cs_client */;
2179 -- Table structure for table `course_instructors`
2182 DROP TABLE IF EXISTS `course_instructors`;
2183 /*!40101 SET @saved_cs_client = @@character_set_client */;
2184 /*!40101 SET character_set_client = utf8 */;
2185 CREATE TABLE `course_instructors` (
2186 `course_id` int(11) NOT NULL COMMENT 'foreign key to link to courses.course_id',
2187 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key to link to borrowers.borrowernumber for instructor information',
2188 PRIMARY KEY (`course_id`,`borrowernumber`),
2189 KEY `borrowernumber` (`borrowernumber`),
2190 CONSTRAINT `course_instructors_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2191 CONSTRAINT `course_instructors_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`)
2192 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2193 /*!40101 SET character_set_client = @saved_cs_client */;
2196 -- Table structure for table `course_items`
2199 DROP TABLE IF EXISTS `course_items`;
2200 /*!40101 SET @saved_cs_client = @@character_set_client */;
2201 /*!40101 SET character_set_client = utf8 */;
2202 CREATE TABLE `course_items` (
2203 `ci_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'course item id',
2204 `itemnumber` int(11) DEFAULT NULL COMMENT 'items.itemnumber for the item on reserve',
2205 `biblionumber` int(11) NOT NULL COMMENT 'biblio.biblionumber for the bibliographic record on reserve',
2206 `itype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'new itemtype for the item to have while on reserve (optional)',
2207 `itype_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2208 `itype_storage` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a place to store the itype when item is on course reserve',
2209 `ccode` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'new category code for the item to have while on reserve (optional)',
2210 `ccode_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if ccode should be changed while on course reserve',
2211 `ccode_storage` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a place to store the ccode when item is on course reserve',
2212 `homebranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'new home branch for the item to have while on reserve (optional)',
2213 `homebranch_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if homebranch should be changed while on course reserve',
2214 `homebranch_storage` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a place to store the homebranch when item is on course reserve',
2215 `holdingbranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'new holding branch for the item to have while on reserve (optional)',
2216 `holdingbranch_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2217 `holdingbranch_storage` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a place to store the holdingbranch when item is on course reserve',
2218 `location` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'new shelving location for the item to have while on reseve (optional)',
2219 `location_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if itype should be changed while on course reserve',
2220 `location_storage` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a place to store the location when the item is on course reserve',
2221 `enabled` enum('yes','no') COLLATE utf8mb4_unicode_ci 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''',
2222 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2223 PRIMARY KEY (`ci_id`),
2224 UNIQUE KEY `itemnumber` (`itemnumber`),
2225 KEY `holdingbranch` (`holdingbranch`),
2226 KEY `fk_course_items_homebranch` (`homebranch`),
2227 KEY `fk_course_items_homebranch_storage` (`homebranch_storage`),
2228 KEY `fk_course_items_biblionumber` (`biblionumber`),
2229 CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2230 CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2231 CONSTRAINT `fk_course_items_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2232 CONSTRAINT `fk_course_items_homebranch` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2233 CONSTRAINT `fk_course_items_homebranch_storage` FOREIGN KEY (`homebranch_storage`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2234 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2235 /*!40101 SET character_set_client = @saved_cs_client */;
2238 -- Table structure for table `course_reserves`
2241 DROP TABLE IF EXISTS `course_reserves`;
2242 /*!40101 SET @saved_cs_client = @@character_set_client */;
2243 /*!40101 SET character_set_client = utf8 */;
2244 CREATE TABLE `course_reserves` (
2245 `cr_id` int(11) NOT NULL AUTO_INCREMENT,
2246 `course_id` int(11) NOT NULL COMMENT 'foreign key to link to courses.course_id',
2247 `ci_id` int(11) NOT NULL COMMENT 'foreign key to link to courses_items.ci_id',
2248 `staff_note` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'staff only note',
2249 `public_note` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'public, OPAC visible note',
2250 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2251 PRIMARY KEY (`cr_id`),
2252 UNIQUE KEY `pseudo_key` (`course_id`,`ci_id`),
2253 KEY `course_id` (`course_id`),
2254 KEY `course_reserves_ibfk_2` (`ci_id`),
2255 CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`),
2256 CONSTRAINT `course_reserves_ibfk_2` FOREIGN KEY (`ci_id`) REFERENCES `course_items` (`ci_id`) ON DELETE CASCADE ON UPDATE CASCADE
2257 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2258 /*!40101 SET character_set_client = @saved_cs_client */;
2261 -- Table structure for table `courses`
2264 DROP TABLE IF EXISTS `courses`;
2265 /*!40101 SET @saved_cs_client = @@character_set_client */;
2266 /*!40101 SET character_set_client = utf8 */;
2267 CREATE TABLE `courses` (
2268 `course_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the course',
2269 `department` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the authorised value for the DEPARTMENT',
2270 `course_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the ''course number'' assigned to a course',
2271 `section` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the ''section'' of a course',
2272 `course_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the name of the course',
2273 `term` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the authorised value for the TERM',
2274 `staff_note` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the text of the staff only note',
2275 `public_note` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the text of the public / opac note',
2276 `students_count` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'how many students will be taking this course/section',
2277 `enabled` enum('yes','no') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'yes' COMMENT 'determines whether the course is active',
2278 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2279 PRIMARY KEY (`course_id`)
2280 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2281 /*!40101 SET character_set_client = @saved_cs_client */;
2284 -- Table structure for table `cover_images`
2287 DROP TABLE IF EXISTS `cover_images`;
2288 /*!40101 SET @saved_cs_client = @@character_set_client */;
2289 /*!40101 SET character_set_client = utf8 */;
2290 CREATE TABLE `cover_images` (
2291 `imagenumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the image',
2292 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from biblio table to link to biblionumber',
2293 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from item table to link to itemnumber',
2294 `mimetype` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'image type',
2295 `imagefile` mediumblob NOT NULL COMMENT 'image file contents',
2296 `thumbnail` mediumblob NOT NULL COMMENT 'thumbnail file contents',
2297 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'image creation/update time',
2298 PRIMARY KEY (`imagenumber`),
2299 KEY `bibliocoverimage_fk1` (`biblionumber`),
2300 KEY `bibliocoverimage_fk2` (`itemnumber`),
2301 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2302 CONSTRAINT `bibliocoverimage_fk2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
2303 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2304 /*!40101 SET character_set_client = @saved_cs_client */;
2307 -- Table structure for table `creator_batches`
2310 DROP TABLE IF EXISTS `creator_batches`;
2311 /*!40101 SET @saved_cs_client = @@character_set_client */;
2312 /*!40101 SET character_set_client = utf8 */;
2313 CREATE TABLE `creator_batches` (
2314 `label_id` int(11) NOT NULL AUTO_INCREMENT,
2315 `batch_id` int(10) NOT NULL DEFAULT 1,
2316 `description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2317 `item_number` int(11) DEFAULT NULL,
2318 `borrower_number` int(11) DEFAULT NULL,
2319 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2320 `branch_code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'NB',
2321 `creator` char(15) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Labels',
2322 PRIMARY KEY (`label_id`),
2323 KEY `branch_fk_constraint` (`branch_code`),
2324 KEY `item_fk_constraint` (`item_number`),
2325 KEY `borrower_fk_constraint` (`borrower_number`),
2326 CONSTRAINT `creator_batches_ibfk_1` FOREIGN KEY (`borrower_number`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2327 CONSTRAINT `creator_batches_ibfk_2` FOREIGN KEY (`branch_code`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
2328 CONSTRAINT `creator_batches_ibfk_3` FOREIGN KEY (`item_number`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE
2329 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2330 /*!40101 SET character_set_client = @saved_cs_client */;
2333 -- Table structure for table `creator_images`
2336 DROP TABLE IF EXISTS `creator_images`;
2337 /*!40101 SET @saved_cs_client = @@character_set_client */;
2338 /*!40101 SET character_set_client = utf8 */;
2339 CREATE TABLE `creator_images` (
2340 `image_id` int(4) NOT NULL AUTO_INCREMENT,
2341 `imagefile` mediumblob DEFAULT NULL,
2342 `image_name` char(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DEFAULT',
2343 PRIMARY KEY (`image_id`),
2344 UNIQUE KEY `image_name_index` (`image_name`)
2345 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2346 /*!40101 SET character_set_client = @saved_cs_client */;
2349 -- Table structure for table `creator_layouts`
2352 DROP TABLE IF EXISTS `creator_layouts`;
2353 /*!40101 SET @saved_cs_client = @@character_set_client */;
2354 /*!40101 SET character_set_client = utf8 */;
2355 CREATE TABLE `creator_layouts` (
2356 `layout_id` int(4) NOT NULL AUTO_INCREMENT,
2357 `barcode_type` char(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'CODE39',
2358 `start_label` int(2) NOT NULL DEFAULT 1,
2359 `printing_type` char(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'BAR',
2360 `layout_name` char(25) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DEFAULT',
2361 `guidebox` int(1) DEFAULT 0,
2362 `oblique_title` int(1) DEFAULT 1,
2363 `font` char(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'TR',
2364 `font_size` int(4) NOT NULL DEFAULT 10,
2365 `units` char(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'POINT',
2366 `callnum_split` int(1) DEFAULT 0,
2367 `text_justify` char(1) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'L',
2368 `format_string` varchar(210) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'barcode',
2369 `layout_xml` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
2370 `creator` char(15) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Labels',
2371 PRIMARY KEY (`layout_id`)
2372 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2373 /*!40101 SET character_set_client = @saved_cs_client */;
2376 -- Table structure for table `creator_templates`
2379 DROP TABLE IF EXISTS `creator_templates`;
2380 /*!40101 SET @saved_cs_client = @@character_set_client */;
2381 /*!40101 SET character_set_client = utf8 */;
2382 CREATE TABLE `creator_templates` (
2383 `template_id` int(4) NOT NULL AUTO_INCREMENT,
2384 `profile_id` int(4) DEFAULT NULL,
2385 `template_code` char(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DEFAULT TEMPLATE',
2386 `template_desc` char(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Default description',
2387 `page_width` float NOT NULL DEFAULT 0,
2388 `page_height` float NOT NULL DEFAULT 0,
2389 `label_width` float NOT NULL DEFAULT 0,
2390 `label_height` float NOT NULL DEFAULT 0,
2391 `top_text_margin` float NOT NULL DEFAULT 0,
2392 `left_text_margin` float NOT NULL DEFAULT 0,
2393 `top_margin` float NOT NULL DEFAULT 0,
2394 `left_margin` float NOT NULL DEFAULT 0,
2395 `cols` int(2) NOT NULL DEFAULT 0,
2396 `rows` int(2) NOT NULL DEFAULT 0,
2397 `col_gap` float NOT NULL DEFAULT 0,
2398 `row_gap` float NOT NULL DEFAULT 0,
2399 `units` char(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'POINT',
2400 `creator` char(15) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Labels',
2401 PRIMARY KEY (`template_id`),
2402 KEY `template_profile_fk_constraint` (`profile_id`)
2403 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2404 /*!40101 SET character_set_client = @saved_cs_client */;
2407 -- Table structure for table `curbside_pickup_policy`
2410 DROP TABLE IF EXISTS `curbside_pickup_policy`;
2411 CREATE TABLE `curbside_pickup_policy` (
2412 `id` int(11) NOT NULL auto_increment,
2413 `branchcode` varchar(10) NOT NULL,
2414 `enabled` TINYINT(1) NOT NULL DEFAULT 0,
2415 `enable_waiting_holds_only` TINYINT(1) NOT NULL DEFAULT 0,
2416 `pickup_interval` INT(2) NOT NULL DEFAULT 0,
2417 `patrons_per_interval` INT(2) NOT NULL DEFAULT 0,
2418 `patron_scheduled_pickup` TINYINT(1) NOT NULL DEFAULT 0,
2420 UNIQUE KEY (`branchcode`),
2421 FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE ON UPDATE CASCADE
2422 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2425 -- Table structure for table `curbside_pickup_opening_slots`
2428 DROP TABLE IF EXISTS `curbside_pickup_opening_slots`;
2429 CREATE TABLE `curbside_pickup_opening_slots` (
2430 `id` INT(11) NOT NULL AUTO_INCREMENT,
2431 `curbside_pickup_policy_id` INT(11) NOT NULL,
2432 `day` TINYINT(1) NOT NULL,
2433 `start_hour` INT(2) NOT NULL,
2434 `start_minute` INT(2) NOT NULL,
2435 `end_hour` INT(2) NOT NULL,
2436 `end_minute` INT(2) NOT NULL,
2438 FOREIGN KEY (curbside_pickup_policy_id) REFERENCES curbside_pickup_policy(id) ON DELETE CASCADE ON UPDATE CASCADE
2439 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2442 -- Table structure for table `curbside_pickups`
2445 DROP TABLE IF EXISTS `curbside_pickups`;
2446 CREATE TABLE `curbside_pickups` (
2447 `id` int(11) NOT NULL auto_increment,
2448 `borrowernumber` int(11) NOT NULL,
2449 `branchcode` varchar(10) NOT NULL,
2450 `scheduled_pickup_datetime` datetime NOT NULL,
2451 `staged_datetime` datetime NULL DEFAULT NULL,
2452 `staged_by` int(11) NULL DEFAULT NULL,
2453 `arrival_datetime` datetime NULL DEFAULT NULL,
2454 `delivered_datetime` datetime NULL DEFAULT NULL,
2455 `delivered_by` int(11) NULL DEFAULT NULL,
2456 `notes` text NULL DEFAULT NULL,
2458 FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE ON UPDATE CASCADE,
2459 FOREIGN KEY (borrowernumber) REFERENCES borrowers(borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE,
2460 FOREIGN KEY (staged_by) REFERENCES borrowers(borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE
2461 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2464 -- Table structure for table `curbside_pickup_issues`
2467 DROP TABLE IF EXISTS `curbside_pickup_issues`;
2468 CREATE TABLE `curbside_pickup_issues` (
2469 `id` int(11) NOT NULL auto_increment,
2470 `curbside_pickup_id` int(11) NOT NULL,
2471 `issue_id` int(11) NOT NULL,
2472 `reserve_id` int(11) NOT NULL,
2474 FOREIGN KEY (curbside_pickup_id) REFERENCES curbside_pickups(id) ON DELETE CASCADE ON UPDATE CASCADE
2475 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2478 -- Table structure for table `currency`
2481 DROP TABLE IF EXISTS `currency`;
2482 /*!40101 SET @saved_cs_client = @@character_set_client */;
2483 /*!40101 SET character_set_client = utf8 */;
2484 CREATE TABLE `currency` (
2485 `currency` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
2486 `symbol` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2487 `isocode` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2488 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2489 `rate` float(15,5) DEFAULT NULL,
2490 `active` tinyint(1) DEFAULT NULL,
2491 `archived` tinyint(1) DEFAULT 0,
2492 `p_sep_by_space` tinyint(1) DEFAULT 0,
2493 PRIMARY KEY (`currency`)
2494 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2495 /*!40101 SET character_set_client = @saved_cs_client */;
2498 -- Table structure for table `deletedbiblio`
2501 DROP TABLE IF EXISTS `deletedbiblio`;
2502 /*!40101 SET @saved_cs_client = @@character_set_client */;
2503 /*!40101 SET character_set_client = utf8 */;
2504 CREATE TABLE `deletedbiblio` (
2505 `biblionumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned to each bibliographic record',
2506 `frameworkcode` varchar(4) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'foriegn key from the biblio_framework table to identify which framework was used in cataloging this record',
2507 `author` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'statement of responsibility from MARC record (100$a in MARC21)',
2508 `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'title (without the subtitle) from the MARC record (245$a in MARC21)',
2509 `medium` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'medium from the MARC record (245$h in MARC21)',
2510 `subtitle` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'remainder of the title from the MARC record (245$b in MARC21)',
2511 `part_number` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'part number from the MARC record (245$n in MARC21)',
2512 `part_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'part name from the MARC record (245$p in MARC21)',
2513 `unititle` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'uniform title (without the subtitle) from the MARC record (240$a in MARC21)',
2514 `notes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)',
2515 `serial` tinyint(1) DEFAULT NULL COMMENT 'Boolean indicating whether biblio is for a serial',
2516 `seriestitle` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2517 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'publication or copyright date from the MARC record',
2518 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this record was last touched',
2519 `datecreated` date NOT NULL COMMENT 'the date this record was added to Koha',
2520 `abstract` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'summary from the MARC record (520$a in MARC21)',
2521 PRIMARY KEY (`biblionumber`),
2522 KEY `blbnoidx` (`biblionumber`)
2523 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2524 /*!40101 SET character_set_client = @saved_cs_client */;
2527 -- Table structure for table `deletedbiblio_metadata`
2530 DROP TABLE IF EXISTS `deletedbiblio_metadata`;
2531 /*!40101 SET @saved_cs_client = @@character_set_client */;
2532 /*!40101 SET character_set_client = utf8 */;
2533 CREATE TABLE `deletedbiblio_metadata` (
2534 `id` int(11) NOT NULL AUTO_INCREMENT,
2535 `biblionumber` int(11) NOT NULL,
2536 `format` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
2537 `schema` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
2538 `metadata` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
2539 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2541 UNIQUE KEY `deletedbiblio_metadata_uniq_key` (`biblionumber`,`format`,`schema`),
2542 KEY `timestamp` (`timestamp`),
2543 CONSTRAINT `deletedrecord_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `deletedbiblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2544 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2545 /*!40101 SET character_set_client = @saved_cs_client */;
2548 -- Table structure for table `deletedbiblioitems`
2551 DROP TABLE IF EXISTS `deletedbiblioitems`;
2552 /*!40101 SET @saved_cs_client = @@character_set_client */;
2553 /*!40101 SET character_set_client = utf8 */;
2554 CREATE TABLE `deletedbiblioitems` (
2555 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key, unique identifier assigned by Koha',
2556 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key linking this table to the biblio table',
2557 `volume` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2558 `number` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2559 `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'biblio level item type (MARC21 942$c)',
2560 `isbn` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'ISBN (MARC21 020$a)',
2561 `issn` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'ISSN (MARC21 022$a)',
2562 `ean` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2563 `publicationyear` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2564 `publishercode` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'publisher (MARC21 260$b)',
2565 `volumedate` date DEFAULT NULL,
2566 `volumedesc` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'volume information (MARC21 362$a)',
2567 `collectiontitle` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2568 `collectionissn` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2569 `collectionvolume` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2570 `editionstatement` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2571 `editionresponsibility` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2572 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
2573 `illus` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)',
2574 `pages` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'number of pages (MARC21 300$c)',
2575 `notes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2576 `size` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'material size (MARC21 300$c)',
2577 `place` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'publication place (MARC21 260$a)',
2578 `lccn` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'library of congress control number (MARC21 010$a)',
2579 `url` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'url (MARC21 856$u)',
2580 `cn_source` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'classification source (MARC21 942$2)',
2581 `cn_class` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2582 `cn_item` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2583 `cn_suffix` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2584 `cn_sort` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'normalized version of the call number used for sorting',
2585 `agerestriction` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'target audience/age restriction from the bib record (MARC21 521$a)',
2586 `totalissues` int(10) DEFAULT NULL,
2587 PRIMARY KEY (`biblioitemnumber`),
2588 KEY `bibinoidx` (`biblioitemnumber`),
2589 KEY `bibnoidx` (`biblionumber`),
2590 KEY `itemtype_idx` (`itemtype`),
2591 KEY `isbn` (`isbn`(191)),
2592 KEY `ean` (`ean`(191)),
2593 KEY `publishercode` (`publishercode`(191)),
2594 KEY `timestamp` (`timestamp`)
2595 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2596 /*!40101 SET character_set_client = @saved_cs_client */;
2599 -- Table structure for table `deletedborrowers`
2602 DROP TABLE IF EXISTS `deletedborrowers`;
2603 /*!40101 SET @saved_cs_client = @@character_set_client */;
2604 /*!40101 SET character_set_client = utf8 */;
2605 CREATE TABLE `deletedborrowers` (
2606 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key, Koha assigned ID number for patrons/borrowers',
2607 `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
2608 `surname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2609 `firstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s first name',
2610 `middle_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s middle name',
2611 `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2612 `othernames` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
2613 `initials` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'initials for your patron/borrower',
2614 `pronouns` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower pronouns',
2615 `streetnumber` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',
2616 `streettype` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s primary address',
2617 `address` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s primary address',
2618 `address2` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s primary address',
2619 `city` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s primary address',
2620 `state` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the state or province for your patron/borrower''s primary address',
2621 `zipcode` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s primary address',
2622 `country` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the country for your patron/borrower''s primary address',
2623 `email` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the primary email address for your patron/borrower''s primary address',
2624 `phone` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the primary phone number for your patron/borrower''s primary address',
2625 `mobile` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the other phone number for your patron/borrower''s primary address',
2626 `fax` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the fax number for your patron/borrower''s primary address',
2627 `emailpro` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the secondary email addres for your patron/borrower''s primary address',
2628 `phonepro` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the secondary phone number for your patron/borrower''s primary address',
2629 `B_streetnumber` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address',
2630 `B_streettype` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the street type (Rd., Blvd, etc) for your patron/borrower''s alternate address',
2631 `B_address` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the first address line for your patron/borrower''s alternate address',
2632 `B_address2` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the second address line for your patron/borrower''s alternate address',
2633 `B_city` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the city or town for your patron/borrower''s alternate address',
2634 `B_state` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the state for your patron/borrower''s alternate address',
2635 `B_zipcode` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the zip or postal code for your patron/borrower''s alternate address',
2636 `B_country` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the country for your patron/borrower''s alternate address',
2637 `B_email` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the patron/borrower''s alternate email address',
2638 `B_phone` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the patron/borrower''s alternate phone number',
2639 `dateofbirth` date DEFAULT NULL COMMENT 'the patron/borrower''s date of birth (YYYY-MM-DD)',
2640 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table, includes the code of the patron/borrower''s home branch',
2641 `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category',
2642 `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)',
2643 `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)',
2644 `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)',
2645 `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed',
2646 `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',
2647 `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',
2648 `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)',
2649 `debarredcomment` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'comment on the stop of patron',
2650 `contactname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children and profesionals to include surname or last name of guarantor or organization name',
2651 `contactfirstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include first name of guarantor',
2652 `contacttitle` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include title (Mr., Mrs., etc) of guarantor',
2653 `borrowernotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is only visible in the staff interface',
2654 `relationship` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor',
2655 `sex` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s gender',
2656 `password` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s encrypted password',
2657 `secret` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Secret for 2FA',
2658 `auth_method` enum('password','two-factor') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'password' COMMENT 'Authentication method',
2659 `flags` int(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions',
2660 `userid` varchar(75) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in',
2661 `opacnote` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface',
2662 `contactnote` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a note related to the patron/borrower''s alternate address',
2663 `sort1` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
2664 `sort2` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a field that can be used for any information unique to the library',
2665 `altcontactfirstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'first name of alternate contact for the patron/borrower',
2666 `altcontactsurname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'surname or last name of the alternate contact for the patron/borrower',
2667 `altcontactaddress1` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the first address line for the alternate contact for the patron/borrower',
2668 `altcontactaddress2` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the second address line for the alternate contact for the patron/borrower',
2669 `altcontactaddress3` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the city for the alternate contact for the patron/borrower',
2670 `altcontactstate` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the state for the alternate contact for the patron/borrower',
2671 `altcontactzipcode` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the zipcode for the alternate contact for the patron/borrower',
2672 `altcontactcountry` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the country for the alternate contact for the patron/borrower',
2673 `altcontactphone` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the phone number for the alternate contact for the patron/borrower',
2674 `smsalertnumber` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the mobile phone number where the patron/borrower would like to receive notices (if SMS turned on)',
2675 `sms_provider_id` int(11) DEFAULT NULL COMMENT 'the provider of the mobile phone number defined in smsalertnumber',
2676 `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history KEY `borrowernumber` (`borrowernumber`),',
2677 `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines',
2678 `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
2679 `checkprevcheckout` varchar(7) COLLATE utf8mb4_unicode_ci 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''.',
2680 `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)',
2681 `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
2682 `lang` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
2683 `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
2684 `overdrive_auth_token` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'persist OverDrive auth token',
2685 `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2686 `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2687 `primary_contact_method` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'useful for reporting purposes',
2688 KEY `borrowernumber` (`borrowernumber`),
2689 KEY `cardnumber` (`cardnumber`),
2690 KEY `sms_provider_id` (`sms_provider_id`)
2691 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2692 /*!40101 SET character_set_client = @saved_cs_client */;
2695 -- Table structure for table `deleteditems`
2698 DROP TABLE IF EXISTS `deleteditems`;
2699 /*!40101 SET @saved_cs_client = @@character_set_client */;
2700 /*!40101 SET character_set_client = utf8 */;
2701 CREATE TABLE `deleteditems` (
2702 `itemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'primary key and unique identifier added by Koha',
2703 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
2704 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
2705 `barcode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
2706 `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
2707 `booksellerid` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
2708 `homebranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
2709 `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
2710 `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
2711 `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
2712 `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out',
2713 `datelastseen` date DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
2714 `stack` tinyint(1) DEFAULT NULL,
2715 `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
2716 `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
2717 `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
2718 `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
2719 `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
2720 `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
2721 `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
2722 `itemcallnumber` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
2723 `coded_location_qualifier` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
2724 `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out',
2725 `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
2726 `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
2727 `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
2728 `itemnotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
2729 `itemnotes_nonpublic` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
2730 `holdingbranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
2731 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
2732 `deleted_on` DATETIME DEFAULT NULL COMMENT 'date/time of deletion',
2733 `location` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
2734 `permanent_location` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
2735 `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
2736 `cn_source` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
2737 `cn_sort` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
2738 `ccode` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
2739 `materials` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
2740 `uri` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
2741 `itype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
2742 `more_subfields_xml` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
2743 `enumchron` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
2744 `copynumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
2745 `stocknumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
2746 `new_status` varchar(32) COLLATE utf8mb4_unicode_ci 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.',
2747 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
2748 PRIMARY KEY (`itemnumber`),
2749 KEY `delitembarcodeidx` (`barcode`),
2750 KEY `delitemstocknumberidx` (`stocknumber`),
2751 KEY `delitembinoidx` (`biblioitemnumber`),
2752 KEY `delitembibnoidx` (`biblionumber`),
2753 KEY `delhomebranch` (`homebranch`),
2754 KEY `delholdingbranch` (`holdingbranch`),
2755 KEY `itype_idx` (`itype`),
2756 KEY `timestamp` (`timestamp`)
2757 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2758 /*!40101 SET character_set_client = @saved_cs_client */;
2761 -- Table structure for table `desks`
2764 DROP TABLE IF EXISTS `desks`;
2765 /*!40101 SET @saved_cs_client = @@character_set_client */;
2766 /*!40101 SET character_set_client = utf8 */;
2767 CREATE TABLE `desks` (
2768 `desk_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
2769 `desk_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'name of the desk',
2770 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'library the desk is located at',
2771 PRIMARY KEY (`desk_id`),
2772 KEY `fk_desks_branchcode` (`branchcode`),
2773 CONSTRAINT `fk_desks_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2774 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2775 /*!40101 SET character_set_client = @saved_cs_client */;
2778 -- Table structure for table `discharges`
2781 DROP TABLE IF EXISTS `discharges`;
2782 /*!40101 SET @saved_cs_client = @@character_set_client */;
2783 /*!40101 SET character_set_client = utf8 */;
2784 CREATE TABLE `discharges` (
2785 `discharge_id` int(11) NOT NULL AUTO_INCREMENT,
2786 `borrower` int(11) DEFAULT NULL,
2787 `needed` timestamp NULL DEFAULT NULL,
2788 `validated` timestamp NULL DEFAULT NULL,
2789 PRIMARY KEY (`discharge_id`),
2790 KEY `borrower_discharges_ibfk1` (`borrower`),
2791 CONSTRAINT `borrower_discharges_ibfk1` FOREIGN KEY (`borrower`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2792 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2793 /*!40101 SET character_set_client = @saved_cs_client */;
2796 -- Table structure for table `edifact_ean`
2799 DROP TABLE IF EXISTS `edifact_ean`;
2800 /*!40101 SET @saved_cs_client = @@character_set_client */;
2801 /*!40101 SET character_set_client = utf8 */;
2802 CREATE TABLE `edifact_ean` (
2803 `ee_id` int(11) NOT NULL AUTO_INCREMENT,
2804 `description` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2805 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2806 `ean` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL,
2807 `id_code_qualifier` varchar(3) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '14',
2808 PRIMARY KEY (`ee_id`),
2809 KEY `efk_branchcode` (`branchcode`),
2810 CONSTRAINT `efk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
2811 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2812 /*!40101 SET character_set_client = @saved_cs_client */;
2815 -- Table structure for table `edifact_messages`
2818 DROP TABLE IF EXISTS `edifact_messages`;
2819 /*!40101 SET @saved_cs_client = @@character_set_client */;
2820 /*!40101 SET character_set_client = utf8 */;
2821 CREATE TABLE `edifact_messages` (
2822 `id` int(11) NOT NULL AUTO_INCREMENT,
2823 `message_type` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
2824 `transfer_date` date DEFAULT NULL,
2825 `vendor_id` int(11) DEFAULT NULL,
2826 `edi_acct` int(11) DEFAULT NULL,
2827 `status` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2828 `basketno` int(11) DEFAULT NULL,
2829 `raw_msg` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2830 `filename` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2831 `deleted` tinyint(1) NOT NULL DEFAULT 0,
2833 KEY `vendorid` (`vendor_id`),
2834 KEY `ediacct` (`edi_acct`),
2835 KEY `basketno` (`basketno`),
2836 CONSTRAINT `emfk_basketno` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2837 CONSTRAINT `emfk_edi_acct` FOREIGN KEY (`edi_acct`) REFERENCES `vendor_edi_accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
2838 CONSTRAINT `emfk_vendor` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2839 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2840 /*!40101 SET character_set_client = @saved_cs_client */;
2843 -- Table structure for table `erm_agreements`
2846 DROP TABLE IF EXISTS `erm_agreements`;
2847 CREATE TABLE `erm_agreements` (
2848 `agreement_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2849 `vendor_id` INT(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2850 `name` VARCHAR(255) NOT NULL COMMENT 'name of the agreement',
2851 `description` LONGTEXT DEFAULT NULL COMMENT 'description of the agreement',
2852 `status` VARCHAR(80) NOT NULL COMMENT 'current status of the agreement',
2853 `closure_reason` VARCHAR(80) DEFAULT NULL COMMENT 'reason of the closure',
2854 `is_perpetual` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'is the agreement perpetual',
2855 `renewal_priority` VARCHAR(80) DEFAULT NULL COMMENT 'priority of the renewal',
2856 `license_info` VARCHAR(80) DEFAULT NULL COMMENT 'info about the license',
2857 CONSTRAINT `erm_agreements_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
2858 PRIMARY KEY(`agreement_id`)
2859 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2862 -- Table structure for table `erm_agreement_periods`
2865 DROP TABLE IF EXISTS `erm_agreement_periods`;
2866 CREATE TABLE `erm_agreement_periods` (
2867 `agreement_period_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2868 `agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement',
2869 `started_on` DATE NOT NULL COMMENT 'start of the agreement period',
2870 `ended_on` DATE COMMENT 'end of the agreement period',
2871 `cancellation_deadline` DATE DEFAULT NULL COMMENT 'Deadline for the cancellation',
2872 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this period',
2873 CONSTRAINT `erm_agreement_periods_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2874 PRIMARY KEY(`agreement_period_id`)
2875 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2878 -- Table structure for table `erm_user_roles`
2881 DROP TABLE IF EXISTS `erm_user_roles`;
2882 CREATE TABLE `erm_user_roles` (
2883 `agreement_id` INT(11) NULL COMMENT 'link to the agreement',
2884 `license_id` INT(11) NULL COMMENT 'link to the license',
2885 `user_id` INT(11) NOT NULL COMMENT 'link to the user',
2886 `role` VARCHAR(80) NOT NULL COMMENT 'role of the user',
2887 CONSTRAINT `erm_user_roles_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2888 CONSTRAINT `erm_user_roles_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2889 CONSTRAINT `erm_user_roles_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2890 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2893 -- Table structure for table `erm_licenses`
2896 DROP TABLE IF EXISTS `erm_licenses`;
2897 CREATE TABLE `erm_licenses` (
2898 `license_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2899 `vendor_id` INT(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2900 `name` VARCHAR(255) NOT NULL COMMENT 'name of the license',
2901 `description` LONGTEXT DEFAULT NULL COMMENT 'description of the license',
2902 `type` VARCHAR(80) NOT NULL COMMENT 'type of the license',
2903 `status` VARCHAR(80) NOT NULL COMMENT 'current status of the license',
2904 `started_on` DATE COMMENT 'start of the license',
2905 `ended_on` DATE COMMENT 'end of the license',
2906 CONSTRAINT `erm_licenses_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
2907 PRIMARY KEY(`license_id`)
2908 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2911 -- Table structure for table `erm_agreement_licenses`
2914 DROP TABLE IF EXISTS `erm_agreement_licenses`;
2915 CREATE TABLE `erm_agreement_licenses` (
2916 `agreement_license_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2917 `agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement',
2918 `license_id` INT(11) NOT NULL COMMENT 'link to the license',
2919 `status` VARCHAR(80) NOT NULL COMMENT 'current status of the license',
2920 `physical_location` VARCHAR(80) DEFAULT NULL COMMENT 'physical location of the license',
2921 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this license',
2922 `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the license',
2923 CONSTRAINT `erm_agreement_licenses_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2924 CONSTRAINT `erm_agreement_licenses_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2925 PRIMARY KEY(`agreement_license_id`),
2926 UNIQUE KEY `erm_agreement_licenses_uniq` (`agreement_id`, `license_id`)
2927 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2930 -- Table structure for table `erm_agreement_relationships`
2933 DROP TABLE IF EXISTS `erm_agreement_relationships`;
2934 CREATE TABLE `erm_agreement_relationships` (
2935 `agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement',
2936 `related_agreement_id` INT(11) NOT NULL COMMENT 'link to the related agreement',
2937 `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',
2938 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
2939 CONSTRAINT `erm_agreement_relationships_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2940 CONSTRAINT `erm_agreement_relationships_ibfk_2` FOREIGN KEY (`related_agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2941 PRIMARY KEY(`agreement_id`, `related_agreement_id`)
2942 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2945 -- Table structure for table `erm_documents`
2948 DROP TABLE IF EXISTS `erm_documents`;
2949 CREATE TABLE `erm_documents` (
2950 `document_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2951 `agreement_id` INT(11) NULL COMMENT 'link to the agreement',
2952 `license_id` INT(11) NULL COMMENT 'link to the license',
2953 `file_name` varchar(255) DEFAULT NULL COMMENT 'name of the file',
2954 `file_type` varchar(255) DEFAULT NULL COMMENT 'type of the file',
2955 `file_description` varchar(255) DEFAULT NULL COMMENT 'description of the file',
2956 `file_content` longblob DEFAULT NULL COMMENT 'the content of the file',
2957 `uploaded_on` datetime DEFAULT NULL COMMENT 'datetime when the file as attached',
2958 `physical_location` VARCHAR(255) DEFAULT NULL COMMENT 'physical location of the document',
2959 `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the document',
2960 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
2961 CONSTRAINT `erm_documents_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2962 CONSTRAINT `erm_documents_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2963 PRIMARY KEY(`document_id`)
2964 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2967 -- Table structure for table `erm_eholdings_packages`
2970 DROP TABLE IF EXISTS `erm_eholdings_packages`;
2971 CREATE TABLE `erm_eholdings_packages` (
2972 `package_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
2973 `vendor_id` INT(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
2974 `name` VARCHAR(255) NOT NULL COMMENT 'name of the package',
2975 `external_id` VARCHAR(255) DEFAULT NULL COMMENT 'External key',
2976 `provider` ENUM('ebsco') DEFAULT NULL COMMENT 'External provider',
2977 `package_type` VARCHAR(80) DEFAULT NULL COMMENT 'type of the package',
2978 `content_type` VARCHAR(80) DEFAULT NULL COMMENT 'type of the package',
2979 `notes` mediumtext DEFAULT NULL COMMENT 'notes about this package',
2980 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date of creation of the package',
2981 CONSTRAINT `erm_eholdings_packages_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
2982 PRIMARY KEY(`package_id`)
2983 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2986 -- Table structure for table `erm_eholdings_packages_agreements`
2989 DROP TABLE IF EXISTS `erm_eholdings_packages_agreements`;
2990 CREATE TABLE `erm_eholdings_packages_agreements` (
2991 `package_id` INT(11) NOT NULL COMMENT 'link to the package',
2992 `agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement',
2993 UNIQUE KEY `erm_eholdings_packages_agreements_uniq` (`package_id`, `agreement_id`),
2994 CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2995 CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2996 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2999 -- Table structure for table `erm_eholdings_titles`
3002 DROP TABLE IF EXISTS `erm_eholdings_titles`;
3003 CREATE TABLE `erm_eholdings_titles` (
3004 `title_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3005 `biblio_id` INT(11) DEFAULT NULL,
3006 `publication_title` VARCHAR(255) DEFAULT NULL,
3007 `external_id` VARCHAR(255) DEFAULT NULL,
3008 `print_identifier` VARCHAR(255) DEFAULT NULL,
3009 `online_identifier` VARCHAR(255) DEFAULT NULL,
3010 `date_first_issue_online` VARCHAR(255) DEFAULT NULL,
3011 `num_first_vol_online` VARCHAR(255) DEFAULT NULL,
3012 `num_first_issue_online` VARCHAR(255) DEFAULT NULL,
3013 `date_last_issue_online` VARCHAR(255) DEFAULT NULL,
3014 `num_last_vol_online` VARCHAR(255) DEFAULT NULL,
3015 `num_last_issue_online` VARCHAR(255) DEFAULT NULL,
3016 `title_url` VARCHAR(255) DEFAULT NULL,
3017 `first_author` VARCHAR(255) DEFAULT NULL,
3018 `embargo_info` VARCHAR(255) DEFAULT NULL,
3019 `coverage_depth` VARCHAR(255) DEFAULT NULL,
3020 `notes` VARCHAR(255) DEFAULT NULL,
3021 `publisher_name` VARCHAR(255) DEFAULT NULL,
3022 `publication_type` VARCHAR(80) DEFAULT NULL,
3023 `date_monograph_published_print` VARCHAR(255) DEFAULT NULL,
3024 `date_monograph_published_online` VARCHAR(255) DEFAULT NULL,
3025 `monograph_volume` VARCHAR(255) DEFAULT NULL,
3026 `monograph_edition` VARCHAR(255) DEFAULT NULL,
3027 `first_editor` VARCHAR(255) DEFAULT NULL,
3028 `parent_publication_title_id` VARCHAR(255) DEFAULT NULL,
3029 `preceeding_publication_title_id` VARCHAR(255) DEFAULT NULL,
3030 `access_type` VARCHAR(255) DEFAULT NULL,
3031 CONSTRAINT `erm_eholdings_titles_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
3032 PRIMARY KEY(`title_id`)
3033 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3036 -- Table structure for table `erm_eholdings_resources`
3039 DROP TABLE IF EXISTS `erm_eholdings_resources`;
3040 CREATE TABLE `erm_eholdings_resources` (
3041 `resource_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
3042 `title_id` INT(11) NOT NULL,
3043 `package_id` INT(11) NOT NULL,
3044 `vendor_id` INT(11) DEFAULT NULL,
3047 `proxy` VARCHAR(80) DEFAULT NULL,
3048 UNIQUE KEY `erm_eholdings_resources_uniq` (`title_id`, `package_id`),
3049 CONSTRAINT `erm_eholdings_resources_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_eholdings_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3050 CONSTRAINT `erm_eholdings_resources_ibfk_2` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
3051 CONSTRAINT `erm_eholdings_resources_ibfk_3` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
3052 PRIMARY KEY(`resource_id`)
3053 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3056 -- Table structure for table `export_format`
3059 DROP TABLE IF EXISTS `export_format`;
3060 /*!40101 SET @saved_cs_client = @@character_set_client */;
3061 /*!40101 SET character_set_client = utf8 */;
3062 CREATE TABLE `export_format` (
3063 `export_format_id` int(11) NOT NULL AUTO_INCREMENT,
3064 `profile` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
3065 `description` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
3066 `content` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
3067 `csv_separator` varchar(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ',',
3068 `field_separator` varchar(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3069 `subfield_separator` varchar(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3070 `encoding` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'utf8',
3071 `type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT 'marc',
3072 `used_for` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT 'export_records',
3073 `staff_only` tinyint(1) NOT NULL DEFAULT 0,
3074 PRIMARY KEY (`export_format_id`),
3075 KEY `used_for_idx` (`used_for`(191)),
3076 KEY `staff_only_idx` (`staff_only`)
3077 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Used for CSV export';
3078 /*!40101 SET character_set_client = @saved_cs_client */;
3081 -- Table structure for table `hold_fill_targets`
3084 DROP TABLE IF EXISTS `hold_fill_targets`;
3085 /*!40101 SET @saved_cs_client = @@character_set_client */;
3086 /*!40101 SET character_set_client = utf8 */;
3087 CREATE TABLE `hold_fill_targets` (
3088 `borrowernumber` int(11) NOT NULL,
3089 `biblionumber` int(11) NOT NULL,
3090 `itemnumber` int(11) NOT NULL,
3091 `source_branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3092 `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
3093 `reserve_id` int(11) DEFAULT NULL,
3094 PRIMARY KEY (`itemnumber`),
3095 KEY `bib_branch` (`biblionumber`,`source_branchcode`),
3096 KEY `hold_fill_targets_ibfk_1` (`borrowernumber`),
3097 KEY `hold_fill_targets_ibfk_4` (`source_branchcode`),
3098 CONSTRAINT `hold_fill_targets_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3099 CONSTRAINT `hold_fill_targets_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3100 CONSTRAINT `hold_fill_targets_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3101 CONSTRAINT `hold_fill_targets_ibfk_4` FOREIGN KEY (`source_branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
3102 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3103 /*!40101 SET character_set_client = @saved_cs_client */;
3106 -- Table structure for table `housebound_profile`
3109 DROP TABLE IF EXISTS `housebound_profile`;
3110 /*!40101 SET @saved_cs_client = @@character_set_client */;
3111 /*!40101 SET character_set_client = utf8 */;
3112 CREATE TABLE `housebound_profile` (
3113 `borrowernumber` int(11) NOT NULL COMMENT 'Number of the borrower associated with this profile.',
3114 `day` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The preferred day of the week for delivery.',
3115 `frequency` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The Authorised_Value definining the pattern for delivery.',
3116 `fav_itemtypes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Free text describing preferred itemtypes.',
3117 `fav_subjects` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Free text describing preferred subjects.',
3118 `fav_authors` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Free text describing preferred authors.',
3119 `referral` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Free text indicating how the borrower was added to the service.',
3120 `notes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Free text for additional notes.',
3121 PRIMARY KEY (`borrowernumber`),
3122 CONSTRAINT `housebound_profile_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3123 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3124 /*!40101 SET character_set_client = @saved_cs_client */;
3127 -- Table structure for table `housebound_role`
3130 DROP TABLE IF EXISTS `housebound_role`;
3131 /*!40101 SET @saved_cs_client = @@character_set_client */;
3132 /*!40101 SET character_set_client = utf8 */;
3133 CREATE TABLE `housebound_role` (
3134 `borrowernumber_id` int(11) NOT NULL COMMENT 'borrowernumber link',
3135 `housebound_chooser` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'set to 1 to indicate this patron is a housebound chooser volunteer',
3136 `housebound_deliverer` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'set to 1 to indicate this patron is a housebound deliverer volunteer',
3137 PRIMARY KEY (`borrowernumber_id`),
3138 CONSTRAINT `houseboundrole_bnfk` FOREIGN KEY (`borrowernumber_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3139 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3140 /*!40101 SET character_set_client = @saved_cs_client */;
3143 -- Table structure for table `housebound_visit`
3146 DROP TABLE IF EXISTS `housebound_visit`;
3147 /*!40101 SET @saved_cs_client = @@character_set_client */;
3148 /*!40101 SET character_set_client = utf8 */;
3149 CREATE TABLE `housebound_visit` (
3150 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the visit.',
3151 `borrowernumber` int(11) NOT NULL COMMENT 'Number of the borrower, & the profile, linked to this visit.',
3152 `appointment_date` date DEFAULT NULL COMMENT 'Date of visit.',
3153 `day_segment` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Rough time frame: ''morning'', ''afternoon'' ''evening''',
3154 `chooser_brwnumber` int(11) DEFAULT NULL COMMENT 'Number of the borrower to choose items for delivery.',
3155 `deliverer_brwnumber` int(11) DEFAULT NULL COMMENT 'Number of the borrower to deliver items.',
3157 KEY `houseboundvisit_bnfk` (`borrowernumber`),
3158 KEY `houseboundvisit_bnfk_1` (`chooser_brwnumber`),
3159 KEY `houseboundvisit_bnfk_2` (`deliverer_brwnumber`),
3160 CONSTRAINT `houseboundvisit_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `housebound_profile` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3161 CONSTRAINT `houseboundvisit_bnfk_1` FOREIGN KEY (`chooser_brwnumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3162 CONSTRAINT `houseboundvisit_bnfk_2` FOREIGN KEY (`deliverer_brwnumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3163 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3164 /*!40101 SET character_set_client = @saved_cs_client */;
3167 -- Table structure for table `illcomments`
3170 DROP TABLE IF EXISTS `illcomments`;
3171 /*!40101 SET @saved_cs_client = @@character_set_client */;
3172 /*!40101 SET character_set_client = utf8 */;
3173 CREATE TABLE `illcomments` (
3174 `illcomment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the comment',
3175 `illrequest_id` bigint(20) unsigned NOT NULL COMMENT 'ILL request number',
3176 `borrowernumber` int(11) DEFAULT NULL COMMENT 'Link to the user who made the comment (could be librarian, patron or ILL partner library)',
3177 `comment` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'The text of the comment',
3178 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date and time when the comment was made',
3179 PRIMARY KEY (`illcomment_id`),
3180 KEY `illcomments_bnfk` (`borrowernumber`),
3181 KEY `illcomments_ifk` (`illrequest_id`),
3182 CONSTRAINT `illcomments_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3183 CONSTRAINT `illcomments_ifk` FOREIGN KEY (`illrequest_id`) REFERENCES `illrequests` (`illrequest_id`) ON DELETE CASCADE ON UPDATE CASCADE
3184 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3185 /*!40101 SET character_set_client = @saved_cs_client */;
3188 -- Table structure for table `illrequestattributes`
3191 DROP TABLE IF EXISTS `illrequestattributes`;
3192 /*!40101 SET @saved_cs_client = @@character_set_client */;
3193 /*!40101 SET character_set_client = utf8 */;
3194 CREATE TABLE `illrequestattributes` (
3195 `illrequest_id` bigint(20) unsigned NOT NULL COMMENT 'ILL request number',
3196 `type` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'API ILL property name',
3197 `value` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'API ILL property value',
3198 `readonly` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Is this attribute read only',
3199 PRIMARY KEY (`illrequest_id`,`type`(191)),
3200 CONSTRAINT `illrequestattributes_ifk` FOREIGN KEY (`illrequest_id`) REFERENCES `illrequests` (`illrequest_id`) ON DELETE CASCADE ON UPDATE CASCADE
3201 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3202 /*!40101 SET character_set_client = @saved_cs_client */;
3205 -- Table structure for table `illrequests`
3208 DROP TABLE IF EXISTS `illrequests`;
3209 /*!40101 SET @saved_cs_client = @@character_set_client */;
3210 /*!40101 SET character_set_client = utf8 */;
3211 CREATE TABLE `illrequests` (
3212 `illrequest_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ILL request number',
3213 `borrowernumber` int(11) DEFAULT NULL COMMENT 'Patron associated with request',
3214 `biblio_id` int(11) DEFAULT NULL COMMENT 'Potential bib linked to request',
3215 `due_date` datetime DEFAULT NULL COMMENT 'Custom date due specified by backend, leave NULL for default date_due calculation',
3216 `branchcode` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The branch associated with the request',
3217 `status` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Current Koha status of request',
3218 `status_alias` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Foreign key to relevant authorised_values.authorised_value',
3219 `placed` date DEFAULT NULL COMMENT 'Date the request was placed',
3220 `replied` date DEFAULT NULL COMMENT 'Last API response',
3221 `updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
3222 `completed` date DEFAULT NULL COMMENT 'Date the request was completed',
3223 `medium` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'The Koha request type',
3224 `accessurl` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Potential URL for accessing item',
3225 `cost` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Quotes cost of request',
3226 `price_paid` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Final cost of request',
3227 `notesopac` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Patron notes attached to request',
3228 `notesstaff` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Staff notes attached to request',
3229 `orderid` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Backend id attached to request',
3230 `backend` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'The backend used to create request',
3231 PRIMARY KEY (`illrequest_id`),
3232 KEY `illrequests_bnfk` (`borrowernumber`),
3233 KEY `illrequests_bcfk_2` (`branchcode`),
3234 KEY `illrequests_safk` (`status_alias`),
3235 CONSTRAINT `illrequests_bcfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3236 CONSTRAINT `illrequests_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3237 CONSTRAINT `illrequests_safk` FOREIGN KEY (`status_alias`) REFERENCES `authorised_values` (`authorised_value`) ON DELETE SET NULL ON UPDATE CASCADE
3238 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3239 /*!40101 SET character_set_client = @saved_cs_client */;
3242 -- Table structure for table `import_auths`
3245 DROP TABLE IF EXISTS `import_auths`;
3246 /*!40101 SET @saved_cs_client = @@character_set_client */;
3247 /*!40101 SET character_set_client = utf8 */;
3248 CREATE TABLE `import_auths` (
3249 `import_record_id` int(11) NOT NULL,
3250 `matched_authid` int(11) DEFAULT NULL,
3251 `control_number` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3252 `authorized_heading` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3253 `original_source` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3254 KEY `import_auths_ibfk_1` (`import_record_id`),
3255 KEY `matched_authid` (`matched_authid`),
3256 CONSTRAINT `import_auths_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3257 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3258 /*!40101 SET character_set_client = @saved_cs_client */;
3261 -- Table structure for table `import_batch_profiles`
3264 DROP TABLE IF EXISTS `import_batch_profiles`;
3265 /*!40101 SET @saved_cs_client = @@character_set_client */;
3266 /*!40101 SET character_set_client = utf8 */;
3267 CREATE TABLE `import_batch_profiles` (
3268 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3269 `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'name of this profile',
3270 `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3271 `template_id` int(11) DEFAULT NULL COMMENT 'the id of the marc modification template',
3272 `overlay_action` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'how to handle duplicate records',
3273 `nomatch_action` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'how to handle records where no match is found',
3274 `item_action` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'what to do with item records',
3275 `parse_items` tinyint(1) DEFAULT NULL COMMENT 'should items be parsed',
3276 `record_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'type of record in the batch',
3277 `encoding` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'file encoding',
3278 `format` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'marc format',
3279 `comments` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3281 UNIQUE KEY `u_import_batch_profiles__name` (`name`)
3282 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3283 /*!40101 SET character_set_client = @saved_cs_client */;
3286 -- Table structure for table `import_batches`
3289 DROP TABLE IF EXISTS `import_batches`;
3290 /*!40101 SET @saved_cs_client = @@character_set_client */;
3291 /*!40101 SET character_set_client = utf8 */;
3292 CREATE TABLE `import_batches` (
3293 `import_batch_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier and primary key',
3294 `matcher_id` int(11) DEFAULT NULL COMMENT 'the id of the match rule used (matchpoints.matcher_id)',
3295 `template_id` int(11) DEFAULT NULL,
3296 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3297 `num_records` int(11) NOT NULL DEFAULT 0 COMMENT 'number of records in the file',
3298 `num_items` int(11) NOT NULL DEFAULT 0 COMMENT 'number of items in the file',
3299 `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was uploaded',
3300 `overlay_action` enum('replace','create_new','use_template','ignore') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'create_new' COMMENT 'how to handle duplicate records',
3301 `nomatch_action` enum('create_new','ignore') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'create_new' COMMENT 'how to handle records where no match is found',
3302 `item_action` enum('always_add','add_only_for_matches','add_only_for_new','ignore','replace') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'always_add' COMMENT 'what to do with item records',
3303 `import_status` enum('staging','staged','importing','imported','reverting','reverted','cleaned') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'staging' COMMENT 'the status of the imported file',
3304 `batch_type` enum('batch','z3950','webservice') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'batch' COMMENT 'where this batch has come from',
3305 `record_type` enum('biblio','auth','holdings') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'biblio' COMMENT 'type of record in the batch',
3306 `file_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the name of the file uploaded',
3307 `comments` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any comments added when the file was uploaded',
3308 `profile_id` int(11) DEFAULT NULL,
3309 PRIMARY KEY (`import_batch_id`),
3310 KEY `branchcode` (`branchcode`),
3311 KEY `import_batches_ibfk_1` (`profile_id`),
3312 CONSTRAINT `import_batches_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `import_batch_profiles` (`id`) ON DELETE SET NULL ON UPDATE SET NULL
3313 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3314 /*!40101 SET character_set_client = @saved_cs_client */;
3317 -- Table structure for table `import_biblios`
3320 DROP TABLE IF EXISTS `import_biblios`;
3321 /*!40101 SET @saved_cs_client = @@character_set_client */;
3322 /*!40101 SET character_set_client = utf8 */;
3323 CREATE TABLE `import_biblios` (
3324 `import_record_id` int(11) NOT NULL,
3325 `matched_biblionumber` int(11) DEFAULT NULL,
3326 `control_number` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3327 `original_source` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3328 `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3329 `author` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3330 `isbn` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3331 `issn` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3332 `has_items` tinyint(1) NOT NULL DEFAULT 0,
3333 PRIMARY KEY (`import_record_id`),
3334 KEY `import_biblios_ibfk_1` (`import_record_id`),
3335 KEY `matched_biblionumber` (`matched_biblionumber`),
3336 KEY `title` (`title`(191)),
3337 KEY `isbn` (`isbn`(191)),
3338 CONSTRAINT `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3339 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3340 /*!40101 SET character_set_client = @saved_cs_client */;
3343 -- Table structure for table `import_items`
3346 DROP TABLE IF EXISTS `import_items`;
3347 /*!40101 SET @saved_cs_client = @@character_set_client */;
3348 /*!40101 SET character_set_client = utf8 */;
3349 CREATE TABLE `import_items` (
3350 `import_items_id` int(11) NOT NULL AUTO_INCREMENT,
3351 `import_record_id` int(11) NOT NULL,
3352 `itemnumber` int(11) DEFAULT NULL,
3353 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3354 `status` enum('error','staged','imported','reverted','ignored') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'staged',
3355 `marcxml` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
3356 `import_error` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3357 PRIMARY KEY (`import_items_id`),
3358 KEY `import_items_ibfk_1` (`import_record_id`),
3359 KEY `itemnumber` (`itemnumber`),
3360 KEY `branchcode` (`branchcode`),
3361 CONSTRAINT `import_items_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3362 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3363 /*!40101 SET character_set_client = @saved_cs_client */;
3366 -- Table structure for table `import_record_matches`
3369 DROP TABLE IF EXISTS `import_record_matches`;
3370 /*!40101 SET @saved_cs_client = @@character_set_client */;
3371 /*!40101 SET character_set_client = utf8 */;
3372 CREATE TABLE `import_record_matches` (
3373 `import_record_id` int(11) NOT NULL COMMENT 'the id given to the imported bib record (import_records.import_record_id)',
3374 `candidate_match_id` int(11) NOT NULL COMMENT 'the biblio the imported record matches (biblio.biblionumber)',
3375 `score` int(11) NOT NULL DEFAULT 0 COMMENT 'the match score',
3376 `chosen` tinyint(1) DEFAULT NULL COMMENT 'whether this match has been allowed or denied',
3377 PRIMARY KEY (`import_record_id`,`candidate_match_id`),
3378 KEY `record_score` (`import_record_id`,`score`),
3379 CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`) REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE
3380 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3381 /*!40101 SET character_set_client = @saved_cs_client */;
3384 -- Table structure for table `import_records`
3387 DROP TABLE IF EXISTS `import_records`;
3388 /*!40101 SET @saved_cs_client = @@character_set_client */;
3389 /*!40101 SET character_set_client = utf8 */;
3390 CREATE TABLE `import_records` (
3391 `import_record_id` int(11) NOT NULL AUTO_INCREMENT,
3392 `import_batch_id` int(11) NOT NULL,
3393 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3394 `record_sequence` int(11) NOT NULL DEFAULT 0,
3395 `upload_timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
3396 `import_date` date DEFAULT NULL,
3397 `marc` longblob NOT NULL,
3398 `marcxml` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
3399 `marcxml_old` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
3400 `record_type` enum('biblio','auth','holdings') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'biblio',
3401 `overlay_status` enum('no_match','auto_match','manual_match','match_applied') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no_match',
3402 `status` enum('error','staged','imported','reverted','items_reverted','ignored') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'staged',
3403 `import_error` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3404 `encoding` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
3405 PRIMARY KEY (`import_record_id`),
3406 KEY `branchcode` (`branchcode`),
3407 KEY `batch_sequence` (`import_batch_id`,`record_sequence`),
3408 KEY `batch_id_record_type` (`import_batch_id`,`record_type`),
3409 CONSTRAINT `import_records_ifbk_1` FOREIGN KEY (`import_batch_id`) REFERENCES `import_batches` (`import_batch_id`) ON DELETE CASCADE ON UPDATE CASCADE
3410 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3411 /*!40101 SET character_set_client = @saved_cs_client */;
3414 -- Table structure for table `issues`
3417 DROP TABLE IF EXISTS `issues`;
3418 /*!40101 SET @saved_cs_client = @@character_set_client */;
3419 /*!40101 SET character_set_client = utf8 */;
3420 CREATE TABLE `issues` (
3421 `issue_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key for issues table',
3422 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
3423 `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
3424 `itemnumber` int(11) NOT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
3425 `date_due` datetime DEFAULT NULL COMMENT 'datetime the item is due (yyyy-mm-dd hh:mm::ss)',
3426 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
3427 `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned, will be NULL until moved to old_issues',
3428 `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
3429 `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
3430 `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
3431 `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
3432 `auto_renew_error` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'automatic renewal error',
3433 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
3434 `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
3435 `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
3436 `note` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'issue note text',
3437 `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
3438 `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
3439 PRIMARY KEY (`issue_id`),
3440 UNIQUE KEY `itemnumber` (`itemnumber`),
3441 KEY `issuesborridx` (`borrowernumber`),
3442 KEY `itemnumber_idx` (`itemnumber`),
3443 KEY `branchcode_idx` (`branchcode`),
3444 KEY `bordate` (`borrowernumber`,`timestamp`),
3445 KEY `issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
3446 CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE,
3447 CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE,
3448 CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
3449 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3450 /*!40101 SET character_set_client = @saved_cs_client */;
3453 -- Table structure for table `item_circulation_alert_preferences`
3456 DROP TABLE IF EXISTS `item_circulation_alert_preferences`;
3457 /*!40101 SET @saved_cs_client = @@character_set_client */;
3458 /*!40101 SET character_set_client = utf8 */;
3459 CREATE TABLE `item_circulation_alert_preferences` (
3460 `id` int(11) NOT NULL AUTO_INCREMENT,
3461 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
3462 `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
3463 `item_type` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
3464 `notification` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
3466 KEY `branchcode` (`branchcode`,`categorycode`,`item_type`,`notification`)
3467 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3468 /*!40101 SET character_set_client = @saved_cs_client */;
3471 -- Table structure for table `items`
3474 DROP TABLE IF EXISTS `items`;
3475 /*!40101 SET @saved_cs_client = @@character_set_client */;
3476 /*!40101 SET character_set_client = utf8 */;
3477 CREATE TABLE `items` (
3478 `itemnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier added by Koha',
3479 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from biblio table used to link this item to the right bib record',
3480 `biblioitemnumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblioitems table to link to item to additional information',
3481 `barcode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'item barcode (MARC21 952$p)',
3482 `dateaccessioned` date DEFAULT NULL COMMENT 'date the item was acquired or added to Koha (MARC21 952$d)',
3483 `booksellerid` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'where the item was purchased (MARC21 952$e)',
3484 `homebranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the branches table for the library that owns this item (MARC21 952$a)',
3485 `price` decimal(8,2) DEFAULT NULL COMMENT 'purchase price (MARC21 952$g)',
3486 `replacementprice` decimal(8,2) DEFAULT NULL COMMENT 'cost the library charges to replace the item if it has been marked lost (MARC21 952$v)',
3487 `replacementpricedate` date DEFAULT NULL COMMENT 'the date the price is effective from (MARC21 952$w)',
3488 `datelastborrowed` date DEFAULT NULL COMMENT 'the date the item was last checked out/issued',
3489 `datelastseen` date DEFAULT NULL COMMENT 'the date the item was last see (usually the last time the barcode was scanned or inventory was done)',
3490 `stack` tinyint(1) DEFAULT NULL,
3491 `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining why this item is not for loan (MARC21 952$7)',
3492 `damaged` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as damaged (MARC21 952$4)',
3493 `damaged_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as damaged, NULL if not damaged',
3494 `itemlost` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as lost (MARC21 952$1)',
3495 `itemlost_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as lost, NULL if not lost',
3496 `withdrawn` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'authorized value defining this item as withdrawn (MARC21 952$0)',
3497 `withdrawn_on` datetime DEFAULT NULL COMMENT 'the date and time an item was last marked as withdrawn, NULL if not withdrawn',
3498 `itemcallnumber` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'call number for this item (MARC21 952$o)',
3499 `coded_location_qualifier` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)',
3500 `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out/issued',
3501 `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed',
3502 `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved',
3503 `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)',
3504 `itemnotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)',
3505 `itemnotes_nonpublic` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'non-public notes on this item (MARC21 952$x)',
3506 `holdingbranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)',
3507 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this item was last altered',
3508 `deleted_on` DATETIME DEFAULT NULL COMMENT 'date/time of deletion',
3509 `location` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
3510 `permanent_location` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'linked to the CART and PROC temporary locations feature, stores the permanent shelving location',
3511 `onloan` date DEFAULT NULL COMMENT 'defines if item is checked out (NULL for not checked out, and due date for checked out)',
3512 `cn_source` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'classification source used on this item (MARC21 952$2)',
3513 `cn_sort` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'normalized form of the call number (MARC21 952$o) used for sorting',
3514 `ccode` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'authorized value for the collection code associated with this item (MARC21 952$8)',
3515 `materials` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'materials specified (MARC21 952$3)',
3516 `uri` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'URL for the item (MARC21 952$u)',
3517 `itype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the itemtypes table defining the type for this item (MARC21 952$y)',
3518 `more_subfields_xml` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'additional 952 subfields in XML format',
3519 `enumchron` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'serial enumeration/chronology for the item (MARC21 952$h)',
3520 `copynumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'copy number (MARC21 952$t)',
3521 `stocknumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)',
3522 `new_status` varchar(32) COLLATE utf8mb4_unicode_ci 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.',
3523 `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority',
3524 PRIMARY KEY (`itemnumber`),
3525 UNIQUE KEY `itembarcodeidx` (`barcode`),
3526 KEY `itemstocknumberidx` (`stocknumber`),
3527 KEY `itembinoidx` (`biblioitemnumber`),
3528 KEY `itembibnoidx` (`biblionumber`),
3529 KEY `homebranch` (`homebranch`),
3530 KEY `holdingbranch` (`holdingbranch`),
3531 KEY `itemcallnumber` (`itemcallnumber`(191)),
3532 KEY `items_location` (`location`),
3533 KEY `items_ccode` (`ccode`),
3534 KEY `itype_idx` (`itype`),
3535 KEY `timestamp` (`timestamp`),
3536 CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3537 CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
3538 CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
3539 CONSTRAINT `items_ibfk_4` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
3540 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3541 /*!40101 SET character_set_client = @saved_cs_client */;
3544 -- Table structure for table item_bundles
3547 DROP TABLE IF EXISTS `item_bundles`;
3548 /*!40101 SET @saved_cs_client = @@character_set_client */;
3549 /*!40101 SET character_set_client = utf8 */;
3550 CREATE TABLE `item_bundles` (
3551 `item` int(11) NOT NULL,
3552 `host` int(11) NOT NULL,
3553 PRIMARY KEY (`host`, `item`),
3554 UNIQUE KEY `item_bundles_uniq_1` (`item`),
3555 CONSTRAINT `item_bundles_ibfk_1` FOREIGN KEY (`item`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3556 CONSTRAINT `item_bundles_ibfk_2` FOREIGN KEY (`host`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
3557 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3558 /*!40101 SET character_set_client = @saved_cs_client */;
3561 -- Table structure for table `items_last_borrower`
3564 DROP TABLE IF EXISTS `items_last_borrower`;
3565 /*!40101 SET @saved_cs_client = @@character_set_client */;
3566 /*!40101 SET character_set_client = utf8 */;
3567 CREATE TABLE `items_last_borrower` (
3568 `id` int(11) NOT NULL AUTO_INCREMENT,
3569 `itemnumber` int(11) NOT NULL,
3570 `borrowernumber` int(11) NOT NULL,
3571 `created_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
3573 UNIQUE KEY `itemnumber` (`itemnumber`),
3574 KEY `borrowernumber` (`borrowernumber`),
3575 CONSTRAINT `items_last_borrower_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3576 CONSTRAINT `items_last_borrower_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
3577 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3578 /*!40101 SET character_set_client = @saved_cs_client */;
3581 -- Table structure for table `items_search_fields`
3584 DROP TABLE IF EXISTS `items_search_fields`;
3585 /*!40101 SET @saved_cs_client = @@character_set_client */;
3586 /*!40101 SET character_set_client = utf8 */;
3587 CREATE TABLE `items_search_fields` (
3588 `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
3589 `label` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
3590 `tagfield` char(3) COLLATE utf8mb4_unicode_ci NOT NULL,
3591 `tagsubfield` char(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3592 `authorised_values_category` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3593 PRIMARY KEY (`name`(191)),
3594 KEY `items_search_fields_authorised_values_category` (`authorised_values_category`),
3595 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
3596 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3597 /*!40101 SET character_set_client = @saved_cs_client */;
3600 -- Table structure for table `itemtypes`
3603 DROP TABLE IF EXISTS `itemtypes`;
3604 /*!40101 SET @saved_cs_client = @@character_set_client */;
3605 /*!40101 SET character_set_client = utf8 */;
3606 CREATE TABLE `itemtypes` (
3607 `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'unique key, a code associated with the item type',
3608 `parent_type` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'unique key, a code associated with the item type',
3609 `description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a plain text explanation of the item type',
3610 `rentalcharge` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged when this item is checked out/issued',
3611 `rentalcharge_daily` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each day between checkout date and due date',
3612 `rentalcharge_daily_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the daily rental fee is calculated directly or using finesCalendar',
3613 `rentalcharge_hourly` decimal(28,6) DEFAULT NULL COMMENT 'the amount charged for each hour between checkout date and due date',
3614 `rentalcharge_hourly_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the hourly rental fee is calculated directly or using finesCalendar',
3615 `defaultreplacecost` decimal(28,6) DEFAULT NULL COMMENT 'default replacement cost',
3616 `processfee` decimal(28,6) DEFAULT NULL COMMENT 'default text be recorded in the column note when the processing fee is applied',
3617 `notforloan` smallint(6) DEFAULT NULL COMMENT '1 if the item is not for loan, 0 if the item is available for loan',
3618 `imageurl` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'URL for the item type icon',
3619 `summary` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'information from the summary field, may include HTML',
3620 `checkinmsg` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'message that is displayed when an item with the given item type is checked in',
3621 `checkinmsgtype` char(16) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'message' COMMENT 'type (CSS class) for the checkinmsg, can be ''alert'' or ''message''',
3622 `sip_media_type` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'SIP2 protocol media type for this itemtype',
3623 `hideinopac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Hide the item type from the search options in OPAC',
3624 `searchcategory` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Group this item type with others with the same value on OPAC search options',
3625 `automatic_checkin` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If automatic checkin is enabled for items of this type',
3626 PRIMARY KEY (`itemtype`),
3627 UNIQUE KEY `itemtype` (`itemtype`),
3628 KEY `itemtypes_ibfk_1` (`parent_type`),
3629 CONSTRAINT `itemtypes_ibfk_1` FOREIGN KEY (`parent_type`) REFERENCES `itemtypes` (`itemtype`)
3630 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3631 /*!40101 SET character_set_client = @saved_cs_client */;
3634 -- Table structure for table `itemtypes_branches`
3637 DROP TABLE IF EXISTS `itemtypes_branches`;
3638 /*!40101 SET @saved_cs_client = @@character_set_client */;
3639 /*!40101 SET character_set_client = utf8 */;
3640 CREATE TABLE `itemtypes_branches` (
3641 `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
3642 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
3643 KEY `itemtype` (`itemtype`),
3644 KEY `branchcode` (`branchcode`),
3645 CONSTRAINT `itemtypes_branches_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE,
3646 CONSTRAINT `itemtypes_branches_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE
3647 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3648 /*!40101 SET character_set_client = @saved_cs_client */;
3651 -- Table structure for table `keyboard_shortcuts`
3654 DROP TABLE IF EXISTS `keyboard_shortcuts`;
3655 /*!40101 SET @saved_cs_client = @@character_set_client */;
3656 /*!40101 SET character_set_client = utf8 */;
3657 CREATE TABLE `keyboard_shortcuts` (
3658 `shortcut_name` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL,
3659 `shortcut_keys` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL,
3660 PRIMARY KEY (`shortcut_name`)
3661 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3662 /*!40101 SET character_set_client = @saved_cs_client */;
3665 -- Table structure for table `language_descriptions`
3668 DROP TABLE IF EXISTS `language_descriptions`;
3669 /*!40101 SET @saved_cs_client = @@character_set_client */;
3670 /*!40101 SET character_set_client = utf8 */;
3671 CREATE TABLE `language_descriptions` (
3672 `subtag` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3673 `type` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3674 `lang` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3675 `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3676 `id` int(11) NOT NULL AUTO_INCREMENT,
3678 UNIQUE KEY `uniq_desc` (`subtag`,`type`,`lang`),
3680 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3681 /*!40101 SET character_set_client = @saved_cs_client */;
3684 -- Table structure for table `language_rfc4646_to_iso639`
3687 DROP TABLE IF EXISTS `language_rfc4646_to_iso639`;
3688 /*!40101 SET @saved_cs_client = @@character_set_client */;
3689 /*!40101 SET character_set_client = utf8 */;
3690 CREATE TABLE `language_rfc4646_to_iso639` (
3691 `rfc4646_subtag` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3692 `iso639_2_code` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3693 `id` int(11) NOT NULL AUTO_INCREMENT,
3695 UNIQUE KEY `uniq_code` (`rfc4646_subtag`,`iso639_2_code`),
3696 KEY `rfc4646_subtag` (`rfc4646_subtag`)
3697 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3698 /*!40101 SET character_set_client = @saved_cs_client */;
3701 -- Table structure for table `language_script_bidi`
3704 DROP TABLE IF EXISTS `language_script_bidi`;
3705 /*!40101 SET @saved_cs_client = @@character_set_client */;
3706 /*!40101 SET character_set_client = utf8 */;
3707 CREATE TABLE `language_script_bidi` (
3708 `rfc4646_subtag` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'script subtag, Arab, Hebr, etc.',
3709 `bidi` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'rtl ltr',
3710 KEY `rfc4646_subtag` (`rfc4646_subtag`)
3711 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3712 /*!40101 SET character_set_client = @saved_cs_client */;
3715 -- Table structure for table `language_script_mapping`
3718 DROP TABLE IF EXISTS `language_script_mapping`;
3719 /*!40101 SET @saved_cs_client = @@character_set_client */;
3720 /*!40101 SET character_set_client = utf8 */;
3721 CREATE TABLE `language_script_mapping` (
3722 `language_subtag` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL,
3723 `script_subtag` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3724 PRIMARY KEY (`language_subtag`)
3725 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3726 /*!40101 SET character_set_client = @saved_cs_client */;
3729 -- Table structure for table `language_subtag_registry`
3732 DROP TABLE IF EXISTS `language_subtag_registry`;
3733 /*!40101 SET @saved_cs_client = @@character_set_client */;
3734 /*!40101 SET character_set_client = utf8 */;
3735 CREATE TABLE `language_subtag_registry` (
3736 `subtag` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3737 `type` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'language-script-region-variant-extension-privateuse',
3738 `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'only one of the possible descriptions for ease of reference, see language_descriptions for the complete list',
3739 `added` date DEFAULT NULL,
3740 `id` int(11) NOT NULL AUTO_INCREMENT,
3742 UNIQUE KEY `uniq_lang` (`subtag`,`type`),
3743 KEY `subtag` (`subtag`)
3744 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3745 /*!40101 SET character_set_client = @saved_cs_client */;
3748 -- Table structure for table `letter`
3751 DROP TABLE IF EXISTS `letter`;
3752 /*!40101 SET @saved_cs_client = @@character_set_client */;
3753 /*!40101 SET character_set_client = utf8 */;
3754 CREATE TABLE `letter` (
3755 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
3756 `module` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'Koha module that triggers this notice or slip',
3757 `code` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'unique identifier for this notice or slip',
3758 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'the branch this notice or slip is used at (branches.branchcode)',
3759 `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'plain text name for this notice or slip',
3760 `is_html` tinyint(1) DEFAULT 0 COMMENT 'does this notice or slip use HTML (1 for yes, 0 for no)',
3761 `title` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'subject line of the notice',
3762 `content` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'body text for the notice or slip',
3763 `message_transport_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3764 `lang` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3765 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3767 UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3768 KEY `message_transport_type_fk` (`message_transport_type`),
3769 CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
3770 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3771 /*!40101 SET character_set_client = @saved_cs_client */;
3774 -- Table structure for table `library_groups`
3777 DROP TABLE IF EXISTS `library_groups`;
3778 /*!40101 SET @saved_cs_client = @@character_set_client */;
3779 /*!40101 SET character_set_client = utf8 */;
3780 CREATE TABLE `library_groups` (
3781 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for each group',
3782 `parent_id` int(11) DEFAULT NULL COMMENT 'if this is a child group, the id of the parent group',
3783 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'The branchcode of a branch belonging to the parent group',
3784 `title` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Short description of the goup',
3785 `description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Longer explanation of the group, if necessary',
3786 `ft_hide_patron_info` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Turn on the feature ''Hide patron''s info'' for this group',
3787 `ft_search_groups_opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for staff side search groups',
3788 `ft_search_groups_staff` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group for opac side search groups',
3789 `ft_local_hold_group` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group to identify libraries as pick up location for holds',
3790 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Date and time of creation',
3791 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time of last',
3793 UNIQUE KEY `title` (`title`),
3794 UNIQUE KEY `library_groups_uniq_2` (`parent_id`,`branchcode`),
3795 KEY `branchcode` (`branchcode`),
3796 CONSTRAINT `library_groups_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `library_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
3797 CONSTRAINT `library_groups_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
3798 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3799 /*!40101 SET character_set_client = @saved_cs_client */;
3802 -- Table structure for table `library_smtp_servers`
3805 DROP TABLE IF EXISTS `library_smtp_servers`;
3806 /*!40101 SET @saved_cs_client = @@character_set_client */;
3807 /*!40101 SET character_set_client = utf8 */;
3808 CREATE TABLE `library_smtp_servers` (
3809 `id` int(11) NOT NULL AUTO_INCREMENT,
3810 `library_id` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
3811 `smtp_server_id` int(11) NOT NULL,
3813 UNIQUE KEY `library_id_idx` (`library_id`),
3814 KEY `smtp_server_id_idx` (`smtp_server_id`),
3815 CONSTRAINT `library_smtp_servers_library_fk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3816 CONSTRAINT `library_smtp_servers_smtp_servers_fk` FOREIGN KEY (`smtp_server_id`) REFERENCES `smtp_servers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
3817 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3818 /*!40101 SET character_set_client = @saved_cs_client */;
3821 -- Table structure for table `linktracker`
3824 DROP TABLE IF EXISTS `linktracker`;
3825 /*!40101 SET @saved_cs_client = @@character_set_client */;
3826 /*!40101 SET character_set_client = utf8 */;
3827 CREATE TABLE `linktracker` (
3828 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
3829 `biblionumber` int(11) DEFAULT NULL COMMENT 'biblionumber of the record the link is from',
3830 `itemnumber` int(11) DEFAULT NULL COMMENT 'itemnumber if applicable that the link was from',
3831 `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrowernumber who clicked the link',
3832 `url` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the link itself',
3833 `timeclicked` datetime DEFAULT NULL COMMENT 'the date and time the link was clicked',
3835 KEY `bibidx` (`biblionumber`),
3836 KEY `itemidx` (`itemnumber`),
3837 KEY `borridx` (`borrowernumber`),
3838 KEY `dateidx` (`timeclicked`),
3839 CONSTRAINT `linktracker_biblio_ibfk` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3840 CONSTRAINT `linktracker_borrower_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3841 CONSTRAINT `linktracker_item_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL
3842 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3843 /*!40101 SET character_set_client = @saved_cs_client */;
3846 -- Table structure for table `localization`
3849 DROP TABLE IF EXISTS `localization`;
3850 /*!40101 SET @saved_cs_client = @@character_set_client */;
3851 /*!40101 SET character_set_client = utf8 */;
3852 CREATE TABLE `localization` (
3853 `localization_id` int(11) NOT NULL AUTO_INCREMENT,
3854 `entity` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
3855 `code` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
3856 `lang` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'could be a foreign key',
3857 `translation` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3858 PRIMARY KEY (`localization_id`),
3859 UNIQUE KEY `entity_code_lang` (`entity`,`code`,`lang`)
3860 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3861 /*!40101 SET character_set_client = @saved_cs_client */;
3864 -- Table structure for table `marc_matchers`
3867 DROP TABLE IF EXISTS `marc_matchers`;
3868 /*!40101 SET @saved_cs_client = @@character_set_client */;
3869 /*!40101 SET character_set_client = utf8 */;
3870 CREATE TABLE `marc_matchers` (
3871 `matcher_id` int(11) NOT NULL AUTO_INCREMENT,
3872 `code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
3873 `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
3874 `record_type` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'biblio',
3875 `threshold` int(11) NOT NULL DEFAULT 0,
3876 PRIMARY KEY (`matcher_id`),
3877 KEY `code` (`code`),
3878 KEY `record_type` (`record_type`)
3879 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3880 /*!40101 SET character_set_client = @saved_cs_client */;
3883 -- Table structure for table `marc_modification_template_actions`
3886 DROP TABLE IF EXISTS `marc_modification_template_actions`;
3887 /*!40101 SET @saved_cs_client = @@character_set_client */;
3888 /*!40101 SET character_set_client = utf8 */;
3889 CREATE TABLE `marc_modification_template_actions` (
3890 `mmta_id` int(11) NOT NULL AUTO_INCREMENT,
3891 `template_id` int(11) NOT NULL,
3892 `ordering` int(3) NOT NULL,
3893 `action` enum('delete_field','add_field','update_field','move_field','copy_field','copy_and_replace_field') COLLATE utf8mb4_unicode_ci NOT NULL,
3894 `field_number` smallint(6) NOT NULL DEFAULT 0,
3895 `from_field` varchar(3) COLLATE utf8mb4_unicode_ci NOT NULL,
3896 `from_subfield` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3897 `field_value` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3898 `to_field` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3899 `to_subfield` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3900 `to_regex_search` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3901 `to_regex_replace` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3902 `to_regex_modifiers` varchar(8) COLLATE utf8mb4_unicode_ci DEFAULT '',
3903 `conditional` enum('if','unless') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3904 `conditional_field` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3905 `conditional_subfield` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3906 `conditional_comparison` enum('exists','not_exists','equals','not_equals') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3907 `conditional_value` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3908 `conditional_regex` tinyint(1) NOT NULL DEFAULT 0,
3909 `description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3910 PRIMARY KEY (`mmta_id`),
3911 KEY `mmta_ibfk_1` (`template_id`),
3912 CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
3913 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3914 /*!40101 SET character_set_client = @saved_cs_client */;
3917 -- Table structure for table `marc_modification_templates`
3920 DROP TABLE IF EXISTS `marc_modification_templates`;
3921 /*!40101 SET @saved_cs_client = @@character_set_client */;
3922 /*!40101 SET character_set_client = utf8 */;
3923 CREATE TABLE `marc_modification_templates` (
3924 `template_id` int(11) NOT NULL AUTO_INCREMENT,
3925 `name` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
3926 PRIMARY KEY (`template_id`)
3927 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3928 /*!40101 SET character_set_client = @saved_cs_client */;
3931 -- Table structure for table `marc_overlay_rules`
3934 DROP TABLE IF EXISTS `marc_overlay_rules`;
3935 /*!40101 SET @saved_cs_client = @@character_set_client */;
3936 /*!40101 SET character_set_client = utf8 */;
3937 CREATE TABLE `marc_overlay_rules` (
3938 `id` int(11) NOT NULL AUTO_INCREMENT,
3939 `tag` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
3940 `module` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL,
3941 `filter` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
3942 `add` tinyint(1) NOT NULL DEFAULT 0,
3943 `append` tinyint(1) NOT NULL DEFAULT 0,
3944 `remove` tinyint(1) NOT NULL DEFAULT 0,
3945 `delete` tinyint(1) NOT NULL DEFAULT 0,
3947 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3948 /*!40101 SET character_set_client = @saved_cs_client */;
3951 -- Table structure for table `marc_subfield_structure`
3954 DROP TABLE IF EXISTS `marc_subfield_structure`;
3955 /*!40101 SET @saved_cs_client = @@character_set_client */;
3956 /*!40101 SET character_set_client = utf8 */;
3957 CREATE TABLE `marc_subfield_structure` (
3958 `tagfield` varchar(3) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
3959 `tagsubfield` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
3960 `liblibrarian` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
3961 `libopac` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
3962 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
3963 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
3964 `important` tinyint(4) NOT NULL DEFAULT 0,
3965 `kohafield` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3966 `tab` tinyint(1) DEFAULT NULL,
3967 `authorised_value` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3968 `authtypecode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3969 `value_builder` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3970 `isurl` tinyint(1) DEFAULT NULL,
3971 `hidden` tinyint(1) NOT NULL DEFAULT 8,
3972 `frameworkcode` varchar(4) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
3973 `seealso` varchar(1100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3974 `link` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3975 `defaultvalue` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3976 `maxlength` int(4) NOT NULL DEFAULT 9999,
3977 `display_order` int(2) NOT NULL DEFAULT 0,
3978 PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`),
3979 KEY `kohafield_2` (`kohafield`),
3980 KEY `tab` (`frameworkcode`,`tab`),
3981 KEY `kohafield` (`frameworkcode`,`kohafield`),
3982 KEY `marc_subfield_structure_ibfk_1` (`authorised_value`),
3983 CONSTRAINT `marc_subfield_structure_ibfk_1` FOREIGN KEY (`authorised_value`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE SET NULL ON UPDATE CASCADE
3984 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3985 /*!40101 SET character_set_client = @saved_cs_client */;
3988 -- Table structure for table `marc_tag_structure`
3991 DROP TABLE IF EXISTS `marc_tag_structure`;
3992 /*!40101 SET @saved_cs_client = @@character_set_client */;
3993 /*!40101 SET character_set_client = utf8 */;
3994 CREATE TABLE `marc_tag_structure` (
3995 `tagfield` varchar(3) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
3996 `liblibrarian` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
3997 `libopac` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
3998 `repeatable` tinyint(4) NOT NULL DEFAULT 0,
3999 `mandatory` tinyint(4) NOT NULL DEFAULT 0,
4000 `important` tinyint(4) NOT NULL DEFAULT 0,
4001 `authorised_value` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4002 `ind1_defaultvalue` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
4003 `ind2_defaultvalue` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
4004 `frameworkcode` varchar(4) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
4005 PRIMARY KEY (`frameworkcode`,`tagfield`)
4006 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4007 /*!40101 SET character_set_client = @saved_cs_client */;
4010 -- Table structure for table `matchchecks`
4013 DROP TABLE IF EXISTS `matchchecks`;
4014 /*!40101 SET @saved_cs_client = @@character_set_client */;
4015 /*!40101 SET character_set_client = utf8 */;
4016 CREATE TABLE `matchchecks` (
4017 `matcher_id` int(11) NOT NULL,
4018 `matchcheck_id` int(11) NOT NULL AUTO_INCREMENT,
4019 `source_matchpoint_id` int(11) NOT NULL,
4020 `target_matchpoint_id` int(11) NOT NULL,
4021 PRIMARY KEY (`matchcheck_id`),
4022 KEY `matcher_matchchecks_ifbk_1` (`matcher_id`),
4023 KEY `matcher_matchchecks_ifbk_2` (`source_matchpoint_id`),
4024 KEY `matcher_matchchecks_ifbk_3` (`target_matchpoint_id`),
4025 CONSTRAINT `matcher_matchchecks_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4026 CONSTRAINT `matcher_matchchecks_ifbk_2` FOREIGN KEY (`source_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4027 CONSTRAINT `matcher_matchchecks_ifbk_3` FOREIGN KEY (`target_matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4028 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4029 /*!40101 SET character_set_client = @saved_cs_client */;
4032 -- Table structure for table `matcher_matchpoints`
4035 DROP TABLE IF EXISTS `matcher_matchpoints`;
4036 /*!40101 SET @saved_cs_client = @@character_set_client */;
4037 /*!40101 SET character_set_client = utf8 */;
4038 CREATE TABLE `matcher_matchpoints` (
4039 `matcher_id` int(11) NOT NULL,
4040 `matchpoint_id` int(11) NOT NULL,
4041 KEY `matcher_matchpoints_ifbk_1` (`matcher_id`),
4042 KEY `matcher_matchpoints_ifbk_2` (`matchpoint_id`),
4043 CONSTRAINT `matcher_matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4044 CONSTRAINT `matcher_matchpoints_ifbk_2` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4045 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4046 /*!40101 SET character_set_client = @saved_cs_client */;
4049 -- Table structure for table `matchpoint_component_norms`
4052 DROP TABLE IF EXISTS `matchpoint_component_norms`;
4053 /*!40101 SET @saved_cs_client = @@character_set_client */;
4054 /*!40101 SET character_set_client = utf8 */;
4055 CREATE TABLE `matchpoint_component_norms` (
4056 `matchpoint_component_id` int(11) NOT NULL,
4057 `sequence` int(11) NOT NULL DEFAULT 0,
4058 `norm_routine` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
4059 KEY `matchpoint_component_norms` (`matchpoint_component_id`,`sequence`),
4060 CONSTRAINT `matchpoint_component_norms_ifbk_1` FOREIGN KEY (`matchpoint_component_id`) REFERENCES `matchpoint_components` (`matchpoint_component_id`) ON DELETE CASCADE ON UPDATE CASCADE
4061 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4062 /*!40101 SET character_set_client = @saved_cs_client */;
4065 -- Table structure for table `matchpoint_components`
4068 DROP TABLE IF EXISTS `matchpoint_components`;
4069 /*!40101 SET @saved_cs_client = @@character_set_client */;
4070 /*!40101 SET character_set_client = utf8 */;
4071 CREATE TABLE `matchpoint_components` (
4072 `matchpoint_id` int(11) NOT NULL,
4073 `matchpoint_component_id` int(11) NOT NULL AUTO_INCREMENT,
4074 `sequence` int(11) NOT NULL DEFAULT 0,
4075 `tag` varchar(3) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
4076 `subfields` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
4077 `offset` int(4) NOT NULL DEFAULT 0,
4078 `length` int(4) NOT NULL DEFAULT 0,
4079 PRIMARY KEY (`matchpoint_component_id`),
4080 KEY `by_sequence` (`matchpoint_id`,`sequence`),
4081 CONSTRAINT `matchpoint_components_ifbk_1` FOREIGN KEY (`matchpoint_id`) REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
4082 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4083 /*!40101 SET character_set_client = @saved_cs_client */;
4086 -- Table structure for table `matchpoints`
4089 DROP TABLE IF EXISTS `matchpoints`;
4090 /*!40101 SET @saved_cs_client = @@character_set_client */;
4091 /*!40101 SET character_set_client = utf8 */;
4092 CREATE TABLE `matchpoints` (
4093 `matcher_id` int(11) NOT NULL,
4094 `matchpoint_id` int(11) NOT NULL AUTO_INCREMENT,
4095 `search_index` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
4096 `score` int(11) NOT NULL DEFAULT 0,
4097 PRIMARY KEY (`matchpoint_id`),
4098 KEY `matchpoints_ifbk_1` (`matcher_id`),
4099 CONSTRAINT `matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`) REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE
4100 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4101 /*!40101 SET character_set_client = @saved_cs_client */;
4104 -- Table structure for table `message_attributes`
4107 DROP TABLE IF EXISTS `message_attributes`;
4108 /*!40101 SET @saved_cs_client = @@character_set_client */;
4109 /*!40101 SET character_set_client = utf8 */;
4110 CREATE TABLE `message_attributes` (
4111 `message_attribute_id` int(11) NOT NULL AUTO_INCREMENT,
4112 `message_name` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
4113 `takes_days` tinyint(1) NOT NULL DEFAULT 0,
4114 PRIMARY KEY (`message_attribute_id`),
4115 UNIQUE KEY `message_name` (`message_name`)
4116 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4117 /*!40101 SET character_set_client = @saved_cs_client */;
4120 -- Table structure for table `message_queue`
4123 DROP TABLE IF EXISTS `message_queue`;
4124 /*!40101 SET @saved_cs_client = @@character_set_client */;
4125 /*!40101 SET character_set_client = utf8 */;
4126 CREATE TABLE `message_queue` (
4127 `message_id` int(11) NOT NULL AUTO_INCREMENT,
4128 `letter_id` int(11) DEFAULT NULL COMMENT 'Foreign key to the letters table',
4129 `borrowernumber` int(11) DEFAULT NULL,
4130 `subject` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4131 `content` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4132 `metadata` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4133 `letter_code` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4134 `message_transport_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
4135 `status` enum('sent','pending','failed','deleted') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
4136 `time_queued` timestamp NULL DEFAULT NULL,
4137 `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
4138 `to_address` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4139 `from_address` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4140 `reply_address` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4141 `content_type` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4142 `failure_code` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4143 PRIMARY KEY (`message_id`),
4144 KEY `borrowernumber` (`borrowernumber`),
4145 KEY `message_transport_type` (`message_transport_type`),
4146 CONSTRAINT `letter_fk` FOREIGN KEY (`letter_id`) REFERENCES `letter` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
4147 CONSTRAINT `messageq_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4148 CONSTRAINT `messageq_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON UPDATE CASCADE
4149 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4150 /*!40101 SET character_set_client = @saved_cs_client */;
4153 -- Table structure for table `message_transport_types`
4156 DROP TABLE IF EXISTS `message_transport_types`;
4157 /*!40101 SET @saved_cs_client = @@character_set_client */;
4158 /*!40101 SET character_set_client = utf8 */;
4159 CREATE TABLE `message_transport_types` (
4160 `message_transport_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
4161 PRIMARY KEY (`message_transport_type`)
4162 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4163 /*!40101 SET character_set_client = @saved_cs_client */;
4166 -- Table structure for table `message_transports`
4169 DROP TABLE IF EXISTS `message_transports`;
4170 /*!40101 SET @saved_cs_client = @@character_set_client */;
4171 /*!40101 SET character_set_client = utf8 */;
4172 CREATE TABLE `message_transports` (
4173 `message_attribute_id` int(11) NOT NULL,
4174 `message_transport_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
4175 `is_digest` tinyint(1) NOT NULL DEFAULT 0,
4176 `letter_module` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
4177 `letter_code` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
4178 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
4179 PRIMARY KEY (`message_attribute_id`,`message_transport_type`,`is_digest`),
4180 KEY `message_transport_type` (`message_transport_type`),
4181 KEY `letter_module` (`letter_module`,`letter_code`),
4182 CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4183 CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
4184 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4185 /*!40101 SET character_set_client = @saved_cs_client */;
4188 -- Table structure for table `messages`
4191 DROP TABLE IF EXISTS `messages`;
4192 /*!40101 SET @saved_cs_client = @@character_set_client */;
4193 /*!40101 SET character_set_client = utf8 */;
4194 CREATE TABLE `messages` (
4195 `message_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4196 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key linking this message to the borrowers table',
4197 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key linking the message to the branches table',
4198 `message_type` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'whether the message is for the librarians (L) or the patron (B)',
4199 `message` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the text of the message',
4200 `message_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the message was written',
4201 `manager_id` int(11) DEFAULT NULL COMMENT 'creator of message',
4202 PRIMARY KEY (`message_id`),
4203 KEY `messages_ibfk_1` (`manager_id`),
4204 KEY `messages_borrowernumber` (`borrowernumber`),
4205 CONSTRAINT `messages_borrowernumber` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4206 CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL
4207 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4208 /*!40101 SET character_set_client = @saved_cs_client */;
4211 -- Table structure for table `misc_files`
4214 DROP TABLE IF EXISTS `misc_files`;
4215 /*!40101 SET @saved_cs_client = @@character_set_client */;
4216 /*!40101 SET character_set_client = utf8 */;
4217 CREATE TABLE `misc_files` (
4218 `file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the file record',
4219 `table_tag` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'usually table name, or arbitrary unique tag',
4220 `record_id` int(11) NOT NULL COMMENT 'record id from the table this file is associated to',
4221 `file_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'file name',
4222 `file_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'MIME type of the file',
4223 `file_description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'description given to the file',
4224 `file_content` longblob NOT NULL COMMENT 'file content',
4225 `date_uploaded` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the file was added',
4226 PRIMARY KEY (`file_id`),
4227 KEY `table_tag` (`table_tag`(191)),
4228 KEY `record_id` (`record_id`)
4229 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4230 /*!40101 SET character_set_client = @saved_cs_client */;
4233 -- Table structure for table `need_merge_authorities`
4236 DROP TABLE IF EXISTS `need_merge_authorities`;
4237 /*!40101 SET @saved_cs_client = @@character_set_client */;
4238 /*!40101 SET character_set_client = utf8 */;
4239 CREATE TABLE `need_merge_authorities` (
4240 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id',
4241 `authid` bigint(20) NOT NULL COMMENT 'reference to original authority record',
4242 `authid_new` bigint(20) DEFAULT NULL COMMENT 'reference to optional new authority record',
4243 `reportxml` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'xml showing original reporting tag',
4244 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time last modified',
4245 `done` tinyint(4) DEFAULT 0,
4247 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4248 /*!40101 SET character_set_client = @saved_cs_client */;
4251 -- Table structure for table `oai_sets`
4254 DROP TABLE IF EXISTS `oai_sets`;
4255 /*!40101 SET @saved_cs_client = @@character_set_client */;
4256 /*!40101 SET character_set_client = utf8 */;
4257 CREATE TABLE `oai_sets` (
4258 `id` int(11) NOT NULL AUTO_INCREMENT,
4259 `spec` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL,
4260 `name` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL,
4262 UNIQUE KEY `spec` (`spec`)
4263 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4264 /*!40101 SET character_set_client = @saved_cs_client */;
4267 -- Table structure for table `oai_sets_biblios`
4270 DROP TABLE IF EXISTS `oai_sets_biblios`;
4271 /*!40101 SET @saved_cs_client = @@character_set_client */;
4272 /*!40101 SET character_set_client = utf8 */;
4273 CREATE TABLE `oai_sets_biblios` (
4274 `biblionumber` int(11) NOT NULL,
4275 `set_id` int(11) NOT NULL,
4276 PRIMARY KEY (`biblionumber`,`set_id`),
4277 KEY `oai_sets_biblios_ibfk_2` (`set_id`),
4278 CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4279 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4280 /*!40101 SET character_set_client = @saved_cs_client */;
4283 -- Table structure for table `oai_sets_descriptions`
4286 DROP TABLE IF EXISTS `oai_sets_descriptions`;
4287 /*!40101 SET @saved_cs_client = @@character_set_client */;
4288 /*!40101 SET character_set_client = utf8 */;
4289 CREATE TABLE `oai_sets_descriptions` (
4290 `set_id` int(11) NOT NULL,
4291 `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
4292 KEY `oai_sets_descriptions_ibfk_1` (`set_id`),
4293 CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4294 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4295 /*!40101 SET character_set_client = @saved_cs_client */;
4298 -- Table structure for table `oai_sets_mappings`
4301 DROP TABLE IF EXISTS `oai_sets_mappings`;
4302 /*!40101 SET @saved_cs_client = @@character_set_client */;
4303 /*!40101 SET character_set_client = utf8 */;
4304 CREATE TABLE `oai_sets_mappings` (
4305 `set_id` int(11) NOT NULL,
4306 `rule_order` int(11) DEFAULT NULL,
4307 `rule_operator` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4308 `marcfield` char(3) COLLATE utf8mb4_unicode_ci NOT NULL,
4309 `marcsubfield` char(1) COLLATE utf8mb4_unicode_ci NOT NULL,
4310 `operator` varchar(8) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'equal',
4311 `marcvalue` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL,
4312 KEY `oai_sets_mappings_ibfk_1` (`set_id`),
4313 CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4314 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4315 /*!40101 SET character_set_client = @saved_cs_client */;
4318 -- Table structure for table `oauth_access_tokens`
4321 DROP TABLE IF EXISTS `oauth_access_tokens`;
4322 /*!40101 SET @saved_cs_client = @@character_set_client */;
4323 /*!40101 SET character_set_client = utf8 */;
4324 CREATE TABLE `oauth_access_tokens` (
4325 `access_token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'generarated access token',
4326 `client_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the client id the access token belongs to',
4327 `expires` int(11) NOT NULL COMMENT 'expiration time in seconds',
4328 PRIMARY KEY (`access_token`)
4329 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4330 /*!40101 SET character_set_client = @saved_cs_client */;
4333 -- Table structure for table `old_issues`
4336 DROP TABLE IF EXISTS `old_issues`;
4337 /*!40101 SET @saved_cs_client = @@character_set_client */;
4338 /*!40101 SET character_set_client = utf8 */;
4339 CREATE TABLE `old_issues` (
4340 `issue_id` int(11) NOT NULL COMMENT 'primary key for issues table',
4341 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to',
4342 `issuer_id` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table for the user who checked out this item',
4343 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out',
4344 `date_due` datetime DEFAULT NULL COMMENT 'date the item is due (yyyy-mm-dd)',
4345 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
4346 `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned',
4347 `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
4348 `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
4349 `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
4350 `auto_renew` tinyint(1) DEFAULT 0 COMMENT 'automatic renewal',
4351 `auto_renew_error` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'automatic renewal error',
4352 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this record was last touched',
4353 `issuedate` datetime DEFAULT NULL COMMENT 'date the item was checked out or issued',
4354 `onsite_checkout` int(1) NOT NULL DEFAULT 0 COMMENT 'in house use flag',
4355 `note` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'issue note text',
4356 `notedate` datetime DEFAULT NULL COMMENT 'datetime of issue note (yyyy-mm-dd hh:mm::ss)',
4357 `noteseen` int(1) DEFAULT NULL COMMENT 'describes whether checkout note has been seen 1, not been seen 0 or doesn''t exist null',
4358 PRIMARY KEY (`issue_id`),
4359 KEY `old_issuesborridx` (`borrowernumber`),
4360 KEY `old_issuesitemidx` (`itemnumber`),
4361 KEY `branchcode_idx` (`branchcode`),
4362 KEY `old_bordate` (`borrowernumber`,`timestamp`),
4363 KEY `old_issues_ibfk_borrowers_borrowernumber` (`issuer_id`),
4364 CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4365 CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4366 CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
4367 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4368 /*!40101 SET character_set_client = @saved_cs_client */;
4371 -- Table structure for table `old_reserves`
4374 DROP TABLE IF EXISTS `old_reserves`;
4375 /*!40101 SET @saved_cs_client = @@character_set_client */;
4376 /*!40101 SET character_set_client = utf8 */;
4377 CREATE TABLE `old_reserves` (
4378 `reserve_id` int(11) NOT NULL COMMENT 'primary key',
4379 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4380 `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places',
4381 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4382 `item_group_id` int(11) NULL default NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
4383 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
4384 `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4385 `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4386 `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4387 `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4388 `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4389 `reservenotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes related to this hold',
4390 `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4391 `found` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
4392 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4393 `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',
4394 `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4395 `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)',
4396 `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',
4397 `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)',
4398 `suspend` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'in this hold suspended (1 for yes, 0 for no)',
4399 `suspend_until` datetime DEFAULT NULL COMMENT 'the date this hold is suspended until (NULL for infinitely)',
4400 `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4401 `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
4402 `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4403 PRIMARY KEY (`reserve_id`),
4404 KEY `old_reserves_borrowernumber` (`borrowernumber`),
4405 KEY `old_reserves_biblionumber` (`biblionumber`),
4406 KEY `old_reserves_itemnumber` (`itemnumber`),
4407 KEY `old_reserves_branchcode` (`branchcode`),
4408 KEY `old_reserves_itemtype` (`itemtype`),
4409 CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL,
4410 CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4411 CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4412 CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
4413 CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL
4414 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4415 /*!40101 SET character_set_client = @saved_cs_client */;
4418 -- Table structure for table `overduerules`
4421 DROP TABLE IF EXISTS `overduerules`;
4422 /*!40101 SET @saved_cs_client = @@character_set_client */;
4423 /*!40101 SET character_set_client = utf8 */;
4424 CREATE TABLE `overduerules` (
4425 `overduerules_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the overduerules',
4426 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'foreign key from the branches table to define which branch this rule is for (if blank it''s all libraries)',
4427 `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table to define which patron category this rule is for',
4428 `delay1` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the first notice is sent',
4429 `letter1` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the first notice',
4430 `debarred1` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT '0' COMMENT 'is the patron restricted when the first notice is sent (1 for yes, 0 for no)',
4431 `delay2` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the second notice is sent',
4432 `debarred2` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT '0' COMMENT 'is the patron restricted when the second notice is sent (1 for yes, 0 for no)',
4433 `letter2` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the second notice',
4434 `delay3` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the third notice is sent',
4435 `letter3` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the third notice',
4436 `debarred3` int(1) DEFAULT 0 COMMENT 'is the patron restricted when the third notice is sent (1 for yes, 0 for no)',
4437 PRIMARY KEY (`overduerules_id`),
4438 UNIQUE KEY `overduerules_branch_cat` (`branchcode`,`categorycode`)
4439 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4440 /*!40101 SET character_set_client = @saved_cs_client */;
4443 -- Table structure for table `overduerules_transport_types`
4446 DROP TABLE IF EXISTS `overduerules_transport_types`;
4447 /*!40101 SET @saved_cs_client = @@character_set_client */;
4448 /*!40101 SET character_set_client = utf8 */;
4449 CREATE TABLE `overduerules_transport_types` (
4450 `id` int(11) NOT NULL AUTO_INCREMENT,
4451 `letternumber` int(1) NOT NULL DEFAULT 1,
4452 `message_transport_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'email',
4453 `overduerules_id` int(11) NOT NULL,
4455 KEY `overduerules_fk` (`overduerules_id`),
4456 KEY `mtt_fk` (`message_transport_type`),
4457 CONSTRAINT `mtt_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
4458 CONSTRAINT `overduerules_fk` FOREIGN KEY (`overduerules_id`) REFERENCES `overduerules` (`overduerules_id`) ON DELETE CASCADE ON UPDATE CASCADE
4459 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4460 /*!40101 SET character_set_client = @saved_cs_client */;
4463 -- Table structure for table `patron_consent`
4466 DROP TABLE IF EXISTS `patron_consent`;
4467 /*!40101 SET @saved_cs_client = @@character_set_client */;
4468 /*!40101 SET character_set_client = utf8 */;
4469 CREATE TABLE `patron_consent` (
4470 `id` int(11) NOT NULL AUTO_INCREMENT,
4471 `borrowernumber` int(11) NOT NULL,
4472 `type` enum('GDPR_PROCESSING') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'allows for future extension',
4473 `given_on` datetime DEFAULT NULL,
4474 `refused_on` datetime DEFAULT NULL,
4476 KEY `borrowernumber` (`borrowernumber`),
4477 CONSTRAINT `patron_consent_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4478 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4479 /*!40101 SET character_set_client = @saved_cs_client */;
4482 -- Table structure for table `patron_list_patrons`
4485 DROP TABLE IF EXISTS `patron_list_patrons`;
4486 /*!40101 SET @saved_cs_client = @@character_set_client */;
4487 /*!40101 SET character_set_client = utf8 */;
4488 CREATE TABLE `patron_list_patrons` (
4489 `patron_list_patron_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
4490 `patron_list_id` int(11) NOT NULL COMMENT 'the list this entry is part of',
4491 `borrowernumber` int(11) NOT NULL COMMENT 'the borrower that is part of this list',
4492 PRIMARY KEY (`patron_list_patron_id`),
4493 KEY `patron_list_id` (`patron_list_id`),
4494 KEY `borrowernumber` (`borrowernumber`),
4495 CONSTRAINT `patron_list_patrons_ibfk_1` FOREIGN KEY (`patron_list_id`) REFERENCES `patron_lists` (`patron_list_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4496 CONSTRAINT `patron_list_patrons_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4497 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4498 /*!40101 SET character_set_client = @saved_cs_client */;
4501 -- Table structure for table `patron_lists`
4504 DROP TABLE IF EXISTS `patron_lists`;
4505 /*!40101 SET @saved_cs_client = @@character_set_client */;
4506 /*!40101 SET character_set_client = utf8 */;
4507 CREATE TABLE `patron_lists` (
4508 `patron_list_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
4509 `name` varchar(255) CHARACTER SET utf8mb4 NOT NULL COMMENT 'the list''s name',
4510 `owner` int(11) NOT NULL COMMENT 'borrowernumber of the list creator',
4511 `shared` tinyint(1) DEFAULT 0,
4512 PRIMARY KEY (`patron_list_id`),
4513 KEY `owner` (`owner`),
4514 CONSTRAINT `patron_lists_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4515 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4516 /*!40101 SET character_set_client = @saved_cs_client */;
4519 -- Table structure for table `patronimage`
4522 DROP TABLE IF EXISTS `patronimage`;
4523 /*!40101 SET @saved_cs_client = @@character_set_client */;
4524 /*!40101 SET character_set_client = utf8 */;
4525 CREATE TABLE `patronimage` (
4526 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron this image is attached to (borrowers.borrowernumber)',
4527 `mimetype` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the format of the image (png, jpg, etc)',
4528 `imagefile` mediumblob NOT NULL COMMENT 'the image',
4529 PRIMARY KEY (`borrowernumber`),
4530 CONSTRAINT `patronimage_fk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
4531 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4532 /*!40101 SET character_set_client = @saved_cs_client */;
4535 -- Table structure for table `pending_offline_operations`
4538 DROP TABLE IF EXISTS `pending_offline_operations`;
4539 /*!40101 SET @saved_cs_client = @@character_set_client */;
4540 /*!40101 SET character_set_client = utf8 */;
4541 CREATE TABLE `pending_offline_operations` (
4542 `operationid` int(11) NOT NULL AUTO_INCREMENT,
4543 `userid` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
4544 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
4545 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
4546 `action` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
4547 `barcode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4548 `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4549 `amount` decimal(28,6) DEFAULT NULL,
4550 PRIMARY KEY (`operationid`)
4551 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4552 /*!40101 SET character_set_client = @saved_cs_client */;
4555 -- Table structure for table `permissions`
4558 DROP TABLE IF EXISTS `permissions`;
4559 /*!40101 SET @saved_cs_client = @@character_set_client */;
4560 /*!40101 SET character_set_client = utf8 */;
4561 CREATE TABLE `permissions` (
4562 `module_bit` int(11) NOT NULL DEFAULT 0,
4563 `code` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
4564 `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4565 PRIMARY KEY (`module_bit`,`code`),
4566 CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`) ON DELETE CASCADE ON UPDATE CASCADE
4567 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4568 /*!40101 SET character_set_client = @saved_cs_client */;
4571 -- Table structure for table `plugin_data`
4574 DROP TABLE IF EXISTS `plugin_data`;
4575 /*!40101 SET @saved_cs_client = @@character_set_client */;
4576 /*!40101 SET character_set_client = utf8 */;
4577 CREATE TABLE `plugin_data` (
4578 `plugin_class` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
4579 `plugin_key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
4580 `plugin_value` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4581 PRIMARY KEY (`plugin_class`(191),`plugin_key`(191))
4582 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4583 /*!40101 SET character_set_client = @saved_cs_client */;
4586 -- Table structure for table `plugin_methods`
4589 DROP TABLE IF EXISTS `plugin_methods`;
4590 /*!40101 SET @saved_cs_client = @@character_set_client */;
4591 /*!40101 SET character_set_client = utf8 */;
4592 CREATE TABLE `plugin_methods` (
4593 `plugin_class` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
4594 `plugin_method` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
4595 PRIMARY KEY (`plugin_class`(191),`plugin_method`(191))
4596 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4597 /*!40101 SET character_set_client = @saved_cs_client */;
4600 -- Table structure for table `printers_profile`
4603 DROP TABLE IF EXISTS `printers_profile`;
4604 /*!40101 SET @saved_cs_client = @@character_set_client */;
4605 /*!40101 SET character_set_client = utf8 */;
4606 CREATE TABLE `printers_profile` (
4607 `profile_id` int(4) NOT NULL AUTO_INCREMENT,
4608 `printer_name` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Default Printer',
4609 `template_id` int(4) NOT NULL DEFAULT 0,
4610 `paper_bin` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Bypass',
4611 `offset_horz` float NOT NULL DEFAULT 0,
4612 `offset_vert` float NOT NULL DEFAULT 0,
4613 `creep_horz` float NOT NULL DEFAULT 0,
4614 `creep_vert` float NOT NULL DEFAULT 0,
4615 `units` char(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'POINT',
4616 `creator` char(15) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Labels',
4617 PRIMARY KEY (`profile_id`),
4618 UNIQUE KEY `printername` (`printer_name`,`template_id`,`paper_bin`,`creator`)
4619 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4620 /*!40101 SET character_set_client = @saved_cs_client */;
4623 -- Table structure for table `problem_reports`
4626 DROP TABLE IF EXISTS `problem_reports`;
4627 /*!40101 SET @saved_cs_client = @@character_set_client */;
4628 /*!40101 SET character_set_client = utf8 */;
4629 CREATE TABLE `problem_reports` (
4630 `reportid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4631 `title` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'report subject line',
4632 `content` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'report message content',
4633 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'the user who created the problem report',
4634 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'borrower''s branch',
4635 `username` varchar(75) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'OPAC username',
4636 `problempage` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'page the user triggered the problem report form from',
4637 `recipient` enum('admin','library') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'library' COMMENT 'the ''to-address'' of the problem report',
4638 `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'timestamp of report submission',
4639 `status` varchar(6) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'New' COMMENT 'status of the report. New, Viewed, Closed',
4640 PRIMARY KEY (`reportid`),
4641 KEY `problem_reports_ibfk1` (`borrowernumber`),
4642 KEY `problem_reports_ibfk2` (`branchcode`),
4643 CONSTRAINT `problem_reports_ibfk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4644 CONSTRAINT `problem_reports_ibfk2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) 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 `pseudonymized_borrower_attributes`
4652 DROP TABLE IF EXISTS `pseudonymized_borrower_attributes`;
4653 /*!40101 SET @saved_cs_client = @@character_set_client */;
4654 /*!40101 SET character_set_client = utf8 */;
4655 CREATE TABLE `pseudonymized_borrower_attributes` (
4656 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Row id field',
4657 `transaction_id` int(11) NOT NULL,
4658 `code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for',
4659 `attribute` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'custom patron field value',
4661 KEY `pseudonymized_borrower_attributes_ibfk_1` (`transaction_id`),
4662 KEY `anonymized_borrower_attributes_ibfk_2` (`code`),
4663 CONSTRAINT `anonymized_borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
4664 CONSTRAINT `pseudonymized_borrower_attributes_ibfk_1` FOREIGN KEY (`transaction_id`) REFERENCES `pseudonymized_transactions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4665 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4666 /*!40101 SET character_set_client = @saved_cs_client */;
4669 -- Table structure for table `pseudonymized_transactions`
4672 DROP TABLE IF EXISTS `pseudonymized_transactions`;
4673 /*!40101 SET @saved_cs_client = @@character_set_client */;
4674 /*!40101 SET character_set_client = utf8 */;
4675 CREATE TABLE `pseudonymized_transactions` (
4676 `id` int(11) NOT NULL AUTO_INCREMENT,
4677 `hashed_borrowernumber` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
4678 `has_cardnumber` tinyint(1) NOT NULL DEFAULT 0,
4679 `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4680 `city` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4681 `state` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4682 `zipcode` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4683 `country` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4684 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
4685 `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
4686 `dateenrolled` date DEFAULT NULL,
4687 `sex` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4688 `sort1` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4689 `sort2` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4690 `datetime` datetime DEFAULT NULL,
4691 `transaction_branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4692 `transaction_type` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4693 `itemnumber` int(11) DEFAULT NULL,
4694 `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4695 `holdingbranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4696 `homebranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4697 `location` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4698 `itemcallnumber` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4699 `ccode` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4701 KEY `pseudonymized_transactions_ibfk_1` (`categorycode`),
4702 KEY `pseudonymized_transactions_borrowers_ibfk_2` (`branchcode`),
4703 KEY `pseudonymized_transactions_borrowers_ibfk_3` (`transaction_branchcode`)
4704 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4705 /*!40101 SET character_set_client = @saved_cs_client */;
4708 -- Table structure for table `quotes`
4711 DROP TABLE IF EXISTS `quotes`;
4712 /*!40101 SET @saved_cs_client = @@character_set_client */;
4713 /*!40101 SET character_set_client = utf8 */;
4714 CREATE TABLE `quotes` (
4715 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the quote',
4716 `source` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'source/credit for the quote',
4717 `text` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'text of the quote',
4718 `timestamp` datetime DEFAULT NULL COMMENT 'date and time that the quote last appeared in the opac',
4720 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4721 /*!40101 SET character_set_client = @saved_cs_client */;
4724 -- Table structure for table `ratings`
4727 DROP TABLE IF EXISTS `ratings`;
4728 /*!40101 SET @saved_cs_client = @@character_set_client */;
4729 /*!40101 SET character_set_client = utf8 */;
4730 CREATE TABLE `ratings` (
4731 `borrowernumber` int(11) NOT NULL COMMENT 'the borrowernumber of the patron who left this rating (borrowers.borrowernumber)',
4732 `biblionumber` int(11) NOT NULL COMMENT 'the biblio this rating is for (biblio.biblionumber)',
4733 `rating_value` tinyint(1) NOT NULL COMMENT 'the rating, from 1 to 5',
4734 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
4735 PRIMARY KEY (`borrowernumber`,`biblionumber`),
4736 KEY `ratings_ibfk_2` (`biblionumber`),
4737 CONSTRAINT `ratings_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4738 CONSTRAINT `ratings_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
4739 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4740 /*!40101 SET character_set_client = @saved_cs_client */;
4743 -- Table structure for table `recalls`
4746 DROP TABLE IF EXISTS `recalls`;
4747 /*!40101 SET @saved_cs_client = @@character_set_client */;
4748 /*!40101 SET character_set_client = utf8 */;
4749 CREATE TABLE `recalls` (
4750 `recall_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier for this recall',
4751 `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Identifier for patron who requested recall',
4752 `created_date` datetime DEFAULT NULL COMMENT 'Date the recall was requested',
4753 `biblio_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Identifier for bibliographic record that has been recalled',
4754 `pickup_library_id` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Identifier for recall pickup library',
4755 `completed_date` datetime DEFAULT NULL COMMENT 'Date the recall is completed (fulfilled, cancelled or expired)',
4756 `notes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Notes related to the recall',
4757 `priority` smallint(6) DEFAULT NULL COMMENT 'Where in the queue the patron sits',
4758 `status` enum('requested','overdue','waiting','in_transit','cancelled','expired','fulfilled') COLLATE utf8mb4_unicode_ci DEFAULT 'requested' COMMENT 'Status of recall',
4759 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date and time the recall was last updated',
4760 `item_id` int(11) DEFAULT NULL COMMENT 'Identifier for item record that was recalled, if an item-level recall',
4761 `waiting_date` datetime DEFAULT NULL COMMENT 'Date an item was marked as waiting for the patron at the library',
4762 `expiration_date` datetime DEFAULT NULL COMMENT 'Date recall is no longer required, or date recall will expire after waiting on shelf for pickup',
4763 `completed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is old and no longer active, i.e. expired, cancelled or completed',
4764 `item_level` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag if recall is for a specific item',
4765 PRIMARY KEY (`recall_id`),
4766 KEY `recalls_ibfk_1` (`patron_id`),
4767 KEY `recalls_ibfk_2` (`biblio_id`),
4768 KEY `recalls_ibfk_3` (`item_id`),
4769 KEY `recalls_ibfk_4` (`pickup_library_id`),
4770 CONSTRAINT `recalls_ibfk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4771 CONSTRAINT `recalls_ibfk_2` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4772 CONSTRAINT `recalls_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4773 CONSTRAINT `recalls_ibfk_4` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4774 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Information related to recalls in Koha';
4775 /*!40101 SET character_set_client = @saved_cs_client */;
4778 -- Table structure for table `repeatable_holidays`
4781 DROP TABLE IF EXISTS `repeatable_holidays`;
4782 /*!40101 SET @saved_cs_client = @@character_set_client */;
4783 /*!40101 SET character_set_client = utf8 */;
4784 CREATE TABLE `repeatable_holidays` (
4785 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4786 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
4787 `weekday` smallint(6) DEFAULT NULL COMMENT 'day of the week (0=Sunday, 1=Monday, etc) this closing is repeated on',
4788 `day` smallint(6) DEFAULT NULL COMMENT 'day of the month this closing is on',
4789 `month` smallint(6) DEFAULT NULL COMMENT 'month this closing is in',
4790 `title` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'title of this closing',
4791 `description` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'description for this closing',
4793 KEY `repeatable_holidays_ibfk_1` (`branchcode`),
4794 CONSTRAINT `repeatable_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4795 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4796 /*!40101 SET character_set_client = @saved_cs_client */;
4799 -- Table structure for table `reports_dictionary`
4802 DROP TABLE IF EXISTS `reports_dictionary`;
4803 /*!40101 SET @saved_cs_client = @@character_set_client */;
4804 /*!40101 SET character_set_client = utf8 */;
4805 CREATE TABLE `reports_dictionary` (
4806 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
4807 `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'name for this definition',
4808 `description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'description for this definition',
4809 `date_created` datetime DEFAULT NULL COMMENT 'date and time this definition was created',
4810 `date_modified` datetime DEFAULT NULL COMMENT 'date and time this definition was last modified',
4811 `saved_sql` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'SQL snippet for us in reports',
4812 `report_area` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Koha module this definition is for Circulation, Catalog, Patrons, Acquistions, Accounts)',
4814 KEY `dictionary_area_idx` (`report_area`)
4815 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4816 /*!40101 SET character_set_client = @saved_cs_client */;
4819 -- Table structure for table `reserves`
4822 DROP TABLE IF EXISTS `reserves`;
4823 /*!40101 SET @saved_cs_client = @@character_set_client */;
4824 /*!40101 SET character_set_client = utf8 */;
4825 CREATE TABLE `reserves` (
4826 `reserve_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4827 `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4828 `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
4829 `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4830 `item_group_id` int(11) NULL default NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold',
4831 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
4832 `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4833 `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4834 `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4835 `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4836 `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4837 `reservenotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes related to this hold',
4838 `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4839 `found` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
4840 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4841 `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',
4842 `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4843 `expirationdate` date DEFAULT NULL COMMENT 'the date the hold expires (calculated value)',
4844 `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',
4845 `lowestPriority` tinyint(1) NOT NULL DEFAULT 0,
4846 `suspend` tinyint(1) NOT NULL DEFAULT 0,
4847 `suspend_until` datetime DEFAULT NULL,
4848 `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4849 `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
4850 `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4851 PRIMARY KEY (`reserve_id`),
4852 KEY `priorityfoundidx` (`priority`,`found`),
4853 KEY `borrowernumber` (`borrowernumber`),
4854 KEY `biblionumber` (`biblionumber`),
4855 KEY `itemnumber` (`itemnumber`),
4856 KEY `branchcode` (`branchcode`),
4857 KEY `desk_id` (`desk_id`),
4858 KEY `itemtype` (`itemtype`),
4859 CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4860 CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4861 CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4862 CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4863 CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4864 CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4865 CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE
4866 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4867 /*!40101 SET character_set_client = @saved_cs_client */;
4870 -- Table structure for table `hold_cancellation_requests`
4873 DROP TABLE IF EXISTS `hold_cancellation_requests`;
4874 /*!40101 SET @saved_cs_client = @@character_set_client */;
4875 /*!40101 SET character_set_client = utf8 */;
4876 CREATE TABLE `hold_cancellation_requests` (
4877 `hold_cancellation_request_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the cancellation request',
4878 `hold_id` int(11) NOT null COMMENT 'ID of the hold',
4879 `creation_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Time and date the cancellation request was created',
4880 PRIMARY KEY (`hold_cancellation_request_id`)
4881 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4882 /*!40101 SET character_set_client = @saved_cs_client */;
4885 -- Table structure for table `return_claims`
4888 DROP TABLE IF EXISTS `return_claims`;
4889 /*!40101 SET @saved_cs_client = @@character_set_client */;
4890 /*!40101 SET character_set_client = utf8 */;
4891 CREATE TABLE `return_claims` (
4892 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of the return claim',
4893 `itemnumber` int(11) NOT NULL COMMENT 'ID of the item',
4894 `issue_id` int(11) DEFAULT NULL COMMENT 'ID of the checkout that triggered the claim',
4895 `borrowernumber` int(11) NOT NULL COMMENT 'ID of the patron',
4896 `notes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Notes about the claim',
4897 `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was created',
4898 `created_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that registered the claim',
4899 `updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Time and date of the latest change on the claim (notes)',
4900 `updated_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that updated the claim',
4901 `resolution` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Resolution code (RETURN_CLAIM_RESOLUTION AVs)',
4902 `resolved_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the claim was resolved',
4903 `resolved_by` int(11) DEFAULT NULL COMMENT 'ID of the staff member that resolved the claim',
4905 UNIQUE KEY `item_issue` (`itemnumber`, `issue_id`),
4906 KEY `itemnumber` (`itemnumber`),
4907 KEY `rc_borrowers_ibfk` (`borrowernumber`),
4908 KEY `rc_created_by_ibfk` (`created_by`),
4909 KEY `rc_updated_by_ibfk` (`updated_by`),
4910 KEY `rc_resolved_by_ibfk` (`resolved_by`),
4911 CONSTRAINT `rc_borrowers_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4912 CONSTRAINT `rc_created_by_ibfk` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
4913 CONSTRAINT `rc_items_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4914 CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
4915 CONSTRAINT `rc_updated_by_ibfk` FOREIGN KEY (`updated_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
4916 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4917 /*!40101 SET character_set_client = @saved_cs_client */;
4920 -- Table structure for table `reviews`
4923 DROP TABLE IF EXISTS `reviews`;
4924 /*!40101 SET @saved_cs_client = @@character_set_client */;
4925 /*!40101 SET character_set_client = utf8 */;
4926 CREATE TABLE `reviews` (
4927 `reviewid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for this comment',
4928 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron left this comment',
4929 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bibliographic record this comment is for',
4930 `review` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the body of the comment',
4931 `approved` tinyint(4) DEFAULT 0 COMMENT 'whether this comment has been approved by a librarian (1 for yes, 0 for no)',
4932 `datereviewed` datetime DEFAULT NULL COMMENT 'the date the comment was left',
4933 PRIMARY KEY (`reviewid`),
4934 KEY `reviews_ibfk_1` (`borrowernumber`),
4935 KEY `reviews_ibfk_2` (`biblionumber`),
4936 CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
4937 CONSTRAINT `reviews_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
4938 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4939 /*!40101 SET character_set_client = @saved_cs_client */;
4942 -- Table structure for table `saved_reports`
4945 DROP TABLE IF EXISTS `saved_reports`;
4946 /*!40101 SET @saved_cs_client = @@character_set_client */;
4947 /*!40101 SET character_set_client = utf8 */;
4948 CREATE TABLE `saved_reports` (
4949 `id` int(11) NOT NULL AUTO_INCREMENT,
4950 `report_id` int(11) DEFAULT NULL,
4951 `report` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4952 `date_run` datetime DEFAULT NULL,
4954 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4955 /*!40101 SET character_set_client = @saved_cs_client */;
4958 -- Table structure for table `saved_sql`
4961 DROP TABLE IF EXISTS `saved_sql`;
4962 /*!40101 SET @saved_cs_client = @@character_set_client */;
4963 /*!40101 SET character_set_client = utf8 */;
4964 CREATE TABLE `saved_sql` (
4965 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key assigned by Koha',
4966 `borrowernumber` int(11) DEFAULT NULL COMMENT 'the staff member who created this report (borrowers.borrowernumber)',
4967 `date_created` datetime DEFAULT NULL COMMENT 'the date this report was created',
4968 `last_modified` datetime DEFAULT NULL COMMENT 'the date this report was last edited',
4969 `savedsql` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the SQL for this report',
4970 `last_run` datetime DEFAULT NULL,
4971 `report_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'the name of this report',
4972 `type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'always 1 for tabular',
4973 `notes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the notes or description given to this report',
4974 `cache_expiry` int(11) NOT NULL DEFAULT 300,
4975 `public` tinyint(1) NOT NULL DEFAULT 0,
4976 `report_area` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4977 `report_group` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4978 `report_subgroup` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4979 `mana_id` int(11) DEFAULT NULL,
4981 KEY `sql_area_group_idx` (`report_group`,`report_subgroup`),
4982 KEY `boridx` (`borrowernumber`)
4983 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4984 /*!40101 SET character_set_client = @saved_cs_client */;
4987 -- Table structure for table `search_field`
4990 DROP TABLE IF EXISTS `search_field`;
4991 /*!40101 SET @saved_cs_client = @@character_set_client */;
4992 /*!40101 SET character_set_client = utf8 */;
4993 CREATE TABLE `search_field` (
4994 `id` int(11) NOT NULL AUTO_INCREMENT,
4995 `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the name of the field as it will be stored in the search engine',
4996 `label` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the human readable name of the field, for display',
4997 `type` enum('','string','date','number','boolean','sum','isbn','stdno','year','callnumber') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'what type of data this holds, relevant when storing it in the search engine',
4998 `weight` decimal(5,2) DEFAULT NULL,
4999 `facet_order` tinyint(4) DEFAULT NULL COMMENT 'the order place of the field in facet list if faceted',
5000 `staff_client` tinyint(1) NOT NULL DEFAULT 1,
5001 `opac` tinyint(1) NOT NULL DEFAULT 1,
5002 `mandatory` tinyint(1) DEFAULT NULL COMMENT 'if marked this field is not editable or removable',
5004 UNIQUE KEY `name` (`name`(191))
5005 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5006 /*!40101 SET character_set_client = @saved_cs_client */;
5009 -- Table structure for table `search_filters`
5012 DROP TABLE IF EXISTS `search_filters`;
5013 /*!40101 SET @saved_cs_client = @@character_set_client */;
5014 /*!40101 SET character_set_client = utf8 */;
5015 CREATE TABLE `search_filters` (
5016 `search_filter_id` int(11) NOT NULL AUTO_INCREMENT,
5017 `name` varchar(255) NOT NULL COMMENT 'filter name',
5018 `query` mediumtext NULL DEFAULT NULL COMMENT 'filter query part',
5019 `limits` mediumtext NULL DEFAULT NULL COMMENT 'filter limits part',
5020 `opac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown on OPAC',
5021 `staff_client` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'whether this filter is shown in staff client',
5022 PRIMARY KEY (`search_filter_id`)
5023 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5024 /*!40101 SET character_set_client = @saved_cs_client */;
5027 -- Table structure for table `search_history`
5030 DROP TABLE IF EXISTS `search_history`;
5031 /*!40101 SET @saved_cs_client = @@character_set_client */;
5032 /*!40101 SET character_set_client = utf8 */;
5033 CREATE TABLE `search_history` (
5034 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'search history id',
5035 `userid` int(11) NOT NULL COMMENT 'the patron who performed the search (borrowers.borrowernumber)',
5036 `sessionid` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'a system generated session id',
5037 `query_desc` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the search that was performed',
5038 `query_cgi` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the string to append to the search url to rerun the search',
5039 `type` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'biblio' COMMENT 'search type, must be ''biblio'' or ''authority''',
5040 `total` int(11) NOT NULL COMMENT 'the total of results found',
5041 `time` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the search was run',
5043 KEY `userid` (`userid`),
5044 KEY `sessionid` (`sessionid`)
5045 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Opac search history results';
5046 /*!40101 SET character_set_client = @saved_cs_client */;
5049 -- Table structure for table `search_marc_map`
5052 DROP TABLE IF EXISTS `search_marc_map`;
5053 /*!40101 SET @saved_cs_client = @@character_set_client */;
5054 /*!40101 SET character_set_client = utf8 */;
5055 CREATE TABLE `search_marc_map` (
5056 `id` int(11) NOT NULL AUTO_INCREMENT,
5057 `index_name` enum('biblios','authorities') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'what storage index this map is for',
5058 `marc_type` enum('marc21','unimarc') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'what MARC type this map is for',
5059 `marc_field` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the MARC specifier for this field',
5061 UNIQUE KEY `index_name` (`index_name`,`marc_field`(191),`marc_type`),
5062 KEY `index_name_2` (`index_name`)
5063 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5064 /*!40101 SET character_set_client = @saved_cs_client */;
5067 -- Table structure for table `search_marc_to_field`
5070 DROP TABLE IF EXISTS `search_marc_to_field`;
5071 /*!40101 SET @saved_cs_client = @@character_set_client */;
5072 /*!40101 SET character_set_client = utf8 */;
5073 CREATE TABLE `search_marc_to_field` (
5074 `search` tinyint(1) NOT NULL DEFAULT 1,
5075 `search_marc_map_id` int(11) NOT NULL,
5076 `search_field_id` int(11) NOT NULL,
5077 `facet` tinyint(1) DEFAULT 0 COMMENT 'true if a facet field should be generated for this',
5078 `suggestible` tinyint(1) DEFAULT 0 COMMENT 'true if this field can be used to generate suggestions for browse',
5079 `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',
5080 PRIMARY KEY (`search_marc_map_id`,`search_field_id`),
5081 KEY `search_field_id` (`search_field_id`),
5082 CONSTRAINT `search_marc_to_field_ibfk_1` FOREIGN KEY (`search_marc_map_id`) REFERENCES `search_marc_map` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
5083 CONSTRAINT `search_marc_to_field_ibfk_2` FOREIGN KEY (`search_field_id`) REFERENCES `search_field` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
5084 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5085 /*!40101 SET character_set_client = @saved_cs_client */;
5088 -- Table structure for table `serial`
5091 DROP TABLE IF EXISTS `serial`;
5092 /*!40101 SET @saved_cs_client = @@character_set_client */;
5093 /*!40101 SET character_set_client = utf8 */;
5094 CREATE TABLE `serial` (
5095 `serialid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for the issue',
5096 `biblionumber` int(11) NOT NULL COMMENT 'foreign key for the biblio.biblionumber that this issue is attached to',
5097 `subscriptionid` int(11) NOT NULL COMMENT 'foreign key to the subscription.subscriptionid that this issue is part of',
5098 `serialseq` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'issue information (volume, number, etc)',
5099 `serialseq_x` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'first part of issue information',
5100 `serialseq_y` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'second part of issue information',
5101 `serialseq_z` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'third part of issue information',
5102 `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'status code for this issue (see manual for full descriptions)',
5103 `planneddate` date DEFAULT NULL COMMENT 'date expected',
5104 `notes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes',
5105 `publisheddate` date DEFAULT NULL COMMENT 'date published',
5106 `publisheddatetext` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'date published (descriptive)',
5107 `claimdate` date DEFAULT NULL COMMENT 'date claimed',
5108 `claims_count` int(11) DEFAULT 0 COMMENT 'number of claims made related to this issue',
5109 `routingnotes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes from the routing list',
5110 PRIMARY KEY (`serialid`),
5111 KEY `serial_ibfk_1` (`biblionumber`),
5112 KEY `serial_ibfk_2` (`subscriptionid`),
5113 CONSTRAINT `serial_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5114 CONSTRAINT `serial_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5115 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5116 /*!40101 SET character_set_client = @saved_cs_client */;
5119 -- Table structure for table `serialitems`
5122 DROP TABLE IF EXISTS `serialitems`;
5123 /*!40101 SET @saved_cs_client = @@character_set_client */;
5124 /*!40101 SET character_set_client = utf8 */;
5125 CREATE TABLE `serialitems` (
5126 `itemnumber` int(11) NOT NULL,
5127 `serialid` int(11) NOT NULL,
5128 PRIMARY KEY (`itemnumber`),
5129 KEY `serialitems_sfk_1` (`serialid`),
5130 CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE,
5131 CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
5132 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5133 /*!40101 SET character_set_client = @saved_cs_client */;
5136 -- Table structure for table `sessions`
5139 DROP TABLE IF EXISTS `sessions`;
5140 /*!40101 SET @saved_cs_client = @@character_set_client */;
5141 /*!40101 SET character_set_client = utf8 */;
5142 CREATE TABLE `sessions` (
5143 `id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
5144 `a_session` longblob NOT NULL,
5146 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5147 /*!40101 SET character_set_client = @saved_cs_client */;
5150 -- Table structure for table `sms_providers`
5153 DROP TABLE IF EXISTS `sms_providers`;
5154 /*!40101 SET @saved_cs_client = @@character_set_client */;
5155 /*!40101 SET character_set_client = utf8 */;
5156 CREATE TABLE `sms_providers` (
5157 `id` int(11) NOT NULL AUTO_INCREMENT,
5158 `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
5159 `domain` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
5161 UNIQUE KEY `name` (`name`(191))
5162 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5163 /*!40101 SET character_set_client = @saved_cs_client */;
5166 -- Table structure for table `smtp_servers`
5169 DROP TABLE IF EXISTS `smtp_servers`;
5170 /*!40101 SET @saved_cs_client = @@character_set_client */;
5171 /*!40101 SET character_set_client = utf8 */;
5172 CREATE TABLE `smtp_servers` (
5173 `id` int(11) NOT NULL AUTO_INCREMENT,
5174 `name` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL,
5175 `host` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'localhost',
5176 `port` int(11) NOT NULL DEFAULT 25,
5177 `timeout` int(11) NOT NULL DEFAULT 120,
5178 `ssl_mode` enum('disabled','ssl','starttls') COLLATE utf8mb4_unicode_ci NOT NULL,
5179 `user_name` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5180 `password` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5181 `debug` tinyint(1) NOT NULL DEFAULT 0,
5183 KEY `host_idx` (`host`)
5184 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5185 /*!40101 SET character_set_client = @saved_cs_client */;
5188 -- Table structure for table `social_data`
5191 DROP TABLE IF EXISTS `social_data`;
5192 /*!40101 SET @saved_cs_client = @@character_set_client */;
5193 /*!40101 SET character_set_client = utf8 */;
5194 CREATE TABLE `social_data` (
5195 `isbn` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
5196 `num_critics` int(11) DEFAULT NULL,
5197 `num_critics_pro` int(11) DEFAULT NULL,
5198 `num_quotations` int(11) DEFAULT NULL,
5199 `num_videos` int(11) DEFAULT NULL,
5200 `score_avg` decimal(5,2) DEFAULT NULL,
5201 `num_scores` int(11) DEFAULT NULL,
5202 PRIMARY KEY (`isbn`)
5203 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5204 /*!40101 SET character_set_client = @saved_cs_client */;
5207 -- Table structure for table `special_holidays`
5210 DROP TABLE IF EXISTS `special_holidays`;
5211 /*!40101 SET @saved_cs_client = @@character_set_client */;
5212 /*!40101 SET character_set_client = utf8 */;
5213 CREATE TABLE `special_holidays` (
5214 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5215 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'foreign key from the branches table, defines which branch this closing is for',
5216 `day` smallint(6) NOT NULL DEFAULT 0 COMMENT 'day of the month this closing is on',
5217 `month` smallint(6) NOT NULL DEFAULT 0 COMMENT 'month this closing is in',
5218 `year` smallint(6) NOT NULL DEFAULT 0 COMMENT 'year this closing is in',
5219 `isexception` smallint(1) NOT NULL DEFAULT 1 COMMENT 'is this a holiday exception to a repeatable holiday (1 for yes, 0 for no)',
5220 `title` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'title for this closing',
5221 `description` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'description of this closing',
5223 KEY `special_holidays_ibfk_1` (`branchcode`),
5224 CONSTRAINT `special_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5225 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5226 /*!40101 SET character_set_client = @saved_cs_client */;
5229 -- Table structure for table `statistics`
5232 DROP TABLE IF EXISTS `statistics`;
5233 /*!40101 SET @saved_cs_client = @@character_set_client */;
5234 /*!40101 SET character_set_client = utf8 */;
5235 CREATE TABLE `statistics` (
5236 `datetime` datetime DEFAULT NULL COMMENT 'date and time of the transaction',
5237 `branch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key, branch where the transaction occurred',
5238 `value` double(16,4) DEFAULT NULL COMMENT 'monetary value associated with the transaction',
5239 `type` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'transaction type (localuse, issue, return, renew, writeoff, payment)',
5240 `other` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used by SIP',
5241 `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific item',
5242 `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the itemtypes table, links transaction to a specific item type',
5243 `location` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'authorized value for the shelving location for this item (MARC21 952$c)',
5244 `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower',
5245 `ccode` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific collection code',
5246 `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower category',
5247 KEY `timeidx` (`datetime`),
5248 KEY `branch_idx` (`branch`),
5249 KEY `type_idx` (`type`),
5250 KEY `itemnumber_idx` (`itemnumber`),
5251 KEY `itemtype_idx` (`itemtype`),
5252 KEY `borrowernumber_idx` (`borrowernumber`),
5253 KEY `ccode_idx` (`ccode`)
5254 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5255 /*!40101 SET character_set_client = @saved_cs_client */;
5258 -- Table structure for table `stockrotationitems`
5261 DROP TABLE IF EXISTS `stockrotationitems`;
5262 /*!40101 SET @saved_cs_client = @@character_set_client */;
5263 /*!40101 SET character_set_client = utf8 */;
5264 CREATE TABLE `stockrotationitems` (
5265 `itemnumber_id` int(11) NOT NULL COMMENT 'Itemnumber to link to a stage & rota',
5266 `stage_id` int(11) NOT NULL COMMENT 'stage ID to link the item to',
5267 `indemand` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should this item be skipped for rotation?',
5268 `fresh` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Flag showing item is only just added to rota',
5269 PRIMARY KEY (`itemnumber_id`),
5270 KEY `stockrotationitems_sifk` (`stage_id`),
5271 CONSTRAINT `stockrotationitems_iifk` FOREIGN KEY (`itemnumber_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5272 CONSTRAINT `stockrotationitems_sifk` FOREIGN KEY (`stage_id`) REFERENCES `stockrotationstages` (`stage_id`) ON DELETE CASCADE ON UPDATE CASCADE
5273 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5274 /*!40101 SET character_set_client = @saved_cs_client */;
5277 -- Table structure for table `stockrotationrotas`
5280 DROP TABLE IF EXISTS `stockrotationrotas`;
5281 /*!40101 SET @saved_cs_client = @@character_set_client */;
5282 /*!40101 SET character_set_client = utf8 */;
5283 CREATE TABLE `stockrotationrotas` (
5284 `rota_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Stockrotation rota ID',
5285 `title` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Title for this rota',
5286 `description` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Description for this rota',
5287 `cyclical` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should items on this rota keep cycling?',
5288 `active` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this rota currently active?',
5289 PRIMARY KEY (`rota_id`),
5290 UNIQUE KEY `stockrotationrotas_title` (`title`)
5291 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5292 /*!40101 SET character_set_client = @saved_cs_client */;
5295 -- Table structure for table `stockrotationstages`
5298 DROP TABLE IF EXISTS `stockrotationstages`;
5299 /*!40101 SET @saved_cs_client = @@character_set_client */;
5300 /*!40101 SET character_set_client = utf8 */;
5301 CREATE TABLE `stockrotationstages` (
5302 `stage_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique stage ID',
5303 `position` int(11) NOT NULL COMMENT 'The position of this stage within its rota',
5304 `rota_id` int(11) NOT NULL COMMENT 'The rota this stage belongs to',
5305 `branchcode_id` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Branch this stage relates to',
5306 `duration` int(11) NOT NULL DEFAULT 4 COMMENT 'The number of days items shoud occupy this stage',
5307 PRIMARY KEY (`stage_id`),
5308 KEY `stockrotationstages_rifk` (`rota_id`),
5309 KEY `stockrotationstages_bifk` (`branchcode_id`),
5310 CONSTRAINT `stockrotationstages_bifk` FOREIGN KEY (`branchcode_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5311 CONSTRAINT `stockrotationstages_rifk` FOREIGN KEY (`rota_id`) REFERENCES `stockrotationrotas` (`rota_id`) ON DELETE CASCADE ON UPDATE CASCADE
5312 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5313 /*!40101 SET character_set_client = @saved_cs_client */;
5316 -- Table structure for table `subscription`
5319 DROP TABLE IF EXISTS `subscription`;
5320 /*!40101 SET @saved_cs_client = @@character_set_client */;
5321 /*!40101 SET character_set_client = utf8 */;
5322 CREATE TABLE `subscription` (
5323 `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
5324 `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
5325 `librarian` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'the librarian''s username from borrowers.userid',
5326 `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
5327 `aqbooksellerid` int(11) DEFAULT 0 COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
5328 `cost` int(11) DEFAULT 0,
5329 `aqbudgetid` int(11) DEFAULT 0,
5330 `weeklength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or numberlength is set)',
5331 `monthlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if weeklength or numberlength is set)',
5332 `numberlength` int(11) DEFAULT 0 COMMENT 'subscription length in weeks (will not be filled in if monthlength or weeklength is set)',
5333 `periodicity` int(11) DEFAULT NULL COMMENT 'frequency type links to subscription_frequencies.id',
5334 `countissuesperunit` int(11) NOT NULL DEFAULT 1,
5335 `notes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes',
5336 `status` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'status of this subscription',
5337 `lastvalue1` int(11) DEFAULT NULL,
5338 `innerloop1` int(11) DEFAULT 0,
5339 `lastvalue2` int(11) DEFAULT NULL,
5340 `innerloop2` int(11) DEFAULT 0,
5341 `lastvalue3` int(11) DEFAULT NULL,
5342 `innerloop3` int(11) DEFAULT 0,
5343 `firstacquidate` date DEFAULT NULL COMMENT 'first issue received date',
5344 `manualhistory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes or no to managing the history manually',
5345 `irregularity` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any irregularities in the subscription',
5346 `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
5347 `letter` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5348 `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
5349 `locale` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
5350 `distributedto` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5351 `internalnotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5352 `callnumber` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'default call number',
5353 `location` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'default shelving location (items.location)',
5354 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'default branches (items.homebranch)',
5355 `lastbranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5356 `serialsadditems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'does receiving this serial create an item record',
5357 `staffdisplaycount` INT(11) NULL DEFAULT NULL COMMENT 'how many issues to show to the staff',
5358 `opacdisplaycount` INT(11) NULL DEFAULT NULL COMMENT 'how many issues to show to the public',
5359 `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
5360 `enddate` date DEFAULT NULL COMMENT 'subscription end date',
5361 `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
5362 `reneweddate` date DEFAULT NULL COMMENT 'date of last renewal for the subscription',
5363 `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5364 `previousitemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5365 `mana_id` int(11) DEFAULT NULL,
5366 `ccode` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'collection code to assign to serial items',
5367 PRIMARY KEY (`subscriptionid`),
5368 KEY `subscription_ibfk_1` (`periodicity`),
5369 KEY `subscription_ibfk_2` (`numberpattern`),
5370 KEY `subscription_ibfk_3` (`biblionumber`),
5371 CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5372 CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5373 CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5374 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5375 /*!40101 SET character_set_client = @saved_cs_client */;
5378 -- Table structure for table `subscription_frequencies`
5381 DROP TABLE IF EXISTS `subscription_frequencies`;
5382 /*!40101 SET @saved_cs_client = @@character_set_client */;
5383 /*!40101 SET character_set_client = utf8 */;
5384 CREATE TABLE `subscription_frequencies` (
5385 `id` int(11) NOT NULL AUTO_INCREMENT,
5386 `description` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
5387 `displayorder` int(11) DEFAULT NULL,
5388 `unit` enum('day','week','month','year') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5389 `unitsperissue` int(11) NOT NULL DEFAULT 1,
5390 `issuesperunit` int(11) NOT NULL DEFAULT 1,
5392 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5393 /*!40101 SET character_set_client = @saved_cs_client */;
5396 -- Table structure for table `subscription_numberpatterns`
5399 DROP TABLE IF EXISTS `subscription_numberpatterns`;
5400 /*!40101 SET @saved_cs_client = @@character_set_client */;
5401 /*!40101 SET character_set_client = utf8 */;
5402 CREATE TABLE `subscription_numberpatterns` (
5403 `id` int(11) NOT NULL AUTO_INCREMENT,
5404 `label` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
5405 `displayorder` int(11) DEFAULT NULL,
5406 `description` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
5407 `numberingmethod` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
5408 `label1` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5409 `add1` int(11) DEFAULT NULL,
5410 `every1` int(11) DEFAULT NULL,
5411 `whenmorethan1` int(11) DEFAULT NULL,
5412 `setto1` int(11) DEFAULT NULL,
5413 `numbering1` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5414 `label2` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5415 `add2` int(11) DEFAULT NULL,
5416 `every2` int(11) DEFAULT NULL,
5417 `whenmorethan2` int(11) DEFAULT NULL,
5418 `setto2` int(11) DEFAULT NULL,
5419 `numbering2` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5420 `label3` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5421 `add3` int(11) DEFAULT NULL,
5422 `every3` int(11) DEFAULT NULL,
5423 `whenmorethan3` int(11) DEFAULT NULL,
5424 `setto3` int(11) DEFAULT NULL,
5425 `numbering3` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5427 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5428 /*!40101 SET character_set_client = @saved_cs_client */;
5431 -- Table structure for table `subscriptionhistory`
5434 DROP TABLE IF EXISTS `subscriptionhistory`;
5435 /*!40101 SET @saved_cs_client = @@character_set_client */;
5436 /*!40101 SET character_set_client = utf8 */;
5437 CREATE TABLE `subscriptionhistory` (
5438 `biblionumber` int(11) NOT NULL,
5439 `subscriptionid` int(11) NOT NULL,
5440 `histstartdate` date DEFAULT NULL,
5441 `histenddate` date DEFAULT NULL,
5442 `missinglist` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
5443 `recievedlist` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
5444 `opacnote` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5445 `librariannote` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5446 PRIMARY KEY (`subscriptionid`),
5447 KEY `subscription_history_ibfk_1` (`biblionumber`),
5448 CONSTRAINT `subscription_history_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5449 CONSTRAINT `subscription_history_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5450 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5451 /*!40101 SET character_set_client = @saved_cs_client */;
5454 -- Table structure for table `subscriptionroutinglist`
5457 DROP TABLE IF EXISTS `subscriptionroutinglist`;
5458 /*!40101 SET @saved_cs_client = @@character_set_client */;
5459 /*!40101 SET character_set_client = utf8 */;
5460 CREATE TABLE `subscriptionroutinglist` (
5461 `routingid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5462 `borrowernumber` int(11) NOT NULL COMMENT 'foreign key from the borrowers table, defines with patron is on the routing list',
5463 `ranking` int(11) DEFAULT NULL COMMENT 'where the patron stands in line to receive the serial',
5464 `subscriptionid` int(11) NOT NULL COMMENT 'foreign key from the subscription table, defines which subscription this routing list is for',
5465 PRIMARY KEY (`routingid`),
5466 UNIQUE KEY `subscriptionid` (`subscriptionid`,`borrowernumber`),
5467 KEY `subscriptionroutinglist_ibfk_1` (`borrowernumber`),
5468 CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5469 CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
5470 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5471 /*!40101 SET character_set_client = @saved_cs_client */;
5474 -- Table structure for table `suggestions`
5477 DROP TABLE IF EXISTS `suggestions`;
5478 /*!40101 SET @saved_cs_client = @@character_set_client */;
5479 /*!40101 SET character_set_client = utf8 */;
5480 CREATE TABLE `suggestions` (
5481 `suggestionid` int(8) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned automatically by Koha',
5482 `suggestedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the person making the suggestion, foreign key linking to the borrowers table',
5483 `suggesteddate` date NOT NULL COMMENT 'date the suggestion was submitted',
5484 `managedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian managing the suggestion, foreign key linking to the borrowers table',
5485 `manageddate` date DEFAULT NULL COMMENT 'date the suggestion was updated',
5486 `acceptedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who accepted the suggestion, foreign key linking to the borrowers table',
5487 `accepteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as accepted',
5488 `rejectedby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table',
5489 `rejecteddate` date DEFAULT NULL COMMENT 'date the suggestion was marked as rejected',
5490 `lastmodificationby` int(11) DEFAULT NULL COMMENT 'borrowernumber for the librarian who edit the suggestion for the last time',
5491 `lastmodificationdate` date DEFAULT NULL COMMENT 'date of the last modification',
5492 `STATUS` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'suggestion status (ASKED, CHECKED, ACCEPTED, REJECTED, ORDERED, AVAILABLE or a value from the SUGGEST_STATUS authorised value category)',
5493 `archived` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the suggestion archived?',
5494 `note` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'note entered on the suggestion',
5495 `staff_note` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'non-public note entered on the suggestion',
5496 `author` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'author of the suggested item',
5497 `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'title of the suggested item',
5498 `copyrightdate` smallint(6) DEFAULT NULL COMMENT 'copyright date of the suggested item',
5499 `publishercode` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'publisher of the suggested item',
5500 `date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the suggestion was updated',
5501 `volumedesc` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5502 `publicationyear` smallint(6) DEFAULT 0,
5503 `place` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'publication place of the suggested item',
5504 `isbn` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'isbn of the suggested item',
5505 `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggestion to the biblio table after the suggestion has been ordered',
5506 `reason` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'reason for accepting or rejecting the suggestion',
5507 `patronreason` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'reason for making the suggestion',
5508 `budgetid` int(11) DEFAULT NULL COMMENT 'foreign key linking the suggested budget to the aqbudgets table',
5509 `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key linking the suggested branch to the branches table',
5510 `collectiontitle` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'collection name for the suggested item',
5511 `itemtype` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'suggested item type',
5512 `quantity` smallint(6) DEFAULT NULL COMMENT 'suggested quantity to be purchased',
5513 `currency` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'suggested currency for the suggested price',
5514 `price` decimal(28,6) DEFAULT NULL COMMENT 'suggested price',
5515 `total` decimal(28,6) DEFAULT NULL COMMENT 'suggested total cost (price*quantity updated for currency)',
5516 PRIMARY KEY (`suggestionid`),
5517 KEY `suggestedby` (`suggestedby`),
5518 KEY `managedby` (`managedby`),
5519 KEY `acceptedby` (`acceptedby`),
5520 KEY `rejectedby` (`rejectedby`),
5521 KEY `biblionumber` (`biblionumber`),
5522 KEY `budgetid` (`budgetid`),
5523 KEY `branchcode` (`branchcode`),
5524 KEY `status` (`STATUS`),
5525 KEY `suggestions_ibfk_lastmodificationby` (`lastmodificationby`),
5526 CONSTRAINT `suggestions_budget_id_fk` FOREIGN KEY (`budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
5527 CONSTRAINT `suggestions_ibfk_acceptedby` FOREIGN KEY (`acceptedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5528 CONSTRAINT `suggestions_ibfk_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5529 CONSTRAINT `suggestions_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
5530 CONSTRAINT `suggestions_ibfk_lastmodificationby` FOREIGN KEY (`lastmodificationby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5531 CONSTRAINT `suggestions_ibfk_managedby` FOREIGN KEY (`managedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5532 CONSTRAINT `suggestions_ibfk_rejectedby` FOREIGN KEY (`rejectedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
5533 CONSTRAINT `suggestions_ibfk_suggestedby` FOREIGN KEY (`suggestedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5534 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5535 /*!40101 SET character_set_client = @saved_cs_client */;
5538 -- Table structure for table `systempreferences`
5541 DROP TABLE IF EXISTS `systempreferences`;
5542 /*!40101 SET @saved_cs_client = @@character_set_client */;
5543 /*!40101 SET character_set_client = utf8 */;
5544 CREATE TABLE `systempreferences` (
5545 `variable` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'system preference name',
5546 `value` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'system preference values',
5547 `options` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'options for multiple choice system preferences',
5548 `explanation` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'descriptive text for the system preference',
5549 `type` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'type of question this preference asks (multiple choice, plain text, yes or no, etc)',
5550 PRIMARY KEY (`variable`)
5551 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5552 /*!40101 SET character_set_client = @saved_cs_client */;
5555 -- Table structure for table `tables_settings`
5558 DROP TABLE IF EXISTS `tables_settings`;
5559 /*!40101 SET @saved_cs_client = @@character_set_client */;
5560 /*!40101 SET character_set_client = utf8 */;
5561 CREATE TABLE `tables_settings` (
5562 `module` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
5563 `page` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
5564 `tablename` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
5565 `default_display_length` smallint(6) DEFAULT NULL,
5566 `default_sort_order` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5567 PRIMARY KEY (`module`(191),`page`(191),`tablename`(191))
5568 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5569 /*!40101 SET character_set_client = @saved_cs_client */;
5572 -- Table structure for table `tags`
5575 DROP TABLE IF EXISTS `tags`;
5576 /*!40101 SET @saved_cs_client = @@character_set_client */;
5577 /*!40101 SET character_set_client = utf8 */;
5578 CREATE TABLE `tags` (
5579 `entry` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
5580 `weight` bigint(20) NOT NULL DEFAULT 0,
5581 PRIMARY KEY (`entry`(191))
5582 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5583 /*!40101 SET character_set_client = @saved_cs_client */;
5586 -- Table structure for table `tags_all`
5589 DROP TABLE IF EXISTS `tags_all`;
5590 /*!40101 SET @saved_cs_client = @@character_set_client */;
5591 /*!40101 SET character_set_client = utf8 */;
5592 CREATE TABLE `tags_all` (
5593 `tag_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id and primary key',
5594 `borrowernumber` int(11) DEFAULT NULL COMMENT 'the patron who added the tag (borrowers.borrowernumber)',
5595 `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was left on (biblio.biblionumber)',
5596 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5597 `language` int(4) DEFAULT NULL COMMENT 'the language the tag was left in',
5598 `date_created` datetime NOT NULL COMMENT 'the date the tag was added',
5599 PRIMARY KEY (`tag_id`),
5600 KEY `tags_borrowers_fk_1` (`borrowernumber`),
5601 KEY `tags_biblionumber_fk_1` (`biblionumber`),
5602 CONSTRAINT `tags_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5603 CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5604 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5605 /*!40101 SET character_set_client = @saved_cs_client */;
5608 -- Table structure for table `tags_approval`
5611 DROP TABLE IF EXISTS `tags_approval`;
5612 /*!40101 SET @saved_cs_client = @@character_set_client */;
5613 /*!40101 SET character_set_client = utf8 */;
5614 CREATE TABLE `tags_approval` (
5615 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5616 `approved` int(1) NOT NULL DEFAULT 0 COMMENT 'whether the tag is approved or not (1=yes, 0=pending, -1=rejected)',
5617 `date_approved` datetime DEFAULT NULL COMMENT 'the date this tag was approved',
5618 `approved_by` int(11) DEFAULT NULL COMMENT 'the librarian who approved the tag (borrowers.borrowernumber)',
5619 `weight_total` int(9) NOT NULL DEFAULT 1 COMMENT 'the total number of times this tag was used',
5620 PRIMARY KEY (`term`),
5621 KEY `tags_approval_borrowers_fk_1` (`approved_by`),
5622 CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL 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 `tags_index`
5630 DROP TABLE IF EXISTS `tags_index`;
5631 /*!40101 SET @saved_cs_client = @@character_set_client */;
5632 /*!40101 SET character_set_client = utf8 */;
5633 CREATE TABLE `tags_index` (
5634 `term` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'the tag',
5635 `biblionumber` int(11) NOT NULL COMMENT 'the bib record this tag was used on (biblio.biblionumber)',
5636 `weight` int(9) NOT NULL DEFAULT 1 COMMENT 'the number of times this term was used on this bib record',
5637 PRIMARY KEY (`term`,`biblionumber`),
5638 KEY `tags_index_biblionumber_fk_1` (`biblionumber`),
5639 CONSTRAINT `tags_index_biblionumber_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5640 CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`) REFERENCES `tags_approval` (`term`) ON DELETE CASCADE ON UPDATE CASCADE
5641 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5642 /*!40101 SET character_set_client = @saved_cs_client */;
5645 -- Table structure for table `tmp_holdsqueue`
5648 DROP TABLE IF EXISTS `tmp_holdsqueue`;
5649 /*!40101 SET @saved_cs_client = @@character_set_client */;
5650 /*!40101 SET character_set_client = utf8 */;
5651 CREATE TABLE `tmp_holdsqueue` (
5652 `biblionumber` int(11) DEFAULT NULL,
5653 `itemnumber` int(11) DEFAULT NULL,
5654 `barcode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5655 `surname` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
5656 `firstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5657 `phone` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5658 `borrowernumber` int(11) NOT NULL,
5659 `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5660 `reservedate` date DEFAULT NULL,
5661 `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5662 `itemcallnumber` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5663 `holdingbranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5664 `pickbranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5665 `notes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5666 `item_level_request` tinyint(4) NOT NULL DEFAULT 0,
5667 `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this entry as added/last updated',
5668 KEY `tmp_holdsqueue_ibfk_1` (`itemnumber`),
5669 KEY `tmp_holdsqueue_ibfk_2` (`biblionumber`),
5670 KEY `tmp_holdsqueue_ibfk_3` (`borrowernumber`),
5671 CONSTRAINT `tmp_holdsqueue_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5672 CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5673 CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
5674 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5675 /*!40101 SET character_set_client = @saved_cs_client */;
5678 -- Table structure for table `transport_cost`
5681 DROP TABLE IF EXISTS `transport_cost`;
5682 /*!40101 SET @saved_cs_client = @@character_set_client */;
5683 /*!40101 SET character_set_client = utf8 */;
5684 CREATE TABLE `transport_cost` (
5685 `frombranch` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
5686 `tobranch` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
5687 `cost` decimal(6,2) NOT NULL,
5688 `disable_transfer` tinyint(1) NOT NULL DEFAULT 0,
5689 PRIMARY KEY (`frombranch`,`tobranch`),
5690 KEY `transport_cost_ibfk_2` (`tobranch`),
5691 CONSTRAINT `transport_cost_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
5692 CONSTRAINT `transport_cost_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
5693 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5694 /*!40101 SET character_set_client = @saved_cs_client */;
5697 -- Table structure for table `uploaded_files`
5700 DROP TABLE IF EXISTS `uploaded_files`;
5701 /*!40101 SET @saved_cs_client = @@character_set_client */;
5702 /*!40101 SET character_set_client = utf8 */;
5703 CREATE TABLE `uploaded_files` (
5704 `id` int(11) NOT NULL AUTO_INCREMENT,
5705 `hashvalue` char(40) COLLATE utf8mb4_unicode_ci NOT NULL,
5706 `filename` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
5707 `dir` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
5708 `filesize` int(11) DEFAULT NULL,
5709 `dtcreated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
5710 `uploadcategorycode` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5711 `owner` int(11) DEFAULT NULL,
5712 `public` tinyint(4) DEFAULT NULL,
5713 `permanent` tinyint(4) DEFAULT NULL,
5715 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5716 /*!40101 SET character_set_client = @saved_cs_client */;
5719 -- Table structure for table `user_permissions`
5722 DROP TABLE IF EXISTS `user_permissions`;
5723 /*!40101 SET @saved_cs_client = @@character_set_client */;
5724 /*!40101 SET character_set_client = utf8 */;
5725 CREATE TABLE `user_permissions` (
5726 `borrowernumber` int(11) NOT NULL DEFAULT 0,
5727 `module_bit` int(11) NOT NULL DEFAULT 0,
5728 `code` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
5729 PRIMARY KEY (`borrowernumber`,`module_bit`,`code`),
5730 KEY `user_permissions_ibfk_1` (`borrowernumber`),
5731 KEY `user_permissions_ibfk_2` (`module_bit`,`code`),
5732 CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5733 CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`) ON DELETE CASCADE ON UPDATE CASCADE
5734 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5735 /*!40101 SET character_set_client = @saved_cs_client */;
5738 -- Table structure for table `userflags`
5741 DROP TABLE IF EXISTS `userflags`;
5742 /*!40101 SET @saved_cs_client = @@character_set_client */;
5743 /*!40101 SET character_set_client = utf8 */;
5744 CREATE TABLE `userflags` (
5745 `bit` int(11) NOT NULL DEFAULT 0,
5746 `flag` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5747 `flagdesc` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5748 `defaulton` int(11) DEFAULT NULL,
5750 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5751 /*!40101 SET character_set_client = @saved_cs_client */;
5754 -- Table structure for table `vendor_edi_accounts`
5757 DROP TABLE IF EXISTS `vendor_edi_accounts`;
5758 /*!40101 SET @saved_cs_client = @@character_set_client */;
5759 /*!40101 SET character_set_client = utf8 */;
5760 CREATE TABLE `vendor_edi_accounts` (
5761 `id` int(11) NOT NULL AUTO_INCREMENT,
5762 `description` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
5763 `host` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5764 `username` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5765 `password` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5766 `last_activity` date DEFAULT NULL,
5767 `vendor_id` int(11) DEFAULT NULL,
5768 `download_directory` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5769 `upload_directory` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5770 `san` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5771 `standard` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT 'EUR',
5772 `id_code_qualifier` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT '14',
5773 `transport` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT 'FTP',
5774 `quotes_enabled` tinyint(1) NOT NULL DEFAULT 0,
5775 `invoices_enabled` tinyint(1) NOT NULL DEFAULT 0,
5776 `orders_enabled` tinyint(1) NOT NULL DEFAULT 0,
5777 `responses_enabled` tinyint(1) NOT NULL DEFAULT 0,
5778 `auto_orders` tinyint(1) NOT NULL DEFAULT 0,
5779 `shipment_budget` int(11) DEFAULT NULL,
5780 `plugin` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
5782 KEY `vendorid` (`vendor_id`),
5783 KEY `shipmentbudget` (`shipment_budget`),
5784 CONSTRAINT `vfk_shipment_budget` FOREIGN KEY (`shipment_budget`) REFERENCES `aqbudgets` (`budget_id`),
5785 CONSTRAINT `vfk_vendor_id` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`)
5786 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5787 /*!40101 SET character_set_client = @saved_cs_client */;
5790 -- Table structure for table `virtualshelfcontents`
5793 DROP TABLE IF EXISTS `virtualshelfcontents`;
5794 /*!40101 SET @saved_cs_client = @@character_set_client */;
5795 /*!40101 SET character_set_client = utf8 */;
5796 CREATE TABLE `virtualshelfcontents` (
5797 `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',
5798 `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',
5799 `flags` int(11) DEFAULT NULL,
5800 `dateadded` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this bib record was added to the list',
5801 `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)',
5802 KEY `shelfnumber` (`shelfnumber`),
5803 KEY `biblionumber` (`biblionumber`),
5804 KEY `shelfcontents_ibfk_3` (`borrowernumber`),
5805 CONSTRAINT `shelfcontents_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5806 CONSTRAINT `shelfcontents_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
5807 CONSTRAINT `virtualshelfcontents_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE
5808 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5809 /*!40101 SET character_set_client = @saved_cs_client */;
5812 -- Table structure for table `virtualshelfshares`
5815 DROP TABLE IF EXISTS `virtualshelfshares`;
5816 /*!40101 SET @saved_cs_client = @@character_set_client */;
5817 /*!40101 SET character_set_client = utf8 */;
5818 CREATE TABLE `virtualshelfshares` (
5819 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key',
5820 `shelfnumber` int(11) NOT NULL COMMENT 'foreign key for virtualshelves',
5821 `borrowernumber` int(11) DEFAULT NULL COMMENT 'borrower that accepted access to this list',
5822 `invitekey` varchar(10) COLLATE utf8mb4_unicode_ci 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',
5823 `sharedate` datetime DEFAULT NULL COMMENT 'date of invitation or acceptance of invitation',
5825 KEY `virtualshelfshares_ibfk_1` (`shelfnumber`),
5826 KEY `virtualshelfshares_ibfk_2` (`borrowernumber`),
5827 CONSTRAINT `virtualshelfshares_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5828 CONSTRAINT `virtualshelfshares_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
5829 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5830 /*!40101 SET character_set_client = @saved_cs_client */;
5833 -- Table structure for table `virtualshelves`
5836 DROP TABLE IF EXISTS `virtualshelves`;
5837 /*!40101 SET @saved_cs_client = @@character_set_client */;
5838 /*!40101 SET character_set_client = utf8 */;
5839 CREATE TABLE `virtualshelves` (
5840 `shelfnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5841 `shelfname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'name of the list',
5842 `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)',
5843 `public` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If the list is public',
5844 `sortfield` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT 'title' COMMENT 'the field this list is sorted on',
5845 `lastmodified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the list was last modified',
5846 `created_on` datetime NOT NULL COMMENT 'creation time',
5847 `allow_change_from_owner` tinyint(1) DEFAULT 1 COMMENT 'can owner change contents?',
5848 `allow_change_from_others` tinyint(1) DEFAULT 0 COMMENT 'can others change contents?',
5849 `allow_change_from_staff` tinyint(1) DEFAULT 0 COMMENT 'can staff change contents?',
5850 PRIMARY KEY (`shelfnumber`),
5851 KEY `virtualshelves_ibfk_1` (`owner`),
5852 CONSTRAINT `virtualshelves_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL
5853 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5854 /*!40101 SET character_set_client = @saved_cs_client */;
5857 -- Table structure for table `z3950servers`
5860 DROP TABLE IF EXISTS `z3950servers`;
5861 /*!40101 SET @saved_cs_client = @@character_set_client */;
5862 /*!40101 SET character_set_client = utf8 */;
5863 CREATE TABLE `z3950servers` (
5864 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
5865 `host` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'target''s host name',
5866 `port` int(11) DEFAULT NULL COMMENT 'port number used to connect to target',
5867 `db` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'target''s database name',
5868 `userid` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'username needed to log in to target',
5869 `password` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'password needed to log in to target',
5870 `servername` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'name given to the target by the library',
5871 `checked` smallint(6) DEFAULT NULL COMMENT 'whether this target is checked by default (1 for yes, 0 for no)',
5872 `rank` int(11) DEFAULT NULL COMMENT 'where this target appears in the list of targets',
5873 `syntax` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'MARC format provided by this target',
5874 `timeout` int(11) NOT NULL DEFAULT 0 COMMENT 'number of seconds before Koha stops trying to access this server',
5875 `servertype` enum('zed','sru') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'zed' COMMENT 'zed means z39.50 server',
5876 `encoding` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'characters encoding provided by this target',
5877 `recordtype` enum('authority','biblio') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'biblio' COMMENT 'server contains bibliographic or authority records',
5878 `sru_options` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'options like sru=get, sru_version=1.1; will be passed to the server via ZOOM',
5879 `sru_fields` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'contains the mapping between the Z3950 search fields and the specific SRU server indexes',
5880 `add_xslt` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'zero or more paths to XSLT files to be processed on the search results',
5881 `attributes` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'additional attributes passed to PQF queries',
5883 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5884 /*!40101 SET character_set_client = @saved_cs_client */;
5887 -- Table structure for table `zebraqueue`
5890 DROP TABLE IF EXISTS `zebraqueue`;
5891 /*!40101 SET @saved_cs_client = @@character_set_client */;
5892 /*!40101 SET character_set_client = utf8 */;
5893 CREATE TABLE `zebraqueue` (
5894 `id` int(11) NOT NULL AUTO_INCREMENT,
5895 `biblio_auth_number` bigint(20) unsigned NOT NULL DEFAULT 0,
5896 `operation` char(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
5897 `server` char(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
5898 `done` int(11) NOT NULL DEFAULT 0,
5899 `time` timestamp NOT NULL DEFAULT current_timestamp(),
5901 KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
5902 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5903 /*!40101 SET character_set_client = @saved_cs_client */;
5904 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
5906 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
5907 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
5908 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
5909 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
5910 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
5911 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
5912 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
5914 -- Dump completed on 2022-05-26 2:46:01