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 `display_checkout` tinyint(1) NOT NULL default 0,-- defines if this field displays in checkout screens
288 PRIMARY KEY (`code`),
289 KEY `auth_val_cat_idx` (`authorised_value_category`)
290 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
293 -- Table structure for table `borrower_attributes`
296 DROP TABLE IF EXISTS `borrower_attributes`;
297 CREATE TABLE `borrower_attributes` ( -- values of custom patron fields known as extended patron attributes linked to patrons/borrowers
298 `borrowernumber` int(11) NOT NULL, -- foreign key from the borrowers table, defines which patron/borrower has this attribute
299 `code` varchar(10) NOT NULL, -- foreign key from the borrower_attribute_types table, defines which custom field this value was entered for
300 `attribute` varchar(64) default NULL, -- custom patron field value
301 `password` varchar(64) default NULL, -- password associated with this field
302 KEY `borrowernumber` (`borrowernumber`),
303 KEY `code_attribute` (`code`, `attribute`),
304 CONSTRAINT `borrower_attributes_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
305 ON DELETE CASCADE ON UPDATE CASCADE,
306 CONSTRAINT `borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`)
307 ON DELETE CASCADE ON UPDATE CASCADE
308 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
311 -- Table structure for table `branch_item_rules`
314 DROP TABLE IF EXISTS `branch_item_rules`;
315 CREATE TABLE `branch_item_rules` (
316 `branchcode` varchar(10) NOT NULL,
317 `itemtype` varchar(10) NOT NULL,
318 `holdallowed` tinyint(1) default NULL,
319 PRIMARY KEY (`itemtype`,`branchcode`),
320 KEY `branch_item_rules_ibfk_2` (`branchcode`),
321 CONSTRAINT `branch_item_rules_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`)
322 ON DELETE CASCADE ON UPDATE CASCADE,
323 CONSTRAINT `branch_item_rules_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
324 ON DELETE CASCADE ON UPDATE CASCADE
325 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
328 -- Table structure for table `branchcategories`
331 DROP TABLE IF EXISTS `branchcategories`;
332 CREATE TABLE `branchcategories` ( -- information related to library/branch groups
333 `categorycode` varchar(10) NOT NULL default '', -- unique identifier for the library/branch group
334 `categoryname` varchar(32), -- name of the library/branch group
335 `codedescription` mediumtext, -- longer description of the library/branch group
336 `categorytype` varchar(16), -- says whether this is a search group or a properties group
337 PRIMARY KEY (`categorycode`)
338 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
341 -- Table structure for table `branches`
344 DROP TABLE IF EXISTS `branches`;
345 CREATE TABLE `branches` ( -- information about your libraries or branches are stored here
346 `branchcode` varchar(10) NOT NULL default '', -- a unique key assigned to each branch
347 `branchname` mediumtext NOT NULL, -- the name of your library or branch
348 `branchaddress1` mediumtext, -- the first address line of for your library or branch
349 `branchaddress2` mediumtext, -- the second address line of for your library or branch
350 `branchaddress3` mediumtext, -- the third address line of for your library or branch
351 `branchzip` varchar(25) default NULL, -- the zip or postal code for your library or branch
352 `branchcity` mediumtext, -- the city or province for your library or branch
353 `branchstate` mediumtext, -- the state for your library or branch
354 `branchcountry` text, -- the county for your library or branch
355 `branchphone` mediumtext, -- the primary phone for your library or branch
356 `branchfax` mediumtext, -- the fax number for your library or branch
357 `branchemail` mediumtext, -- the primary email address for your library or branch
358 `branchurl` mediumtext, -- the URL for your library or branch's website
359 `issuing` tinyint(4) default NULL, -- unused in Koha
360 `branchip` varchar(15) default NULL, -- the IP address for your library or branch
361 `branchprinter` varchar(100) default NULL, -- unused in Koha
362 `branchnotes` mediumtext, -- notes related to your library or branch
363 UNIQUE KEY `branchcode` (`branchcode`)
364 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
367 -- Table structure for table `branchrelations`
370 DROP TABLE IF EXISTS `branchrelations`;
371 CREATE TABLE `branchrelations` ( -- this table links libraries/branches to groups
372 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table to identify the branch
373 `categorycode` varchar(10) NOT NULL default '', -- foreign key from the branchcategories table to identify the group
374 PRIMARY KEY (`branchcode`,`categorycode`),
375 KEY `branchcode` (`branchcode`),
376 KEY `categorycode` (`categorycode`),
377 CONSTRAINT `branchrelations_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
378 CONSTRAINT `branchrelations_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `branchcategories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
379 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
382 -- Table structure for table `branchtransfers`
385 DROP TABLE IF EXISTS `branchtransfers`;
386 CREATE TABLE `branchtransfers` (
387 `itemnumber` int(11) NOT NULL default 0,
388 `datesent` datetime default NULL,
389 `frombranch` varchar(10) NOT NULL default '',
390 `datearrived` datetime default NULL,
391 `tobranch` varchar(10) NOT NULL default '',
392 `comments` mediumtext,
393 KEY `frombranch` (`frombranch`),
394 KEY `tobranch` (`tobranch`),
395 KEY `itemnumber` (`itemnumber`),
396 CONSTRAINT `branchtransfers_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
397 CONSTRAINT `branchtransfers_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
398 CONSTRAINT `branchtransfers_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
399 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
403 -- Table structure for table `browser`
405 DROP TABLE IF EXISTS `browser`;
406 CREATE TABLE `browser` (
407 `level` int(11) NOT NULL,
408 `classification` varchar(20) NOT NULL,
409 `description` varchar(255) NOT NULL,
410 `number` bigint(20) NOT NULL,
411 `endnode` tinyint(4) NOT NULL
412 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
415 -- Table structure for table `categories`
418 DROP TABLE IF EXISTS `categories`;
419 CREATE TABLE `categories` (
420 `categorycode` varchar(10) NOT NULL default '',
421 `description` mediumtext,
422 `enrolmentperiod` smallint(6) default NULL,
423 `enrolmentperioddate` DATE NULL DEFAULT NULL,
424 `upperagelimit` smallint(6) default NULL,
425 `dateofbirthrequired` tinyint(1) default NULL,
426 `finetype` varchar(30) default NULL,
427 `bulk` tinyint(1) default NULL,
428 `enrolmentfee` decimal(28,6) default NULL,
429 `overduenoticerequired` tinyint(1) default NULL,
430 `issuelimit` smallint(6) default NULL,
431 `reservefee` decimal(28,6) default NULL,
432 `hidelostitems` tinyint(1) NOT NULL default '0',
433 `category_type` varchar(1) NOT NULL default 'A',
434 PRIMARY KEY (`categorycode`),
435 UNIQUE KEY `categorycode` (`categorycode`)
436 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
439 -- Table: collections
441 DROP TABLE IF EXISTS collections;
442 CREATE TABLE collections (
443 colId integer(11) NOT NULL auto_increment,
444 colTitle varchar(100) NOT NULL DEFAULT '',
445 colDesc text NOT NULL,
446 colBranchcode varchar(4) DEFAULT NULL comment 'branchcode for branch where item should be held.',
448 ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
451 -- Table: collections_tracking
453 DROP TABLE IF EXISTS collections_tracking;
454 CREATE TABLE collections_tracking (
455 ctId integer(11) NOT NULL auto_increment,
456 colId integer(11) NOT NULL DEFAULT 0 comment 'collections.colId',
457 itemnumber integer(11) NOT NULL DEFAULT 0 comment 'items.itemnumber',
459 ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
462 -- Table structure for table `borrower_branch_circ_rules`
465 DROP TABLE IF EXISTS `branch_borrower_circ_rules`;
466 CREATE TABLE `branch_borrower_circ_rules` (
467 `branchcode` VARCHAR(10) NOT NULL,
468 `categorycode` VARCHAR(10) NOT NULL,
469 `maxissueqty` int(4) default NULL,
470 PRIMARY KEY (`categorycode`, `branchcode`),
471 CONSTRAINT `branch_borrower_circ_rules_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`)
472 ON DELETE CASCADE ON UPDATE CASCADE,
473 CONSTRAINT `branch_borrower_circ_rules_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
474 ON DELETE CASCADE ON UPDATE CASCADE
475 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
478 -- Table structure for table `default_borrower_circ_rules`
481 DROP TABLE IF EXISTS `default_borrower_circ_rules`;
482 CREATE TABLE `default_borrower_circ_rules` (
483 `categorycode` VARCHAR(10) NOT NULL,
484 `maxissueqty` int(4) default NULL,
485 PRIMARY KEY (`categorycode`),
486 CONSTRAINT `borrower_borrower_circ_rules_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`)
487 ON DELETE CASCADE ON UPDATE CASCADE
488 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
491 -- Table structure for table `default_branch_circ_rules`
494 DROP TABLE IF EXISTS `default_branch_circ_rules`;
495 CREATE TABLE `default_branch_circ_rules` (
496 `branchcode` VARCHAR(10) NOT NULL,
497 `maxissueqty` int(4) default NULL,
498 `holdallowed` tinyint(1) default NULL,
499 PRIMARY KEY (`branchcode`),
500 CONSTRAINT `default_branch_circ_rules_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
501 ON DELETE CASCADE ON UPDATE CASCADE
502 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
505 -- Table structure for table `default_branch_item_rules`
507 DROP TABLE IF EXISTS `default_branch_item_rules`;
508 CREATE TABLE `default_branch_item_rules` (
509 `itemtype` varchar(10) NOT NULL,
510 `holdallowed` tinyint(1) default NULL,
511 PRIMARY KEY (`itemtype`),
512 CONSTRAINT `default_branch_item_rules_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`)
513 ON DELETE CASCADE ON UPDATE CASCADE
514 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
517 -- Table structure for table `default_circ_rules`
520 DROP TABLE IF EXISTS `default_circ_rules`;
521 CREATE TABLE `default_circ_rules` (
522 `singleton` enum('singleton') NOT NULL default 'singleton',
523 `maxissueqty` int(4) default NULL,
524 `holdallowed` int(1) default NULL,
525 PRIMARY KEY (`singleton`)
526 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
529 -- Table structure for table `cities`
532 DROP TABLE IF EXISTS `cities`;
533 CREATE TABLE `cities` ( -- authorized values for cities/states/countries to choose when adding/editing a patron/borrower
534 `cityid` int(11) NOT NULL auto_increment, -- unique identifier added by Koha
535 `city_name` varchar(100) NOT NULL default '', -- name of the city
536 `city_state` VARCHAR( 100 ) NULL DEFAULT NULL, -- name of the state/province
537 `city_country` VARCHAR( 100 ) NULL DEFAULT NULL, -- name of the country
538 `city_zipcode` varchar(20) default NULL, -- zip or postal code
539 PRIMARY KEY (`cityid`)
540 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
543 -- Table structure for table `class_sort_rules`
546 DROP TABLE IF EXISTS `class_sort_rules`;
547 CREATE TABLE `class_sort_rules` (
548 `class_sort_rule` varchar(10) NOT NULL default '',
549 `description` mediumtext,
550 `sort_routine` varchar(30) NOT NULL default '',
551 PRIMARY KEY (`class_sort_rule`),
552 UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
553 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
556 -- Table structure for table `class_sources`
559 DROP TABLE IF EXISTS `class_sources`;
560 CREATE TABLE `class_sources` (
561 `cn_source` varchar(10) NOT NULL default '',
562 `description` mediumtext,
563 `used` tinyint(4) NOT NULL default 0,
564 `class_sort_rule` varchar(10) NOT NULL default '',
565 PRIMARY KEY (`cn_source`),
566 UNIQUE KEY `cn_source_idx` (`cn_source`),
567 KEY `used_idx` (`used`),
568 CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`)
569 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
572 -- Table structure for table `currency`
575 DROP TABLE IF EXISTS `currency`;
576 CREATE TABLE `currency` (
577 `currency` varchar(10) NOT NULL default '',
578 `symbol` varchar(5) default NULL,
579 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
580 `rate` float(15,5) default NULL,
581 `active` tinyint(1) default NULL,
582 PRIMARY KEY (`currency`)
583 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
586 -- Table structure for table `deletedbiblio`
589 DROP TABLE IF EXISTS `deletedbiblio`;
590 CREATE TABLE `deletedbiblio` ( -- stores information about bibliographic records that have been deleted
591 `biblionumber` int(11) NOT NULL auto_increment, -- unique identifier assigned to each bibliographic record
592 `frameworkcode` varchar(4) NOT NULL default '', -- foriegn key from the biblio_framework table to identify which framework was used in cataloging this record
593 `author` mediumtext, -- statement of responsibility from MARC record (100 in MARC21)
594 `title` mediumtext, -- title (without the subtitle) from the MARC record (245 in MARC21)
595 `unititle` mediumtext, -- uniform title (without the subtitle) from the MARC record (240 in MARC21)
596 `notes` mediumtext, -- values from the general notes field in the MARC record (500 in MARC21) split by bar (|)
597 `serial` tinyint(1) default NULL, -- foreign key, linking to the subscriptionid in the serial table
598 `seriestitle` mediumtext,
599 `copyrightdate` smallint(6) default NULL, -- publication or copyright date from the MARC record
600 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
601 `datecreated` DATE NOT NULL, -- the date this record was added to Koha
602 `abstract` mediumtext, -- summary from the MARC record (520 in MARC21)
603 PRIMARY KEY (`biblionumber`),
604 KEY `blbnoidx` (`biblionumber`)
605 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
608 -- Table structure for table `deletedbiblioitems`
611 DROP TABLE IF EXISTS `deletedbiblioitems`;
612 CREATE TABLE `deletedbiblioitems` (
613 `biblioitemnumber` int(11) NOT NULL default 0,
614 `biblionumber` int(11) NOT NULL default 0,
617 `itemtype` varchar(10) default NULL,
618 `isbn` varchar(30) default NULL,
619 `issn` varchar(9) default NULL,
620 `publicationyear` text,
621 `publishercode` varchar(255) default NULL,
622 `volumedate` date default NULL,
624 `collectiontitle` mediumtext default NULL,
625 `collectionissn` text default NULL,
626 `collectionvolume` mediumtext default NULL,
627 `editionstatement` text default NULL,
628 `editionresponsibility` text default NULL,
629 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
630 `illus` varchar(255) default NULL,
631 `pages` varchar(255) default NULL,
633 `size` varchar(255) default NULL,
634 `place` varchar(255) default NULL,
635 `lccn` varchar(25) default NULL,
637 `url` varchar(255) default NULL,
638 `cn_source` varchar(10) default NULL,
639 `cn_class` varchar(30) default NULL,
640 `cn_item` varchar(10) default NULL,
641 `cn_suffix` varchar(10) default NULL,
642 `cn_sort` varchar(30) default NULL,
643 `totalissues` int(10),
644 `marcxml` longtext NOT NULL,
645 PRIMARY KEY (`biblioitemnumber`),
646 KEY `bibinoidx` (`biblioitemnumber`),
647 KEY `bibnoidx` (`biblionumber`),
649 KEY `publishercode` (`publishercode`)
650 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
653 -- Table structure for table `deletedborrowers`
656 DROP TABLE IF EXISTS `deletedborrowers`;
657 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrowers you have deleted
658 `borrowernumber` int(11) NOT NULL default 0, -- primary key, Koha assigned ID number for patrons/borrowers
659 `cardnumber` varchar(16) default NULL, -- unique key, library assigned ID number for patrons/borrowers
660 `surname` mediumtext NOT NULL, -- patron/borrower's last name (surname)
661 `firstname` text, -- patron/borrower's first name
662 `title` mediumtext, -- patron/borrower's title, for example: Mr. or Mrs.
663 `othernames` mediumtext, -- any other names associated with the patron/borrower
664 `initials` text, -- initials for your patron/borrower
665 `streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's primary address
666 `streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's primary address
667 `address` mediumtext NOT NULL, -- the first address line for your patron/borrower's primary address
668 `address2` text, -- the second address line for your patron/borrower's primary address
669 `city` mediumtext NOT NULL, -- the city or town for your patron/borrower's primary address
670 `state` text default NULL, -- the state or province for your patron/borrower's primary address
671 `zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's primary address
672 `country` text, -- the country for your patron/borrower's primary address
673 `email` mediumtext, -- the primary email address for your patron/borrower's primary address
674 `phone` text, -- the primary phone number for your patron/borrower's primary address
675 `mobile` varchar(50) default NULL, -- the other phone number for your patron/borrower's primary address
676 `fax` mediumtext, -- the fax number for your patron/borrower's primary address
677 `emailpro` text, -- the secondary email addres for your patron/borrower's primary address
678 `phonepro` text, -- the secondary phone number for your patron/borrower's primary address
679 `B_streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's alternate address
680 `B_streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's alternate address
681 `B_address` varchar(100) default NULL, -- the first address line for your patron/borrower's alternate address
682 `B_address2` text default NULL, -- the second address line for your patron/borrower's alternate address
683 `B_city` mediumtext, -- the city or town for your patron/borrower's alternate address
684 `B_state` text default NULL, -- the state for your patron/borrower's alternate address
685 `B_zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's alternate address
686 `B_country` text, -- the country for your patron/borrower's alternate address
687 `B_email` text, -- the patron/borrower's alternate email address
688 `B_phone` mediumtext, -- the patron/borrower's alternate phone number
689 `dateofbirth` date default NULL, -- the patron/borrower's date of birth (YYYY-MM-DD)
690 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, includes the code of the patron/borrower's home branch
691 `categorycode` varchar(10) NOT NULL default '', -- foreign key from the categories table, includes the code of the patron category
692 `dateenrolled` date default NULL, -- date the patron was added to Koha (YYYY-MM-DD)
693 `dateexpiry` date default NULL, -- date the patron/borrower's card is set to expire (YYYY-MM-DD)
694 `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
695 `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
696 `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
697 `contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
698 `contactfirstname` text, -- used for children to include first name of guarentor
699 `contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
700 `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
701 `borrowernotes` mediumtext, -- a note on the patron/borroewr's account that is only visible in the staff client
702 `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
703 `ethnicity` varchar(50) default NULL, -- unused in Koha
704 `ethnotes` varchar(255) default NULL, -- unused in Koha
705 `sex` varchar(1) default NULL, -- patron/borrower's gender
706 `password` varchar(30) default NULL, -- patron/borrower's encrypted password
707 `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
708 `userid` varchar(30) default NULL, -- patron/borrower's opac and/or staff client log in
709 `opacnote` mediumtext, -- a note on the patron/borrower's account that is visible in the OPAC and staff client
710 `contactnote` varchar(255) default NULL, -- a note related to the patron/borrower's alternate address
711 `sort1` varchar(80) default NULL, -- a field that can be used for any information unique to the library
712 `sort2` varchar(80) default NULL, -- a field that can be used for any information unique to the library
713 `altcontactfirstname` varchar(255) default NULL, -- first name of alternate contact for the patron/borrower
714 `altcontactsurname` varchar(255) default NULL, -- surname or last name of the alternate contact for the patron/borrower
715 `altcontactaddress1` varchar(255) default NULL, -- the first address line for the alternate contact for the patron/borrower
716 `altcontactaddress2` varchar(255) default NULL, -- the second address line for the alternate contact for the patron/borrower
717 `altcontactaddress3` varchar(255) default NULL, -- the third address line for the alternate contact for the patron/borrower
718 `altcontactstate` text default NULL, -- the city and state for the alternate contact for the patron/borrower
719 `altcontactzipcode` varchar(50) default NULL, -- the zipcode for the alternate contact for the patron/borrower
720 `altcontactcountry` text default NULL, -- the country for the alternate contact for the patron/borrower
721 `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
722 `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
723 `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history KEY `borrowernumber` (`borrowernumber`),
724 KEY borrowernumber (borrowernumber),
725 KEY `cardnumber` (`cardnumber`)
726 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
729 -- Table structure for table `deleteditems`
732 DROP TABLE IF EXISTS `deleteditems`;
733 CREATE TABLE `deleteditems` (
734 `itemnumber` int(11) NOT NULL default 0,
735 `biblionumber` int(11) NOT NULL default 0,
736 `biblioitemnumber` int(11) NOT NULL default 0,
737 `barcode` varchar(20) default NULL,
738 `dateaccessioned` date default NULL,
739 `booksellerid` mediumtext default NULL,
740 `homebranch` varchar(10) default NULL,
741 `price` decimal(8,2) default NULL,
742 `replacementprice` decimal(8,2) default NULL,
743 `replacementpricedate` date default NULL,
744 `datelastborrowed` date default NULL,
745 `datelastseen` date default NULL,
746 `stack` tinyint(1) default NULL,
747 `notforloan` tinyint(1) NOT NULL default 0,
748 `damaged` tinyint(1) NOT NULL default 0,
749 `itemlost` tinyint(1) NOT NULL default 0,
750 `wthdrawn` tinyint(1) NOT NULL default 0,
751 `itemcallnumber` varchar(255) default NULL,
752 `issues` smallint(6) default NULL,
753 `renewals` smallint(6) default NULL,
754 `reserves` smallint(6) default NULL,
755 `restricted` tinyint(1) default NULL,
756 `itemnotes` mediumtext,
757 `holdingbranch` varchar(10) default NULL,
758 `paidfor` mediumtext,
759 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
760 `location` varchar(80) default NULL,
761 `permanent_location` varchar(80) default NULL,
762 `onloan` date default NULL,
763 `cn_source` varchar(10) default NULL,
764 `cn_sort` varchar(30) default NULL,
765 `ccode` varchar(10) default NULL,
766 `materials` varchar(10) default NULL,
767 `uri` varchar(255) default NULL,
768 `itype` varchar(10) default NULL,
769 `more_subfields_xml` longtext default NULL,
770 `enumchron` text default NULL,
771 `copynumber` varchar(32) default NULL,
772 `stocknumber` varchar(32) default NULL,
774 PRIMARY KEY (`itemnumber`),
775 KEY `delitembarcodeidx` (`barcode`),
776 KEY `delitemstocknumberidx` (`stocknumber`),
777 KEY `delitembinoidx` (`biblioitemnumber`),
778 KEY `delitembibnoidx` (`biblionumber`),
779 KEY `delhomebranch` (`homebranch`),
780 KEY `delholdingbranch` (`holdingbranch`)
781 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
784 -- Table structure for table `ethnicity`
787 DROP TABLE IF EXISTS `ethnicity`;
788 CREATE TABLE `ethnicity` (
789 `code` varchar(10) NOT NULL default '',
790 `name` varchar(255) default NULL,
792 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
795 -- Table structure for table `export_format`
798 DROP TABLE IF EXISTS `export_format`;
799 CREATE TABLE `export_format` (
800 `export_format_id` int(11) NOT NULL auto_increment,
801 `profile` varchar(255) NOT NULL,
802 `description` mediumtext NOT NULL,
803 `marcfields` mediumtext NOT NULL,
804 `csv_separator` varchar(2) NOT NULL,
805 `field_separator` varchar(2) NOT NULL,
806 `subfield_separator` varchar(2) NOT NULL,
807 `encoding` varchar(255) NOT NULL,
808 PRIMARY KEY (`export_format_id`)
809 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Used for CSV export';
813 -- Table structure for table `hold_fill_targets`
816 DROP TABLE IF EXISTS `hold_fill_targets`;
817 CREATE TABLE hold_fill_targets (
818 `borrowernumber` int(11) NOT NULL,
819 `biblionumber` int(11) NOT NULL,
820 `itemnumber` int(11) NOT NULL,
821 `source_branchcode` varchar(10) default NULL,
822 `item_level_request` tinyint(4) NOT NULL default 0,
823 PRIMARY KEY `itemnumber` (`itemnumber`),
824 KEY `bib_branch` (`biblionumber`, `source_branchcode`),
825 CONSTRAINT `hold_fill_targets_ibfk_1` FOREIGN KEY (`borrowernumber`)
826 REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
827 CONSTRAINT `hold_fill_targets_ibfk_2` FOREIGN KEY (`biblionumber`)
828 REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
829 CONSTRAINT `hold_fill_targets_ibfk_3` FOREIGN KEY (`itemnumber`)
830 REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
831 CONSTRAINT `hold_fill_targets_ibfk_4` FOREIGN KEY (`source_branchcode`)
832 REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
833 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
836 -- Table structure for table `import_batches`
839 DROP TABLE IF EXISTS `import_batches`;
840 CREATE TABLE `import_batches` (
841 `import_batch_id` int(11) NOT NULL auto_increment,
842 `matcher_id` int(11) default NULL,
843 `template_id` int(11) default NULL,
844 `branchcode` varchar(10) default NULL,
845 `num_biblios` int(11) NOT NULL default 0,
846 `num_items` int(11) NOT NULL default 0,
847 `upload_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
848 `overlay_action` enum('replace', 'create_new', 'use_template', 'ignore') NOT NULL default 'create_new',
849 `nomatch_action` enum('create_new', 'ignore') NOT NULL default 'create_new',
850 `item_action` enum('always_add', 'add_only_for_matches', 'add_only_for_new', 'ignore') NOT NULL default 'always_add',
851 `import_status` enum('staging', 'staged', 'importing', 'imported', 'reverting', 'reverted', 'cleaned') NOT NULL default 'staging',
852 `batch_type` enum('batch', 'z3950') NOT NULL default 'batch',
853 `file_name` varchar(100),
854 `comments` mediumtext,
855 PRIMARY KEY (`import_batch_id`),
856 KEY `branchcode` (`branchcode`)
857 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
860 -- Table structure for table `import_records`
863 DROP TABLE IF EXISTS `import_records`;
864 CREATE TABLE `import_records` (
865 `import_record_id` int(11) NOT NULL auto_increment,
866 `import_batch_id` int(11) NOT NULL,
867 `branchcode` varchar(10) default NULL,
868 `record_sequence` int(11) NOT NULL default 0,
869 `upload_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
870 `import_date` DATE default NULL,
871 `marc` longblob NOT NULL,
872 `marcxml` longtext NOT NULL,
873 `marcxml_old` longtext NOT NULL,
874 `record_type` enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio',
875 `overlay_status` enum('no_match', 'auto_match', 'manual_match', 'match_applied') NOT NULL default 'no_match',
876 `status` enum('error', 'staged', 'imported', 'reverted', 'items_reverted', 'ignored') NOT NULL default 'staged',
877 `import_error` mediumtext,
878 `encoding` varchar(40) NOT NULL default '',
879 `z3950random` varchar(40) default NULL,
880 PRIMARY KEY (`import_record_id`),
881 CONSTRAINT `import_records_ifbk_1` FOREIGN KEY (`import_batch_id`)
882 REFERENCES `import_batches` (`import_batch_id`) ON DELETE CASCADE ON UPDATE CASCADE,
883 KEY `branchcode` (`branchcode`),
884 KEY `batch_sequence` (`import_batch_id`, `record_sequence`)
885 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
888 -- Table structure for `import_record_matches`
890 DROP TABLE IF EXISTS `import_record_matches`;
891 CREATE TABLE `import_record_matches` (
892 `import_record_id` int(11) NOT NULL,
893 `candidate_match_id` int(11) NOT NULL,
894 `score` int(11) NOT NULL default 0,
895 CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`)
896 REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
897 KEY `record_score` (`import_record_id`, `score`)
898 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
901 -- Table structure for table `import_biblios`
904 DROP TABLE IF EXISTS `import_biblios`;
905 CREATE TABLE `import_biblios` (
906 `import_record_id` int(11) NOT NULL,
907 `matched_biblionumber` int(11) default NULL,
908 `control_number` varchar(25) default NULL,
909 `original_source` varchar(25) default NULL,
910 `title` varchar(128) default NULL,
911 `author` varchar(80) default NULL,
912 `isbn` varchar(30) default NULL,
913 `issn` varchar(9) default NULL,
914 `has_items` tinyint(1) NOT NULL default 0,
915 CONSTRAINT `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`)
916 REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
917 KEY `matched_biblionumber` (`matched_biblionumber`),
918 KEY `title` (`title`),
920 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
923 -- Table structure for table `import_items`
926 DROP TABLE IF EXISTS `import_items`;
927 CREATE TABLE `import_items` (
928 `import_items_id` int(11) NOT NULL auto_increment,
929 `import_record_id` int(11) NOT NULL,
930 `itemnumber` int(11) default NULL,
931 `branchcode` varchar(10) default NULL,
932 `status` enum('error', 'staged', 'imported', 'reverted', 'ignored') NOT NULL default 'staged',
933 `marcxml` longtext NOT NULL,
934 `import_error` mediumtext,
935 PRIMARY KEY (`import_items_id`),
936 CONSTRAINT `import_items_ibfk_1` FOREIGN KEY (`import_record_id`)
937 REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
938 KEY `itemnumber` (`itemnumber`),
939 KEY `branchcode` (`branchcode`)
940 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
943 -- Table structure for table `issues`
946 DROP TABLE IF EXISTS `issues`;
947 CREATE TABLE `issues` ( -- information related to check outs or issues
948 `borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to
949 `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out
950 `date_due` date default NULL, -- date the item is due (yyyy-mm-dd)
951 `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
952 `issuingbranch` varchar(18) default NULL,
953 `returndate` date default NULL, -- date the item was returned, will be NULL until moved to old_issues
954 `lastreneweddate` date default NULL, -- date the item was last renewed
955 `return` varchar(4) default NULL,
956 `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
957 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
958 `issuedate` date default NULL, -- date the item was checked out or issued
959 KEY `issuesborridx` (`borrowernumber`),
960 KEY `bordate` (`borrowernumber`,`timestamp`),
961 CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE RESTRICT ON UPDATE CASCADE,
962 CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE RESTRICT ON UPDATE CASCADE
963 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
966 -- Table structure for table `issuingrules`
969 DROP TABLE IF EXISTS `issuingrules`;
970 CREATE TABLE `issuingrules` (
971 `categorycode` varchar(10) NOT NULL default '',
972 `itemtype` varchar(10) NOT NULL default '',
973 `restrictedtype` tinyint(1) default NULL,
974 `rentaldiscount` decimal(28,6) default NULL,
975 `reservecharge` decimal(28,6) default NULL,
976 `fine` decimal(28,6) default NULL,
977 `finedays` int(11) default NULL,
978 `firstremind` int(11) default NULL,
979 `chargeperiod` int(11) default NULL,
980 `accountsent` int(11) default NULL,
981 `chargename` varchar(100) default NULL,
982 `maxissueqty` int(4) default NULL,
983 `issuelength` int(4) default NULL,
984 `hardduedate` date default NULL,
985 `hardduedatecompare` tinyint NOT NULL default "0",
986 `renewalsallowed` smallint(6) NOT NULL default "0",
987 `reservesallowed` smallint(6) NOT NULL default "0",
988 `branchcode` varchar(10) NOT NULL default '',
989 PRIMARY KEY (`branchcode`,`categorycode`,`itemtype`),
990 KEY `categorycode` (`categorycode`),
991 KEY `itemtype` (`itemtype`)
992 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
995 -- Table structure for table `items`
998 DROP TABLE IF EXISTS `items`;
999 CREATE TABLE `items` (
1000 `itemnumber` int(11) NOT NULL auto_increment,
1001 `biblionumber` int(11) NOT NULL default 0,
1002 `biblioitemnumber` int(11) NOT NULL default 0,
1003 `barcode` varchar(20) default NULL,
1004 `dateaccessioned` date default NULL,
1005 `booksellerid` mediumtext default NULL,
1006 `homebranch` varchar(10) default NULL,
1007 `price` decimal(8,2) default NULL,
1008 `replacementprice` decimal(8,2) default NULL,
1009 `replacementpricedate` date default NULL,
1010 `datelastborrowed` date default NULL,
1011 `datelastseen` date default NULL,
1012 `stack` tinyint(1) default NULL,
1013 `notforloan` tinyint(1) NOT NULL default 0,
1014 `damaged` tinyint(1) NOT NULL default 0,
1015 `itemlost` tinyint(1) NOT NULL default 0,
1016 `wthdrawn` tinyint(1) NOT NULL default 0,
1017 `itemcallnumber` varchar(255) default NULL,
1018 `issues` smallint(6) default NULL,
1019 `renewals` smallint(6) default NULL,
1020 `reserves` smallint(6) default NULL,
1021 `restricted` tinyint(1) default NULL,
1022 `itemnotes` mediumtext,
1023 `holdingbranch` varchar(10) default NULL,
1024 `paidfor` mediumtext,
1025 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
1026 `location` varchar(80) default NULL,
1027 `permanent_location` varchar(80) default NULL,
1028 `onloan` date default NULL,
1029 `cn_source` varchar(10) default NULL,
1030 `cn_sort` varchar(30) default NULL,
1031 `ccode` varchar(10) default NULL,
1032 `materials` varchar(10) default NULL,
1033 `uri` varchar(255) default NULL,
1034 `itype` varchar(10) default NULL,
1035 `more_subfields_xml` longtext default NULL,
1036 `enumchron` text default NULL,
1037 `copynumber` varchar(32) default NULL,
1038 `stocknumber` varchar(32) default NULL,
1039 PRIMARY KEY (`itemnumber`),
1040 UNIQUE KEY `itembarcodeidx` (`barcode`),
1041 KEY `itemstocknumberidx` (`stocknumber`),
1042 KEY `itembinoidx` (`biblioitemnumber`),
1043 KEY `itembibnoidx` (`biblionumber`),
1044 KEY `homebranch` (`homebranch`),
1045 KEY `holdingbranch` (`holdingbranch`),
1046 CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1047 CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
1048 CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE
1049 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1052 -- Table structure for table `itemtypes`
1055 DROP TABLE IF EXISTS `itemtypes`;
1056 CREATE TABLE `itemtypes` ( -- defines the item types
1057 `itemtype` varchar(10) NOT NULL default '', -- unique key, a code associated with the item type
1058 `description` mediumtext, -- a plain text explanation of the item type
1059 `rentalcharge` double(16,4) default NULL, -- the amount charged when this item is checked out/issued
1060 `notforloan` smallint(6) default NULL, -- 1 if the item is not for loan, 0 if the item is available for loan
1061 `imageurl` varchar(200) default NULL, -- URL for the item type icon
1062 `summary` text, -- information from the summary field, may include HTML
1063 PRIMARY KEY (`itemtype`),
1064 UNIQUE KEY `itemtype` (`itemtype`)
1065 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1068 -- Table structure for table `creator_batches`
1071 DROP TABLE IF EXISTS `creator_batches`;
1072 SET @saved_cs_client = @@character_set_client;
1073 SET character_set_client = utf8;
1074 CREATE TABLE `creator_batches` (
1075 `label_id` int(11) NOT NULL AUTO_INCREMENT,
1076 `batch_id` int(10) NOT NULL DEFAULT '1',
1077 `item_number` int(11) DEFAULT NULL,
1078 `borrower_number` int(11) DEFAULT NULL,
1079 `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1080 `branch_code` varchar(10) NOT NULL DEFAULT 'NB',
1081 `creator` char(15) NOT NULL DEFAULT 'Labels',
1082 PRIMARY KEY (`label_id`),
1083 KEY `branch_fk_constraint` (`branch_code`),
1084 KEY `item_fk_constraint` (`item_number`),
1085 KEY `borrower_fk_constraint` (`borrower_number`),
1086 CONSTRAINT `creator_batches_ibfk_1` FOREIGN KEY (`borrower_number`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1087 CONSTRAINT `creator_batches_ibfk_2` FOREIGN KEY (`branch_code`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
1088 CONSTRAINT `creator_batches_ibfk_3` FOREIGN KEY (`item_number`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE
1089 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1092 -- Table structure for table `creator_images`
1095 DROP TABLE IF EXISTS `creator_images`;
1096 SET @saved_cs_client = @@character_set_client;
1097 SET character_set_client = utf8;
1098 CREATE TABLE `creator_images` (
1099 `image_id` int(4) NOT NULL AUTO_INCREMENT,
1100 `imagefile` mediumblob,
1101 `image_name` char(20) NOT NULL DEFAULT 'DEFAULT',
1102 PRIMARY KEY (`image_id`),
1103 UNIQUE KEY `image_name_index` (`image_name`)
1104 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1107 -- Table structure for table `creator_layouts`
1110 DROP TABLE IF EXISTS `creator_layouts`;
1111 SET @saved_cs_client = @@character_set_client;
1112 SET character_set_client = utf8;
1113 CREATE TABLE `creator_layouts` (
1114 `layout_id` int(4) NOT NULL AUTO_INCREMENT,
1115 `barcode_type` char(100) NOT NULL DEFAULT 'CODE39',
1116 `start_label` int(2) NOT NULL DEFAULT '1',
1117 `printing_type` char(32) NOT NULL DEFAULT 'BAR',
1118 `layout_name` char(20) NOT NULL DEFAULT 'DEFAULT',
1119 `guidebox` int(1) DEFAULT '0',
1120 `font` char(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'TR',
1121 `font_size` int(4) NOT NULL DEFAULT '10',
1122 `units` char(20) NOT NULL DEFAULT 'POINT',
1123 `callnum_split` int(1) DEFAULT '0',
1124 `text_justify` char(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'L',
1125 `format_string` varchar(210) NOT NULL DEFAULT 'barcode',
1126 `layout_xml` text NOT NULL,
1127 `creator` char(15) NOT NULL DEFAULT 'Labels',
1128 PRIMARY KEY (`layout_id`)
1129 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1132 -- Table structure for table `creator_templates`
1135 DROP TABLE IF EXISTS `creator_templates`;
1136 SET @saved_cs_client = @@character_set_client;
1137 SET character_set_client = utf8;
1138 CREATE TABLE `creator_templates` (
1139 `template_id` int(4) NOT NULL AUTO_INCREMENT,
1140 `profile_id` int(4) DEFAULT NULL,
1141 `template_code` char(100) NOT NULL DEFAULT 'DEFAULT TEMPLATE',
1142 `template_desc` char(100) NOT NULL DEFAULT 'Default description',
1143 `page_width` float NOT NULL DEFAULT '0',
1144 `page_height` float NOT NULL DEFAULT '0',
1145 `label_width` float NOT NULL DEFAULT '0',
1146 `label_height` float NOT NULL DEFAULT '0',
1147 `top_text_margin` float NOT NULL DEFAULT '0',
1148 `left_text_margin` float NOT NULL DEFAULT '0',
1149 `top_margin` float NOT NULL DEFAULT '0',
1150 `left_margin` float NOT NULL DEFAULT '0',
1151 `cols` int(2) NOT NULL DEFAULT '0',
1152 `rows` int(2) NOT NULL DEFAULT '0',
1153 `col_gap` float NOT NULL DEFAULT '0',
1154 `row_gap` float NOT NULL DEFAULT '0',
1155 `units` char(20) NOT NULL DEFAULT 'POINT',
1156 `creator` char(15) NOT NULL DEFAULT 'Labels',
1157 PRIMARY KEY (`template_id`),
1158 KEY `template_profile_fk_constraint` (`profile_id`)
1159 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1162 -- Table structure for table `letter`
1165 DROP TABLE IF EXISTS `letter`;
1166 CREATE TABLE `letter` ( -- table for all notice templates in Koha
1167 `module` varchar(20) NOT NULL default '', -- Koha module that triggers this notice
1168 `code` varchar(20) NOT NULL default '', -- unique identifier for this notice
1169 `name` varchar(100) NOT NULL default '', -- plain text name for this notice
1170 `title` varchar(200) NOT NULL default '', -- subject line of the notice
1171 `content` text, -- body text for the notice
1172 PRIMARY KEY (`module`,`code`)
1173 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1176 -- Table structure for table `marc_subfield_structure`
1179 DROP TABLE IF EXISTS `marc_subfield_structure`;
1180 CREATE TABLE `marc_subfield_structure` (
1181 `tagfield` varchar(3) NOT NULL default '',
1182 `tagsubfield` varchar(1) NOT NULL default '' COLLATE utf8_bin,
1183 `liblibrarian` varchar(255) NOT NULL default '',
1184 `libopac` varchar(255) NOT NULL default '',
1185 `repeatable` tinyint(4) NOT NULL default 0,
1186 `mandatory` tinyint(4) NOT NULL default 0,
1187 `kohafield` varchar(40) default NULL,
1188 `tab` tinyint(1) default NULL,
1189 `authorised_value` varchar(20) default NULL,
1190 `authtypecode` varchar(20) default NULL,
1191 `value_builder` varchar(80) default NULL,
1192 `isurl` tinyint(1) default NULL,
1193 `hidden` tinyint(1) default NULL,
1194 `frameworkcode` varchar(4) NOT NULL default '',
1195 `seealso` varchar(1100) default NULL,
1196 `link` varchar(80) default NULL,
1197 `defaultvalue` text default NULL,
1198 PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`),
1199 KEY `kohafield_2` (`kohafield`),
1200 KEY `tab` (`frameworkcode`,`tab`),
1201 KEY `kohafield` (`frameworkcode`,`kohafield`)
1202 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1205 -- Table structure for table `marc_tag_structure`
1208 DROP TABLE IF EXISTS `marc_tag_structure`;
1209 CREATE TABLE `marc_tag_structure` (
1210 `tagfield` varchar(3) NOT NULL default '',
1211 `liblibrarian` varchar(255) NOT NULL default '',
1212 `libopac` varchar(255) NOT NULL default '',
1213 `repeatable` tinyint(4) NOT NULL default 0,
1214 `mandatory` tinyint(4) NOT NULL default 0,
1215 `authorised_value` varchar(10) default NULL,
1216 `frameworkcode` varchar(4) NOT NULL default '',
1217 PRIMARY KEY (`frameworkcode`,`tagfield`)
1218 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1221 -- Table structure for table `marc_matchers`
1224 DROP TABLE IF EXISTS `marc_matchers`;
1225 CREATE TABLE `marc_matchers` (
1226 `matcher_id` int(11) NOT NULL auto_increment,
1227 `code` varchar(10) NOT NULL default '',
1228 `description` varchar(255) NOT NULL default '',
1229 `record_type` varchar(10) NOT NULL default 'biblio',
1230 `threshold` int(11) NOT NULL default 0,
1231 PRIMARY KEY (`matcher_id`),
1232 KEY `code` (`code`),
1233 KEY `record_type` (`record_type`)
1234 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1237 -- Table structure for table `matchpoints`
1239 DROP TABLE IF EXISTS `matchpoints`;
1240 CREATE TABLE `matchpoints` (
1241 `matcher_id` int(11) NOT NULL,
1242 `matchpoint_id` int(11) NOT NULL auto_increment,
1243 `search_index` varchar(30) NOT NULL default '',
1244 `score` int(11) NOT NULL default 0,
1245 PRIMARY KEY (`matchpoint_id`),
1246 CONSTRAINT `matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`)
1247 REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE
1248 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1252 -- Table structure for table `matchpoint_components`
1254 DROP TABLE IF EXISTS `matchpoint_components`;
1255 CREATE TABLE `matchpoint_components` (
1256 `matchpoint_id` int(11) NOT NULL,
1257 `matchpoint_component_id` int(11) NOT NULL auto_increment,
1258 sequence int(11) NOT NULL default 0,
1259 tag varchar(3) NOT NULL default '',
1260 subfields varchar(40) NOT NULL default '',
1261 offset int(4) NOT NULL default 0,
1262 length int(4) NOT NULL default 0,
1263 PRIMARY KEY (`matchpoint_component_id`),
1264 KEY `by_sequence` (`matchpoint_id`, `sequence`),
1265 CONSTRAINT `matchpoint_components_ifbk_1` FOREIGN KEY (`matchpoint_id`)
1266 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
1267 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1270 -- Table structure for table `matcher_component_norms`
1272 DROP TABLE IF EXISTS `matchpoint_component_norms`;
1273 CREATE TABLE `matchpoint_component_norms` (
1274 `matchpoint_component_id` int(11) NOT NULL,
1275 `sequence` int(11) NOT NULL default 0,
1276 `norm_routine` varchar(50) NOT NULL default '',
1277 KEY `matchpoint_component_norms` (`matchpoint_component_id`, `sequence`),
1278 CONSTRAINT `matchpoint_component_norms_ifbk_1` FOREIGN KEY (`matchpoint_component_id`)
1279 REFERENCES `matchpoint_components` (`matchpoint_component_id`) ON DELETE CASCADE ON UPDATE CASCADE
1280 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1283 -- Table structure for table `matcher_matchpoints`
1285 DROP TABLE IF EXISTS `matcher_matchpoints`;
1286 CREATE TABLE `matcher_matchpoints` (
1287 `matcher_id` int(11) NOT NULL,
1288 `matchpoint_id` int(11) NOT NULL,
1289 CONSTRAINT `matcher_matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`)
1290 REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1291 CONSTRAINT `matcher_matchpoints_ifbk_2` FOREIGN KEY (`matchpoint_id`)
1292 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
1293 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1296 -- Table structure for table `matchchecks`
1298 DROP TABLE IF EXISTS `matchchecks`;
1299 CREATE TABLE `matchchecks` (
1300 `matcher_id` int(11) NOT NULL,
1301 `matchcheck_id` int(11) NOT NULL auto_increment,
1302 `source_matchpoint_id` int(11) NOT NULL,
1303 `target_matchpoint_id` int(11) NOT NULL,
1304 PRIMARY KEY (`matchcheck_id`),
1305 CONSTRAINT `matcher_matchchecks_ifbk_1` FOREIGN KEY (`matcher_id`)
1306 REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1307 CONSTRAINT `matcher_matchchecks_ifbk_2` FOREIGN KEY (`source_matchpoint_id`)
1308 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1309 CONSTRAINT `matcher_matchchecks_ifbk_3` FOREIGN KEY (`target_matchpoint_id`)
1310 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
1311 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1314 -- Table structure for table `notifys`
1317 DROP TABLE IF EXISTS `notifys`;
1318 CREATE TABLE `notifys` (
1319 `notify_id` int(11) NOT NULL default 0,
1320 `borrowernumber` int(11) NOT NULL default 0,
1321 `itemnumber` int(11) NOT NULL default 0,
1322 `notify_date` date default NULL,
1323 `notify_send_date` date default NULL,
1324 `notify_level` int(1) NOT NULL default 0,
1325 `method` varchar(20) NOT NULL default ''
1326 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1329 -- Table structure for table `nozebra`
1332 DROP TABLE IF EXISTS `nozebra`;
1333 CREATE TABLE `nozebra` (
1334 `server` varchar(20) NOT NULL,
1335 `indexname` varchar(40) NOT NULL,
1336 `value` varchar(250) NOT NULL,
1337 `biblionumbers` longtext NOT NULL,
1338 KEY `indexname` (`server`,`indexname`),
1339 KEY `value` (`server`,`value`))
1340 ENGINE=InnoDB DEFAULT CHARSET=utf8;
1343 -- Table structure for table `old_issues`
1346 DROP TABLE IF EXISTS `old_issues`;
1347 CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
1348 `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1349 `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
1350 `date_due` date default NULL, -- date the item is due (yyyy-mm-dd)
1351 `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
1352 `issuingbranch` varchar(18) default NULL,
1353 `returndate` date default NULL, -- date the item was returned
1354 `lastreneweddate` date default NULL, -- date the item was last renewed
1355 `return` varchar(4) default NULL,
1356 `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
1357 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1358 `issuedate` date default NULL, -- date the item was checked out or issued
1359 KEY `old_issuesborridx` (`borrowernumber`),
1360 KEY `old_issuesitemidx` (`itemnumber`),
1361 KEY `old_bordate` (`borrowernumber`,`timestamp`),
1362 CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
1363 ON DELETE SET NULL ON UPDATE SET NULL,
1364 CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`)
1365 ON DELETE SET NULL ON UPDATE SET NULL
1366 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1369 -- Table structure for table `old_reserves`
1371 DROP TABLE IF EXISTS `old_reserves`;
1372 CREATE TABLE `old_reserves` (
1373 `borrowernumber` int(11) default NULL,
1374 `reservedate` date default NULL,
1375 `biblionumber` int(11) default NULL,
1376 `constrainttype` varchar(1) default NULL,
1377 `branchcode` varchar(10) default NULL,
1378 `notificationdate` date default NULL,
1379 `reminderdate` date default NULL,
1380 `cancellationdate` date default NULL,
1381 `reservenotes` mediumtext,
1382 `priority` smallint(6) default NULL,
1383 `found` varchar(1) default NULL,
1384 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
1385 `itemnumber` int(11) default NULL,
1386 `waitingdate` date default NULL,
1387 `expirationdate` DATE DEFAULT NULL,
1388 `lowestPriority` tinyint(1) NOT NULL,
1389 KEY `old_reserves_borrowernumber` (`borrowernumber`),
1390 KEY `old_reserves_biblionumber` (`biblionumber`),
1391 KEY `old_reserves_itemnumber` (`itemnumber`),
1392 KEY `old_reserves_branchcode` (`branchcode`),
1393 CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
1394 ON DELETE SET NULL ON UPDATE SET NULL,
1395 CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`)
1396 ON DELETE SET NULL ON UPDATE SET NULL,
1397 CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`)
1398 ON DELETE SET NULL ON UPDATE SET NULL
1399 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1402 -- Table structure for table `opac_news`
1405 DROP TABLE IF EXISTS `opac_news`;
1406 CREATE TABLE `opac_news` ( -- data from the news tool
1407 `idnew` int(10) unsigned NOT NULL auto_increment, -- unique identifier for the news article
1408 `title` varchar(250) NOT NULL default '', -- title of the news article
1409 `new` text NOT NULL, -- the body of your news article
1410 `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)
1411 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, -- pulibcation date and time
1412 `expirationdate` date default NULL, -- date the article is set to expire or no longer be visible
1413 `number` int(11) default NULL, -- the order in which this article appears in that specific location
1414 PRIMARY KEY (`idnew`)
1415 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1418 -- Table structure for table `overduerules`
1421 DROP TABLE IF EXISTS `overduerules`;
1422 CREATE TABLE `overduerules` ( -- overdue notice status and triggers
1423 `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)
1424 `categorycode` varchar(10) NOT NULL default '', -- foreign key from the categories table to define which patron category this rule is for
1425 `delay1` int(4) default NULL, -- number of days after the item is overdue that the first notice is sent
1426 `letter1` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the first notice
1427 `debarred1` varchar(1) default 0, -- is the patron restricted when the first notice is sent (1 for yes, 0 for no)
1428 `delay2` int(4) default NULL, -- number of days after the item is overdue that the second notice is sent
1429 `debarred2` varchar(1) default 0, -- is the patron restricted when the second notice is sent (1 for yes, 0 for no)
1430 `letter2` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the second notice
1431 `delay3` int(4) default NULL, -- number of days after the item is overdue that the third notice is sent
1432 `letter3` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the third notice
1433 `debarred3` int(1) default 0, -- is the patron restricted when the third notice is sent (1 for yes, 0 for no)
1434 PRIMARY KEY (`branchcode`,`categorycode`)
1435 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1438 -- Table structure for table `patroncards`
1441 DROP TABLE IF EXISTS `patroncards`;
1442 CREATE TABLE `patroncards` (
1443 `cardid` int(11) NOT NULL auto_increment,
1444 `batch_id` varchar(10) NOT NULL default '1',
1445 `borrowernumber` int(11) NOT NULL,
1446 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
1447 PRIMARY KEY (`cardid`),
1448 KEY `patroncards_ibfk_1` (`borrowernumber`),
1449 CONSTRAINT `patroncards_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1450 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1453 -- Table structure for table `patronimage`
1456 DROP TABLE IF EXISTS `patronimage`;
1457 CREATE TABLE `patronimage` (
1458 `cardnumber` varchar(16) NOT NULL,
1459 `mimetype` varchar(15) NOT NULL,
1460 `imagefile` mediumblob NOT NULL,
1461 PRIMARY KEY (`cardnumber`),
1462 CONSTRAINT `patronimage_fk1` FOREIGN KEY (`cardnumber`) REFERENCES `borrowers` (`cardnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1463 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1466 -- Table structure for table `printers`
1469 DROP TABLE IF EXISTS `printers`;
1470 CREATE TABLE `printers` (
1471 `printername` varchar(40) NOT NULL default '',
1472 `printqueue` varchar(20) default NULL,
1473 `printtype` varchar(20) default NULL,
1474 PRIMARY KEY (`printername`)
1475 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1478 -- Table structure for table `printers_profile`
1481 DROP TABLE IF EXISTS `printers_profile`;
1482 CREATE TABLE `printers_profile` (
1483 `profile_id` int(4) NOT NULL auto_increment,
1484 `printer_name` varchar(40) NOT NULL default 'Default Printer',
1485 `template_id` int(4) NOT NULL default '0',
1486 `paper_bin` varchar(20) NOT NULL default 'Bypass',
1487 `offset_horz` float NOT NULL default '0',
1488 `offset_vert` float NOT NULL default '0',
1489 `creep_horz` float NOT NULL default '0',
1490 `creep_vert` float NOT NULL default '0',
1491 `units` char(20) NOT NULL default 'POINT',
1492 `creator` char(15) NOT NULL DEFAULT 'Labels',
1493 PRIMARY KEY (`profile_id`),
1494 UNIQUE KEY `printername` (`printer_name`,`template_id`,`paper_bin`,`creator`)
1495 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1498 -- Table structure for table `repeatable_holidays`
1501 DROP TABLE IF EXISTS `repeatable_holidays`;
1502 CREATE TABLE `repeatable_holidays` ( -- information for the days the library is closed
1503 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1504 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, defines which branch this closing is for
1505 `weekday` smallint(6) default NULL, -- day of the week (0=Sunday, 1=Monday, etc) this closing is repeated on
1506 `day` smallint(6) default NULL, -- day of the month this closing is on
1507 `month` smallint(6) default NULL, -- month this closing is in
1508 `title` varchar(50) NOT NULL default '', -- title of this closing
1509 `description` text NOT NULL, -- description for this closing
1511 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1514 -- Table structure for table `reports_dictionary`
1517 DROP TABLE IF EXISTS `reports_dictionary`;
1518 CREATE TABLE reports_dictionary ( -- definitions (or snippets of SQL) stored for use in reports
1519 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1520 `name` varchar(255) default NULL, -- name for this definition
1521 `description` text, -- description for this definition
1522 `date_created` datetime default NULL, -- date and time this definition was created
1523 `date_modified` datetime default NULL, -- date and time this definition was last modified
1524 `saved_sql` text, -- SQL snippet for us in reports
1525 `area` int(11) default NULL, -- Koha module this definition is for (1 = Circulation, 2 = Catalog, 3 = Patrons, 4 = Acquistions, 5 = Accounts)
1527 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1530 -- Table structure for table `reserveconstraints`
1533 DROP TABLE IF EXISTS `reserveconstraints`;
1534 CREATE TABLE `reserveconstraints` (
1535 `borrowernumber` int(11) NOT NULL default 0,
1536 `reservedate` date default NULL,
1537 `biblionumber` int(11) NOT NULL default 0,
1538 `biblioitemnumber` int(11) default NULL,
1539 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
1540 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1543 -- Table structure for table `reserves`
1546 DROP TABLE IF EXISTS `reserves`;
1547 CREATE TABLE `reserves` (
1548 `borrowernumber` int(11) NOT NULL default 0,
1549 `reservedate` date default NULL,
1550 `biblionumber` int(11) NOT NULL default 0,
1551 `constrainttype` varchar(1) default NULL,
1552 `branchcode` varchar(10) default NULL,
1553 `notificationdate` date default NULL,
1554 `reminderdate` date default NULL,
1555 `cancellationdate` date default NULL,
1556 `reservenotes` mediumtext,
1557 `priority` smallint(6) default NULL,
1558 `found` varchar(1) default NULL,
1559 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
1560 `itemnumber` int(11) default NULL,
1561 `waitingdate` date default NULL,
1562 `expirationdate` DATE DEFAULT NULL,
1563 `lowestPriority` tinyint(1) NOT NULL,
1564 KEY priorityfoundidx (priority,found),
1565 KEY `borrowernumber` (`borrowernumber`),
1566 KEY `biblionumber` (`biblionumber`),
1567 KEY `itemnumber` (`itemnumber`),
1568 KEY `branchcode` (`branchcode`),
1569 CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1570 CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1571 CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1572 CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1573 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1576 -- Table structure for table `reviews`
1579 DROP TABLE IF EXISTS `reviews`;
1580 CREATE TABLE `reviews` ( -- patron opac comments
1581 `reviewid` int(11) NOT NULL auto_increment, -- unique identifier for this comment
1582 `borrowernumber` int(11) default NULL, -- foreign key from the borrowers table defining which patron left this comment
1583 `biblionumber` int(11) default NULL, -- foreign key from the biblio table defining which bibliographic record this comment is for
1584 `review` text, -- the body of the comment
1585 `approved` tinyint(4) default NULL, -- whether this comment has been approved by a librarian (1 for yes, 0 for no)
1586 `datereviewed` datetime default NULL, -- the date the comment was left
1587 PRIMARY KEY (`reviewid`)
1588 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1591 -- Table structure for table `roadtype`
1594 DROP TABLE IF EXISTS `roadtype`;
1595 CREATE TABLE `roadtype` ( -- road types defined in administration and used in patron management
1596 `roadtypeid` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha for each road type
1597 `road_type` varchar(100) NOT NULL default '', -- text for road type
1598 PRIMARY KEY (`roadtypeid`)
1599 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1602 -- Table structure for table `saved_sql`
1605 DROP TABLE IF EXISTS `saved_sql`;
1606 CREATE TABLE saved_sql (
1607 `id` int(11) NOT NULL auto_increment,
1608 `borrowernumber` int(11) default NULL,
1609 `date_created` datetime default NULL,
1610 `last_modified` datetime default NULL,
1612 `last_run` datetime default NULL,
1613 `report_name` varchar(255) default NULL,
1614 `type` varchar(255) default NULL,
1617 KEY boridx (`borrowernumber`)
1618 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1622 -- Table structure for `saved_reports`
1625 DROP TABLE IF EXISTS `saved_reports`;
1626 CREATE TABLE saved_reports (
1627 `id` int(11) NOT NULL auto_increment,
1628 `report_id` int(11) default NULL,
1630 `date_run` datetime default NULL,
1632 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1636 -- Table structure for table `search_history`
1639 DROP TABLE IF EXISTS `search_history`;
1640 CREATE TABLE IF NOT EXISTS `search_history` (
1641 `userid` int(11) NOT NULL,
1642 `sessionid` varchar(32) NOT NULL,
1643 `query_desc` varchar(255) NOT NULL,
1644 `query_cgi` varchar(255) NOT NULL,
1645 `total` int(11) NOT NULL,
1646 `time` timestamp NOT NULL default CURRENT_TIMESTAMP,
1647 KEY `userid` (`userid`),
1648 KEY `sessionid` (`sessionid`)
1649 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Opac search history results';
1653 -- Table structure for table `serial`
1656 DROP TABLE IF EXISTS `serial`;
1657 CREATE TABLE `serial` (
1658 `serialid` int(11) NOT NULL auto_increment,
1659 `biblionumber` varchar(100) NOT NULL default '',
1660 `subscriptionid` varchar(100) NOT NULL default '',
1661 `serialseq` varchar(100) NOT NULL default '',
1662 `status` tinyint(4) NOT NULL default 0,
1663 `planneddate` date default NULL,
1665 `publisheddate` date default NULL,
1666 `itemnumber` text default NULL,
1667 `claimdate` date default NULL,
1668 `routingnotes` text,
1669 PRIMARY KEY (`serialid`)
1670 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1673 -- Table structure for table `sessions`
1676 DROP TABLE IF EXISTS sessions;
1677 CREATE TABLE sessions (
1678 `id` varchar(32) NOT NULL,
1679 `a_session` text NOT NULL,
1681 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1684 -- Table structure for table `special_holidays`
1687 DROP TABLE IF EXISTS `special_holidays`;
1688 CREATE TABLE `special_holidays` ( -- non repeatable holidays/library closings
1689 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1690 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, defines which branch this closing is for
1691 `day` smallint(6) NOT NULL default 0, -- day of the month this closing is on
1692 `month` smallint(6) NOT NULL default 0, -- month this closing is in
1693 `year` smallint(6) NOT NULL default 0, -- year this closing is in
1694 `isexception` smallint(1) NOT NULL default 1, -- is this a holiday exception to a repeatable holiday (1 for yes, 0 for no)
1695 `title` varchar(50) NOT NULL default '', -- title for this closing
1696 `description` text NOT NULL, -- description of this closing
1698 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1701 -- Table structure for table `statistics`
1704 DROP TABLE IF EXISTS `statistics`;
1705 CREATE TABLE `statistics` ( -- information related to transactions (circulation and fines) in Koha
1706 `datetime` datetime default NULL, -- date and time of the transaction
1707 `branch` varchar(10) default NULL, -- foreign key, branch where the transaction occurred
1708 `proccode` varchar(4) default NULL, -- proceedure code
1709 `value` double(16,4) default NULL, -- monetary value associated with the transaction
1710 `type` varchar(16) default NULL, -- transaction type (locause, issue, return, renew, writeoff, payment, Credit*)
1712 `usercode` varchar(10) default NULL,
1713 `itemnumber` int(11) default NULL, -- foreign key from the items table, links transaction to a specific item
1714 `itemtype` varchar(10) default NULL, -- foreign key from the itemtypes table, links transaction to a specific item type
1715 `borrowernumber` int(11) default NULL, -- foreign key from the borrowers table, links transaction to a specific borrower
1716 `associatedborrower` int(11) default NULL,
1717 KEY `timeidx` (`datetime`)
1718 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1721 -- Table structure for table `stopwords`
1724 DROP TABLE IF EXISTS `stopwords`;
1725 CREATE TABLE `stopwords` (
1726 `word` varchar(255) default NULL
1727 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1730 -- Table structure for table `subscription`
1733 DROP TABLE IF EXISTS `subscription`;
1734 CREATE TABLE `subscription` (
1735 `biblionumber` int(11) NOT NULL default 0,
1736 `subscriptionid` int(11) NOT NULL auto_increment,
1737 `librarian` varchar(100) default '',
1738 `startdate` date default NULL,
1739 `aqbooksellerid` int(11) default 0,
1740 `cost` int(11) default 0,
1741 `aqbudgetid` int(11) default 0,
1742 `weeklength` int(11) default 0,
1743 `monthlength` int(11) default 0,
1744 `numberlength` int(11) default 0,
1745 `periodicity` tinyint(4) default 0,
1746 `dow` varchar(100) default '',
1747 `numberingmethod` varchar(100) default '',
1749 `status` varchar(100) NOT NULL default '',
1750 `add1` int(11) default 0,
1751 `every1` int(11) default 0,
1752 `whenmorethan1` int(11) default 0,
1753 `setto1` int(11) default NULL,
1754 `lastvalue1` int(11) default NULL,
1755 `add2` int(11) default 0,
1756 `every2` int(11) default 0,
1757 `whenmorethan2` int(11) default 0,
1758 `setto2` int(11) default NULL,
1759 `lastvalue2` int(11) default NULL,
1760 `add3` int(11) default 0,
1761 `every3` int(11) default 0,
1762 `innerloop1` int(11) default 0,
1763 `innerloop2` int(11) default 0,
1764 `innerloop3` int(11) default 0,
1765 `whenmorethan3` int(11) default 0,
1766 `setto3` int(11) default NULL,
1767 `lastvalue3` int(11) default NULL,
1768 `issuesatonce` tinyint(3) NOT NULL default 1,
1769 `firstacquidate` date default NULL,
1770 `manualhistory` tinyint(1) NOT NULL default 0,
1771 `irregularity` text,
1772 `letter` varchar(20) default NULL,
1773 `numberpattern` tinyint(3) default 0,
1774 `distributedto` text,
1775 `internalnotes` longtext,
1777 `location` varchar(80) NULL default '',
1778 `branchcode` varchar(10) NOT NULL default '',
1779 `hemisphere` tinyint(3) default 0,
1780 `lastbranch` varchar(10),
1781 `serialsadditems` tinyint(1) NOT NULL default '0',
1782 `staffdisplaycount` VARCHAR(10) NULL,
1783 `opacdisplaycount` VARCHAR(10) NULL,
1784 `graceperiod` int(11) NOT NULL default '0',
1785 `enddate` date default NULL,
1786 PRIMARY KEY (`subscriptionid`)
1787 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1790 -- Table structure for table `subscriptionhistory`
1793 DROP TABLE IF EXISTS `subscriptionhistory`;
1794 CREATE TABLE `subscriptionhistory` (
1795 `biblionumber` int(11) NOT NULL default 0,
1796 `subscriptionid` int(11) NOT NULL default 0,
1797 `histstartdate` date default NULL,
1798 `histenddate` date default NULL,
1799 `missinglist` longtext NOT NULL,
1800 `recievedlist` longtext NOT NULL,
1801 `opacnote` varchar(150) NOT NULL default '',
1802 `librariannote` varchar(150) NOT NULL default '',
1803 PRIMARY KEY (`subscriptionid`),
1804 KEY `biblionumber` (`biblionumber`)
1805 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1808 -- Table structure for table `subscriptionroutinglist`
1811 DROP TABLE IF EXISTS `subscriptionroutinglist`;
1812 CREATE TABLE `subscriptionroutinglist` ( -- information related to the routing lists attached to subscriptions
1813 `routingid` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1814 `borrowernumber` int(11) NOT NULL, -- foreign key from the borrowers table, defines with patron is on the routing list
1815 `ranking` int(11) default NULL, -- where the patron stands in line to receive the serial
1816 `subscriptionid` int(11) NOT NULL, -- foreign key from the subscription table, defines which subscription this routing list is for
1817 PRIMARY KEY (`routingid`),
1818 UNIQUE (`subscriptionid`, `borrowernumber`),
1819 CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
1820 ON DELETE CASCADE ON UPDATE CASCADE,
1821 CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`)
1822 ON DELETE CASCADE ON UPDATE CASCADE
1823 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1826 -- Table structure for table `suggestions`
1829 DROP TABLE IF EXISTS `suggestions`;
1830 CREATE TABLE `suggestions` ( -- purchase suggestions
1831 `suggestionid` int(8) NOT NULL auto_increment, -- unique identifier assigned automatically by Koha
1832 `suggestedby` int(11) NOT NULL default 0, -- borrowernumber for the person making the suggestion, foreign key linking to the borrowers table
1833 `suggesteddate` date NOT NULL default 0, -- date the suggestion was submitted
1834 `managedby` int(11) default NULL, -- borrowernumber for the librarian managing the suggestion, foreign key linking to the borrowers table
1835 `manageddate` date default NULL, -- date the suggestion was updated
1836 acceptedby INT(11) default NULL, -- borrowernumber for the librarian who accepted the suggestion, foreign key linking to the borrowers table
1837 accepteddate date default NULL, -- date the suggestion was marked as accepted
1838 rejectedby INT(11) default NULL, -- borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table
1839 rejecteddate date default NULL, -- date the suggestion was marked as rejected
1840 `STATUS` varchar(10) NOT NULL default '', -- suggestion status (ASKED, CHECKED, ACCEPTED, or REJECTED)
1841 `note` mediumtext, -- note entered on the suggestion
1842 `author` varchar(80) default NULL, -- author of the suggested item
1843 `title` varchar(80) default NULL, -- title of the suggested item
1844 `copyrightdate` smallint(6) default NULL, -- copyright date of the suggested item
1845 `publishercode` varchar(255) default NULL, -- publisher of the suggested item
1846 `date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time the suggestion was updated
1847 `volumedesc` varchar(255) default NULL,
1848 `publicationyear` smallint(6) default 0,
1849 `place` varchar(255) default NULL, -- publication place of the suggested item
1850 `isbn` varchar(30) default NULL, -- isbn of the suggested item
1851 `mailoverseeing` smallint(1) default 0,
1852 `biblionumber` int(11) default NULL, -- foreign key linking the suggestion to the biblio table after the suggestion has been ordered
1853 `reason` text, -- reason for making the suggestion
1854 budgetid INT(11), -- foreign key linking the suggested budget to the aqbudgets table
1855 branchcode VARCHAR(10) default NULL, -- foreign key linking the suggested branch to the branches table
1856 collectiontitle text default NULL, -- collection name for the suggested item
1857 itemtype VARCHAR(30) default NULL, -- suggested item type
1858 quantity SMALLINT(6) default NULL, -- suggested quantity to be purchased
1859 currency VARCHAR(3) default NULL, -- suggested currency for the suggested price
1860 price DECIMAL(28,6) default NULL, -- suggested price
1861 total DECIMAL(28,6) default NULL, -- suggested total cost (price*quantity updated for currency)
1862 PRIMARY KEY (`suggestionid`),
1863 KEY `suggestedby` (`suggestedby`),
1864 KEY `managedby` (`managedby`)
1865 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1868 -- Table structure for table `systempreferences`
1871 DROP TABLE IF EXISTS `systempreferences`;
1872 CREATE TABLE `systempreferences` ( -- global system preferences
1873 `variable` varchar(50) NOT NULL default '', -- system preference name
1874 `value` text, -- system preference values
1875 `options` mediumtext, -- options for multiple choice system preferences
1876 `explanation` text, -- descriptive text for the system preference
1877 `type` varchar(20) default NULL, -- type of question this preference asks (multiple choice, plain text, yes or no, etc)
1878 PRIMARY KEY (`variable`)
1879 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1882 -- Table structure for table `tags`
1885 DROP TABLE IF EXISTS `tags`;
1886 CREATE TABLE `tags` (
1887 `entry` varchar(255) NOT NULL default '',
1888 `weight` bigint(20) NOT NULL default 0,
1889 PRIMARY KEY (`entry`)
1890 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1893 -- Table structure for table `tags_all`
1896 DROP TABLE IF EXISTS `tags_all`;
1897 CREATE TABLE `tags_all` (
1898 `tag_id` int(11) NOT NULL auto_increment,
1899 `borrowernumber` int(11) NOT NULL,
1900 `biblionumber` int(11) NOT NULL,
1901 `term` varchar(255) NOT NULL,
1902 `language` int(4) default NULL,
1903 `date_created` datetime NOT NULL,
1904 PRIMARY KEY (`tag_id`),
1905 KEY `tags_borrowers_fk_1` (`borrowernumber`),
1906 KEY `tags_biblionumber_fk_1` (`biblionumber`),
1907 CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`)
1908 REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1909 CONSTRAINT `tags_biblionumber_fk_1` FOREIGN KEY (`biblionumber`)
1910 REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1911 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1914 -- Table structure for table `tags_approval`
1917 DROP TABLE IF EXISTS `tags_approval`;
1918 CREATE TABLE `tags_approval` (
1919 `term` varchar(255) NOT NULL,
1920 `approved` int(1) NOT NULL default '0',
1921 `date_approved` datetime default NULL,
1922 `approved_by` int(11) default NULL,
1923 `weight_total` int(9) NOT NULL default '1',
1924 PRIMARY KEY (`term`),
1925 KEY `tags_approval_borrowers_fk_1` (`approved_by`),
1926 CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`)
1927 REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1928 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1931 -- Table structure for table `tags_index`
1934 DROP TABLE IF EXISTS `tags_index`;
1935 CREATE TABLE `tags_index` (
1936 `term` varchar(255) NOT NULL,
1937 `biblionumber` int(11) NOT NULL,
1938 `weight` int(9) NOT NULL default '1',
1939 PRIMARY KEY (`term`,`biblionumber`),
1940 KEY `tags_index_biblionumber_fk_1` (`biblionumber`),
1941 CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`)
1942 REFERENCES `tags_approval` (`term`) ON DELETE CASCADE ON UPDATE CASCADE,
1943 CONSTRAINT `tags_index_biblionumber_fk_1` FOREIGN KEY (`biblionumber`)
1944 REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1945 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1948 -- Table structure for table `userflags`
1951 DROP TABLE IF EXISTS `userflags`;
1952 CREATE TABLE `userflags` (
1953 `bit` int(11) NOT NULL default 0,
1954 `flag` varchar(30) default NULL,
1955 `flagdesc` varchar(255) default NULL,
1956 `defaulton` int(11) default NULL,
1958 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1961 -- Table structure for table `virtualshelves`
1964 DROP TABLE IF EXISTS `virtualshelves`;
1965 CREATE TABLE `virtualshelves` ( -- information about lists (or virtual shelves)
1966 `shelfnumber` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1967 `shelfname` varchar(255) default NULL, -- name of the list
1968 `owner` varchar(80) default NULL, -- foriegn key linking to the borrowers table (using borrowernumber) for the creator of this list
1969 `category` varchar(1) default NULL, -- type of list (public [2], private [1] or open [3])
1970 `sortfield` varchar(16) default NULL, -- the field this list is sorted on
1971 `lastmodified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time the list was last modified
1972 PRIMARY KEY (`shelfnumber`)
1973 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1976 -- Table structure for table `virtualshelfcontents`
1979 DROP TABLE IF EXISTS `virtualshelfcontents`;
1980 CREATE TABLE `virtualshelfcontents` ( -- information about the titles in a list (or virtual shelf)
1981 `shelfnumber` int(11) NOT NULL default 0, -- foreign key linking to the virtualshelves table, defines the list that this record has been added to
1982 `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
1983 `flags` int(11) default NULL,
1984 `dateadded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- date and time this bib record was added to the list
1985 KEY `shelfnumber` (`shelfnumber`),
1986 KEY `biblionumber` (`biblionumber`),
1987 CONSTRAINT `virtualshelfcontents_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1988 CONSTRAINT `shelfcontents_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1989 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1992 -- Table structure for table `z3950servers`
1995 DROP TABLE IF EXISTS `z3950servers`;
1996 CREATE TABLE `z3950servers` ( -- connection information for the Z39.50 targets used in cataloging
1997 `host` varchar(255) default NULL, -- target's host name
1998 `port` int(11) default NULL, -- port number used to connect to target
1999 `db` varchar(255) default NULL, -- target's database name
2000 `userid` varchar(255) default NULL, -- username needed to log in to target
2001 `password` varchar(255) default NULL, -- password needed to log in to target
2002 `name` mediumtext, -- name given to the target by the library
2003 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2004 `checked` smallint(6) default NULL, -- whether this target is checked by default (1 for yes, 0 for no)
2005 `rank` int(11) default NULL, -- where this target appears in the list of targets
2006 `syntax` varchar(80) default NULL, -- marc format provided by this target
2007 `icon` text, -- unused in Koha
2008 `position` enum('primary','secondary','') NOT NULL default 'primary',
2009 `type` enum('zed','opensearch') NOT NULL default 'zed',
2010 `encoding` text default NULL, -- characters encoding provided by this target
2011 `description` text NOT NULL, -- unused in Koha
2013 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2016 -- Table structure for table `zebraqueue`
2019 DROP TABLE IF EXISTS `zebraqueue`;
2020 CREATE TABLE `zebraqueue` (
2021 `id` int(11) NOT NULL auto_increment,
2022 `biblio_auth_number` bigint(20) unsigned NOT NULL default '0',
2023 `operation` char(20) NOT NULL default '',
2024 `server` char(20) NOT NULL default '',
2025 `done` int(11) NOT NULL default '0',
2026 `time` timestamp NOT NULL default CURRENT_TIMESTAMP,
2028 KEY `zebraqueue_lookup` (`server`, `biblio_auth_number`, `operation`, `done`)
2029 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2032 -- Table structure for table `services_throttle`
2035 DROP TABLE IF EXISTS `services_throttle`;
2036 CREATE TABLE `services_throttle` (
2037 `service_type` varchar(10) NOT NULL default '',
2038 `service_count` varchar(45) default NULL,
2039 PRIMARY KEY (`service_type`)
2040 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2043 -- Table structure for table `language_subtag_registry`
2044 -- http://www.w3.org/International/articles/language-tags/
2048 DROP TABLE IF EXISTS language_subtag_registry;
2049 CREATE TABLE language_subtag_registry (
2051 type varchar(25), -- language-script-region-variant-extension-privateuse
2052 description varchar(25), -- only one of the possible descriptions for ease of reference, see language_descriptions for the complete list
2054 id int(11) NOT NULL auto_increment,
2056 KEY `subtag` (`subtag`)
2057 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2060 -- Table structure for table `language_rfc4646_to_iso639`
2061 -- TODO: add suppress_scripts
2062 -- this maps three letter codes defined in iso639.2 back to their
2063 -- two letter equivilents in rfc4646 (LOC maintains iso639+)
2066 DROP TABLE IF EXISTS language_rfc4646_to_iso639;
2067 CREATE TABLE language_rfc4646_to_iso639 (
2068 rfc4646_subtag varchar(25),
2069 iso639_2_code varchar(25),
2070 id int(11) NOT NULL auto_increment,
2072 KEY `rfc4646_subtag` (`rfc4646_subtag`)
2073 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2076 -- Table structure for table `language_descriptions`
2079 DROP TABLE IF EXISTS language_descriptions;
2080 CREATE TABLE language_descriptions (
2084 description varchar(255),
2085 id int(11) NOT NULL auto_increment,
2087 KEY `lang` (`lang`),
2088 KEY `subtag_type_lang` (`subtag`, `type`, `lang`)
2089 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2092 -- Table structure for table `language_script_bidi`
2093 -- bi-directional support, keyed by script subcode
2096 DROP TABLE IF EXISTS language_script_bidi;
2097 CREATE TABLE language_script_bidi (
2098 rfc4646_subtag varchar(25), -- script subtag, Arab, Hebr, etc.
2099 bidi varchar(3), -- rtl ltr
2100 KEY `rfc4646_subtag` (`rfc4646_subtag`)
2101 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2104 -- Table structure for table `language_script_mapping`
2105 -- TODO: need to map language subtags to script subtags for detection
2106 -- of bidi when script is not specified (like ar, he)
2109 DROP TABLE IF EXISTS language_script_mapping;
2110 CREATE TABLE language_script_mapping (
2111 language_subtag varchar(25),
2112 script_subtag varchar(25),
2113 KEY `language_subtag` (`language_subtag`)
2114 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2117 -- Table structure for table `permissions`
2120 DROP TABLE IF EXISTS `permissions`;
2121 CREATE TABLE `permissions` (
2122 `module_bit` int(11) NOT NULL DEFAULT 0,
2123 `code` varchar(64) DEFAULT NULL,
2124 `description` varchar(255) DEFAULT NULL,
2125 PRIMARY KEY (`module_bit`, `code`),
2126 CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`)
2127 ON DELETE CASCADE ON UPDATE CASCADE
2128 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2131 -- Table structure for table `serialitems`
2134 DROP TABLE IF EXISTS `serialitems`;
2135 CREATE TABLE `serialitems` (
2136 `itemnumber` int(11) NOT NULL,
2137 `serialid` int(11) NOT NULL,
2138 UNIQUE KEY `serialitemsidx` (`itemnumber`),
2139 KEY `serialitems_sfk_1` (`serialid`),
2140 CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE,
2141 CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
2142 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2145 -- Table structure for table `user_permissions`
2148 DROP TABLE IF EXISTS `user_permissions`;
2149 CREATE TABLE `user_permissions` (
2150 `borrowernumber` int(11) NOT NULL DEFAULT 0,
2151 `module_bit` int(11) NOT NULL DEFAULT 0,
2152 `code` varchar(64) DEFAULT NULL,
2153 CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
2154 ON DELETE CASCADE ON UPDATE CASCADE,
2155 CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`)
2156 ON DELETE CASCADE ON UPDATE CASCADE
2157 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2160 -- Table structure for table `tmp_holdsqueue`
2163 DROP TABLE IF EXISTS `tmp_holdsqueue`;
2164 CREATE TABLE `tmp_holdsqueue` (
2165 `biblionumber` int(11) default NULL,
2166 `itemnumber` int(11) default NULL,
2167 `barcode` varchar(20) default NULL,
2168 `surname` mediumtext NOT NULL,
2171 `borrowernumber` int(11) NOT NULL,
2172 `cardnumber` varchar(16) default NULL,
2173 `reservedate` date default NULL,
2175 `itemcallnumber` varchar(255) default NULL,
2176 `holdingbranch` varchar(10) default NULL,
2177 `pickbranch` varchar(10) default NULL,
2179 `item_level_request` tinyint(4) NOT NULL default 0
2180 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2183 -- Table structure for table `message_queue`
2186 DROP TABLE IF EXISTS `message_queue`;
2187 CREATE TABLE `message_queue` (
2188 `message_id` int(11) NOT NULL auto_increment,
2189 `borrowernumber` int(11) default NULL,
2192 `metadata` text DEFAULT NULL,
2193 `letter_code` varchar(64) DEFAULT NULL,
2194 `message_transport_type` varchar(20) NOT NULL,
2195 `status` enum('sent','pending','failed','deleted') NOT NULL default 'pending',
2196 `time_queued` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2197 `to_address` mediumtext,
2198 `from_address` mediumtext,
2199 `content_type` text,
2200 KEY `message_id` (`message_id`),
2201 KEY `borrowernumber` (`borrowernumber`),
2202 KEY `message_transport_type` (`message_transport_type`),
2203 CONSTRAINT `messageq_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2204 CONSTRAINT `messageq_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE RESTRICT ON UPDATE CASCADE
2205 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2208 -- Table structure for table `message_transport_types`
2211 DROP TABLE IF EXISTS `message_transport_types`;
2212 CREATE TABLE `message_transport_types` (
2213 `message_transport_type` varchar(20) NOT NULL,
2214 PRIMARY KEY (`message_transport_type`)
2215 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2218 -- Table structure for table `message_attributes`
2221 DROP TABLE IF EXISTS `message_attributes`;
2222 CREATE TABLE `message_attributes` (
2223 `message_attribute_id` int(11) NOT NULL auto_increment,
2224 `message_name` varchar(40) NOT NULL default '',
2225 `takes_days` tinyint(1) NOT NULL default '0',
2226 PRIMARY KEY (`message_attribute_id`),
2227 UNIQUE KEY `message_name` (`message_name`)
2228 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2231 -- Table structure for table `message_transports`
2234 DROP TABLE IF EXISTS `message_transports`;
2235 CREATE TABLE `message_transports` (
2236 `message_attribute_id` int(11) NOT NULL,
2237 `message_transport_type` varchar(20) NOT NULL,
2238 `is_digest` tinyint(1) NOT NULL default '0',
2239 `letter_module` varchar(20) NOT NULL default '',
2240 `letter_code` varchar(20) NOT NULL default '',
2241 PRIMARY KEY (`message_attribute_id`,`message_transport_type`,`is_digest`),
2242 KEY `message_transport_type` (`message_transport_type`),
2243 KEY `letter_module` (`letter_module`,`letter_code`),
2244 CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2245 CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
2246 CONSTRAINT `message_transports_ibfk_3` FOREIGN KEY (`letter_module`, `letter_code`) REFERENCES `letter` (`module`, `code`) ON DELETE CASCADE ON UPDATE CASCADE
2247 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2250 -- Table structure for table `borrower_message_preferences`
2253 DROP TABLE IF EXISTS `borrower_message_preferences`;
2254 CREATE TABLE `borrower_message_preferences` (
2255 `borrower_message_preference_id` int(11) NOT NULL auto_increment,
2256 `borrowernumber` int(11) default NULL,
2257 `categorycode` varchar(10) default NULL,
2258 `message_attribute_id` int(11) default '0',
2259 `days_in_advance` int(11) default '0',
2260 `wants_digest` tinyint(1) NOT NULL default '0',
2261 PRIMARY KEY (`borrower_message_preference_id`),
2262 KEY `borrowernumber` (`borrowernumber`),
2263 KEY `categorycode` (`categorycode`),
2264 KEY `message_attribute_id` (`message_attribute_id`),
2265 CONSTRAINT `borrower_message_preferences_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2266 CONSTRAINT `borrower_message_preferences_ibfk_2` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2267 CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
2268 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2271 -- Table structure for table `borrower_message_transport_preferences`
2274 DROP TABLE IF EXISTS `borrower_message_transport_preferences`;
2275 CREATE TABLE `borrower_message_transport_preferences` (
2276 `borrower_message_preference_id` int(11) NOT NULL default '0',
2277 `message_transport_type` varchar(20) NOT NULL default '0',
2278 PRIMARY KEY (`borrower_message_preference_id`,`message_transport_type`),
2279 KEY `message_transport_type` (`message_transport_type`),
2280 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,
2281 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
2282 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2285 -- Table structure for the table branch_transfer_limits
2288 DROP TABLE IF EXISTS `branch_transfer_limits`;
2289 CREATE TABLE branch_transfer_limits (
2290 limitId int(8) NOT NULL auto_increment,
2291 toBranch varchar(10) NOT NULL,
2292 fromBranch varchar(10) NOT NULL,
2293 itemtype varchar(10) NULL,
2294 ccode varchar(10) NULL,
2295 PRIMARY KEY (limitId)
2296 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2299 -- Table structure for table `item_circulation_alert_preferences`
2302 DROP TABLE IF EXISTS `item_circulation_alert_preferences`;
2303 CREATE TABLE `item_circulation_alert_preferences` (
2304 `id` int(11) NOT NULL auto_increment,
2305 `branchcode` varchar(10) NOT NULL,
2306 `categorycode` varchar(10) NOT NULL,
2307 `item_type` varchar(10) NOT NULL,
2308 `notification` varchar(16) NOT NULL,
2310 KEY `branchcode` (`branchcode`,`categorycode`,`item_type`, `notification`)
2311 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2314 -- Table structure for table `messages`
2316 DROP TABLE IF EXISTS `messages`;
2317 CREATE TABLE `messages` ( -- circulation messages left via the patron's check out screen
2318 `message_id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2319 `borrowernumber` int(11) NOT NULL, -- foreign key linking this message to the borrowers table
2320 `branchcode` varchar(10) default NULL, -- foreign key linking the message to the branches table
2321 `message_type` varchar(1) NOT NULL, -- whether the message is for the librarians (L) or the patron (B)
2322 `message` text NOT NULL, -- the text of the message
2323 `message_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- the date and time the message was written
2324 PRIMARY KEY (`message_id`)
2325 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2328 -- Table structure for table `accountlines`
2331 DROP TABLE IF EXISTS `accountlines`;
2332 CREATE TABLE `accountlines` (
2333 `borrowernumber` int(11) NOT NULL default 0,
2334 `accountno` smallint(6) NOT NULL default 0,
2335 `itemnumber` int(11) default NULL,
2336 `date` date default NULL,
2337 `amount` decimal(28,6) default NULL,
2338 `description` mediumtext,
2339 `dispute` mediumtext,
2340 `accounttype` varchar(5) default NULL,
2341 `amountoutstanding` decimal(28,6) default NULL,
2342 `lastincrement` decimal(28,6) default NULL,
2343 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2344 `notify_id` int(11) NOT NULL default 0,
2345 `notify_level` int(2) NOT NULL default 0,
2346 `note` text NULL default NULL,
2347 `manager_id` int(11) NULL,
2348 KEY `acctsborridx` (`borrowernumber`),
2349 KEY `timeidx` (`timestamp`),
2350 KEY `itemnumber` (`itemnumber`),
2351 CONSTRAINT `accountlines_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2352 CONSTRAINT `accountlines_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL
2353 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2356 -- Table structure for table `accountoffsets`
2359 DROP TABLE IF EXISTS `accountoffsets`;
2360 CREATE TABLE `accountoffsets` (
2361 `borrowernumber` int(11) NOT NULL default 0,
2362 `accountno` smallint(6) NOT NULL default 0,
2363 `offsetaccount` smallint(6) NOT NULL default 0,
2364 `offsetamount` decimal(28,6) default NULL,
2365 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2366 CONSTRAINT `accountoffsets_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2367 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2370 -- Table structure for table `action_logs`
2373 DROP TABLE IF EXISTS `action_logs`;
2374 CREATE TABLE `action_logs` (
2375 `action_id` int(11) NOT NULL auto_increment,
2376 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2377 `user` int(11) NOT NULL default 0,
2380 `object` int(11) default NULL,
2382 PRIMARY KEY (`action_id`),
2383 KEY (`timestamp`,`user`)
2384 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2387 -- Table structure for table `alert`
2390 DROP TABLE IF EXISTS `alert`;
2391 CREATE TABLE `alert` (
2392 `alertid` int(11) NOT NULL auto_increment,
2393 `borrowernumber` int(11) NOT NULL default 0,
2394 `type` varchar(10) NOT NULL default '',
2395 `externalid` varchar(20) NOT NULL default '',
2396 PRIMARY KEY (`alertid`),
2397 KEY `borrowernumber` (`borrowernumber`),
2398 KEY `type` (`type`,`externalid`)
2399 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2402 -- Table structure for table `aqbasketgroups`
2405 DROP TABLE IF EXISTS `aqbasketgroups`;
2406 CREATE TABLE `aqbasketgroups` (
2407 `id` int(11) NOT NULL auto_increment,
2408 `name` varchar(50) default NULL,
2409 `closed` tinyint(1) default NULL,
2410 `booksellerid` int(11) NOT NULL,
2411 `deliveryplace` varchar(10) default NULL,
2412 `freedeliveryplace` text default NULL,
2413 `deliverycomment` varchar(255) default NULL,
2414 `billingplace` varchar(10) default NULL,
2416 KEY `booksellerid` (`booksellerid`),
2417 CONSTRAINT `aqbasketgroups_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
2418 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2421 -- Table structure for table `aqbasket`
2424 DROP TABLE IF EXISTS `aqbasket`;
2425 CREATE TABLE `aqbasket` (
2426 `basketno` int(11) NOT NULL auto_increment,
2427 `basketname` varchar(50) default NULL,
2429 `booksellernote` mediumtext,
2430 `contractnumber` int(11),
2431 `creationdate` date default NULL,
2432 `closedate` date default NULL,
2433 `booksellerid` int(11) NOT NULL default 1,
2434 `authorisedby` varchar(10) default NULL,
2435 `booksellerinvoicenumber` mediumtext,
2436 `basketgroupid` int(11),
2437 PRIMARY KEY (`basketno`),
2438 KEY `booksellerid` (`booksellerid`),
2439 KEY `basketgroupid` (`basketgroupid`),
2440 KEY `contractnumber` (`contractnumber`),
2441 CONSTRAINT `aqbasket_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE,
2442 CONSTRAINT `aqbasket_ibfk_2` FOREIGN KEY (`contractnumber`) REFERENCES `aqcontract` (`contractnumber`),
2443 CONSTRAINT `aqbasket_ibfk_3` FOREIGN KEY (`basketgroupid`) REFERENCES `aqbasketgroups` (`id`) ON UPDATE CASCADE
2444 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2447 -- Table structure for table `aqbooksellers`
2450 DROP TABLE IF EXISTS `aqbooksellers`;
2451 CREATE TABLE `aqbooksellers` (
2452 `id` int(11) NOT NULL auto_increment,
2453 `name` mediumtext NOT NULL,
2454 `address1` mediumtext,
2455 `address2` mediumtext,
2456 `address3` mediumtext,
2457 `address4` mediumtext,
2458 `phone` varchar(30) default NULL,
2459 `accountnumber` mediumtext,
2460 `othersupplier` mediumtext,
2461 `currency` varchar(3) NOT NULL default '',
2462 `booksellerfax` mediumtext,
2464 `bookselleremail` mediumtext,
2465 `booksellerurl` mediumtext,
2466 `contact` varchar(100) default NULL,
2467 `postal` mediumtext,
2468 `url` varchar(255) default NULL,
2469 `contpos` varchar(100) default NULL,
2470 `contphone` varchar(100) default NULL,
2471 `contfax` varchar(100) default NULL,
2472 `contaltphone` varchar(100) default NULL,
2473 `contemail` varchar(100) default NULL,
2474 `contnotes` mediumtext,
2475 `active` tinyint(4) default NULL,
2476 `listprice` varchar(10) default NULL,
2477 `invoiceprice` varchar(10) default NULL,
2478 `gstreg` tinyint(4) default NULL,
2479 `listincgst` tinyint(4) default NULL,
2480 `invoiceincgst` tinyint(4) default NULL,
2481 `gstrate` decimal(6,4) default NULL,
2482 `discount` float(6,4) default NULL,
2483 `fax` varchar(50) default NULL,
2485 KEY `listprice` (`listprice`),
2486 KEY `invoiceprice` (`invoiceprice`),
2487 CONSTRAINT `aqbooksellers_ibfk_1` FOREIGN KEY (`listprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE,
2488 CONSTRAINT `aqbooksellers_ibfk_2` FOREIGN KEY (`invoiceprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE
2489 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2492 -- Table structure for table `aqbudgets`
2495 DROP TABLE IF EXISTS `aqbudgets`;
2496 CREATE TABLE `aqbudgets` (
2497 `budget_id` int(11) NOT NULL auto_increment,
2498 `budget_parent_id` int(11) default NULL,
2499 `budget_code` varchar(30) default NULL,
2500 `budget_name` varchar(80) default NULL,
2501 `budget_branchcode` varchar(10) default NULL,
2502 `budget_amount` decimal(28,6) NULL default '0.00',
2503 `budget_encumb` decimal(28,6) NULL default '0.00',
2504 `budget_expend` decimal(28,6) NULL default '0.00',
2505 `budget_notes` mediumtext,
2506 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2507 `budget_period_id` int(11) default NULL,
2508 `sort1_authcat` varchar(80) default NULL,
2509 `sort2_authcat` varchar(80) default NULL,
2510 `budget_owner_id` int(11) default NULL,
2511 `budget_permission` int(1) default '0',
2512 PRIMARY KEY (`budget_id`)
2513 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2517 -- Table structure for table `aqbudgetperiods`
2521 DROP TABLE IF EXISTS `aqbudgetperiods`;
2522 CREATE TABLE `aqbudgetperiods` (
2523 `budget_period_id` int(11) NOT NULL auto_increment,
2524 `budget_period_startdate` date NOT NULL,
2525 `budget_period_enddate` date NOT NULL,
2526 `budget_period_active` tinyint(1) default '0',
2527 `budget_period_description` mediumtext,
2528 `budget_period_total` decimal(28,6),
2529 `budget_period_locked` tinyint(1) default NULL,
2530 `sort1_authcat` varchar(10) default NULL,
2531 `sort2_authcat` varchar(10) default NULL,
2532 PRIMARY KEY (`budget_period_id`)
2533 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2536 -- Table structure for table `aqbudgets_planning`
2539 DROP TABLE IF EXISTS `aqbudgets_planning`;
2540 CREATE TABLE `aqbudgets_planning` (
2541 `plan_id` int(11) NOT NULL auto_increment,
2542 `budget_id` int(11) NOT NULL,
2543 `budget_period_id` int(11) NOT NULL,
2544 `estimated_amount` decimal(28,6) default NULL,
2545 `authcat` varchar(30) NOT NULL,
2546 `authvalue` varchar(30) NOT NULL,
2547 `display` tinyint(1) DEFAULT 1,
2548 PRIMARY KEY (`plan_id`),
2549 CONSTRAINT `aqbudgets_planning_ifbk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE
2550 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2553 -- Table structure for table 'aqcontract'
2556 DROP TABLE IF EXISTS `aqcontract`;
2557 CREATE TABLE `aqcontract` (
2558 `contractnumber` int(11) NOT NULL auto_increment,
2559 `contractstartdate` date default NULL,
2560 `contractenddate` date default NULL,
2561 `contractname` varchar(50) default NULL,
2562 `contractdescription` mediumtext,
2563 `booksellerid` int(11) not NULL,
2564 PRIMARY KEY (`contractnumber`),
2565 CONSTRAINT `booksellerid_fk1` FOREIGN KEY (`booksellerid`)
2566 REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2567 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
2570 -- Table structure for table `aqorderdelivery`
2573 DROP TABLE IF EXISTS `aqorderdelivery`;
2574 CREATE TABLE `aqorderdelivery` (
2575 `ordernumber` date default NULL,
2576 `deliverynumber` smallint(6) NOT NULL default 0,
2577 `deliverydate` varchar(18) default NULL,
2578 `qtydelivered` smallint(6) default NULL,
2579 `deliverycomments` mediumtext
2580 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2583 -- Table structure for table `aqorders`
2586 DROP TABLE IF EXISTS `aqorders`;
2587 CREATE TABLE `aqorders` (
2588 `ordernumber` int(11) NOT NULL auto_increment,
2589 `biblionumber` int(11) default NULL,
2590 `entrydate` date default NULL,
2591 `quantity` smallint(6) default NULL,
2592 `currency` varchar(3) default NULL,
2593 `listprice` decimal(28,6) default NULL,
2594 `totalamount` decimal(28,6) default NULL,
2595 `datereceived` date default NULL,
2596 `booksellerinvoicenumber` mediumtext,
2597 `freight` decimal(28,6) default NULL,
2598 `unitprice` decimal(28,6) default NULL,
2599 `quantityreceived` smallint(6) NOT NULL default 0,
2600 `cancelledby` varchar(10) default NULL,
2601 `datecancellationprinted` date default NULL,
2603 `supplierreference` mediumtext,
2604 `purchaseordernumber` mediumtext,
2605 `subscription` tinyint(1) default NULL,
2606 `serialid` varchar(30) default NULL,
2607 `basketno` int(11) default NULL,
2608 `biblioitemnumber` int(11) default NULL,
2609 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2610 `rrp` decimal(13,2) default NULL,
2611 `ecost` decimal(13,2) default NULL,
2612 `gst` decimal(13,2) default NULL,
2613 `budget_id` int(11) NOT NULL,
2614 `budgetgroup_id` int(11) NOT NULL,
2615 `budgetdate` date default NULL,
2616 `sort1` varchar(80) default NULL,
2617 `sort2` varchar(80) default NULL,
2618 `sort1_authcat` varchar(10) default NULL,
2619 `sort2_authcat` varchar(10) default NULL,
2620 `uncertainprice` tinyint(1),
2621 PRIMARY KEY (`ordernumber`),
2622 KEY `basketno` (`basketno`),
2623 KEY `biblionumber` (`biblionumber`),
2624 KEY `budget_id` (`budget_id`),
2625 CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2626 CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE
2627 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2631 -- Table structure for table `aqorders_items`
2634 DROP TABLE IF EXISTS `aqorders_items`;
2635 CREATE TABLE `aqorders_items` (
2636 `ordernumber` int(11) NOT NULL,
2637 `itemnumber` int(11) NOT NULL,
2638 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2639 PRIMARY KEY (`itemnumber`),
2640 KEY `ordernumber` (`ordernumber`)
2641 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2644 -- Table structure for table `fieldmapping`
2647 DROP TABLE IF EXISTS `fieldmapping`;
2648 CREATE TABLE `fieldmapping` ( -- koha to keyword mapping
2649 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2650 `field` varchar(255) NOT NULL, -- keyword to be mapped to (ex. subtitle)
2651 `frameworkcode` char(4) NOT NULL default '', -- foreign key from the biblio_framework table to link this mapping to a specific framework
2652 `fieldcode` char(3) NOT NULL, -- marc field number to map to this keyword
2653 `subfieldcode` char(1) NOT NULL, -- marc subfield associated with the fieldcode to map to this keyword
2655 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2658 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
2659 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
2660 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
2661 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
2662 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
2663 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
2664 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
2665 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;