3 -- Host: localhost Database: koha30test
4 -- ------------------------------------------------------
5 -- Server version 4.1.22
7 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
11 /*!40101 SET NAMES utf8 */;
12 /*!40103 SET TIME_ZONE='+00:00' */;
13 /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
19 -- Table structure for table `auth_header`
22 DROP TABLE IF EXISTS `auth_header`;
23 CREATE TABLE `auth_header` (
24 `authid` bigint(20) unsigned NOT NULL auto_increment,
25 `authtypecode` varchar(10) NOT NULL default '',
26 `datecreated` date default NULL,
27 `datemodified` date default NULL,
28 `origincode` varchar(20) default NULL,
29 `authtrees` mediumtext,
31 `linkid` bigint(20) default NULL,
32 `marcxml` longtext NOT NULL,
33 PRIMARY KEY (`authid`),
34 KEY `origincode` (`origincode`)
35 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
38 -- Table structure for table `auth_subfield_structure`
41 DROP TABLE IF EXISTS `auth_subfield_structure`;
42 CREATE TABLE `auth_subfield_structure` (
43 `authtypecode` varchar(10) NOT NULL default '',
44 `tagfield` varchar(3) NOT NULL default '',
45 `tagsubfield` varchar(1) NOT NULL default '',
46 `liblibrarian` varchar(255) NOT NULL default '',
47 `libopac` varchar(255) NOT NULL default '',
48 `repeatable` tinyint(4) NOT NULL default 0,
49 `mandatory` tinyint(4) NOT NULL default 0,
50 `tab` tinyint(1) default NULL,
51 `authorised_value` varchar(10) default NULL,
52 `value_builder` varchar(80) default NULL,
53 `seealso` varchar(255) default NULL,
54 `isurl` tinyint(1) default NULL,
55 `hidden` tinyint(3) NOT NULL default 0,
56 `linkid` tinyint(1) NOT NULL default 0,
57 `kohafield` varchar(45) NULL default '',
58 `frameworkcode` varchar(10) NOT NULL default '',
59 PRIMARY KEY (`authtypecode`,`tagfield`,`tagsubfield`),
60 KEY `tab` (`authtypecode`,`tab`)
61 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
64 -- Table structure for table `auth_tag_structure`
67 DROP TABLE IF EXISTS `auth_tag_structure`;
68 CREATE TABLE `auth_tag_structure` (
69 `authtypecode` varchar(10) NOT NULL default '',
70 `tagfield` varchar(3) NOT NULL default '',
71 `liblibrarian` varchar(255) NOT NULL default '',
72 `libopac` varchar(255) NOT NULL default '',
73 `repeatable` tinyint(4) NOT NULL default 0,
74 `mandatory` tinyint(4) NOT NULL default 0,
75 `authorised_value` varchar(10) default NULL,
76 PRIMARY KEY (`authtypecode`,`tagfield`),
77 CONSTRAINT `auth_tag_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
78 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
81 -- Table structure for table `auth_types`
84 DROP TABLE IF EXISTS `auth_types`;
85 CREATE TABLE `auth_types` (
86 `authtypecode` varchar(10) NOT NULL default '',
87 `authtypetext` varchar(255) NOT NULL default '',
88 `auth_tag_to_report` varchar(3) NOT NULL default '',
89 `summary` mediumtext NOT NULL,
90 PRIMARY KEY (`authtypecode`)
91 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
94 -- Table structure for table `authorised_values`
97 DROP TABLE IF EXISTS `authorised_values`;
98 CREATE TABLE `authorised_values` ( -- stores values for authorized values categories and values
99 `id` int(11) NOT NULL auto_increment, -- unique key, used to identify the authorized value
100 `category` varchar(10) NOT NULL default '', -- key used to identify the authorized value category
101 `authorised_value` varchar(80) NOT NULL default '', -- code use to identify the authorized value
102 `lib` varchar(80) default NULL, -- authorized value description as printed in the staff client
103 `lib_opac` VARCHAR(80) default NULL, -- authorized value description as printed in the OPAC
104 `imageurl` varchar(200) default NULL, -- authorized value URL
106 KEY `name` (`category`),
108 KEY `auth_value_idx` (`authorised_value`)
109 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
112 -- Table structure for table `biblio`
115 DROP TABLE IF EXISTS `biblio`;
116 CREATE TABLE `biblio` ( -- table that stores bibliographic information
117 `biblionumber` int(11) NOT NULL auto_increment, -- unique identifier assigned to each bibliographic record
118 `frameworkcode` varchar(4) NOT NULL default '', -- foriegn key from the biblio_framework table to identify which framework was used in cataloging this record
119 `author` mediumtext, -- statement of responsibility from MARC record (100 in MARC21)
120 `title` mediumtext, -- title (without the subtitle) from the MARC record (245 in MARC21)
121 `unititle` mediumtext, -- uniform title (without the subtitle) from the MARC record (240 in MARC21)
122 `notes` mediumtext, -- values from the general notes field in the MARC record (500 in MARC21) split by bar (|)
123 `serial` tinyint(1) default NULL, -- foreign key, linking to the subscriptionid in the serial table
124 `seriestitle` mediumtext,
125 `copyrightdate` smallint(6) default NULL, -- publication or copyright date from the MARC record
126 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
127 `datecreated` DATE NOT NULL, -- the date this record was added to Koha
128 `abstract` mediumtext, -- summary from the MARC record (520 in MARC21)
129 PRIMARY KEY (`biblionumber`),
130 KEY `blbnoidx` (`biblionumber`)
131 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
134 -- Table structure for table `biblio_framework`
137 DROP TABLE IF EXISTS `biblio_framework`;
138 CREATE TABLE `biblio_framework` (
139 `frameworkcode` varchar(4) NOT NULL default '',
140 `frameworktext` varchar(255) NOT NULL default '',
141 PRIMARY KEY (`frameworkcode`)
142 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
145 -- Table structure for table `biblioitems`
148 DROP TABLE IF EXISTS `biblioitems`;
149 CREATE TABLE `biblioitems` (
150 `biblioitemnumber` int(11) NOT NULL auto_increment,
151 `biblionumber` int(11) NOT NULL default 0,
154 `itemtype` varchar(10) default NULL,
155 `isbn` varchar(30) default NULL,
156 `issn` varchar(9) default NULL,
157 `publicationyear` text,
158 `publishercode` varchar(255) default NULL,
159 `volumedate` date default NULL,
161 `collectiontitle` mediumtext default NULL,
162 `collectionissn` text default NULL,
163 `collectionvolume` mediumtext default NULL,
164 `editionstatement` text default NULL,
165 `editionresponsibility` text default NULL,
166 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
167 `illus` varchar(255) default NULL,
168 `pages` varchar(255) default NULL,
170 `size` varchar(255) default NULL,
171 `place` varchar(255) default NULL,
172 `lccn` varchar(25) default NULL,
174 `url` varchar(255) default NULL,
175 `cn_source` varchar(10) default NULL,
176 `cn_class` varchar(30) default NULL,
177 `cn_item` varchar(10) default NULL,
178 `cn_suffix` varchar(10) default NULL,
179 `cn_sort` varchar(30) default NULL,
180 `totalissues` int(10),
181 `marcxml` longtext NOT NULL,
182 PRIMARY KEY (`biblioitemnumber`),
183 KEY `bibinoidx` (`biblioitemnumber`),
184 KEY `bibnoidx` (`biblionumber`),
187 KEY `publishercode` (`publishercode`),
188 CONSTRAINT `biblioitems_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
189 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
192 -- Table structure for table `borrowers`
195 DROP TABLE IF EXISTS `borrowers`;
196 CREATE TABLE `borrowers` ( -- this table includes information about your patrons/borrowers/members
197 `borrowernumber` int(11) NOT NULL auto_increment, -- primary key, Koha assigned ID number for patrons/borrowers
198 `cardnumber` varchar(16) default NULL, -- unique key, library assigned ID number for patrons/borrowers
199 `surname` mediumtext NOT NULL, -- patron/borrower's last name (surname)
200 `firstname` text, -- patron/borrower's first name
201 `title` mediumtext, -- patron/borrower's title, for example: Mr. or Mrs.
202 `othernames` mediumtext, -- any other names associated with the patron/borrower
203 `initials` text, -- initials for your patron/borrower
204 `streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's primary address
205 `streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's primary address
206 `address` mediumtext NOT NULL, -- the first address line for your patron/borrower's primary address
207 `address2` text, -- the second address line for your patron/borrower's primary address
208 `city` mediumtext NOT NULL, -- the city or town for your patron/borrower's primary address
209 `state` text default NULL, -- the state or province for your patron/borrower's primary address
210 `zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's primary address
211 `country` text, -- the country for your patron/borrower's primary address
212 `email` mediumtext, -- the primary email address for your patron/borrower's primary address
213 `phone` text, -- the primary phone number for your patron/borrower's primary address
214 `mobile` varchar(50) default NULL, -- the other phone number for your patron/borrower's primary address
215 `fax` mediumtext, -- the fax number for your patron/borrower's primary address
216 `emailpro` text, -- the secondary email addres for your patron/borrower's primary address
217 `phonepro` text, -- the secondary phone number for your patron/borrower's primary address
218 `B_streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's alternate address
219 `B_streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's alternate address
220 `B_address` varchar(100) default NULL, -- the first address line for your patron/borrower's alternate address
221 `B_address2` text default NULL, -- the second address line for your patron/borrower's alternate address
222 `B_city` mediumtext, -- the city or town for your patron/borrower's alternate address
223 `B_state` text default NULL, -- the state for your patron/borrower's alternate address
224 `B_zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's alternate address
225 `B_country` text, -- the country for your patron/borrower's alternate address
226 `B_email` text, -- the patron/borrower's alternate email address
227 `B_phone` mediumtext, -- the patron/borrower's alternate phone number
228 `dateofbirth` date default NULL, -- the patron/borrower's date of birth (YYYY-MM-DD)
229 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, includes the code of the patron/borrower's home branch
230 `categorycode` varchar(10) NOT NULL default '', -- foreign key from the categories table, includes the code of the patron category
231 `dateenrolled` date default NULL, -- date the patron was added to Koha (YYYY-MM-DD)
232 `dateexpiry` date default NULL, -- date the patron/borrower's card is set to expire (YYYY-MM-DD)
233 `gonenoaddress` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having an unconfirmed address
234 `lost` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having lost their card
235 `debarred` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as being restricted
236 `contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
237 `contactfirstname` text, -- used for children to include first name of guarentor
238 `contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
239 `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
240 `borrowernotes` mediumtext, -- a note on the patron/borroewr's account that is only visible in the staff client
241 `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
242 `ethnicity` varchar(50) default NULL, -- unused in Koha
243 `ethnotes` varchar(255) default NULL, -- unused in Koha
244 `sex` varchar(1) default NULL, -- patron/borrower's gender
245 `password` varchar(30) default NULL, -- patron/borrower's encrypted password
246 `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
247 `userid` varchar(30) default NULL, -- patron/borrower's opac and/or staff client log in
248 `opacnote` mediumtext, -- a note on the patron/borrower's account that is visible in the OPAC and staff client
249 `contactnote` varchar(255) default NULL, -- a note related to the patron/borrower's alternate address
250 `sort1` varchar(80) default NULL, -- a field that can be used for any information unique to the library
251 `sort2` varchar(80) default NULL, -- a field that can be used for any information unique to the library
252 `altcontactfirstname` varchar(255) default NULL, -- first name of alternate contact for the patron/borrower
253 `altcontactsurname` varchar(255) default NULL, -- surname or last name of the alternate contact for the patron/borrower
254 `altcontactaddress1` varchar(255) default NULL, -- the first address line for the alternate contact for the patron/borrower
255 `altcontactaddress2` varchar(255) default NULL, -- the second address line for the alternate contact for the patron/borrower
256 `altcontactaddress3` varchar(255) default NULL, -- the third address line for the alternate contact for the patron/borrower
257 `altcontactstate` text default NULL, -- the city and state for the alternate contact for the patron/borrower
258 `altcontactzipcode` varchar(50) default NULL, -- the zipcode for the alternate contact for the patron/borrower
259 `altcontactcountry` text default NULL, -- the country for the alternate contact for the patron/borrower
260 `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
261 `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
262 `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history
263 UNIQUE KEY `cardnumber` (`cardnumber`),
264 PRIMARY KEY `borrowernumber` (`borrowernumber`),
265 KEY `categorycode` (`categorycode`),
266 KEY `branchcode` (`branchcode`),
267 KEY `userid` (`userid`),
268 KEY `guarantorid` (`guarantorid`),
269 CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
270 CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
271 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
274 -- Table structure for table `borrower_attribute_types`
277 DROP TABLE IF EXISTS `borrower_attribute_types`;
278 CREATE TABLE `borrower_attribute_types` ( -- definitions for custom patron fields known as extended patron attributes
279 `code` varchar(10) NOT NULL, -- unique key used to identify each custom field
280 `description` varchar(255) NOT NULL, -- description for each custom field
281 `repeatable` tinyint(1) NOT NULL default 0, -- defines whether one patron/borrower can have multiple values for this custom field (1 for yes, 0 for no)
282 `unique_id` tinyint(1) NOT NULL default 0, -- defines if this value needs to be unique (1 for yes, 0 for no)
283 `opac_display` tinyint(1) NOT NULL default 0, -- defines if this field is visible to patrons on their account in the OPAC (1 for yes, 0 for no)
284 `password_allowed` tinyint(1) NOT NULL default 0, -- defines if it is possible to associate a password with this custom field (1 for yes, 0 for no)
285 `staff_searchable` tinyint(1) NOT NULL default 0, -- defines if this field is searchable via the patron search in the staff client (1 for yes, 0 for no)
286 `authorised_value_category` varchar(10) default NULL, -- foreign key from authorised_values that links this custom field to an authorized value category
287 PRIMARY KEY (`code`),
288 KEY `auth_val_cat_idx` (`authorised_value_category`)
289 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
292 -- Table structure for table `borrower_attributes`
295 DROP TABLE IF EXISTS `borrower_attributes`;
296 CREATE TABLE `borrower_attributes` ( -- values of custom patron fields known as extended patron attributes linked to patrons/borrowers
297 `borrowernumber` int(11) NOT NULL, -- foreign key from the borrowers table, defines which patron/borrower has this attribute
298 `code` varchar(10) NOT NULL, -- foreign key from the borrower_attribute_types table, defines which custom field this value was entered for
299 `attribute` varchar(64) default NULL, -- custom patron field value
300 `password` varchar(64) default NULL, -- password associated with this field
301 KEY `borrowernumber` (`borrowernumber`),
302 KEY `code_attribute` (`code`, `attribute`),
303 CONSTRAINT `borrower_attributes_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
304 ON DELETE CASCADE ON UPDATE CASCADE,
305 CONSTRAINT `borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`)
306 ON DELETE CASCADE ON UPDATE CASCADE
307 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
310 -- Table structure for table `branch_item_rules`
313 DROP TABLE IF EXISTS `branch_item_rules`;
314 CREATE TABLE `branch_item_rules` (
315 `branchcode` varchar(10) NOT NULL,
316 `itemtype` varchar(10) NOT NULL,
317 `holdallowed` tinyint(1) default NULL,
318 PRIMARY KEY (`itemtype`,`branchcode`),
319 KEY `branch_item_rules_ibfk_2` (`branchcode`),
320 CONSTRAINT `branch_item_rules_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`)
321 ON DELETE CASCADE ON UPDATE CASCADE,
322 CONSTRAINT `branch_item_rules_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
323 ON DELETE CASCADE ON UPDATE CASCADE
324 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
327 -- Table structure for table `branchcategories`
330 DROP TABLE IF EXISTS `branchcategories`;
331 CREATE TABLE `branchcategories` ( -- information related to library/branch groups
332 `categorycode` varchar(10) NOT NULL default '', -- unique identifier for the library/branch group
333 `categoryname` varchar(32), -- name of the library/branch group
334 `codedescription` mediumtext, -- longer description of the library/branch group
335 `categorytype` varchar(16), -- says whether this is a search group or a properties group
336 PRIMARY KEY (`categorycode`)
337 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
340 -- Table structure for table `branches`
343 DROP TABLE IF EXISTS `branches`;
344 CREATE TABLE `branches` ( -- information about your libraries or branches are stored here
345 `branchcode` varchar(10) NOT NULL default '', -- a unique key assigned to each branch
346 `branchname` mediumtext NOT NULL, -- the name of your library or branch
347 `branchaddress1` mediumtext, -- the first address line of for your library or branch
348 `branchaddress2` mediumtext, -- the second address line of for your library or branch
349 `branchaddress3` mediumtext, -- the third address line of for your library or branch
350 `branchzip` varchar(25) default NULL, -- the zip or postal code for your library or branch
351 `branchcity` mediumtext, -- the city or province for your library or branch
352 `branchstate` mediumtext, -- the state for your library or branch
353 `branchcountry` text, -- the county for your library or branch
354 `branchphone` mediumtext, -- the primary phone for your library or branch
355 `branchfax` mediumtext, -- the fax number for your library or branch
356 `branchemail` mediumtext, -- the primary email address for your library or branch
357 `branchurl` mediumtext, -- the URL for your library or branch's website
358 `issuing` tinyint(4) default NULL, -- unused in Koha
359 `branchip` varchar(15) default NULL, -- the IP address for your library or branch
360 `branchprinter` varchar(100) default NULL, -- unused in Koha
361 `branchnotes` mediumtext, -- notes related to your library or branch
362 UNIQUE KEY `branchcode` (`branchcode`)
363 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
366 -- Table structure for table `branchrelations`
369 DROP TABLE IF EXISTS `branchrelations`;
370 CREATE TABLE `branchrelations` ( -- this table links libraries/branches to groups
371 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table to identify the branch
372 `categorycode` varchar(10) NOT NULL default '', -- foreign key from the branchcategories table to identify the group
373 PRIMARY KEY (`branchcode`,`categorycode`),
374 KEY `branchcode` (`branchcode`),
375 KEY `categorycode` (`categorycode`),
376 CONSTRAINT `branchrelations_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
377 CONSTRAINT `branchrelations_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `branchcategories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
378 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
381 -- Table structure for table `branchtransfers`
384 DROP TABLE IF EXISTS `branchtransfers`;
385 CREATE TABLE `branchtransfers` (
386 `itemnumber` int(11) NOT NULL default 0,
387 `datesent` datetime default NULL,
388 `frombranch` varchar(10) NOT NULL default '',
389 `datearrived` datetime default NULL,
390 `tobranch` varchar(10) NOT NULL default '',
391 `comments` mediumtext,
392 KEY `frombranch` (`frombranch`),
393 KEY `tobranch` (`tobranch`),
394 KEY `itemnumber` (`itemnumber`),
395 CONSTRAINT `branchtransfers_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
396 CONSTRAINT `branchtransfers_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
397 CONSTRAINT `branchtransfers_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
398 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
402 -- Table structure for table `browser`
404 DROP TABLE IF EXISTS `browser`;
405 CREATE TABLE `browser` (
406 `level` int(11) NOT NULL,
407 `classification` varchar(20) NOT NULL,
408 `description` varchar(255) NOT NULL,
409 `number` bigint(20) NOT NULL,
410 `endnode` tinyint(4) NOT NULL
411 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
414 -- Table structure for table `categories`
417 DROP TABLE IF EXISTS `categories`;
418 CREATE TABLE `categories` (
419 `categorycode` varchar(10) NOT NULL default '',
420 `description` mediumtext,
421 `enrolmentperiod` smallint(6) default NULL,
422 `enrolmentperioddate` DATE NULL DEFAULT NULL,
423 `upperagelimit` smallint(6) default NULL,
424 `dateofbirthrequired` tinyint(1) default NULL,
425 `finetype` varchar(30) default NULL,
426 `bulk` tinyint(1) default NULL,
427 `enrolmentfee` decimal(28,6) default NULL,
428 `overduenoticerequired` tinyint(1) default NULL,
429 `issuelimit` smallint(6) default NULL,
430 `reservefee` decimal(28,6) default NULL,
431 `hidelostitems` tinyint(1) NOT NULL default '0',
432 `category_type` varchar(1) NOT NULL default 'A',
433 PRIMARY KEY (`categorycode`),
434 UNIQUE KEY `categorycode` (`categorycode`)
435 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
438 -- Table: collections
440 DROP TABLE IF EXISTS collections;
441 CREATE TABLE collections (
442 colId integer(11) NOT NULL auto_increment,
443 colTitle varchar(100) NOT NULL DEFAULT '',
444 colDesc text NOT NULL,
445 colBranchcode varchar(4) DEFAULT NULL comment 'branchcode for branch where item should be held.',
447 ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
450 -- Table: collections_tracking
452 DROP TABLE IF EXISTS collections_tracking;
453 CREATE TABLE collections_tracking (
454 ctId integer(11) NOT NULL auto_increment,
455 colId integer(11) NOT NULL DEFAULT 0 comment 'collections.colId',
456 itemnumber integer(11) NOT NULL DEFAULT 0 comment 'items.itemnumber',
458 ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
461 -- Table structure for table `borrower_branch_circ_rules`
464 DROP TABLE IF EXISTS `branch_borrower_circ_rules`;
465 CREATE TABLE `branch_borrower_circ_rules` (
466 `branchcode` VARCHAR(10) NOT NULL,
467 `categorycode` VARCHAR(10) NOT NULL,
468 `maxissueqty` int(4) default NULL,
469 PRIMARY KEY (`categorycode`, `branchcode`),
470 CONSTRAINT `branch_borrower_circ_rules_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`)
471 ON DELETE CASCADE ON UPDATE CASCADE,
472 CONSTRAINT `branch_borrower_circ_rules_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
473 ON DELETE CASCADE ON UPDATE CASCADE
474 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
477 -- Table structure for table `default_borrower_circ_rules`
480 DROP TABLE IF EXISTS `default_borrower_circ_rules`;
481 CREATE TABLE `default_borrower_circ_rules` (
482 `categorycode` VARCHAR(10) NOT NULL,
483 `maxissueqty` int(4) default NULL,
484 PRIMARY KEY (`categorycode`),
485 CONSTRAINT `borrower_borrower_circ_rules_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`)
486 ON DELETE CASCADE ON UPDATE CASCADE
487 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
490 -- Table structure for table `default_branch_circ_rules`
493 DROP TABLE IF EXISTS `default_branch_circ_rules`;
494 CREATE TABLE `default_branch_circ_rules` (
495 `branchcode` VARCHAR(10) NOT NULL,
496 `maxissueqty` int(4) default NULL,
497 `holdallowed` tinyint(1) default NULL,
498 PRIMARY KEY (`branchcode`),
499 CONSTRAINT `default_branch_circ_rules_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
500 ON DELETE CASCADE ON UPDATE CASCADE
501 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
504 -- Table structure for table `default_branch_item_rules`
506 DROP TABLE IF EXISTS `default_branch_item_rules`;
507 CREATE TABLE `default_branch_item_rules` (
508 `itemtype` varchar(10) NOT NULL,
509 `holdallowed` tinyint(1) default NULL,
510 PRIMARY KEY (`itemtype`),
511 CONSTRAINT `default_branch_item_rules_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`)
512 ON DELETE CASCADE ON UPDATE CASCADE
513 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
516 -- Table structure for table `default_circ_rules`
519 DROP TABLE IF EXISTS `default_circ_rules`;
520 CREATE TABLE `default_circ_rules` (
521 `singleton` enum('singleton') NOT NULL default 'singleton',
522 `maxissueqty` int(4) default NULL,
523 `holdallowed` int(1) default NULL,
524 PRIMARY KEY (`singleton`)
525 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
528 -- Table structure for table `cities`
531 DROP TABLE IF EXISTS `cities`;
532 CREATE TABLE `cities` ( -- authorized values for cities/states/countries to choose when adding/editing a patron/borrower
533 `cityid` int(11) NOT NULL auto_increment, -- unique identifier added by Koha
534 `city_name` varchar(100) NOT NULL default '', -- name of the city
535 `city_state` VARCHAR( 100 ) NULL DEFAULT NULL, -- name of the state/province
536 `city_country` VARCHAR( 100 ) NULL DEFAULT NULL, -- name of the country
537 `city_zipcode` varchar(20) default NULL, -- zip or postal code
538 PRIMARY KEY (`cityid`)
539 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
542 -- Table structure for table `class_sort_rules`
545 DROP TABLE IF EXISTS `class_sort_rules`;
546 CREATE TABLE `class_sort_rules` (
547 `class_sort_rule` varchar(10) NOT NULL default '',
548 `description` mediumtext,
549 `sort_routine` varchar(30) NOT NULL default '',
550 PRIMARY KEY (`class_sort_rule`),
551 UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
552 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
555 -- Table structure for table `class_sources`
558 DROP TABLE IF EXISTS `class_sources`;
559 CREATE TABLE `class_sources` (
560 `cn_source` varchar(10) NOT NULL default '',
561 `description` mediumtext,
562 `used` tinyint(4) NOT NULL default 0,
563 `class_sort_rule` varchar(10) NOT NULL default '',
564 PRIMARY KEY (`cn_source`),
565 UNIQUE KEY `cn_source_idx` (`cn_source`),
566 KEY `used_idx` (`used`),
567 CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`)
568 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
571 -- Table structure for table `currency`
574 DROP TABLE IF EXISTS `currency`;
575 CREATE TABLE `currency` (
576 `currency` varchar(10) NOT NULL default '',
577 `symbol` varchar(5) default NULL,
578 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
579 `rate` float(15,5) default NULL,
580 `active` tinyint(1) default NULL,
581 PRIMARY KEY (`currency`)
582 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
585 -- Table structure for table `deletedbiblio`
588 DROP TABLE IF EXISTS `deletedbiblio`;
589 CREATE TABLE `deletedbiblio` ( -- stores information about bibliographic records that have been deleted
590 `biblionumber` int(11) NOT NULL auto_increment, -- unique identifier assigned to each bibliographic record
591 `frameworkcode` varchar(4) NOT NULL default '', -- foriegn key from the biblio_framework table to identify which framework was used in cataloging this record
592 `author` mediumtext, -- statement of responsibility from MARC record (100 in MARC21)
593 `title` mediumtext, -- title (without the subtitle) from the MARC record (245 in MARC21)
594 `unititle` mediumtext, -- uniform title (without the subtitle) from the MARC record (240 in MARC21)
595 `notes` mediumtext, -- values from the general notes field in the MARC record (500 in MARC21) split by bar (|)
596 `serial` tinyint(1) default NULL, -- foreign key, linking to the subscriptionid in the serial table
597 `seriestitle` mediumtext,
598 `copyrightdate` smallint(6) default NULL, -- publication or copyright date from the MARC record
599 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
600 `datecreated` DATE NOT NULL, -- the date this record was added to Koha
601 `abstract` mediumtext, -- summary from the MARC record (520 in MARC21)
602 PRIMARY KEY (`biblionumber`),
603 KEY `blbnoidx` (`biblionumber`)
604 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
607 -- Table structure for table `deletedbiblioitems`
610 DROP TABLE IF EXISTS `deletedbiblioitems`;
611 CREATE TABLE `deletedbiblioitems` (
612 `biblioitemnumber` int(11) NOT NULL default 0,
613 `biblionumber` int(11) NOT NULL default 0,
616 `itemtype` varchar(10) default NULL,
617 `isbn` varchar(30) default NULL,
618 `issn` varchar(9) default NULL,
619 `publicationyear` text,
620 `publishercode` varchar(255) default NULL,
621 `volumedate` date default NULL,
623 `collectiontitle` mediumtext default NULL,
624 `collectionissn` text default NULL,
625 `collectionvolume` mediumtext default NULL,
626 `editionstatement` text default NULL,
627 `editionresponsibility` text default NULL,
628 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
629 `illus` varchar(255) default NULL,
630 `pages` varchar(255) default NULL,
632 `size` varchar(255) default NULL,
633 `place` varchar(255) default NULL,
634 `lccn` varchar(25) default NULL,
636 `url` varchar(255) default NULL,
637 `cn_source` varchar(10) default NULL,
638 `cn_class` varchar(30) default NULL,
639 `cn_item` varchar(10) default NULL,
640 `cn_suffix` varchar(10) default NULL,
641 `cn_sort` varchar(30) default NULL,
642 `totalissues` int(10),
643 `marcxml` longtext NOT NULL,
644 PRIMARY KEY (`biblioitemnumber`),
645 KEY `bibinoidx` (`biblioitemnumber`),
646 KEY `bibnoidx` (`biblionumber`),
648 KEY `publishercode` (`publishercode`)
649 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
652 -- Table structure for table `deletedborrowers`
655 DROP TABLE IF EXISTS `deletedborrowers`;
656 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrowers you have deleted
657 `borrowernumber` int(11) NOT NULL default 0, -- primary key, Koha assigned ID number for patrons/borrowers
658 `cardnumber` varchar(16) default NULL, -- unique key, library assigned ID number for patrons/borrowers
659 `surname` mediumtext NOT NULL, -- patron/borrower's last name (surname)
660 `firstname` text, -- patron/borrower's first name
661 `title` mediumtext, -- patron/borrower's title, for example: Mr. or Mrs.
662 `othernames` mediumtext, -- any other names associated with the patron/borrower
663 `initials` text, -- initials for your patron/borrower
664 `streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's primary address
665 `streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's primary address
666 `address` mediumtext NOT NULL, -- the first address line for your patron/borrower's primary address
667 `address2` text, -- the second address line for your patron/borrower's primary address
668 `city` mediumtext NOT NULL, -- the city or town for your patron/borrower's primary address
669 `state` text default NULL, -- the state or province for your patron/borrower's primary address
670 `zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's primary address
671 `country` text, -- the country for your patron/borrower's primary address
672 `email` mediumtext, -- the primary email address for your patron/borrower's primary address
673 `phone` text, -- the primary phone number for your patron/borrower's primary address
674 `mobile` varchar(50) default NULL, -- the other phone number for your patron/borrower's primary address
675 `fax` mediumtext, -- the fax number for your patron/borrower's primary address
676 `emailpro` text, -- the secondary email addres for your patron/borrower's primary address
677 `phonepro` text, -- the secondary phone number for your patron/borrower's primary address
678 `B_streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's alternate address
679 `B_streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's alternate address
680 `B_address` varchar(100) default NULL, -- the first address line for your patron/borrower's alternate address
681 `B_address2` text default NULL, -- the second address line for your patron/borrower's alternate address
682 `B_city` mediumtext, -- the city or town for your patron/borrower's alternate address
683 `B_state` text default NULL, -- the state for your patron/borrower's alternate address
684 `B_zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's alternate address
685 `B_country` text, -- the country for your patron/borrower's alternate address
686 `B_email` text, -- the patron/borrower's alternate email address
687 `B_phone` mediumtext, -- the patron/borrower's alternate phone number
688 `dateofbirth` date default NULL, -- the patron/borrower's date of birth (YYYY-MM-DD)
689 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, includes the code of the patron/borrower's home branch
690 `categorycode` varchar(10) NOT NULL default '', -- foreign key from the categories table, includes the code of the patron category
691 `dateenrolled` date default NULL, -- date the patron was added to Koha (YYYY-MM-DD)
692 `dateexpiry` date default NULL, -- date the patron/borrower's card is set to expire (YYYY-MM-DD)
693 `gonenoaddress` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having an unconfirmed address
694 `lost` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having lost their card
695 `debarred` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as being restricted
696 `contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
697 `contactfirstname` text, -- used for children to include first name of guarentor
698 `contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
699 `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
700 `borrowernotes` mediumtext, -- a note on the patron/borroewr's account that is only visible in the staff client
701 `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
702 `ethnicity` varchar(50) default NULL, -- unused in Koha
703 `ethnotes` varchar(255) default NULL, -- unused in Koha
704 `sex` varchar(1) default NULL, -- patron/borrower's gender
705 `password` varchar(30) default NULL, -- patron/borrower's encrypted password
706 `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
707 `userid` varchar(30) default NULL, -- patron/borrower's opac and/or staff client log in
708 `opacnote` mediumtext, -- a note on the patron/borrower's account that is visible in the OPAC and staff client
709 `contactnote` varchar(255) default NULL, -- a note related to the patron/borrower's alternate address
710 `sort1` varchar(80) default NULL, -- a field that can be used for any information unique to the library
711 `sort2` varchar(80) default NULL, -- a field that can be used for any information unique to the library
712 `altcontactfirstname` varchar(255) default NULL, -- first name of alternate contact for the patron/borrower
713 `altcontactsurname` varchar(255) default NULL, -- surname or last name of the alternate contact for the patron/borrower
714 `altcontactaddress1` varchar(255) default NULL, -- the first address line for the alternate contact for the patron/borrower
715 `altcontactaddress2` varchar(255) default NULL, -- the second address line for the alternate contact for the patron/borrower
716 `altcontactaddress3` varchar(255) default NULL, -- the third address line for the alternate contact for the patron/borrower
717 `altcontactstate` text default NULL, -- the city and state for the alternate contact for the patron/borrower
718 `altcontactzipcode` varchar(50) default NULL, -- the zipcode for the alternate contact for the patron/borrower
719 `altcontactcountry` text default NULL, -- the country for the alternate contact for the patron/borrower
720 `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
721 `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
722 `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history KEY `borrowernumber` (`borrowernumber`),
723 KEY borrowernumber (borrowernumber),
724 KEY `cardnumber` (`cardnumber`)
725 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
728 -- Table structure for table `deleteditems`
731 DROP TABLE IF EXISTS `deleteditems`;
732 CREATE TABLE `deleteditems` (
733 `itemnumber` int(11) NOT NULL default 0,
734 `biblionumber` int(11) NOT NULL default 0,
735 `biblioitemnumber` int(11) NOT NULL default 0,
736 `barcode` varchar(20) default NULL,
737 `dateaccessioned` date default NULL,
738 `booksellerid` mediumtext default NULL,
739 `homebranch` varchar(10) default NULL,
740 `price` decimal(8,2) default NULL,
741 `replacementprice` decimal(8,2) default NULL,
742 `replacementpricedate` date default NULL,
743 `datelastborrowed` date default NULL,
744 `datelastseen` date default NULL,
745 `stack` tinyint(1) default NULL,
746 `notforloan` tinyint(1) NOT NULL default 0,
747 `damaged` tinyint(1) NOT NULL default 0,
748 `itemlost` tinyint(1) NOT NULL default 0,
749 `wthdrawn` tinyint(1) NOT NULL default 0,
750 `itemcallnumber` varchar(255) default NULL,
751 `issues` smallint(6) default NULL,
752 `renewals` smallint(6) default NULL,
753 `reserves` smallint(6) default NULL,
754 `restricted` tinyint(1) default NULL,
755 `itemnotes` mediumtext,
756 `holdingbranch` varchar(10) default NULL,
757 `paidfor` mediumtext,
758 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
759 `location` varchar(80) default NULL,
760 `permanent_location` varchar(80) default NULL,
761 `onloan` date default NULL,
762 `cn_source` varchar(10) default NULL,
763 `cn_sort` varchar(30) default NULL,
764 `ccode` varchar(10) default NULL,
765 `materials` varchar(10) default NULL,
766 `uri` varchar(255) default NULL,
767 `itype` varchar(10) default NULL,
768 `more_subfields_xml` longtext default NULL,
769 `enumchron` text default NULL,
770 `copynumber` varchar(32) default NULL,
771 `stocknumber` varchar(32) default NULL,
773 PRIMARY KEY (`itemnumber`),
774 KEY `delitembarcodeidx` (`barcode`),
775 KEY `delitemstocknumberidx` (`stocknumber`),
776 KEY `delitembinoidx` (`biblioitemnumber`),
777 KEY `delitembibnoidx` (`biblionumber`),
778 KEY `delhomebranch` (`homebranch`),
779 KEY `delholdingbranch` (`holdingbranch`)
780 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
783 -- Table structure for table `ethnicity`
786 DROP TABLE IF EXISTS `ethnicity`;
787 CREATE TABLE `ethnicity` (
788 `code` varchar(10) NOT NULL default '',
789 `name` varchar(255) default NULL,
791 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
794 -- Table structure for table `export_format`
797 DROP TABLE IF EXISTS `export_format`;
798 CREATE TABLE `export_format` (
799 `export_format_id` int(11) NOT NULL auto_increment,
800 `profile` varchar(255) NOT NULL,
801 `description` mediumtext NOT NULL,
802 `marcfields` mediumtext NOT NULL,
803 `csv_separator` varchar(2) NOT NULL,
804 `field_separator` varchar(2) NOT NULL,
805 `subfield_separator` varchar(2) NOT NULL,
806 `encoding` varchar(255) NOT NULL,
807 PRIMARY KEY (`export_format_id`)
808 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Used for CSV export';
812 -- Table structure for table `hold_fill_targets`
815 DROP TABLE IF EXISTS `hold_fill_targets`;
816 CREATE TABLE hold_fill_targets (
817 `borrowernumber` int(11) NOT NULL,
818 `biblionumber` int(11) NOT NULL,
819 `itemnumber` int(11) NOT NULL,
820 `source_branchcode` varchar(10) default NULL,
821 `item_level_request` tinyint(4) NOT NULL default 0,
822 PRIMARY KEY `itemnumber` (`itemnumber`),
823 KEY `bib_branch` (`biblionumber`, `source_branchcode`),
824 CONSTRAINT `hold_fill_targets_ibfk_1` FOREIGN KEY (`borrowernumber`)
825 REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
826 CONSTRAINT `hold_fill_targets_ibfk_2` FOREIGN KEY (`biblionumber`)
827 REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
828 CONSTRAINT `hold_fill_targets_ibfk_3` FOREIGN KEY (`itemnumber`)
829 REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
830 CONSTRAINT `hold_fill_targets_ibfk_4` FOREIGN KEY (`source_branchcode`)
831 REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
832 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
835 -- Table structure for table `import_batches`
838 DROP TABLE IF EXISTS `import_batches`;
839 CREATE TABLE `import_batches` (
840 `import_batch_id` int(11) NOT NULL auto_increment,
841 `matcher_id` int(11) default NULL,
842 `template_id` int(11) default NULL,
843 `branchcode` varchar(10) default NULL,
844 `num_biblios` int(11) NOT NULL default 0,
845 `num_items` int(11) NOT NULL default 0,
846 `upload_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
847 `overlay_action` enum('replace', 'create_new', 'use_template', 'ignore') NOT NULL default 'create_new',
848 `nomatch_action` enum('create_new', 'ignore') NOT NULL default 'create_new',
849 `item_action` enum('always_add', 'add_only_for_matches', 'add_only_for_new', 'ignore') NOT NULL default 'always_add',
850 `import_status` enum('staging', 'staged', 'importing', 'imported', 'reverting', 'reverted', 'cleaned') NOT NULL default 'staging',
851 `batch_type` enum('batch', 'z3950') NOT NULL default 'batch',
852 `file_name` varchar(100),
853 `comments` mediumtext,
854 PRIMARY KEY (`import_batch_id`),
855 KEY `branchcode` (`branchcode`)
856 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
859 -- Table structure for table `import_records`
862 DROP TABLE IF EXISTS `import_records`;
863 CREATE TABLE `import_records` (
864 `import_record_id` int(11) NOT NULL auto_increment,
865 `import_batch_id` int(11) NOT NULL,
866 `branchcode` varchar(10) default NULL,
867 `record_sequence` int(11) NOT NULL default 0,
868 `upload_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
869 `import_date` DATE default NULL,
870 `marc` longblob NOT NULL,
871 `marcxml` longtext NOT NULL,
872 `marcxml_old` longtext NOT NULL,
873 `record_type` enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio',
874 `overlay_status` enum('no_match', 'auto_match', 'manual_match', 'match_applied') NOT NULL default 'no_match',
875 `status` enum('error', 'staged', 'imported', 'reverted', 'items_reverted', 'ignored') NOT NULL default 'staged',
876 `import_error` mediumtext,
877 `encoding` varchar(40) NOT NULL default '',
878 `z3950random` varchar(40) default NULL,
879 PRIMARY KEY (`import_record_id`),
880 CONSTRAINT `import_records_ifbk_1` FOREIGN KEY (`import_batch_id`)
881 REFERENCES `import_batches` (`import_batch_id`) ON DELETE CASCADE ON UPDATE CASCADE,
882 KEY `branchcode` (`branchcode`),
883 KEY `batch_sequence` (`import_batch_id`, `record_sequence`)
884 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
887 -- Table structure for `import_record_matches`
889 DROP TABLE IF EXISTS `import_record_matches`;
890 CREATE TABLE `import_record_matches` (
891 `import_record_id` int(11) NOT NULL,
892 `candidate_match_id` int(11) NOT NULL,
893 `score` int(11) NOT NULL default 0,
894 CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`)
895 REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
896 KEY `record_score` (`import_record_id`, `score`)
897 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
900 -- Table structure for table `import_biblios`
903 DROP TABLE IF EXISTS `import_biblios`;
904 CREATE TABLE `import_biblios` (
905 `import_record_id` int(11) NOT NULL,
906 `matched_biblionumber` int(11) default NULL,
907 `control_number` varchar(25) default NULL,
908 `original_source` varchar(25) default NULL,
909 `title` varchar(128) default NULL,
910 `author` varchar(80) default NULL,
911 `isbn` varchar(30) default NULL,
912 `issn` varchar(9) default NULL,
913 `has_items` tinyint(1) NOT NULL default 0,
914 CONSTRAINT `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`)
915 REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
916 KEY `matched_biblionumber` (`matched_biblionumber`),
917 KEY `title` (`title`),
919 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
922 -- Table structure for table `import_items`
925 DROP TABLE IF EXISTS `import_items`;
926 CREATE TABLE `import_items` (
927 `import_items_id` int(11) NOT NULL auto_increment,
928 `import_record_id` int(11) NOT NULL,
929 `itemnumber` int(11) default NULL,
930 `branchcode` varchar(10) default NULL,
931 `status` enum('error', 'staged', 'imported', 'reverted', 'ignored') NOT NULL default 'staged',
932 `marcxml` longtext NOT NULL,
933 `import_error` mediumtext,
934 PRIMARY KEY (`import_items_id`),
935 CONSTRAINT `import_items_ibfk_1` FOREIGN KEY (`import_record_id`)
936 REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
937 KEY `itemnumber` (`itemnumber`),
938 KEY `branchcode` (`branchcode`)
939 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
942 -- Table structure for table `issues`
945 DROP TABLE IF EXISTS `issues`;
946 CREATE TABLE `issues` ( -- information related to check outs or issues
947 `borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to
948 `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out
949 `date_due` date default NULL, -- date the item is due (yyyy-mm-dd)
950 `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
951 `issuingbranch` varchar(18) default NULL,
952 `returndate` date default NULL, -- date the item was returned, will be NULL until moved to old_issues
953 `lastreneweddate` date default NULL, -- date the item was last renewed
954 `return` varchar(4) default NULL,
955 `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
956 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
957 `issuedate` date default NULL, -- date the item was checked out or issued
958 KEY `issuesborridx` (`borrowernumber`),
959 KEY `bordate` (`borrowernumber`,`timestamp`),
960 CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE RESTRICT ON UPDATE CASCADE,
961 CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE RESTRICT ON UPDATE CASCADE
962 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
965 -- Table structure for table `issuingrules`
968 DROP TABLE IF EXISTS `issuingrules`;
969 CREATE TABLE `issuingrules` (
970 `categorycode` varchar(10) NOT NULL default '',
971 `itemtype` varchar(10) NOT NULL default '',
972 `restrictedtype` tinyint(1) default NULL,
973 `rentaldiscount` decimal(28,6) default NULL,
974 `reservecharge` decimal(28,6) default NULL,
975 `fine` decimal(28,6) default NULL,
976 `finedays` int(11) default NULL,
977 `firstremind` int(11) default NULL,
978 `chargeperiod` int(11) default NULL,
979 `accountsent` int(11) default NULL,
980 `chargename` varchar(100) default NULL,
981 `maxissueqty` int(4) default NULL,
982 `issuelength` int(4) default NULL,
983 `hardduedate` date default NULL,
984 `hardduedatecompare` tinyint NOT NULL default "0",
985 `renewalsallowed` smallint(6) NOT NULL default "0",
986 `reservesallowed` smallint(6) NOT NULL default "0",
987 `branchcode` varchar(10) NOT NULL default '',
988 PRIMARY KEY (`branchcode`,`categorycode`,`itemtype`),
989 KEY `categorycode` (`categorycode`),
990 KEY `itemtype` (`itemtype`)
991 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
994 -- Table structure for table `items`
997 DROP TABLE IF EXISTS `items`;
998 CREATE TABLE `items` (
999 `itemnumber` int(11) NOT NULL auto_increment,
1000 `biblionumber` int(11) NOT NULL default 0,
1001 `biblioitemnumber` int(11) NOT NULL default 0,
1002 `barcode` varchar(20) default NULL,
1003 `dateaccessioned` date default NULL,
1004 `booksellerid` mediumtext default NULL,
1005 `homebranch` varchar(10) default NULL,
1006 `price` decimal(8,2) default NULL,
1007 `replacementprice` decimal(8,2) default NULL,
1008 `replacementpricedate` date default NULL,
1009 `datelastborrowed` date default NULL,
1010 `datelastseen` date default NULL,
1011 `stack` tinyint(1) default NULL,
1012 `notforloan` tinyint(1) NOT NULL default 0,
1013 `damaged` tinyint(1) NOT NULL default 0,
1014 `itemlost` tinyint(1) NOT NULL default 0,
1015 `wthdrawn` tinyint(1) NOT NULL default 0,
1016 `itemcallnumber` varchar(255) default NULL,
1017 `issues` smallint(6) default NULL,
1018 `renewals` smallint(6) default NULL,
1019 `reserves` smallint(6) default NULL,
1020 `restricted` tinyint(1) default NULL,
1021 `itemnotes` mediumtext,
1022 `holdingbranch` varchar(10) default NULL,
1023 `paidfor` mediumtext,
1024 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
1025 `location` varchar(80) default NULL,
1026 `permanent_location` varchar(80) default NULL,
1027 `onloan` date default NULL,
1028 `cn_source` varchar(10) default NULL,
1029 `cn_sort` varchar(30) default NULL,
1030 `ccode` varchar(10) default NULL,
1031 `materials` varchar(10) default NULL,
1032 `uri` varchar(255) default NULL,
1033 `itype` varchar(10) default NULL,
1034 `more_subfields_xml` longtext default NULL,
1035 `enumchron` text default NULL,
1036 `copynumber` varchar(32) default NULL,
1037 `stocknumber` varchar(32) default NULL,
1038 PRIMARY KEY (`itemnumber`),
1039 UNIQUE KEY `itembarcodeidx` (`barcode`),
1040 KEY `itemstocknumberidx` (`stocknumber`),
1041 KEY `itembinoidx` (`biblioitemnumber`),
1042 KEY `itembibnoidx` (`biblionumber`),
1043 KEY `homebranch` (`homebranch`),
1044 KEY `holdingbranch` (`holdingbranch`),
1045 CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1046 CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
1047 CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE
1048 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1051 -- Table structure for table `itemtypes`
1054 DROP TABLE IF EXISTS `itemtypes`;
1055 CREATE TABLE `itemtypes` ( -- defines the item types
1056 `itemtype` varchar(10) NOT NULL default '', -- unique key, a code associated with the item type
1057 `description` mediumtext, -- a plain text explanation of the item type
1058 `rentalcharge` double(16,4) default NULL, -- the amount charged when this item is checked out/issued
1059 `notforloan` smallint(6) default NULL, -- 1 if the item is not for loan, 0 if the item is available for loan
1060 `imageurl` varchar(200) default NULL, -- URL for the item type icon
1061 `summary` text, -- information from the summary field, may include HTML
1062 PRIMARY KEY (`itemtype`),
1063 UNIQUE KEY `itemtype` (`itemtype`)
1064 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1067 -- Table structure for table `creator_batches`
1070 DROP TABLE IF EXISTS `creator_batches`;
1071 SET @saved_cs_client = @@character_set_client;
1072 SET character_set_client = utf8;
1073 CREATE TABLE `creator_batches` (
1074 `label_id` int(11) NOT NULL AUTO_INCREMENT,
1075 `batch_id` int(10) NOT NULL DEFAULT '1',
1076 `item_number` int(11) DEFAULT NULL,
1077 `borrower_number` int(11) DEFAULT NULL,
1078 `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1079 `branch_code` varchar(10) NOT NULL DEFAULT 'NB',
1080 `creator` char(15) NOT NULL DEFAULT 'Labels',
1081 PRIMARY KEY (`label_id`),
1082 KEY `branch_fk_constraint` (`branch_code`),
1083 KEY `item_fk_constraint` (`item_number`),
1084 KEY `borrower_fk_constraint` (`borrower_number`),
1085 CONSTRAINT `creator_batches_ibfk_1` FOREIGN KEY (`borrower_number`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1086 CONSTRAINT `creator_batches_ibfk_2` FOREIGN KEY (`branch_code`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
1087 CONSTRAINT `creator_batches_ibfk_3` FOREIGN KEY (`item_number`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE
1088 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1091 -- Table structure for table `creator_images`
1094 DROP TABLE IF EXISTS `creator_images`;
1095 SET @saved_cs_client = @@character_set_client;
1096 SET character_set_client = utf8;
1097 CREATE TABLE `creator_images` (
1098 `image_id` int(4) NOT NULL AUTO_INCREMENT,
1099 `imagefile` mediumblob,
1100 `image_name` char(20) NOT NULL DEFAULT 'DEFAULT',
1101 PRIMARY KEY (`image_id`),
1102 UNIQUE KEY `image_name_index` (`image_name`)
1103 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1106 -- Table structure for table `creator_layouts`
1109 DROP TABLE IF EXISTS `creator_layouts`;
1110 SET @saved_cs_client = @@character_set_client;
1111 SET character_set_client = utf8;
1112 CREATE TABLE `creator_layouts` (
1113 `layout_id` int(4) NOT NULL AUTO_INCREMENT,
1114 `barcode_type` char(100) NOT NULL DEFAULT 'CODE39',
1115 `start_label` int(2) NOT NULL DEFAULT '1',
1116 `printing_type` char(32) NOT NULL DEFAULT 'BAR',
1117 `layout_name` char(20) NOT NULL DEFAULT 'DEFAULT',
1118 `guidebox` int(1) DEFAULT '0',
1119 `font` char(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'TR',
1120 `font_size` int(4) NOT NULL DEFAULT '10',
1121 `units` char(20) NOT NULL DEFAULT 'POINT',
1122 `callnum_split` int(1) DEFAULT '0',
1123 `text_justify` char(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'L',
1124 `format_string` varchar(210) NOT NULL DEFAULT 'barcode',
1125 `layout_xml` text NOT NULL,
1126 `creator` char(15) NOT NULL DEFAULT 'Labels',
1127 PRIMARY KEY (`layout_id`)
1128 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1131 -- Table structure for table `creator_templates`
1134 DROP TABLE IF EXISTS `creator_templates`;
1135 SET @saved_cs_client = @@character_set_client;
1136 SET character_set_client = utf8;
1137 CREATE TABLE `creator_templates` (
1138 `template_id` int(4) NOT NULL AUTO_INCREMENT,
1139 `profile_id` int(4) DEFAULT NULL,
1140 `template_code` char(100) NOT NULL DEFAULT 'DEFAULT TEMPLATE',
1141 `template_desc` char(100) NOT NULL DEFAULT 'Default description',
1142 `page_width` float NOT NULL DEFAULT '0',
1143 `page_height` float NOT NULL DEFAULT '0',
1144 `label_width` float NOT NULL DEFAULT '0',
1145 `label_height` float NOT NULL DEFAULT '0',
1146 `top_text_margin` float NOT NULL DEFAULT '0',
1147 `left_text_margin` float NOT NULL DEFAULT '0',
1148 `top_margin` float NOT NULL DEFAULT '0',
1149 `left_margin` float NOT NULL DEFAULT '0',
1150 `cols` int(2) NOT NULL DEFAULT '0',
1151 `rows` int(2) NOT NULL DEFAULT '0',
1152 `col_gap` float NOT NULL DEFAULT '0',
1153 `row_gap` float NOT NULL DEFAULT '0',
1154 `units` char(20) NOT NULL DEFAULT 'POINT',
1155 `creator` char(15) NOT NULL DEFAULT 'Labels',
1156 PRIMARY KEY (`template_id`),
1157 KEY `template_profile_fk_constraint` (`profile_id`)
1158 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1161 -- Table structure for table `letter`
1164 DROP TABLE IF EXISTS `letter`;
1165 CREATE TABLE `letter` ( -- table for all notice templates in Koha
1166 `module` varchar(20) NOT NULL default '', -- Koha module that triggers this notice
1167 `code` varchar(20) NOT NULL default '', -- unique identifier for this notice
1168 `name` varchar(100) NOT NULL default '', -- plain text name for this notice
1169 `title` varchar(200) NOT NULL default '', -- subject line of the notice
1170 `content` text, -- body text for the notice
1171 PRIMARY KEY (`module`,`code`)
1172 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1175 -- Table structure for table `marc_subfield_structure`
1178 DROP TABLE IF EXISTS `marc_subfield_structure`;
1179 CREATE TABLE `marc_subfield_structure` (
1180 `tagfield` varchar(3) NOT NULL default '',
1181 `tagsubfield` varchar(1) NOT NULL default '' COLLATE utf8_bin,
1182 `liblibrarian` varchar(255) NOT NULL default '',
1183 `libopac` varchar(255) NOT NULL default '',
1184 `repeatable` tinyint(4) NOT NULL default 0,
1185 `mandatory` tinyint(4) NOT NULL default 0,
1186 `kohafield` varchar(40) default NULL,
1187 `tab` tinyint(1) default NULL,
1188 `authorised_value` varchar(20) default NULL,
1189 `authtypecode` varchar(20) default NULL,
1190 `value_builder` varchar(80) default NULL,
1191 `isurl` tinyint(1) default NULL,
1192 `hidden` tinyint(1) default NULL,
1193 `frameworkcode` varchar(4) NOT NULL default '',
1194 `seealso` varchar(1100) default NULL,
1195 `link` varchar(80) default NULL,
1196 `defaultvalue` text default NULL,
1197 PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`),
1198 KEY `kohafield_2` (`kohafield`),
1199 KEY `tab` (`frameworkcode`,`tab`),
1200 KEY `kohafield` (`frameworkcode`,`kohafield`)
1201 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1204 -- Table structure for table `marc_tag_structure`
1207 DROP TABLE IF EXISTS `marc_tag_structure`;
1208 CREATE TABLE `marc_tag_structure` (
1209 `tagfield` varchar(3) NOT NULL default '',
1210 `liblibrarian` varchar(255) NOT NULL default '',
1211 `libopac` varchar(255) NOT NULL default '',
1212 `repeatable` tinyint(4) NOT NULL default 0,
1213 `mandatory` tinyint(4) NOT NULL default 0,
1214 `authorised_value` varchar(10) default NULL,
1215 `frameworkcode` varchar(4) NOT NULL default '',
1216 PRIMARY KEY (`frameworkcode`,`tagfield`)
1217 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1220 -- Table structure for table `marc_matchers`
1223 DROP TABLE IF EXISTS `marc_matchers`;
1224 CREATE TABLE `marc_matchers` (
1225 `matcher_id` int(11) NOT NULL auto_increment,
1226 `code` varchar(10) NOT NULL default '',
1227 `description` varchar(255) NOT NULL default '',
1228 `record_type` varchar(10) NOT NULL default 'biblio',
1229 `threshold` int(11) NOT NULL default 0,
1230 PRIMARY KEY (`matcher_id`),
1231 KEY `code` (`code`),
1232 KEY `record_type` (`record_type`)
1233 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1236 -- Table structure for table `matchpoints`
1238 DROP TABLE IF EXISTS `matchpoints`;
1239 CREATE TABLE `matchpoints` (
1240 `matcher_id` int(11) NOT NULL,
1241 `matchpoint_id` int(11) NOT NULL auto_increment,
1242 `search_index` varchar(30) NOT NULL default '',
1243 `score` int(11) NOT NULL default 0,
1244 PRIMARY KEY (`matchpoint_id`),
1245 CONSTRAINT `matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`)
1246 REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE
1247 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1251 -- Table structure for table `matchpoint_components`
1253 DROP TABLE IF EXISTS `matchpoint_components`;
1254 CREATE TABLE `matchpoint_components` (
1255 `matchpoint_id` int(11) NOT NULL,
1256 `matchpoint_component_id` int(11) NOT NULL auto_increment,
1257 sequence int(11) NOT NULL default 0,
1258 tag varchar(3) NOT NULL default '',
1259 subfields varchar(40) NOT NULL default '',
1260 offset int(4) NOT NULL default 0,
1261 length int(4) NOT NULL default 0,
1262 PRIMARY KEY (`matchpoint_component_id`),
1263 KEY `by_sequence` (`matchpoint_id`, `sequence`),
1264 CONSTRAINT `matchpoint_components_ifbk_1` FOREIGN KEY (`matchpoint_id`)
1265 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
1266 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1269 -- Table structure for table `matcher_component_norms`
1271 DROP TABLE IF EXISTS `matchpoint_component_norms`;
1272 CREATE TABLE `matchpoint_component_norms` (
1273 `matchpoint_component_id` int(11) NOT NULL,
1274 `sequence` int(11) NOT NULL default 0,
1275 `norm_routine` varchar(50) NOT NULL default '',
1276 KEY `matchpoint_component_norms` (`matchpoint_component_id`, `sequence`),
1277 CONSTRAINT `matchpoint_component_norms_ifbk_1` FOREIGN KEY (`matchpoint_component_id`)
1278 REFERENCES `matchpoint_components` (`matchpoint_component_id`) ON DELETE CASCADE ON UPDATE CASCADE
1279 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1282 -- Table structure for table `matcher_matchpoints`
1284 DROP TABLE IF EXISTS `matcher_matchpoints`;
1285 CREATE TABLE `matcher_matchpoints` (
1286 `matcher_id` int(11) NOT NULL,
1287 `matchpoint_id` int(11) NOT NULL,
1288 CONSTRAINT `matcher_matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`)
1289 REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1290 CONSTRAINT `matcher_matchpoints_ifbk_2` FOREIGN KEY (`matchpoint_id`)
1291 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
1292 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1295 -- Table structure for table `matchchecks`
1297 DROP TABLE IF EXISTS `matchchecks`;
1298 CREATE TABLE `matchchecks` (
1299 `matcher_id` int(11) NOT NULL,
1300 `matchcheck_id` int(11) NOT NULL auto_increment,
1301 `source_matchpoint_id` int(11) NOT NULL,
1302 `target_matchpoint_id` int(11) NOT NULL,
1303 PRIMARY KEY (`matchcheck_id`),
1304 CONSTRAINT `matcher_matchchecks_ifbk_1` FOREIGN KEY (`matcher_id`)
1305 REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1306 CONSTRAINT `matcher_matchchecks_ifbk_2` FOREIGN KEY (`source_matchpoint_id`)
1307 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1308 CONSTRAINT `matcher_matchchecks_ifbk_3` FOREIGN KEY (`target_matchpoint_id`)
1309 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
1310 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1313 -- Table structure for table `notifys`
1316 DROP TABLE IF EXISTS `notifys`;
1317 CREATE TABLE `notifys` (
1318 `notify_id` int(11) NOT NULL default 0,
1319 `borrowernumber` int(11) NOT NULL default 0,
1320 `itemnumber` int(11) NOT NULL default 0,
1321 `notify_date` date default NULL,
1322 `notify_send_date` date default NULL,
1323 `notify_level` int(1) NOT NULL default 0,
1324 `method` varchar(20) NOT NULL default ''
1325 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1328 -- Table structure for table `nozebra`
1331 DROP TABLE IF EXISTS `nozebra`;
1332 CREATE TABLE `nozebra` (
1333 `server` varchar(20) NOT NULL,
1334 `indexname` varchar(40) NOT NULL,
1335 `value` varchar(250) NOT NULL,
1336 `biblionumbers` longtext NOT NULL,
1337 KEY `indexname` (`server`,`indexname`),
1338 KEY `value` (`server`,`value`))
1339 ENGINE=InnoDB DEFAULT CHARSET=utf8;
1342 -- Table structure for table `old_issues`
1345 DROP TABLE IF EXISTS `old_issues`;
1346 CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
1347 `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1348 `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
1349 `date_due` date default NULL, -- date the item is due (yyyy-mm-dd)
1350 `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
1351 `issuingbranch` varchar(18) default NULL,
1352 `returndate` date default NULL, -- date the item was returned
1353 `lastreneweddate` date default NULL, -- date the item was last renewed
1354 `return` varchar(4) default NULL,
1355 `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
1356 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1357 `issuedate` date default NULL, -- date the item was checked out or issued
1358 KEY `old_issuesborridx` (`borrowernumber`),
1359 KEY `old_issuesitemidx` (`itemnumber`),
1360 KEY `old_bordate` (`borrowernumber`,`timestamp`),
1361 CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
1362 ON DELETE SET NULL ON UPDATE SET NULL,
1363 CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`)
1364 ON DELETE SET NULL ON UPDATE SET NULL
1365 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1368 -- Table structure for table `old_reserves`
1370 DROP TABLE IF EXISTS `old_reserves`;
1371 CREATE TABLE `old_reserves` (
1372 `borrowernumber` int(11) default NULL,
1373 `reservedate` date default NULL,
1374 `biblionumber` int(11) default NULL,
1375 `constrainttype` varchar(1) default NULL,
1376 `branchcode` varchar(10) default NULL,
1377 `notificationdate` date default NULL,
1378 `reminderdate` date default NULL,
1379 `cancellationdate` date default NULL,
1380 `reservenotes` mediumtext,
1381 `priority` smallint(6) default NULL,
1382 `found` varchar(1) default NULL,
1383 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
1384 `itemnumber` int(11) default NULL,
1385 `waitingdate` date default NULL,
1386 `expirationdate` DATE DEFAULT NULL,
1387 `lowestPriority` tinyint(1) NOT NULL,
1388 KEY `old_reserves_borrowernumber` (`borrowernumber`),
1389 KEY `old_reserves_biblionumber` (`biblionumber`),
1390 KEY `old_reserves_itemnumber` (`itemnumber`),
1391 KEY `old_reserves_branchcode` (`branchcode`),
1392 CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
1393 ON DELETE SET NULL ON UPDATE SET NULL,
1394 CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`)
1395 ON DELETE SET NULL ON UPDATE SET NULL,
1396 CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`)
1397 ON DELETE SET NULL ON UPDATE SET NULL
1398 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1401 -- Table structure for table `opac_news`
1404 DROP TABLE IF EXISTS `opac_news`;
1405 CREATE TABLE `opac_news` ( -- data from the news tool
1406 `idnew` int(10) unsigned NOT NULL auto_increment, -- unique identifier for the news article
1407 `title` varchar(250) NOT NULL default '', -- title of the news article
1408 `new` text NOT NULL, -- the body of your news article
1409 `lang` varchar(25) NOT NULL default '', -- location for the article (koha is the staff client, slip is the circulation receipt and language codes are for the opac)
1410 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, -- pulibcation date and time
1411 `expirationdate` date default NULL, -- date the article is set to expire or no longer be visible
1412 `number` int(11) default NULL, -- the order in which this article appears in that specific location
1413 PRIMARY KEY (`idnew`)
1414 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1417 -- Table structure for table `overduerules`
1420 DROP TABLE IF EXISTS `overduerules`;
1421 CREATE TABLE `overduerules` ( -- overdue notice status and triggers
1422 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table to define which branch this rule is for (if blank it's all libraries)
1423 `categorycode` varchar(10) NOT NULL default '', -- foreign key from the categories table to define which patron category this rule is for
1424 `delay1` int(4) default NULL, -- number of days after the item is overdue that the first notice is sent
1425 `letter1` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the first notice
1426 `debarred1` varchar(1) default 0, -- is the patron restricted when the first notice is sent (1 for yes, 0 for no)
1427 `delay2` int(4) default NULL, -- number of days after the item is overdue that the second notice is sent
1428 `debarred2` varchar(1) default 0, -- is the patron restricted when the second notice is sent (1 for yes, 0 for no)
1429 `letter2` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the second notice
1430 `delay3` int(4) default NULL, -- number of days after the item is overdue that the third notice is sent
1431 `letter3` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the third notice
1432 `debarred3` int(1) default 0, -- is the patron restricted when the third notice is sent (1 for yes, 0 for no)
1433 PRIMARY KEY (`branchcode`,`categorycode`)
1434 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1437 -- Table structure for table `patroncards`
1440 DROP TABLE IF EXISTS `patroncards`;
1441 CREATE TABLE `patroncards` (
1442 `cardid` int(11) NOT NULL auto_increment,
1443 `batch_id` varchar(10) NOT NULL default '1',
1444 `borrowernumber` int(11) NOT NULL,
1445 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
1446 PRIMARY KEY (`cardid`),
1447 KEY `patroncards_ibfk_1` (`borrowernumber`),
1448 CONSTRAINT `patroncards_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1449 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1452 -- Table structure for table `patronimage`
1455 DROP TABLE IF EXISTS `patronimage`;
1456 CREATE TABLE `patronimage` (
1457 `cardnumber` varchar(16) NOT NULL,
1458 `mimetype` varchar(15) NOT NULL,
1459 `imagefile` mediumblob NOT NULL,
1460 PRIMARY KEY (`cardnumber`),
1461 CONSTRAINT `patronimage_fk1` FOREIGN KEY (`cardnumber`) REFERENCES `borrowers` (`cardnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1462 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1465 -- Table structure for table `printers`
1468 DROP TABLE IF EXISTS `printers`;
1469 CREATE TABLE `printers` (
1470 `printername` varchar(40) NOT NULL default '',
1471 `printqueue` varchar(20) default NULL,
1472 `printtype` varchar(20) default NULL,
1473 PRIMARY KEY (`printername`)
1474 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1477 -- Table structure for table `printers_profile`
1480 DROP TABLE IF EXISTS `printers_profile`;
1481 CREATE TABLE `printers_profile` (
1482 `profile_id` int(4) NOT NULL auto_increment,
1483 `printer_name` varchar(40) NOT NULL default 'Default Printer',
1484 `template_id` int(4) NOT NULL default '0',
1485 `paper_bin` varchar(20) NOT NULL default 'Bypass',
1486 `offset_horz` float NOT NULL default '0',
1487 `offset_vert` float NOT NULL default '0',
1488 `creep_horz` float NOT NULL default '0',
1489 `creep_vert` float NOT NULL default '0',
1490 `units` char(20) NOT NULL default 'POINT',
1491 `creator` char(15) NOT NULL DEFAULT 'Labels',
1492 PRIMARY KEY (`profile_id`),
1493 UNIQUE KEY `printername` (`printer_name`,`template_id`,`paper_bin`,`creator`)
1494 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1497 -- Table structure for table `repeatable_holidays`
1500 DROP TABLE IF EXISTS `repeatable_holidays`;
1501 CREATE TABLE `repeatable_holidays` ( -- information for the days the library is closed
1502 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1503 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, defines which branch this closing is for
1504 `weekday` smallint(6) default NULL, -- day of the week (0=Sunday, 1=Monday, etc) this closing is repeated on
1505 `day` smallint(6) default NULL, -- day of the month this closing is on
1506 `month` smallint(6) default NULL, -- month this closing is in
1507 `title` varchar(50) NOT NULL default '', -- title of this closing
1508 `description` text NOT NULL, -- description for this closing
1510 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1513 -- Table structure for table `reports_dictionary`
1516 DROP TABLE IF EXISTS `reports_dictionary`;
1517 CREATE TABLE reports_dictionary ( -- definitions (or snippets of SQL) stored for use in reports
1518 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1519 `name` varchar(255) default NULL, -- name for this definition
1520 `description` text, -- description for this definition
1521 `date_created` datetime default NULL, -- date and time this definition was created
1522 `date_modified` datetime default NULL, -- date and time this definition was last modified
1523 `saved_sql` text, -- SQL snippet for us in reports
1524 `area` int(11) default NULL, -- Koha module this definition is for (1 = Circulation, 2 = Catalog, 3 = Patrons, 4 = Acquistions, 5 = Accounts)
1526 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1529 -- Table structure for table `reserveconstraints`
1532 DROP TABLE IF EXISTS `reserveconstraints`;
1533 CREATE TABLE `reserveconstraints` (
1534 `borrowernumber` int(11) NOT NULL default 0,
1535 `reservedate` date default NULL,
1536 `biblionumber` int(11) NOT NULL default 0,
1537 `biblioitemnumber` int(11) default NULL,
1538 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
1539 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1542 -- Table structure for table `reserves`
1545 DROP TABLE IF EXISTS `reserves`;
1546 CREATE TABLE `reserves` (
1547 `borrowernumber` int(11) NOT NULL default 0,
1548 `reservedate` date default NULL,
1549 `biblionumber` int(11) NOT NULL default 0,
1550 `constrainttype` varchar(1) default NULL,
1551 `branchcode` varchar(10) default NULL,
1552 `notificationdate` date default NULL,
1553 `reminderdate` date default NULL,
1554 `cancellationdate` date default NULL,
1555 `reservenotes` mediumtext,
1556 `priority` smallint(6) default NULL,
1557 `found` varchar(1) default NULL,
1558 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
1559 `itemnumber` int(11) default NULL,
1560 `waitingdate` date default NULL,
1561 `expirationdate` DATE DEFAULT NULL,
1562 `lowestPriority` tinyint(1) NOT NULL,
1563 KEY priorityfoundidx (priority,found),
1564 KEY `borrowernumber` (`borrowernumber`),
1565 KEY `biblionumber` (`biblionumber`),
1566 KEY `itemnumber` (`itemnumber`),
1567 KEY `branchcode` (`branchcode`),
1568 CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1569 CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1570 CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1571 CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1572 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1575 -- Table structure for table `reviews`
1578 DROP TABLE IF EXISTS `reviews`;
1579 CREATE TABLE `reviews` ( -- patron opac comments
1580 `reviewid` int(11) NOT NULL auto_increment, -- unique identifier for this comment
1581 `borrowernumber` int(11) default NULL, -- foreign key from the borrowers table defining which patron left this comment
1582 `biblionumber` int(11) default NULL, -- foreign key from the biblio table defining which bibliographic record this comment is for
1583 `review` text, -- the body of the comment
1584 `approved` tinyint(4) default NULL, -- whether this comment has been approved by a librarian (1 for yes, 0 for no)
1585 `datereviewed` datetime default NULL, -- the date the comment was left
1586 PRIMARY KEY (`reviewid`)
1587 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1590 -- Table structure for table `roadtype`
1593 DROP TABLE IF EXISTS `roadtype`;
1594 CREATE TABLE `roadtype` ( -- road types defined in administration and used in patron management
1595 `roadtypeid` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha for each road type
1596 `road_type` varchar(100) NOT NULL default '', -- text for road type
1597 PRIMARY KEY (`roadtypeid`)
1598 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1601 -- Table structure for table `saved_sql`
1604 DROP TABLE IF EXISTS `saved_sql`;
1605 CREATE TABLE saved_sql (
1606 `id` int(11) NOT NULL auto_increment,
1607 `borrowernumber` int(11) default NULL,
1608 `date_created` datetime default NULL,
1609 `last_modified` datetime default NULL,
1611 `last_run` datetime default NULL,
1612 `report_name` varchar(255) default NULL,
1613 `type` varchar(255) default NULL,
1616 KEY boridx (`borrowernumber`)
1617 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1621 -- Table structure for `saved_reports`
1624 DROP TABLE IF EXISTS `saved_reports`;
1625 CREATE TABLE saved_reports (
1626 `id` int(11) NOT NULL auto_increment,
1627 `report_id` int(11) default NULL,
1629 `date_run` datetime default NULL,
1631 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1635 -- Table structure for table `search_history`
1638 DROP TABLE IF EXISTS `search_history`;
1639 CREATE TABLE IF NOT EXISTS `search_history` (
1640 `userid` int(11) NOT NULL,
1641 `sessionid` varchar(32) NOT NULL,
1642 `query_desc` varchar(255) NOT NULL,
1643 `query_cgi` varchar(255) NOT NULL,
1644 `total` int(11) NOT NULL,
1645 `time` timestamp NOT NULL default CURRENT_TIMESTAMP,
1646 KEY `userid` (`userid`),
1647 KEY `sessionid` (`sessionid`)
1648 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Opac search history results';
1652 -- Table structure for table `serial`
1655 DROP TABLE IF EXISTS `serial`;
1656 CREATE TABLE `serial` (
1657 `serialid` int(11) NOT NULL auto_increment,
1658 `biblionumber` varchar(100) NOT NULL default '',
1659 `subscriptionid` varchar(100) NOT NULL default '',
1660 `serialseq` varchar(100) NOT NULL default '',
1661 `status` tinyint(4) NOT NULL default 0,
1662 `planneddate` date default NULL,
1664 `publisheddate` date default NULL,
1665 `itemnumber` text default NULL,
1666 `claimdate` date default NULL,
1667 `routingnotes` text,
1668 PRIMARY KEY (`serialid`)
1669 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1672 -- Table structure for table `sessions`
1675 DROP TABLE IF EXISTS sessions;
1676 CREATE TABLE sessions (
1677 `id` varchar(32) NOT NULL,
1678 `a_session` text NOT NULL,
1680 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1683 -- Table structure for table `special_holidays`
1686 DROP TABLE IF EXISTS `special_holidays`;
1687 CREATE TABLE `special_holidays` ( -- non repeatable holidays/library closings
1688 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1689 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, defines which branch this closing is for
1690 `day` smallint(6) NOT NULL default 0, -- day of the month this closing is on
1691 `month` smallint(6) NOT NULL default 0, -- month this closing is in
1692 `year` smallint(6) NOT NULL default 0, -- year this closing is in
1693 `isexception` smallint(1) NOT NULL default 1, -- is this a holiday exception to a repeatable holiday (1 for yes, 0 for no)
1694 `title` varchar(50) NOT NULL default '', -- title for this closing
1695 `description` text NOT NULL, -- description of this closing
1697 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1700 -- Table structure for table `statistics`
1703 DROP TABLE IF EXISTS `statistics`;
1704 CREATE TABLE `statistics` ( -- information related to transactions (circulation and fines) in Koha
1705 `datetime` datetime default NULL, -- date and time of the transaction
1706 `branch` varchar(10) default NULL, -- foreign key, branch where the transaction occurred
1707 `proccode` varchar(4) default NULL, -- proceedure code
1708 `value` double(16,4) default NULL, -- monetary value associated with the transaction
1709 `type` varchar(16) default NULL, -- transaction type (locause, issue, return, renew, writeoff, payment, Credit*)
1711 `usercode` varchar(10) default NULL,
1712 `itemnumber` int(11) default NULL, -- foreign key from the items table, links transaction to a specific item
1713 `itemtype` varchar(10) default NULL, -- foreign key from the itemtypes table, links transaction to a specific item type
1714 `borrowernumber` int(11) default NULL, -- foreign key from the borrowers table, links transaction to a specific borrower
1715 `associatedborrower` int(11) default NULL,
1716 KEY `timeidx` (`datetime`)
1717 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1720 -- Table structure for table `stopwords`
1723 DROP TABLE IF EXISTS `stopwords`;
1724 CREATE TABLE `stopwords` (
1725 `word` varchar(255) default NULL
1726 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1729 -- Table structure for table `subscription`
1732 DROP TABLE IF EXISTS `subscription`;
1733 CREATE TABLE `subscription` (
1734 `biblionumber` int(11) NOT NULL default 0,
1735 `subscriptionid` int(11) NOT NULL auto_increment,
1736 `librarian` varchar(100) default '',
1737 `startdate` date default NULL,
1738 `aqbooksellerid` int(11) default 0,
1739 `cost` int(11) default 0,
1740 `aqbudgetid` int(11) default 0,
1741 `weeklength` int(11) default 0,
1742 `monthlength` int(11) default 0,
1743 `numberlength` int(11) default 0,
1744 `periodicity` tinyint(4) default 0,
1745 `dow` varchar(100) default '',
1746 `numberingmethod` varchar(100) default '',
1748 `status` varchar(100) NOT NULL default '',
1749 `add1` int(11) default 0,
1750 `every1` int(11) default 0,
1751 `whenmorethan1` int(11) default 0,
1752 `setto1` int(11) default NULL,
1753 `lastvalue1` int(11) default NULL,
1754 `add2` int(11) default 0,
1755 `every2` int(11) default 0,
1756 `whenmorethan2` int(11) default 0,
1757 `setto2` int(11) default NULL,
1758 `lastvalue2` int(11) default NULL,
1759 `add3` int(11) default 0,
1760 `every3` int(11) default 0,
1761 `innerloop1` int(11) default 0,
1762 `innerloop2` int(11) default 0,
1763 `innerloop3` int(11) default 0,
1764 `whenmorethan3` int(11) default 0,
1765 `setto3` int(11) default NULL,
1766 `lastvalue3` int(11) default NULL,
1767 `issuesatonce` tinyint(3) NOT NULL default 1,
1768 `firstacquidate` date default NULL,
1769 `manualhistory` tinyint(1) NOT NULL default 0,
1770 `irregularity` text,
1771 `letter` varchar(20) default NULL,
1772 `numberpattern` tinyint(3) default 0,
1773 `distributedto` text,
1774 `internalnotes` longtext,
1776 `location` varchar(80) NULL default '',
1777 `branchcode` varchar(10) NOT NULL default '',
1778 `hemisphere` tinyint(3) default 0,
1779 `lastbranch` varchar(10),
1780 `serialsadditems` tinyint(1) NOT NULL default '0',
1781 `staffdisplaycount` VARCHAR(10) NULL,
1782 `opacdisplaycount` VARCHAR(10) NULL,
1783 `graceperiod` int(11) NOT NULL default '0',
1784 `enddate` date default NULL,
1785 PRIMARY KEY (`subscriptionid`)
1786 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1789 -- Table structure for table `subscriptionhistory`
1792 DROP TABLE IF EXISTS `subscriptionhistory`;
1793 CREATE TABLE `subscriptionhistory` (
1794 `biblionumber` int(11) NOT NULL default 0,
1795 `subscriptionid` int(11) NOT NULL default 0,
1796 `histstartdate` date default NULL,
1797 `histenddate` date default NULL,
1798 `missinglist` longtext NOT NULL,
1799 `recievedlist` longtext NOT NULL,
1800 `opacnote` varchar(150) NOT NULL default '',
1801 `librariannote` varchar(150) NOT NULL default '',
1802 PRIMARY KEY (`subscriptionid`),
1803 KEY `biblionumber` (`biblionumber`)
1804 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1807 -- Table structure for table `subscriptionroutinglist`
1810 DROP TABLE IF EXISTS `subscriptionroutinglist`;
1811 CREATE TABLE `subscriptionroutinglist` ( -- information related to the routing lists attached to subscriptions
1812 `routingid` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1813 `borrowernumber` int(11) NOT NULL, -- foreign key from the borrowers table, defines with patron is on the routing list
1814 `ranking` int(11) default NULL, -- where the patron stands in line to receive the serial
1815 `subscriptionid` int(11) NOT NULL, -- foreign key from the subscription table, defines which subscription this routing list is for
1816 PRIMARY KEY (`routingid`),
1817 UNIQUE (`subscriptionid`, `borrowernumber`),
1818 CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
1819 ON DELETE CASCADE ON UPDATE CASCADE,
1820 CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`)
1821 ON DELETE CASCADE ON UPDATE CASCADE
1822 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1825 -- Table structure for table `suggestions`
1828 DROP TABLE IF EXISTS `suggestions`;
1829 CREATE TABLE `suggestions` ( -- purchase suggestions
1830 `suggestionid` int(8) NOT NULL auto_increment, -- unique identifier assigned automatically by Koha
1831 `suggestedby` int(11) NOT NULL default 0, -- borrowernumber for the person making the suggestion, foreign key linking to the borrowers table
1832 `suggesteddate` date NOT NULL default 0, -- date the suggestion was submitted
1833 `managedby` int(11) default NULL, -- borrowernumber for the librarian managing the suggestion, foreign key linking to the borrowers table
1834 `manageddate` date default NULL, -- date the suggestion was updated
1835 acceptedby INT(11) default NULL, -- borrowernumber for the librarian who accepted the suggestion, foreign key linking to the borrowers table
1836 accepteddate date default NULL, -- date the suggestion was marked as accepted
1837 rejectedby INT(11) default NULL, -- borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table
1838 rejecteddate date default NULL, -- date the suggestion was marked as rejected
1839 `STATUS` varchar(10) NOT NULL default '', -- suggestion status (ASKED, CHECKED, ACCEPTED, or REJECTED)
1840 `note` mediumtext, -- note entered on the suggestion
1841 `author` varchar(80) default NULL, -- author of the suggested item
1842 `title` varchar(80) default NULL, -- title of the suggested item
1843 `copyrightdate` smallint(6) default NULL, -- copyright date of the suggested item
1844 `publishercode` varchar(255) default NULL, -- publisher of the suggested item
1845 `date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time the suggestion was updated
1846 `volumedesc` varchar(255) default NULL,
1847 `publicationyear` smallint(6) default 0,
1848 `place` varchar(255) default NULL, -- publication place of the suggested item
1849 `isbn` varchar(30) default NULL, -- isbn of the suggested item
1850 `mailoverseeing` smallint(1) default 0,
1851 `biblionumber` int(11) default NULL, -- foreign key linking the suggestion to the biblio table after the suggestion has been ordered
1852 `reason` text, -- reason for making the suggestion
1853 budgetid INT(11), -- foreign key linking the suggested budget to the aqbudgets table
1854 branchcode VARCHAR(10) default NULL, -- foreign key linking the suggested branch to the branches table
1855 collectiontitle text default NULL, -- collection name for the suggested item
1856 itemtype VARCHAR(30) default NULL, -- suggested item type
1857 quantity SMALLINT(6) default NULL, -- suggested quantity to be purchased
1858 currency VARCHAR(3) default NULL, -- suggested currency for the suggested price
1859 price DECIMAL(28,6) default NULL, -- suggested price
1860 total DECIMAL(28,6) default NULL, -- suggested total cost (price*quantity updated for currency)
1861 PRIMARY KEY (`suggestionid`),
1862 KEY `suggestedby` (`suggestedby`),
1863 KEY `managedby` (`managedby`)
1864 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1867 -- Table structure for table `systempreferences`
1870 DROP TABLE IF EXISTS `systempreferences`;
1871 CREATE TABLE `systempreferences` ( -- global system preferences
1872 `variable` varchar(50) NOT NULL default '', -- system preference name
1873 `value` text, -- system preference values
1874 `options` mediumtext, -- options for multiple choice system preferences
1875 `explanation` text, -- descriptive text for the system preference
1876 `type` varchar(20) default NULL, -- type of question this preference asks (multiple choice, plain text, yes or no, etc)
1877 PRIMARY KEY (`variable`)
1878 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1881 -- Table structure for table `tags`
1884 DROP TABLE IF EXISTS `tags`;
1885 CREATE TABLE `tags` (
1886 `entry` varchar(255) NOT NULL default '',
1887 `weight` bigint(20) NOT NULL default 0,
1888 PRIMARY KEY (`entry`)
1889 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1892 -- Table structure for table `tags_all`
1895 DROP TABLE IF EXISTS `tags_all`;
1896 CREATE TABLE `tags_all` (
1897 `tag_id` int(11) NOT NULL auto_increment,
1898 `borrowernumber` int(11) NOT NULL,
1899 `biblionumber` int(11) NOT NULL,
1900 `term` varchar(255) NOT NULL,
1901 `language` int(4) default NULL,
1902 `date_created` datetime NOT NULL,
1903 PRIMARY KEY (`tag_id`),
1904 KEY `tags_borrowers_fk_1` (`borrowernumber`),
1905 KEY `tags_biblionumber_fk_1` (`biblionumber`),
1906 CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`)
1907 REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1908 CONSTRAINT `tags_biblionumber_fk_1` FOREIGN KEY (`biblionumber`)
1909 REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1910 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1913 -- Table structure for table `tags_approval`
1916 DROP TABLE IF EXISTS `tags_approval`;
1917 CREATE TABLE `tags_approval` (
1918 `term` varchar(255) NOT NULL,
1919 `approved` int(1) NOT NULL default '0',
1920 `date_approved` datetime default NULL,
1921 `approved_by` int(11) default NULL,
1922 `weight_total` int(9) NOT NULL default '1',
1923 PRIMARY KEY (`term`),
1924 KEY `tags_approval_borrowers_fk_1` (`approved_by`),
1925 CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`)
1926 REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1927 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1930 -- Table structure for table `tags_index`
1933 DROP TABLE IF EXISTS `tags_index`;
1934 CREATE TABLE `tags_index` (
1935 `term` varchar(255) NOT NULL,
1936 `biblionumber` int(11) NOT NULL,
1937 `weight` int(9) NOT NULL default '1',
1938 PRIMARY KEY (`term`,`biblionumber`),
1939 KEY `tags_index_biblionumber_fk_1` (`biblionumber`),
1940 CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`)
1941 REFERENCES `tags_approval` (`term`) ON DELETE CASCADE ON UPDATE CASCADE,
1942 CONSTRAINT `tags_index_biblionumber_fk_1` FOREIGN KEY (`biblionumber`)
1943 REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1944 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1947 -- Table structure for table `userflags`
1950 DROP TABLE IF EXISTS `userflags`;
1951 CREATE TABLE `userflags` (
1952 `bit` int(11) NOT NULL default 0,
1953 `flag` varchar(30) default NULL,
1954 `flagdesc` varchar(255) default NULL,
1955 `defaulton` int(11) default NULL,
1957 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1960 -- Table structure for table `virtualshelves`
1963 DROP TABLE IF EXISTS `virtualshelves`;
1964 CREATE TABLE `virtualshelves` ( -- information about lists (or virtual shelves)
1965 `shelfnumber` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1966 `shelfname` varchar(255) default NULL, -- name of the list
1967 `owner` varchar(80) default NULL, -- foriegn key linking to the borrowers table (using borrowernumber) for the creator of this list
1968 `category` varchar(1) default NULL, -- type of list (public [2], private [1] or open [3])
1969 `sortfield` varchar(16) default NULL, -- the field this list is sorted on
1970 `lastmodified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time the list was last modified
1971 PRIMARY KEY (`shelfnumber`)
1972 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1975 -- Table structure for table `virtualshelfcontents`
1978 DROP TABLE IF EXISTS `virtualshelfcontents`;
1979 CREATE TABLE `virtualshelfcontents` ( -- information about the titles in a list (or virtual shelf)
1980 `shelfnumber` int(11) NOT NULL default 0, -- foreign key linking to the virtualshelves table, defines the list that this record has been added to
1981 `biblionumber` int(11) NOT NULL default 0, -- foreign key linking to the biblio table, defines the bib record that has been added to the list
1982 `flags` int(11) default NULL,
1983 `dateadded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- date and time this bib record was added to the list
1984 KEY `shelfnumber` (`shelfnumber`),
1985 KEY `biblionumber` (`biblionumber`),
1986 CONSTRAINT `virtualshelfcontents_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1987 CONSTRAINT `shelfcontents_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1988 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1991 -- Table structure for table `z3950servers`
1994 DROP TABLE IF EXISTS `z3950servers`;
1995 CREATE TABLE `z3950servers` ( -- connection information for the Z39.50 targets used in cataloging
1996 `host` varchar(255) default NULL, -- target's host name
1997 `port` int(11) default NULL, -- port number used to connect to target
1998 `db` varchar(255) default NULL, -- target's database name
1999 `userid` varchar(255) default NULL, -- username needed to log in to target
2000 `password` varchar(255) default NULL, -- password needed to log in to target
2001 `name` mediumtext, -- name given to the target by the library
2002 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2003 `checked` smallint(6) default NULL, -- whether this target is checked by default (1 for yes, 0 for no)
2004 `rank` int(11) default NULL, -- where this target appears in the list of targets
2005 `syntax` varchar(80) default NULL, -- marc format provided by this target
2006 `icon` text, -- unused in Koha
2007 `position` enum('primary','secondary','') NOT NULL default 'primary',
2008 `type` enum('zed','opensearch') NOT NULL default 'zed',
2009 `encoding` text default NULL, -- characters encoding provided by this target
2010 `description` text NOT NULL, -- unused in Koha
2012 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2015 -- Table structure for table `zebraqueue`
2018 DROP TABLE IF EXISTS `zebraqueue`;
2019 CREATE TABLE `zebraqueue` (
2020 `id` int(11) NOT NULL auto_increment,
2021 `biblio_auth_number` bigint(20) unsigned NOT NULL default '0',
2022 `operation` char(20) NOT NULL default '',
2023 `server` char(20) NOT NULL default '',
2024 `done` int(11) NOT NULL default '0',
2025 `time` timestamp NOT NULL default CURRENT_TIMESTAMP,
2027 KEY `zebraqueue_lookup` (`server`, `biblio_auth_number`, `operation`, `done`)
2028 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2031 -- Table structure for table `services_throttle`
2034 DROP TABLE IF EXISTS `services_throttle`;
2035 CREATE TABLE `services_throttle` (
2036 `service_type` varchar(10) NOT NULL default '',
2037 `service_count` varchar(45) default NULL,
2038 PRIMARY KEY (`service_type`)
2039 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2042 -- Table structure for table `language_subtag_registry`
2043 -- http://www.w3.org/International/articles/language-tags/
2047 DROP TABLE IF EXISTS language_subtag_registry;
2048 CREATE TABLE language_subtag_registry (
2050 type varchar(25), -- language-script-region-variant-extension-privateuse
2051 description varchar(25), -- only one of the possible descriptions for ease of reference, see language_descriptions for the complete list
2053 id int(11) NOT NULL auto_increment,
2055 KEY `subtag` (`subtag`)
2056 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2059 -- Table structure for table `language_rfc4646_to_iso639`
2060 -- TODO: add suppress_scripts
2061 -- this maps three letter codes defined in iso639.2 back to their
2062 -- two letter equivilents in rfc4646 (LOC maintains iso639+)
2065 DROP TABLE IF EXISTS language_rfc4646_to_iso639;
2066 CREATE TABLE language_rfc4646_to_iso639 (
2067 rfc4646_subtag varchar(25),
2068 iso639_2_code varchar(25),
2069 id int(11) NOT NULL auto_increment,
2071 KEY `rfc4646_subtag` (`rfc4646_subtag`)
2072 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2075 -- Table structure for table `language_descriptions`
2078 DROP TABLE IF EXISTS language_descriptions;
2079 CREATE TABLE language_descriptions (
2083 description varchar(255),
2084 id int(11) NOT NULL auto_increment,
2086 KEY `lang` (`lang`),
2087 KEY `subtag_type_lang` (`subtag`, `type`, `lang`)
2088 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2091 -- Table structure for table `language_script_bidi`
2092 -- bi-directional support, keyed by script subcode
2095 DROP TABLE IF EXISTS language_script_bidi;
2096 CREATE TABLE language_script_bidi (
2097 rfc4646_subtag varchar(25), -- script subtag, Arab, Hebr, etc.
2098 bidi varchar(3), -- rtl ltr
2099 KEY `rfc4646_subtag` (`rfc4646_subtag`)
2100 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2103 -- Table structure for table `language_script_mapping`
2104 -- TODO: need to map language subtags to script subtags for detection
2105 -- of bidi when script is not specified (like ar, he)
2108 DROP TABLE IF EXISTS language_script_mapping;
2109 CREATE TABLE language_script_mapping (
2110 language_subtag varchar(25),
2111 script_subtag varchar(25),
2112 KEY `language_subtag` (`language_subtag`)
2113 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2116 -- Table structure for table `permissions`
2119 DROP TABLE IF EXISTS `permissions`;
2120 CREATE TABLE `permissions` (
2121 `module_bit` int(11) NOT NULL DEFAULT 0,
2122 `code` varchar(64) DEFAULT NULL,
2123 `description` varchar(255) DEFAULT NULL,
2124 PRIMARY KEY (`module_bit`, `code`),
2125 CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`)
2126 ON DELETE CASCADE ON UPDATE CASCADE
2127 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2130 -- Table structure for table `serialitems`
2133 DROP TABLE IF EXISTS `serialitems`;
2134 CREATE TABLE `serialitems` (
2135 `itemnumber` int(11) NOT NULL,
2136 `serialid` int(11) NOT NULL,
2137 UNIQUE KEY `serialitemsidx` (`itemnumber`),
2138 KEY `serialitems_sfk_1` (`serialid`),
2139 CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE,
2140 CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
2141 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2144 -- Table structure for table `user_permissions`
2147 DROP TABLE IF EXISTS `user_permissions`;
2148 CREATE TABLE `user_permissions` (
2149 `borrowernumber` int(11) NOT NULL DEFAULT 0,
2150 `module_bit` int(11) NOT NULL DEFAULT 0,
2151 `code` varchar(64) DEFAULT NULL,
2152 CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
2153 ON DELETE CASCADE ON UPDATE CASCADE,
2154 CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`)
2155 ON DELETE CASCADE ON UPDATE CASCADE
2156 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2159 -- Table structure for table `tmp_holdsqueue`
2162 DROP TABLE IF EXISTS `tmp_holdsqueue`;
2163 CREATE TABLE `tmp_holdsqueue` (
2164 `biblionumber` int(11) default NULL,
2165 `itemnumber` int(11) default NULL,
2166 `barcode` varchar(20) default NULL,
2167 `surname` mediumtext NOT NULL,
2170 `borrowernumber` int(11) NOT NULL,
2171 `cardnumber` varchar(16) default NULL,
2172 `reservedate` date default NULL,
2174 `itemcallnumber` varchar(255) default NULL,
2175 `holdingbranch` varchar(10) default NULL,
2176 `pickbranch` varchar(10) default NULL,
2178 `item_level_request` tinyint(4) NOT NULL default 0
2179 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2182 -- Table structure for table `message_queue`
2185 DROP TABLE IF EXISTS `message_queue`;
2186 CREATE TABLE `message_queue` (
2187 `message_id` int(11) NOT NULL auto_increment,
2188 `borrowernumber` int(11) default NULL,
2191 `metadata` text DEFAULT NULL,
2192 `letter_code` varchar(64) DEFAULT NULL,
2193 `message_transport_type` varchar(20) NOT NULL,
2194 `status` enum('sent','pending','failed','deleted') NOT NULL default 'pending',
2195 `time_queued` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2196 `to_address` mediumtext,
2197 `from_address` mediumtext,
2198 `content_type` text,
2199 KEY `message_id` (`message_id`),
2200 KEY `borrowernumber` (`borrowernumber`),
2201 KEY `message_transport_type` (`message_transport_type`),
2202 CONSTRAINT `messageq_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2203 CONSTRAINT `messageq_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE RESTRICT ON UPDATE CASCADE
2204 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2207 -- Table structure for table `message_transport_types`
2210 DROP TABLE IF EXISTS `message_transport_types`;
2211 CREATE TABLE `message_transport_types` (
2212 `message_transport_type` varchar(20) NOT NULL,
2213 PRIMARY KEY (`message_transport_type`)
2214 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2217 -- Table structure for table `message_attributes`
2220 DROP TABLE IF EXISTS `message_attributes`;
2221 CREATE TABLE `message_attributes` (
2222 `message_attribute_id` int(11) NOT NULL auto_increment,
2223 `message_name` varchar(40) NOT NULL default '',
2224 `takes_days` tinyint(1) NOT NULL default '0',
2225 PRIMARY KEY (`message_attribute_id`),
2226 UNIQUE KEY `message_name` (`message_name`)
2227 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2230 -- Table structure for table `message_transports`
2233 DROP TABLE IF EXISTS `message_transports`;
2234 CREATE TABLE `message_transports` (
2235 `message_attribute_id` int(11) NOT NULL,
2236 `message_transport_type` varchar(20) NOT NULL,
2237 `is_digest` tinyint(1) NOT NULL default '0',
2238 `letter_module` varchar(20) NOT NULL default '',
2239 `letter_code` varchar(20) NOT NULL default '',
2240 PRIMARY KEY (`message_attribute_id`,`message_transport_type`,`is_digest`),
2241 KEY `message_transport_type` (`message_transport_type`),
2242 KEY `letter_module` (`letter_module`,`letter_code`),
2243 CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2244 CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
2245 CONSTRAINT `message_transports_ibfk_3` FOREIGN KEY (`letter_module`, `letter_code`) REFERENCES `letter` (`module`, `code`) ON DELETE CASCADE ON UPDATE CASCADE
2246 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2249 -- Table structure for table `borrower_message_preferences`
2252 DROP TABLE IF EXISTS `borrower_message_preferences`;
2253 CREATE TABLE `borrower_message_preferences` (
2254 `borrower_message_preference_id` int(11) NOT NULL auto_increment,
2255 `borrowernumber` int(11) default NULL,
2256 `categorycode` varchar(10) default NULL,
2257 `message_attribute_id` int(11) default '0',
2258 `days_in_advance` int(11) default '0',
2259 `wants_digest` tinyint(1) NOT NULL default '0',
2260 PRIMARY KEY (`borrower_message_preference_id`),
2261 KEY `borrowernumber` (`borrowernumber`),
2262 KEY `categorycode` (`categorycode`),
2263 KEY `message_attribute_id` (`message_attribute_id`),
2264 CONSTRAINT `borrower_message_preferences_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2265 CONSTRAINT `borrower_message_preferences_ibfk_2` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2266 CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
2267 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2270 -- Table structure for table `borrower_message_transport_preferences`
2273 DROP TABLE IF EXISTS `borrower_message_transport_preferences`;
2274 CREATE TABLE `borrower_message_transport_preferences` (
2275 `borrower_message_preference_id` int(11) NOT NULL default '0',
2276 `message_transport_type` varchar(20) NOT NULL default '0',
2277 PRIMARY KEY (`borrower_message_preference_id`,`message_transport_type`),
2278 KEY `message_transport_type` (`message_transport_type`),
2279 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,
2280 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
2281 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2284 -- Table structure for the table branch_transfer_limits
2287 DROP TABLE IF EXISTS `branch_transfer_limits`;
2288 CREATE TABLE branch_transfer_limits (
2289 limitId int(8) NOT NULL auto_increment,
2290 toBranch varchar(10) NOT NULL,
2291 fromBranch varchar(10) NOT NULL,
2292 itemtype varchar(10) NULL,
2293 ccode varchar(10) NULL,
2294 PRIMARY KEY (limitId)
2295 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2298 -- Table structure for table `item_circulation_alert_preferences`
2301 DROP TABLE IF EXISTS `item_circulation_alert_preferences`;
2302 CREATE TABLE `item_circulation_alert_preferences` (
2303 `id` int(11) NOT NULL auto_increment,
2304 `branchcode` varchar(10) NOT NULL,
2305 `categorycode` varchar(10) NOT NULL,
2306 `item_type` varchar(10) NOT NULL,
2307 `notification` varchar(16) NOT NULL,
2309 KEY `branchcode` (`branchcode`,`categorycode`,`item_type`, `notification`)
2310 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2313 -- Table structure for table `messages`
2315 DROP TABLE IF EXISTS `messages`;
2316 CREATE TABLE `messages` ( -- circulation messages left via the patron's check out screen
2317 `message_id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2318 `borrowernumber` int(11) NOT NULL, -- foreign key linking this message to the borrowers table
2319 `branchcode` varchar(10) default NULL, -- foreign key linking the message to the branches table
2320 `message_type` varchar(1) NOT NULL, -- whether the message is for the librarians (L) or the patron (B)
2321 `message` text NOT NULL, -- the text of the message
2322 `message_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- the date and time the message was written
2323 PRIMARY KEY (`message_id`)
2324 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2327 -- Table structure for table `accountlines`
2330 DROP TABLE IF EXISTS `accountlines`;
2331 CREATE TABLE `accountlines` (
2332 `borrowernumber` int(11) NOT NULL default 0,
2333 `accountno` smallint(6) NOT NULL default 0,
2334 `itemnumber` int(11) default NULL,
2335 `date` date default NULL,
2336 `amount` decimal(28,6) default NULL,
2337 `description` mediumtext,
2338 `dispute` mediumtext,
2339 `accounttype` varchar(5) default NULL,
2340 `amountoutstanding` decimal(28,6) default NULL,
2341 `lastincrement` decimal(28,6) default NULL,
2342 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2343 `notify_id` int(11) NOT NULL default 0,
2344 `notify_level` int(2) NOT NULL default 0,
2345 `note` text NULL default NULL,
2346 `manager_id` int(11) NULL,
2347 KEY `acctsborridx` (`borrowernumber`),
2348 KEY `timeidx` (`timestamp`),
2349 KEY `itemnumber` (`itemnumber`),
2350 CONSTRAINT `accountlines_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2351 CONSTRAINT `accountlines_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL
2352 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2355 -- Table structure for table `accountoffsets`
2358 DROP TABLE IF EXISTS `accountoffsets`;
2359 CREATE TABLE `accountoffsets` (
2360 `borrowernumber` int(11) NOT NULL default 0,
2361 `accountno` smallint(6) NOT NULL default 0,
2362 `offsetaccount` smallint(6) NOT NULL default 0,
2363 `offsetamount` decimal(28,6) default NULL,
2364 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2365 CONSTRAINT `accountoffsets_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2366 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2369 -- Table structure for table `action_logs`
2372 DROP TABLE IF EXISTS `action_logs`;
2373 CREATE TABLE `action_logs` (
2374 `action_id` int(11) NOT NULL auto_increment,
2375 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2376 `user` int(11) NOT NULL default 0,
2379 `object` int(11) default NULL,
2381 PRIMARY KEY (`action_id`),
2382 KEY (`timestamp`,`user`)
2383 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2386 -- Table structure for table `alert`
2389 DROP TABLE IF EXISTS `alert`;
2390 CREATE TABLE `alert` (
2391 `alertid` int(11) NOT NULL auto_increment,
2392 `borrowernumber` int(11) NOT NULL default 0,
2393 `type` varchar(10) NOT NULL default '',
2394 `externalid` varchar(20) NOT NULL default '',
2395 PRIMARY KEY (`alertid`),
2396 KEY `borrowernumber` (`borrowernumber`),
2397 KEY `type` (`type`,`externalid`)
2398 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2401 -- Table structure for table `aqbasketgroups`
2404 DROP TABLE IF EXISTS `aqbasketgroups`;
2405 CREATE TABLE `aqbasketgroups` (
2406 `id` int(11) NOT NULL auto_increment,
2407 `name` varchar(50) default NULL,
2408 `closed` tinyint(1) default NULL,
2409 `booksellerid` int(11) NOT NULL,
2410 `deliveryplace` varchar(10) default NULL,
2411 `freedeliveryplace` text default NULL,
2412 `deliverycomment` varchar(255) default NULL,
2413 `billingplace` varchar(10) default NULL,
2415 KEY `booksellerid` (`booksellerid`),
2416 CONSTRAINT `aqbasketgroups_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
2417 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2420 -- Table structure for table `aqbasket`
2423 DROP TABLE IF EXISTS `aqbasket`;
2424 CREATE TABLE `aqbasket` (
2425 `basketno` int(11) NOT NULL auto_increment,
2426 `basketname` varchar(50) default NULL,
2428 `booksellernote` mediumtext,
2429 `contractnumber` int(11),
2430 `creationdate` date default NULL,
2431 `closedate` date default NULL,
2432 `booksellerid` int(11) NOT NULL default 1,
2433 `authorisedby` varchar(10) default NULL,
2434 `booksellerinvoicenumber` mediumtext,
2435 `basketgroupid` int(11),
2436 PRIMARY KEY (`basketno`),
2437 KEY `booksellerid` (`booksellerid`),
2438 KEY `basketgroupid` (`basketgroupid`),
2439 KEY `contractnumber` (`contractnumber`),
2440 CONSTRAINT `aqbasket_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE,
2441 CONSTRAINT `aqbasket_ibfk_2` FOREIGN KEY (`contractnumber`) REFERENCES `aqcontract` (`contractnumber`),
2442 CONSTRAINT `aqbasket_ibfk_3` FOREIGN KEY (`basketgroupid`) REFERENCES `aqbasketgroups` (`id`) ON UPDATE CASCADE
2443 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2446 -- Table structure for table `aqbooksellers`
2449 DROP TABLE IF EXISTS `aqbooksellers`;
2450 CREATE TABLE `aqbooksellers` (
2451 `id` int(11) NOT NULL auto_increment,
2452 `name` mediumtext NOT NULL,
2453 `address1` mediumtext,
2454 `address2` mediumtext,
2455 `address3` mediumtext,
2456 `address4` mediumtext,
2457 `phone` varchar(30) default NULL,
2458 `accountnumber` mediumtext,
2459 `othersupplier` mediumtext,
2460 `currency` varchar(3) NOT NULL default '',
2461 `booksellerfax` mediumtext,
2463 `bookselleremail` mediumtext,
2464 `booksellerurl` mediumtext,
2465 `contact` varchar(100) default NULL,
2466 `postal` mediumtext,
2467 `url` varchar(255) default NULL,
2468 `contpos` varchar(100) default NULL,
2469 `contphone` varchar(100) default NULL,
2470 `contfax` varchar(100) default NULL,
2471 `contaltphone` varchar(100) default NULL,
2472 `contemail` varchar(100) default NULL,
2473 `contnotes` mediumtext,
2474 `active` tinyint(4) default NULL,
2475 `listprice` varchar(10) default NULL,
2476 `invoiceprice` varchar(10) default NULL,
2477 `gstreg` tinyint(4) default NULL,
2478 `listincgst` tinyint(4) default NULL,
2479 `invoiceincgst` tinyint(4) default NULL,
2480 `gstrate` decimal(6,4) default NULL,
2481 `discount` float(6,4) default NULL,
2482 `fax` varchar(50) default NULL,
2484 KEY `listprice` (`listprice`),
2485 KEY `invoiceprice` (`invoiceprice`),
2486 CONSTRAINT `aqbooksellers_ibfk_1` FOREIGN KEY (`listprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE,
2487 CONSTRAINT `aqbooksellers_ibfk_2` FOREIGN KEY (`invoiceprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE
2488 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2491 -- Table structure for table `aqbudgets`
2494 DROP TABLE IF EXISTS `aqbudgets`;
2495 CREATE TABLE `aqbudgets` (
2496 `budget_id` int(11) NOT NULL auto_increment,
2497 `budget_parent_id` int(11) default NULL,
2498 `budget_code` varchar(30) default NULL,
2499 `budget_name` varchar(80) default NULL,
2500 `budget_branchcode` varchar(10) default NULL,
2501 `budget_amount` decimal(28,6) NULL default '0.00',
2502 `budget_encumb` decimal(28,6) NULL default '0.00',
2503 `budget_expend` decimal(28,6) NULL default '0.00',
2504 `budget_notes` mediumtext,
2505 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2506 `budget_period_id` int(11) default NULL,
2507 `sort1_authcat` varchar(80) default NULL,
2508 `sort2_authcat` varchar(80) default NULL,
2509 `budget_owner_id` int(11) default NULL,
2510 `budget_permission` int(1) default '0',
2511 PRIMARY KEY (`budget_id`)
2512 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2516 -- Table structure for table `aqbudgetperiods`
2520 DROP TABLE IF EXISTS `aqbudgetperiods`;
2521 CREATE TABLE `aqbudgetperiods` (
2522 `budget_period_id` int(11) NOT NULL auto_increment,
2523 `budget_period_startdate` date NOT NULL,
2524 `budget_period_enddate` date NOT NULL,
2525 `budget_period_active` tinyint(1) default '0',
2526 `budget_period_description` mediumtext,
2527 `budget_period_total` decimal(28,6),
2528 `budget_period_locked` tinyint(1) default NULL,
2529 `sort1_authcat` varchar(10) default NULL,
2530 `sort2_authcat` varchar(10) default NULL,
2531 PRIMARY KEY (`budget_period_id`)
2532 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2535 -- Table structure for table `aqbudgets_planning`
2538 DROP TABLE IF EXISTS `aqbudgets_planning`;
2539 CREATE TABLE `aqbudgets_planning` (
2540 `plan_id` int(11) NOT NULL auto_increment,
2541 `budget_id` int(11) NOT NULL,
2542 `budget_period_id` int(11) NOT NULL,
2543 `estimated_amount` decimal(28,6) default NULL,
2544 `authcat` varchar(30) NOT NULL,
2545 `authvalue` varchar(30) NOT NULL,
2546 `display` tinyint(1) DEFAULT 1,
2547 PRIMARY KEY (`plan_id`),
2548 CONSTRAINT `aqbudgets_planning_ifbk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE
2549 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2552 -- Table structure for table 'aqcontract'
2555 DROP TABLE IF EXISTS `aqcontract`;
2556 CREATE TABLE `aqcontract` (
2557 `contractnumber` int(11) NOT NULL auto_increment,
2558 `contractstartdate` date default NULL,
2559 `contractenddate` date default NULL,
2560 `contractname` varchar(50) default NULL,
2561 `contractdescription` mediumtext,
2562 `booksellerid` int(11) not NULL,
2563 PRIMARY KEY (`contractnumber`),
2564 CONSTRAINT `booksellerid_fk1` FOREIGN KEY (`booksellerid`)
2565 REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2566 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
2569 -- Table structure for table `aqorderdelivery`
2572 DROP TABLE IF EXISTS `aqorderdelivery`;
2573 CREATE TABLE `aqorderdelivery` (
2574 `ordernumber` date default NULL,
2575 `deliverynumber` smallint(6) NOT NULL default 0,
2576 `deliverydate` varchar(18) default NULL,
2577 `qtydelivered` smallint(6) default NULL,
2578 `deliverycomments` mediumtext
2579 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2582 -- Table structure for table `aqorders`
2585 DROP TABLE IF EXISTS `aqorders`;
2586 CREATE TABLE `aqorders` (
2587 `ordernumber` int(11) NOT NULL auto_increment,
2588 `biblionumber` int(11) default NULL,
2589 `entrydate` date default NULL,
2590 `quantity` smallint(6) default NULL,
2591 `currency` varchar(3) default NULL,
2592 `listprice` decimal(28,6) default NULL,
2593 `totalamount` decimal(28,6) default NULL,
2594 `datereceived` date default NULL,
2595 `booksellerinvoicenumber` mediumtext,
2596 `freight` decimal(28,6) default NULL,
2597 `unitprice` decimal(28,6) default NULL,
2598 `quantityreceived` smallint(6) NOT NULL default 0,
2599 `cancelledby` varchar(10) default NULL,
2600 `datecancellationprinted` date default NULL,
2602 `supplierreference` mediumtext,
2603 `purchaseordernumber` mediumtext,
2604 `subscription` tinyint(1) default NULL,
2605 `serialid` varchar(30) default NULL,
2606 `basketno` int(11) default NULL,
2607 `biblioitemnumber` int(11) default NULL,
2608 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2609 `rrp` decimal(13,2) default NULL,
2610 `ecost` decimal(13,2) default NULL,
2611 `gst` decimal(13,2) default NULL,
2612 `budget_id` int(11) NOT NULL,
2613 `budgetgroup_id` int(11) NOT NULL,
2614 `budgetdate` date default NULL,
2615 `sort1` varchar(80) default NULL,
2616 `sort2` varchar(80) default NULL,
2617 `sort1_authcat` varchar(10) default NULL,
2618 `sort2_authcat` varchar(10) default NULL,
2619 `uncertainprice` tinyint(1),
2620 PRIMARY KEY (`ordernumber`),
2621 KEY `basketno` (`basketno`),
2622 KEY `biblionumber` (`biblionumber`),
2623 KEY `budget_id` (`budget_id`),
2624 CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2625 CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE
2626 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2630 -- Table structure for table `aqorders_items`
2633 DROP TABLE IF EXISTS `aqorders_items`;
2634 CREATE TABLE `aqorders_items` (
2635 `ordernumber` int(11) NOT NULL,
2636 `itemnumber` int(11) NOT NULL,
2637 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2638 PRIMARY KEY (`itemnumber`),
2639 KEY `ordernumber` (`ordernumber`)
2640 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2643 -- Table structure for table `fieldmapping`
2646 DROP TABLE IF EXISTS `fieldmapping`;
2647 CREATE TABLE `fieldmapping` ( -- koha to keyword mapping
2648 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2649 `field` varchar(255) NOT NULL, -- keyword to be mapped to (ex. subtitle)
2650 `frameworkcode` char(4) NOT NULL default '', -- foreign key from the biblio_framework table to link this mapping to a specific framework
2651 `fieldcode` char(3) NOT NULL, -- marc field number to map to this keyword
2652 `subfieldcode` char(1) NOT NULL, -- marc subfield associated with the fieldcode to map to this keyword
2654 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2657 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
2658 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
2659 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
2660 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
2661 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
2662 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
2663 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
2664 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;