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$a in MARC21)
120 `title` mediumtext, -- title (without the subtitle) from the MARC record (245$a in MARC21)
121 `unititle` mediumtext, -- uniform title (without the subtitle) from the MARC record (240$a in MARC21)
122 `notes` mediumtext, -- values from the general notes field in the MARC record (500$a 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$a 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` ( -- information related to bibliographic records in Koha
150 `biblioitemnumber` int(11) NOT NULL auto_increment, -- primary key, unique identifier assigned by Koha
151 `biblionumber` int(11) NOT NULL default 0, -- foreign key linking this table to the biblio table
154 `itemtype` varchar(10) default NULL, -- biblio level item type (MARC21 942$c)
155 `isbn` varchar(30) default NULL, -- ISBN (MARC21 020$a)
156 `issn` varchar(9) default NULL, -- ISSN (MARC21 022$a)
157 `publicationyear` text,
158 `publishercode` varchar(255) default NULL, -- publisher (MARC21 260$b)
159 `volumedate` date default NULL,
160 `volumedesc` text, -- volume information (MARC21 362$a)
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, -- illustrations (MARC21 300$b)
168 `pages` varchar(255) default NULL, -- number of pages (MARC21 300$c)
170 `size` varchar(255) default NULL, -- material size (MARC21 300$c)
171 `place` varchar(255) default NULL, -- publication place (MARC21 260$a)
172 `lccn` varchar(25) default NULL, -- library of congress control number (MARC21 010$a)
173 `marc` longblob, -- full bibliographic MARC record
174 `url` varchar(255) default NULL, -- url (MARC21 856$u)
175 `cn_source` varchar(10) default NULL, -- classification source (MARC21 942$2)
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, -- full bibliographic MARC record in MARCXML
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` date default NULL, -- until this date the patron can only check-in (no loans, no holds, etc.), is a fine based on days instead of money (YYY-MM-DD)
236 `debarredcomment` VARCHAR(255) DEFAULT NULL, -- comment on the stop of the patron
237 `contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
238 `contactfirstname` text, -- used for children to include first name of guarentor
239 `contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
240 `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
241 `borrowernotes` mediumtext, -- a note on the patron/borroewr's account that is only visible in the staff client
242 `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
243 `ethnicity` varchar(50) default NULL, -- unused in Koha
244 `ethnotes` varchar(255) default NULL, -- unused in Koha
245 `sex` varchar(1) default NULL, -- patron/borrower's gender
246 `password` varchar(30) default NULL, -- patron/borrower's encrypted password
247 `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
248 `userid` varchar(75) default NULL, -- patron/borrower's opac and/or staff client log in
249 `opacnote` mediumtext, -- a note on the patron/borrower's account that is visible in the OPAC and staff client
250 `contactnote` varchar(255) default NULL, -- a note related to the patron/borrower's alternate address
251 `sort1` varchar(80) default NULL, -- a field that can be used for any information unique to the library
252 `sort2` varchar(80) default NULL, -- a field that can be used for any information unique to the library
253 `altcontactfirstname` varchar(255) default NULL, -- first name of alternate contact for the patron/borrower
254 `altcontactsurname` varchar(255) default NULL, -- surname or last name of the alternate contact for the patron/borrower
255 `altcontactaddress1` varchar(255) default NULL, -- the first address line for the alternate contact for the patron/borrower
256 `altcontactaddress2` varchar(255) default NULL, -- the second address line for the alternate contact for the patron/borrower
257 `altcontactaddress3` varchar(255) default NULL, -- the third address line for the alternate contact for the patron/borrower
258 `altcontactstate` text default NULL, -- the city and state for the alternate contact for the patron/borrower
259 `altcontactzipcode` varchar(50) default NULL, -- the zipcode for the alternate contact for the patron/borrower
260 `altcontactcountry` text default NULL, -- the country for the alternate contact for the patron/borrower
261 `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
262 `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
263 `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history
264 UNIQUE KEY `cardnumber` (`cardnumber`),
265 PRIMARY KEY `borrowernumber` (`borrowernumber`),
266 KEY `categorycode` (`categorycode`),
267 KEY `branchcode` (`branchcode`),
268 KEY `userid` (`userid`),
269 KEY `guarantorid` (`guarantorid`),
270 CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
271 CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
272 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
275 -- Table structure for table `borrower_attribute_types`
278 DROP TABLE IF EXISTS `borrower_attribute_types`;
279 CREATE TABLE `borrower_attribute_types` ( -- definitions for custom patron fields known as extended patron attributes
280 `code` varchar(10) NOT NULL, -- unique key used to identify each custom field
281 `description` varchar(255) NOT NULL, -- description for each custom field
282 `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)
283 `unique_id` tinyint(1) NOT NULL default 0, -- defines if this value needs to be unique (1 for yes, 0 for no)
284 `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)
285 `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)
286 `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)
287 `authorised_value_category` varchar(10) default NULL, -- foreign key from authorised_values that links this custom field to an authorized value category
288 `display_checkout` tinyint(1) NOT NULL default 0,-- defines if this field displays in checkout screens
289 PRIMARY KEY (`code`),
290 KEY `auth_val_cat_idx` (`authorised_value_category`)
291 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
294 -- Table structure for table `borrower_attributes`
297 DROP TABLE IF EXISTS `borrower_attributes`;
298 CREATE TABLE `borrower_attributes` ( -- values of custom patron fields known as extended patron attributes linked to patrons/borrowers
299 `borrowernumber` int(11) NOT NULL, -- foreign key from the borrowers table, defines which patron/borrower has this attribute
300 `code` varchar(10) NOT NULL, -- foreign key from the borrower_attribute_types table, defines which custom field this value was entered for
301 `attribute` varchar(64) default NULL, -- custom patron field value
302 `password` varchar(64) default NULL, -- password associated with this field
303 KEY `borrowernumber` (`borrowernumber`),
304 KEY `code_attribute` (`code`, `attribute`),
305 CONSTRAINT `borrower_attributes_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
306 ON DELETE CASCADE ON UPDATE CASCADE,
307 CONSTRAINT `borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`)
308 ON DELETE CASCADE ON UPDATE CASCADE
309 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
312 -- Table structure for table `branch_item_rules`
315 DROP TABLE IF EXISTS `branch_item_rules`;
316 CREATE TABLE `branch_item_rules` (
317 `branchcode` varchar(10) NOT NULL,
318 `itemtype` varchar(10) NOT NULL,
319 `holdallowed` tinyint(1) default NULL,
320 `returnbranch` varchar(15) default NULL,
321 PRIMARY KEY (`itemtype`,`branchcode`),
322 KEY `branch_item_rules_ibfk_2` (`branchcode`),
323 CONSTRAINT `branch_item_rules_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`)
324 ON DELETE CASCADE ON UPDATE CASCADE,
325 CONSTRAINT `branch_item_rules_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
326 ON DELETE CASCADE ON UPDATE CASCADE
327 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
330 -- Table structure for table `branchcategories`
333 DROP TABLE IF EXISTS `branchcategories`;
334 CREATE TABLE `branchcategories` ( -- information related to library/branch groups
335 `categorycode` varchar(10) NOT NULL default '', -- unique identifier for the library/branch group
336 `categoryname` varchar(32), -- name of the library/branch group
337 `codedescription` mediumtext, -- longer description of the library/branch group
338 `categorytype` varchar(16), -- says whether this is a search group or a properties group
339 PRIMARY KEY (`categorycode`)
340 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
343 -- Table structure for table `branches`
346 DROP TABLE IF EXISTS `branches`;
347 CREATE TABLE `branches` ( -- information about your libraries or branches are stored here
348 `branchcode` varchar(10) NOT NULL default '', -- a unique key assigned to each branch
349 `branchname` mediumtext NOT NULL, -- the name of your library or branch
350 `branchaddress1` mediumtext, -- the first address line of for your library or branch
351 `branchaddress2` mediumtext, -- the second address line of for your library or branch
352 `branchaddress3` mediumtext, -- the third address line of for your library or branch
353 `branchzip` varchar(25) default NULL, -- the zip or postal code for your library or branch
354 `branchcity` mediumtext, -- the city or province for your library or branch
355 `branchstate` mediumtext, -- the state for your library or branch
356 `branchcountry` text, -- the county for your library or branch
357 `branchphone` mediumtext, -- the primary phone for your library or branch
358 `branchfax` mediumtext, -- the fax number for your library or branch
359 `branchemail` mediumtext, -- the primary email address for your library or branch
360 `branchurl` mediumtext, -- the URL for your library or branch's website
361 `issuing` tinyint(4) default NULL, -- unused in Koha
362 `branchip` varchar(15) default NULL, -- the IP address for your library or branch
363 `branchprinter` varchar(100) default NULL, -- unused in Koha
364 `branchnotes` mediumtext, -- notes related to your library or branch
365 UNIQUE KEY `branchcode` (`branchcode`)
366 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
369 -- Table structure for table `branchrelations`
372 DROP TABLE IF EXISTS `branchrelations`;
373 CREATE TABLE `branchrelations` ( -- this table links libraries/branches to groups
374 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table to identify the branch
375 `categorycode` varchar(10) NOT NULL default '', -- foreign key from the branchcategories table to identify the group
376 PRIMARY KEY (`branchcode`,`categorycode`),
377 KEY `branchcode` (`branchcode`),
378 KEY `categorycode` (`categorycode`),
379 CONSTRAINT `branchrelations_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
380 CONSTRAINT `branchrelations_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `branchcategories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
381 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
384 -- Table structure for table `branchtransfers`
387 DROP TABLE IF EXISTS `branchtransfers`;
388 CREATE TABLE `branchtransfers` (
389 `itemnumber` int(11) NOT NULL default 0,
390 `datesent` datetime default NULL,
391 `frombranch` varchar(10) NOT NULL default '',
392 `datearrived` datetime default NULL,
393 `tobranch` varchar(10) NOT NULL default '',
394 `comments` mediumtext,
395 KEY `frombranch` (`frombranch`),
396 KEY `tobranch` (`tobranch`),
397 KEY `itemnumber` (`itemnumber`),
398 CONSTRAINT `branchtransfers_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
399 CONSTRAINT `branchtransfers_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
400 CONSTRAINT `branchtransfers_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
401 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
405 -- Table structure for table `browser`
407 DROP TABLE IF EXISTS `browser`;
408 CREATE TABLE `browser` (
409 `level` int(11) NOT NULL,
410 `classification` varchar(20) NOT NULL,
411 `description` varchar(255) NOT NULL,
412 `number` bigint(20) NOT NULL,
413 `endnode` tinyint(4) NOT NULL
414 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
417 -- Table structure for table `categories`
420 DROP TABLE IF EXISTS `categories`;
421 CREATE TABLE `categories` ( -- this table shows information related to Koha patron categories
422 `categorycode` varchar(10) NOT NULL default '', -- unique primary key used to idenfity the patron category
423 `description` mediumtext, -- description of the patron category
424 `enrolmentperiod` smallint(6) default NULL, -- number of months the patron is enrolled for (will be NULL if enrolmentperioddate is set)
425 `enrolmentperioddate` DATE NULL DEFAULT NULL, -- date the patron is enrolled until (will be NULL if enrolmentperiod is set)
426 `upperagelimit` smallint(6) default NULL, -- age limit for the patron
427 `dateofbirthrequired` tinyint(1) default NULL,
428 `finetype` varchar(30) default NULL, -- unused in Koha
429 `bulk` tinyint(1) default NULL,
430 `enrolmentfee` decimal(28,6) default NULL, -- enrollment fee for the patron
431 `overduenoticerequired` tinyint(1) default NULL, -- are overdue notices sent to this patron category (1 for yes, 0 for no)
432 `issuelimit` smallint(6) default NULL, -- unused in Koha
433 `reservefee` decimal(28,6) default NULL, -- cost to place holds
434 `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
435 `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
436 PRIMARY KEY (`categorycode`),
437 UNIQUE KEY `categorycode` (`categorycode`)
438 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
441 -- Table: collections
443 DROP TABLE IF EXISTS collections;
444 CREATE TABLE collections (
445 colId integer(11) NOT NULL auto_increment,
446 colTitle varchar(100) NOT NULL DEFAULT '',
447 colDesc text NOT NULL,
448 colBranchcode varchar(4) DEFAULT NULL comment 'branchcode for branch where item should be held.',
450 ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
453 -- Table: collections_tracking
455 DROP TABLE IF EXISTS collections_tracking;
456 CREATE TABLE collections_tracking (
457 ctId integer(11) NOT NULL auto_increment,
458 colId integer(11) NOT NULL DEFAULT 0 comment 'collections.colId',
459 itemnumber integer(11) NOT NULL DEFAULT 0 comment 'items.itemnumber',
461 ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
464 -- Table structure for table `borrower_branch_circ_rules`
467 DROP TABLE IF EXISTS `branch_borrower_circ_rules`;
468 CREATE TABLE `branch_borrower_circ_rules` (
469 `branchcode` VARCHAR(10) NOT NULL,
470 `categorycode` VARCHAR(10) NOT NULL,
471 `maxissueqty` int(4) default NULL,
472 PRIMARY KEY (`categorycode`, `branchcode`),
473 CONSTRAINT `branch_borrower_circ_rules_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`)
474 ON DELETE CASCADE ON UPDATE CASCADE,
475 CONSTRAINT `branch_borrower_circ_rules_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
476 ON DELETE CASCADE ON UPDATE CASCADE
477 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
480 -- Table structure for table `default_borrower_circ_rules`
483 DROP TABLE IF EXISTS `default_borrower_circ_rules`;
484 CREATE TABLE `default_borrower_circ_rules` (
485 `categorycode` VARCHAR(10) NOT NULL,
486 `maxissueqty` int(4) default NULL,
487 PRIMARY KEY (`categorycode`),
488 CONSTRAINT `borrower_borrower_circ_rules_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`)
489 ON DELETE CASCADE ON UPDATE CASCADE
490 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
493 -- Table structure for table `default_branch_circ_rules`
496 DROP TABLE IF EXISTS `default_branch_circ_rules`;
497 CREATE TABLE `default_branch_circ_rules` (
498 `branchcode` VARCHAR(10) NOT NULL,
499 `maxissueqty` int(4) default NULL,
500 `holdallowed` tinyint(1) default NULL,
501 `returnbranch` varchar(15) default NULL,
502 PRIMARY KEY (`branchcode`),
503 CONSTRAINT `default_branch_circ_rules_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
504 ON DELETE CASCADE ON UPDATE CASCADE
505 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
508 -- Table structure for table `default_branch_item_rules`
510 DROP TABLE IF EXISTS `default_branch_item_rules`;
511 CREATE TABLE `default_branch_item_rules` (
512 `itemtype` varchar(10) NOT NULL,
513 `holdallowed` tinyint(1) default NULL,
514 `returnbranch` varchar(15) default NULL,
515 PRIMARY KEY (`itemtype`),
516 CONSTRAINT `default_branch_item_rules_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`)
517 ON DELETE CASCADE ON UPDATE CASCADE
518 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
521 -- Table structure for table `default_circ_rules`
524 DROP TABLE IF EXISTS `default_circ_rules`;
525 CREATE TABLE `default_circ_rules` (
526 `singleton` enum('singleton') NOT NULL default 'singleton',
527 `maxissueqty` int(4) default NULL,
528 `holdallowed` int(1) default NULL,
529 `returnbranch` varchar(15) default NULL,
530 PRIMARY KEY (`singleton`)
531 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
534 -- Table structure for table `cities`
537 DROP TABLE IF EXISTS `cities`;
538 CREATE TABLE `cities` ( -- authorized values for cities/states/countries to choose when adding/editing a patron/borrower
539 `cityid` int(11) NOT NULL auto_increment, -- unique identifier added by Koha
540 `city_name` varchar(100) NOT NULL default '', -- name of the city
541 `city_state` VARCHAR( 100 ) NULL DEFAULT NULL, -- name of the state/province
542 `city_country` VARCHAR( 100 ) NULL DEFAULT NULL, -- name of the country
543 `city_zipcode` varchar(20) default NULL, -- zip or postal code
544 PRIMARY KEY (`cityid`)
545 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
548 -- Table structure for table `class_sort_rules`
551 DROP TABLE IF EXISTS `class_sort_rules`;
552 CREATE TABLE `class_sort_rules` (
553 `class_sort_rule` varchar(10) NOT NULL default '',
554 `description` mediumtext,
555 `sort_routine` varchar(30) NOT NULL default '',
556 PRIMARY KEY (`class_sort_rule`),
557 UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
558 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
561 -- Table structure for table `class_sources`
564 DROP TABLE IF EXISTS `class_sources`;
565 CREATE TABLE `class_sources` (
566 `cn_source` varchar(10) NOT NULL default '',
567 `description` mediumtext,
568 `used` tinyint(4) NOT NULL default 0,
569 `class_sort_rule` varchar(10) NOT NULL default '',
570 PRIMARY KEY (`cn_source`),
571 UNIQUE KEY `cn_source_idx` (`cn_source`),
572 KEY `used_idx` (`used`),
573 CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`)
574 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
577 -- Table structure for table `currency`
580 DROP TABLE IF EXISTS `currency`;
581 CREATE TABLE `currency` (
582 `currency` varchar(10) NOT NULL default '',
583 `symbol` varchar(5) default NULL,
584 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
585 `rate` float(15,5) default NULL,
586 `active` tinyint(1) default NULL,
587 PRIMARY KEY (`currency`)
588 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
591 -- Table structure for table `deletedbiblio`
594 DROP TABLE IF EXISTS `deletedbiblio`;
595 CREATE TABLE `deletedbiblio` ( -- stores information about bibliographic records that have been deleted
596 `biblionumber` int(11) NOT NULL auto_increment, -- unique identifier assigned to each bibliographic record
597 `frameworkcode` varchar(4) NOT NULL default '', -- foriegn key from the biblio_framework table to identify which framework was used in cataloging this record
598 `author` mediumtext, -- statement of responsibility from MARC record (100$a in MARC21)
599 `title` mediumtext, -- title (without the subtitle) from the MARC record (245$a in MARC21)
600 `unititle` mediumtext, -- uniform title (without the subtitle) from the MARC record (240$a in MARC21)
601 `notes` mediumtext, -- values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)
602 `serial` tinyint(1) default NULL, -- foreign key, linking to the subscriptionid in the serial table
603 `seriestitle` mediumtext,
604 `copyrightdate` smallint(6) default NULL, -- publication or copyright date from the MARC record
605 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
606 `datecreated` DATE NOT NULL, -- the date this record was added to Koha
607 `abstract` mediumtext, -- summary from the MARC record (520$a in MARC21)
608 PRIMARY KEY (`biblionumber`),
609 KEY `blbnoidx` (`biblionumber`)
610 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
613 -- Table structure for table `deletedbiblioitems`
616 DROP TABLE IF EXISTS `deletedbiblioitems`;
617 CREATE TABLE `deletedbiblioitems` ( -- information about bibliographic records that have been deleted
618 `biblioitemnumber` int(11) NOT NULL default 0, -- primary key, unique identifier assigned by Koha
619 `biblionumber` int(11) NOT NULL default 0, -- foreign key linking this table to the biblio table
622 `itemtype` varchar(10) default NULL, -- biblio level item type (MARC21 942$c)
623 `isbn` varchar(30) default NULL, -- ISBN (MARC21 020$a)
624 `issn` varchar(9) default NULL, -- ISSN (MARC21 022$a)
625 `publicationyear` text,
626 `publishercode` varchar(255) default NULL, -- publisher (MARC21 260$b)
627 `volumedate` date default NULL,
628 `volumedesc` text, -- volume information (MARC21 362$a)
629 `collectiontitle` mediumtext default NULL,
630 `collectionissn` text default NULL,
631 `collectionvolume` mediumtext default NULL,
632 `editionstatement` text default NULL,
633 `editionresponsibility` text default NULL,
634 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
635 `illus` varchar(255) default NULL, -- illustrations (MARC21 300$b)
636 `pages` varchar(255) default NULL, -- number of pages (MARC21 300$c)
638 `size` varchar(255) default NULL, -- material size (MARC21 300$c)
639 `place` varchar(255) default NULL, -- publication place (MARC21 260$a)
640 `lccn` varchar(25) default NULL, -- library of congress control number (MARC21 010$a)
641 `marc` longblob, -- full bibliographic MARC record
642 `url` varchar(255) default NULL, -- url (MARC21 856$u)
643 `cn_source` varchar(10) default NULL, -- classification source (MARC21 942$2)
644 `cn_class` varchar(30) default NULL,
645 `cn_item` varchar(10) default NULL,
646 `cn_suffix` varchar(10) default NULL,
647 `cn_sort` varchar(30) default NULL,
648 `totalissues` int(10),
649 `marcxml` longtext NOT NULL, -- full bibliographic MARC record in MARCXML
650 PRIMARY KEY (`biblioitemnumber`),
651 KEY `bibinoidx` (`biblioitemnumber`),
652 KEY `bibnoidx` (`biblionumber`),
654 KEY `publishercode` (`publishercode`)
655 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
658 -- Table structure for table `deletedborrowers`
661 DROP TABLE IF EXISTS `deletedborrowers`;
662 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrowers you have deleted
663 `borrowernumber` int(11) NOT NULL default 0, -- primary key, Koha assigned ID number for patrons/borrowers
664 `cardnumber` varchar(16) default NULL, -- unique key, library assigned ID number for patrons/borrowers
665 `surname` mediumtext NOT NULL, -- patron/borrower's last name (surname)
666 `firstname` text, -- patron/borrower's first name
667 `title` mediumtext, -- patron/borrower's title, for example: Mr. or Mrs.
668 `othernames` mediumtext, -- any other names associated with the patron/borrower
669 `initials` text, -- initials for your patron/borrower
670 `streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's primary address
671 `streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's primary address
672 `address` mediumtext NOT NULL, -- the first address line for your patron/borrower's primary address
673 `address2` text, -- the second address line for your patron/borrower's primary address
674 `city` mediumtext NOT NULL, -- the city or town for your patron/borrower's primary address
675 `state` text default NULL, -- the state or province for your patron/borrower's primary address
676 `zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's primary address
677 `country` text, -- the country for your patron/borrower's primary address
678 `email` mediumtext, -- the primary email address for your patron/borrower's primary address
679 `phone` text, -- the primary phone number for your patron/borrower's primary address
680 `mobile` varchar(50) default NULL, -- the other phone number for your patron/borrower's primary address
681 `fax` mediumtext, -- the fax number for your patron/borrower's primary address
682 `emailpro` text, -- the secondary email addres for your patron/borrower's primary address
683 `phonepro` text, -- the secondary phone number for your patron/borrower's primary address
684 `B_streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's alternate address
685 `B_streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's alternate address
686 `B_address` varchar(100) default NULL, -- the first address line for your patron/borrower's alternate address
687 `B_address2` text default NULL, -- the second address line for your patron/borrower's alternate address
688 `B_city` mediumtext, -- the city or town for your patron/borrower's alternate address
689 `B_state` text default NULL, -- the state for your patron/borrower's alternate address
690 `B_zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's alternate address
691 `B_country` text, -- the country for your patron/borrower's alternate address
692 `B_email` text, -- the patron/borrower's alternate email address
693 `B_phone` mediumtext, -- the patron/borrower's alternate phone number
694 `dateofbirth` date default NULL, -- the patron/borrower's date of birth (YYYY-MM-DD)
695 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, includes the code of the patron/borrower's home branch
696 `categorycode` varchar(10) NOT NULL default '', -- foreign key from the categories table, includes the code of the patron category
697 `dateenrolled` date default NULL, -- date the patron was added to Koha (YYYY-MM-DD)
698 `dateexpiry` date default NULL, -- date the patron/borrower's card is set to expire (YYYY-MM-DD)
699 `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
700 `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
701 `debarred` date default NULL, -- until this date the patron can only check-in (no loans, no holds, etc.), is a fine based on days instead of money (YYY-MM-DD)
702 `debarredcomment` VARCHAR(255) DEFAULT NULL, -- comment on the stop of patron
703 `contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
704 `contactfirstname` text, -- used for children to include first name of guarentor
705 `contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
706 `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
707 `borrowernotes` mediumtext, -- a note on the patron/borroewr's account that is only visible in the staff client
708 `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
709 `ethnicity` varchar(50) default NULL, -- unused in Koha
710 `ethnotes` varchar(255) default NULL, -- unused in Koha
711 `sex` varchar(1) default NULL, -- patron/borrower's gender
712 `password` varchar(30) default NULL, -- patron/borrower's encrypted password
713 `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
714 `userid` varchar(30) default NULL, -- patron/borrower's opac and/or staff client log in
715 `opacnote` mediumtext, -- a note on the patron/borrower's account that is visible in the OPAC and staff client
716 `contactnote` varchar(255) default NULL, -- a note related to the patron/borrower's alternate address
717 `sort1` varchar(80) default NULL, -- a field that can be used for any information unique to the library
718 `sort2` varchar(80) default NULL, -- a field that can be used for any information unique to the library
719 `altcontactfirstname` varchar(255) default NULL, -- first name of alternate contact for the patron/borrower
720 `altcontactsurname` varchar(255) default NULL, -- surname or last name of the alternate contact for the patron/borrower
721 `altcontactaddress1` varchar(255) default NULL, -- the first address line for the alternate contact for the patron/borrower
722 `altcontactaddress2` varchar(255) default NULL, -- the second address line for the alternate contact for the patron/borrower
723 `altcontactaddress3` varchar(255) default NULL, -- the third address line for the alternate contact for the patron/borrower
724 `altcontactstate` text default NULL, -- the city and state for the alternate contact for the patron/borrower
725 `altcontactzipcode` varchar(50) default NULL, -- the zipcode for the alternate contact for the patron/borrower
726 `altcontactcountry` text default NULL, -- the country for the alternate contact for the patron/borrower
727 `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
728 `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
729 `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history KEY `borrowernumber` (`borrowernumber`),
730 KEY borrowernumber (borrowernumber),
731 KEY `cardnumber` (`cardnumber`)
732 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
735 -- Table structure for table `deleteditems`
738 DROP TABLE IF EXISTS `deleteditems`;
739 CREATE TABLE `deleteditems` (
740 `itemnumber` int(11) NOT NULL default 0, -- primary key and unique identifier added by Koha
741 `biblionumber` int(11) NOT NULL default 0, -- foreign key from biblio table used to link this item to the right bib record
742 `biblioitemnumber` int(11) NOT NULL default 0, -- foreign key from the biblioitems table to link to item to additional information
743 `barcode` varchar(20) default NULL, -- item barcode (MARC21 952$p)
744 `dateaccessioned` date default NULL, -- date the item was acquired or added to Koha (MARC21 952$d)
745 `booksellerid` mediumtext default NULL, -- where the item was purchased (MARC21 952$e)
746 `homebranch` varchar(10) default NULL, -- foreign key from the branches table for the library that owns this item (MARC21 952$a)
747 `price` decimal(8,2) default NULL, -- purchase price (MARC21 952$g)
748 `replacementprice` decimal(8,2) default NULL, -- cost the library charges to replace the item if it has been marked lost (MARC21 952$v)
749 `replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w)
750 `datelastborrowed` date default NULL, -- the date the item was last checked out
751 `datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done)
752 `stack` tinyint(1) default NULL,
753 `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
754 `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
755 `itemlost` tinyint(1) NOT NULL default 0, -- authorized value defining this item as lost (MARC21 952$1)
756 `wthdrawn` tinyint(1) NOT NULL default 0, -- authorized value defining this item as withdrawn (MARC21 952$0)
757 `itemcallnumber` varchar(255) default NULL, -- call number for this item (MARC21 952$o)
758 `issues` smallint(6) default NULL, -- number of times this item has been checked out
759 `renewals` smallint(6) default NULL, -- number of times this item has been renewed
760 `reserves` smallint(6) default NULL, -- number of times this item has been placed on hold/reserved
761 `restricted` tinyint(1) default NULL, -- authorized value defining use restrictions for this item (MARC21 952$5)
762 `itemnotes` mediumtext, -- public notes on this item (MARC21 952$x)
763 `holdingbranch` varchar(10) default NULL, -- foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)
764 `paidfor` mediumtext,
765 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this item was last altered
766 `location` varchar(80) default NULL, -- authorized value for the shelving location for this item (MARC21 952$c)
767 `permanent_location` varchar(80) default NULL, -- linked to the CART and PROC temporary locations feature, stores the permanent shelving location
768 `onloan` date default NULL, -- defines if this item is currently checked out (1 for yes, 0 for no)
769 `cn_source` varchar(10) default NULL, -- classification source used on this item (MARC21 952$2)
770 `cn_sort` varchar(30) default NULL, -- normalized form of the call number (MARC21 952$o) used for sorting
771 `ccode` varchar(10) default NULL, -- authorized value for the collection code associated with this item (MARC21 952$8)
772 `materials` varchar(10) default NULL, -- materials specified (MARC21 952$3)
773 `uri` varchar(255) default NULL, -- URL for the item (MARC21 952$u)
774 `itype` varchar(10) default NULL, -- foreign key from the itemtypes table defining the type for this item (MARC21 952$y)
775 `more_subfields_xml` longtext default NULL, -- additional 952 subfields in XML format
776 `enumchron` text default NULL, -- serial enumeration/chronology for the item (MARC21 952$h)
777 `copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t)
778 `stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i)
779 `marc` longblob, -- unused in Koha
780 PRIMARY KEY (`itemnumber`),
781 KEY `delitembarcodeidx` (`barcode`),
782 KEY `delitemstocknumberidx` (`stocknumber`),
783 KEY `delitembinoidx` (`biblioitemnumber`),
784 KEY `delitembibnoidx` (`biblionumber`),
785 KEY `delhomebranch` (`homebranch`),
786 KEY `delholdingbranch` (`holdingbranch`)
787 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
790 -- Table structure for table `ethnicity`
793 DROP TABLE IF EXISTS `ethnicity`;
794 CREATE TABLE `ethnicity` (
795 `code` varchar(10) NOT NULL default '',
796 `name` varchar(255) default NULL,
798 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
801 -- Table structure for table `export_format`
804 DROP TABLE IF EXISTS `export_format`;
805 CREATE TABLE `export_format` (
806 `export_format_id` int(11) NOT NULL auto_increment,
807 `profile` varchar(255) NOT NULL,
808 `description` mediumtext NOT NULL,
809 `marcfields` mediumtext NOT NULL,
810 `csv_separator` varchar(2) NOT NULL,
811 `field_separator` varchar(2) NOT NULL,
812 `subfield_separator` varchar(2) NOT NULL,
813 `encoding` varchar(255) NOT NULL,
814 PRIMARY KEY (`export_format_id`)
815 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Used for CSV export';
819 -- Table structure for table `hold_fill_targets`
822 DROP TABLE IF EXISTS `hold_fill_targets`;
823 CREATE TABLE hold_fill_targets (
824 `borrowernumber` int(11) NOT NULL,
825 `biblionumber` int(11) NOT NULL,
826 `itemnumber` int(11) NOT NULL,
827 `source_branchcode` varchar(10) default NULL,
828 `item_level_request` tinyint(4) NOT NULL default 0,
829 PRIMARY KEY `itemnumber` (`itemnumber`),
830 KEY `bib_branch` (`biblionumber`, `source_branchcode`),
831 CONSTRAINT `hold_fill_targets_ibfk_1` FOREIGN KEY (`borrowernumber`)
832 REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
833 CONSTRAINT `hold_fill_targets_ibfk_2` FOREIGN KEY (`biblionumber`)
834 REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
835 CONSTRAINT `hold_fill_targets_ibfk_3` FOREIGN KEY (`itemnumber`)
836 REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
837 CONSTRAINT `hold_fill_targets_ibfk_4` FOREIGN KEY (`source_branchcode`)
838 REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
839 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
842 -- Table structure for table `import_batches`
845 DROP TABLE IF EXISTS `import_batches`;
846 CREATE TABLE `import_batches` (
847 `import_batch_id` int(11) NOT NULL auto_increment,
848 `matcher_id` int(11) default NULL,
849 `template_id` int(11) default NULL,
850 `branchcode` varchar(10) default NULL,
851 `num_biblios` int(11) NOT NULL default 0,
852 `num_items` int(11) NOT NULL default 0,
853 `upload_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
854 `overlay_action` enum('replace', 'create_new', 'use_template', 'ignore') NOT NULL default 'create_new',
855 `nomatch_action` enum('create_new', 'ignore') NOT NULL default 'create_new',
856 `item_action` enum('always_add', 'add_only_for_matches', 'add_only_for_new', 'ignore') NOT NULL default 'always_add',
857 `import_status` enum('staging', 'staged', 'importing', 'imported', 'reverting', 'reverted', 'cleaned') NOT NULL default 'staging',
858 `batch_type` enum('batch', 'z3950') NOT NULL default 'batch',
859 `file_name` varchar(100),
860 `comments` mediumtext,
861 PRIMARY KEY (`import_batch_id`),
862 KEY `branchcode` (`branchcode`)
863 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
866 -- Table structure for table `import_records`
869 DROP TABLE IF EXISTS `import_records`;
870 CREATE TABLE `import_records` (
871 `import_record_id` int(11) NOT NULL auto_increment,
872 `import_batch_id` int(11) NOT NULL,
873 `branchcode` varchar(10) default NULL,
874 `record_sequence` int(11) NOT NULL default 0,
875 `upload_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
876 `import_date` DATE default NULL,
877 `marc` longblob NOT NULL,
878 `marcxml` longtext NOT NULL,
879 `marcxml_old` longtext NOT NULL,
880 `record_type` enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio',
881 `overlay_status` enum('no_match', 'auto_match', 'manual_match', 'match_applied') NOT NULL default 'no_match',
882 `status` enum('error', 'staged', 'imported', 'reverted', 'items_reverted', 'ignored') NOT NULL default 'staged',
883 `import_error` mediumtext,
884 `encoding` varchar(40) NOT NULL default '',
885 `z3950random` varchar(40) default NULL,
886 PRIMARY KEY (`import_record_id`),
887 CONSTRAINT `import_records_ifbk_1` FOREIGN KEY (`import_batch_id`)
888 REFERENCES `import_batches` (`import_batch_id`) ON DELETE CASCADE ON UPDATE CASCADE,
889 KEY `branchcode` (`branchcode`),
890 KEY `batch_sequence` (`import_batch_id`, `record_sequence`)
891 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
894 -- Table structure for `import_record_matches`
896 DROP TABLE IF EXISTS `import_record_matches`;
897 CREATE TABLE `import_record_matches` (
898 `import_record_id` int(11) NOT NULL,
899 `candidate_match_id` int(11) NOT NULL,
900 `score` int(11) NOT NULL default 0,
901 CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`)
902 REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
903 KEY `record_score` (`import_record_id`, `score`)
904 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
907 -- Table structure for table `import_biblios`
910 DROP TABLE IF EXISTS `import_biblios`;
911 CREATE TABLE `import_biblios` (
912 `import_record_id` int(11) NOT NULL,
913 `matched_biblionumber` int(11) default NULL,
914 `control_number` varchar(25) default NULL,
915 `original_source` varchar(25) default NULL,
916 `title` varchar(128) default NULL,
917 `author` varchar(80) default NULL,
918 `isbn` varchar(30) default NULL,
919 `issn` varchar(9) default NULL,
920 `has_items` tinyint(1) NOT NULL default 0,
921 CONSTRAINT `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`)
922 REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
923 KEY `matched_biblionumber` (`matched_biblionumber`),
924 KEY `title` (`title`),
926 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
929 -- Table structure for table `import_items`
932 DROP TABLE IF EXISTS `import_items`;
933 CREATE TABLE `import_items` (
934 `import_items_id` int(11) NOT NULL auto_increment,
935 `import_record_id` int(11) NOT NULL,
936 `itemnumber` int(11) default NULL,
937 `branchcode` varchar(10) default NULL,
938 `status` enum('error', 'staged', 'imported', 'reverted', 'ignored') NOT NULL default 'staged',
939 `marcxml` longtext NOT NULL,
940 `import_error` mediumtext,
941 PRIMARY KEY (`import_items_id`),
942 CONSTRAINT `import_items_ibfk_1` FOREIGN KEY (`import_record_id`)
943 REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
944 KEY `itemnumber` (`itemnumber`),
945 KEY `branchcode` (`branchcode`)
946 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
949 -- Table structure for table `issues`
952 DROP TABLE IF EXISTS `issues`;
953 CREATE TABLE `issues` ( -- information related to check outs or issues
954 `borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to
955 `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out
956 `date_due` date default NULL, -- date the item is due (yyyy-mm-dd)
957 `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
958 `issuingbranch` varchar(18) default NULL,
959 `returndate` date default NULL, -- date the item was returned, will be NULL until moved to old_issues
960 `lastreneweddate` date default NULL, -- date the item was last renewed
961 `return` varchar(4) default NULL,
962 `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
963 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
964 `issuedate` date default NULL, -- date the item was checked out or issued
965 KEY `issuesborridx` (`borrowernumber`),
966 KEY `bordate` (`borrowernumber`,`timestamp`),
967 CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE RESTRICT ON UPDATE CASCADE,
968 CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE RESTRICT ON UPDATE CASCADE
969 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
972 -- Table structure for table `issuingrules`
975 DROP TABLE IF EXISTS `issuingrules`;
976 CREATE TABLE `issuingrules` (
977 `categorycode` varchar(10) NOT NULL default '',
978 `itemtype` varchar(10) NOT NULL default '',
979 `restrictedtype` tinyint(1) default NULL,
980 `rentaldiscount` decimal(28,6) default NULL,
981 `reservecharge` decimal(28,6) default NULL,
982 `fine` decimal(28,6) default NULL,
983 `finedays` int(11) default NULL,
984 `firstremind` int(11) default NULL,
985 `chargeperiod` int(11) default NULL,
986 `accountsent` int(11) default NULL,
987 `chargename` varchar(100) default NULL,
988 `maxissueqty` int(4) default NULL,
989 `issuelength` int(4) default NULL,
990 `hardduedate` date default NULL,
991 `hardduedatecompare` tinyint NOT NULL default "0",
992 `renewalsallowed` smallint(6) NOT NULL default "0",
993 `reservesallowed` smallint(6) NOT NULL default "0",
994 `branchcode` varchar(10) NOT NULL default '',
995 PRIMARY KEY (`branchcode`,`categorycode`,`itemtype`),
996 KEY `categorycode` (`categorycode`),
997 KEY `itemtype` (`itemtype`)
998 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1001 -- Table structure for table `items`
1004 DROP TABLE IF EXISTS `items`;
1005 CREATE TABLE `items` ( -- holdings/item information
1006 `itemnumber` int(11) NOT NULL auto_increment, -- primary key and unique identifier added by Koha
1007 `biblionumber` int(11) NOT NULL default 0, -- foreign key from biblio table used to link this item to the right bib record
1008 `biblioitemnumber` int(11) NOT NULL default 0, -- foreign key from the biblioitems table to link to item to additional information
1009 `barcode` varchar(20) default NULL, -- item barcode (MARC21 952$p)
1010 `dateaccessioned` date default NULL, -- date the item was acquired or added to Koha (MARC21 952$d)
1011 `booksellerid` mediumtext default NULL, -- where the item was purchased (MARC21 952$e)
1012 `homebranch` varchar(10) default NULL, -- foreign key from the branches table for the library that owns this item (MARC21 952$a)
1013 `price` decimal(8,2) default NULL, -- purchase price (MARC21 952$g)
1014 `replacementprice` decimal(8,2) default NULL, -- cost the library charges to replace the item if it has been marked lost (MARC21 952$v)
1015 `replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w)
1016 `datelastborrowed` date default NULL, -- the date the item was last checked out/issued
1017 `datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done)
1018 `stack` tinyint(1) default NULL,
1019 `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
1020 `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
1021 `itemlost` tinyint(1) NOT NULL default 0, -- authorized value defining this item as lost (MARC21 952$1)
1022 `wthdrawn` tinyint(1) NOT NULL default 0, -- authorized value defining this item as withdrawn (MARC21 952$0)
1023 `itemcallnumber` varchar(255) default NULL, -- call number for this item (MARC21 952$o)
1024 `issues` smallint(6) default NULL, -- number of times this item has been checked out/issued
1025 `renewals` smallint(6) default NULL, -- number of times this item has been renewed
1026 `reserves` smallint(6) default NULL, -- number of times this item has been placed on hold/reserved
1027 `restricted` tinyint(1) default NULL, -- authorized value defining use restrictions for this item (MARC21 952$5)
1028 `itemnotes` mediumtext, -- public notes on this item (MARC21 952$x)
1029 `holdingbranch` varchar(10) default NULL, -- foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)
1030 `paidfor` mediumtext,
1031 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this item was last altered
1032 `location` varchar(80) default NULL, -- authorized value for the shelving location for this item (MARC21 952$c)
1033 `permanent_location` varchar(80) default NULL, -- linked to the CART and PROC temporary locations feature, stores the permanent shelving location
1034 `onloan` date default NULL, -- defines if this item is currently checked out (1 for yes, 0 for no)
1035 `cn_source` varchar(10) default NULL, -- classification source used on this item (MARC21 952$2)
1036 `cn_sort` varchar(30) default NULL, -- normalized form of the call number (MARC21 952$o) used for sorting
1037 `ccode` varchar(10) default NULL, -- authorized value for the collection code associated with this item (MARC21 952$8)
1038 `materials` text default NULL, -- materials specified (MARC21 952$3)
1039 `uri` varchar(255) default NULL, -- URL for the item (MARC21 952$u)
1040 `itype` varchar(10) default NULL, -- foreign key from the itemtypes table defining the type for this item (MARC21 952$y)
1041 `more_subfields_xml` longtext default NULL, -- additional 952 subfields in XML format
1042 `enumchron` text default NULL, -- serial enumeration/chronology for the item (MARC21 952$h)
1043 `copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t)
1044 `stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i)
1045 PRIMARY KEY (`itemnumber`),
1046 UNIQUE KEY `itembarcodeidx` (`barcode`),
1047 KEY `itemstocknumberidx` (`stocknumber`),
1048 KEY `itembinoidx` (`biblioitemnumber`),
1049 KEY `itembibnoidx` (`biblionumber`),
1050 KEY `homebranch` (`homebranch`),
1051 KEY `holdingbranch` (`holdingbranch`),
1052 KEY `itemcallnumber` (`itemcallnumber`),
1053 CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1054 CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
1055 CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE
1056 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1059 -- Table structure for table `itemtypes`
1062 DROP TABLE IF EXISTS `itemtypes`;
1063 CREATE TABLE `itemtypes` ( -- defines the item types
1064 `itemtype` varchar(10) NOT NULL default '', -- unique key, a code associated with the item type
1065 `description` mediumtext, -- a plain text explanation of the item type
1066 `rentalcharge` double(16,4) default NULL, -- the amount charged when this item is checked out/issued
1067 `notforloan` smallint(6) default NULL, -- 1 if the item is not for loan, 0 if the item is available for loan
1068 `imageurl` varchar(200) default NULL, -- URL for the item type icon
1069 `summary` text, -- information from the summary field, may include HTML
1070 PRIMARY KEY (`itemtype`),
1071 UNIQUE KEY `itemtype` (`itemtype`)
1072 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1075 -- Table structure for table `creator_batches`
1078 DROP TABLE IF EXISTS `creator_batches`;
1079 SET @saved_cs_client = @@character_set_client;
1080 SET character_set_client = utf8;
1081 CREATE TABLE `creator_batches` (
1082 `label_id` int(11) NOT NULL AUTO_INCREMENT,
1083 `batch_id` int(10) NOT NULL DEFAULT '1',
1084 `item_number` int(11) DEFAULT NULL,
1085 `borrower_number` int(11) DEFAULT NULL,
1086 `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1087 `branch_code` varchar(10) NOT NULL DEFAULT 'NB',
1088 `creator` char(15) NOT NULL DEFAULT 'Labels',
1089 PRIMARY KEY (`label_id`),
1090 KEY `branch_fk_constraint` (`branch_code`),
1091 KEY `item_fk_constraint` (`item_number`),
1092 KEY `borrower_fk_constraint` (`borrower_number`),
1093 CONSTRAINT `creator_batches_ibfk_1` FOREIGN KEY (`borrower_number`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1094 CONSTRAINT `creator_batches_ibfk_2` FOREIGN KEY (`branch_code`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
1095 CONSTRAINT `creator_batches_ibfk_3` FOREIGN KEY (`item_number`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE
1096 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1099 -- Table structure for table `creator_images`
1102 DROP TABLE IF EXISTS `creator_images`;
1103 SET @saved_cs_client = @@character_set_client;
1104 SET character_set_client = utf8;
1105 CREATE TABLE `creator_images` (
1106 `image_id` int(4) NOT NULL AUTO_INCREMENT,
1107 `imagefile` mediumblob,
1108 `image_name` char(20) NOT NULL DEFAULT 'DEFAULT',
1109 PRIMARY KEY (`image_id`),
1110 UNIQUE KEY `image_name_index` (`image_name`)
1111 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1114 -- Table structure for table `creator_layouts`
1117 DROP TABLE IF EXISTS `creator_layouts`;
1118 SET @saved_cs_client = @@character_set_client;
1119 SET character_set_client = utf8;
1120 CREATE TABLE `creator_layouts` (
1121 `layout_id` int(4) NOT NULL AUTO_INCREMENT,
1122 `barcode_type` char(100) NOT NULL DEFAULT 'CODE39',
1123 `start_label` int(2) NOT NULL DEFAULT '1',
1124 `printing_type` char(32) NOT NULL DEFAULT 'BAR',
1125 `layout_name` char(20) NOT NULL DEFAULT 'DEFAULT',
1126 `guidebox` int(1) DEFAULT '0',
1127 `font` char(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'TR',
1128 `font_size` int(4) NOT NULL DEFAULT '10',
1129 `units` char(20) NOT NULL DEFAULT 'POINT',
1130 `callnum_split` int(1) DEFAULT '0',
1131 `text_justify` char(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'L',
1132 `format_string` varchar(210) NOT NULL DEFAULT 'barcode',
1133 `layout_xml` text NOT NULL,
1134 `creator` char(15) NOT NULL DEFAULT 'Labels',
1135 PRIMARY KEY (`layout_id`)
1136 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1139 -- Table structure for table `creator_templates`
1142 DROP TABLE IF EXISTS `creator_templates`;
1143 SET @saved_cs_client = @@character_set_client;
1144 SET character_set_client = utf8;
1145 CREATE TABLE `creator_templates` (
1146 `template_id` int(4) NOT NULL AUTO_INCREMENT,
1147 `profile_id` int(4) DEFAULT NULL,
1148 `template_code` char(100) NOT NULL DEFAULT 'DEFAULT TEMPLATE',
1149 `template_desc` char(100) NOT NULL DEFAULT 'Default description',
1150 `page_width` float NOT NULL DEFAULT '0',
1151 `page_height` float NOT NULL DEFAULT '0',
1152 `label_width` float NOT NULL DEFAULT '0',
1153 `label_height` float NOT NULL DEFAULT '0',
1154 `top_text_margin` float NOT NULL DEFAULT '0',
1155 `left_text_margin` float NOT NULL DEFAULT '0',
1156 `top_margin` float NOT NULL DEFAULT '0',
1157 `left_margin` float NOT NULL DEFAULT '0',
1158 `cols` int(2) NOT NULL DEFAULT '0',
1159 `rows` int(2) NOT NULL DEFAULT '0',
1160 `col_gap` float NOT NULL DEFAULT '0',
1161 `row_gap` float NOT NULL DEFAULT '0',
1162 `units` char(20) NOT NULL DEFAULT 'POINT',
1163 `creator` char(15) NOT NULL DEFAULT 'Labels',
1164 PRIMARY KEY (`template_id`),
1165 KEY `template_profile_fk_constraint` (`profile_id`)
1166 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1169 -- Table structure for table `letter`
1172 DROP TABLE IF EXISTS `letter`;
1173 CREATE TABLE `letter` ( -- table for all notice templates in Koha
1174 `module` varchar(20) NOT NULL default '', -- Koha module that triggers this notice
1175 `code` varchar(20) NOT NULL default '', -- unique identifier for this notice
1176 `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
1177 `name` varchar(100) NOT NULL default '', -- plain text name for this notice
1178 `is_html` tinyint(1) default 0,
1179 `title` varchar(200) NOT NULL default '', -- subject line of the notice
1180 `content` text, -- body text for the notice
1181 PRIMARY KEY (`module`,`code`, `branchcode`)
1182 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1185 -- Table structure for table `marc_subfield_structure`
1188 DROP TABLE IF EXISTS `marc_subfield_structure`;
1189 CREATE TABLE `marc_subfield_structure` (
1190 `tagfield` varchar(3) NOT NULL default '',
1191 `tagsubfield` varchar(1) NOT NULL default '' COLLATE utf8_bin,
1192 `liblibrarian` varchar(255) NOT NULL default '',
1193 `libopac` varchar(255) NOT NULL default '',
1194 `repeatable` tinyint(4) NOT NULL default 0,
1195 `mandatory` tinyint(4) NOT NULL default 0,
1196 `kohafield` varchar(40) default NULL,
1197 `tab` tinyint(1) default NULL,
1198 `authorised_value` varchar(20) default NULL,
1199 `authtypecode` varchar(20) default NULL,
1200 `value_builder` varchar(80) default NULL,
1201 `isurl` tinyint(1) default NULL,
1202 `hidden` tinyint(1) default NULL,
1203 `frameworkcode` varchar(4) NOT NULL default '',
1204 `seealso` varchar(1100) default NULL,
1205 `link` varchar(80) default NULL,
1206 `defaultvalue` text default NULL,
1207 PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`),
1208 KEY `kohafield_2` (`kohafield`),
1209 KEY `tab` (`frameworkcode`,`tab`),
1210 KEY `kohafield` (`frameworkcode`,`kohafield`)
1211 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1214 -- Table structure for table `marc_tag_structure`
1217 DROP TABLE IF EXISTS `marc_tag_structure`;
1218 CREATE TABLE `marc_tag_structure` (
1219 `tagfield` varchar(3) NOT NULL default '',
1220 `liblibrarian` varchar(255) NOT NULL default '',
1221 `libopac` varchar(255) NOT NULL default '',
1222 `repeatable` tinyint(4) NOT NULL default 0,
1223 `mandatory` tinyint(4) NOT NULL default 0,
1224 `authorised_value` varchar(10) default NULL,
1225 `frameworkcode` varchar(4) NOT NULL default '',
1226 PRIMARY KEY (`frameworkcode`,`tagfield`)
1227 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1230 -- Table structure for table `marc_matchers`
1233 DROP TABLE IF EXISTS `marc_matchers`;
1234 CREATE TABLE `marc_matchers` (
1235 `matcher_id` int(11) NOT NULL auto_increment,
1236 `code` varchar(10) NOT NULL default '',
1237 `description` varchar(255) NOT NULL default '',
1238 `record_type` varchar(10) NOT NULL default 'biblio',
1239 `threshold` int(11) NOT NULL default 0,
1240 PRIMARY KEY (`matcher_id`),
1241 KEY `code` (`code`),
1242 KEY `record_type` (`record_type`)
1243 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1246 -- Table structure for table `matchpoints`
1248 DROP TABLE IF EXISTS `matchpoints`;
1249 CREATE TABLE `matchpoints` (
1250 `matcher_id` int(11) NOT NULL,
1251 `matchpoint_id` int(11) NOT NULL auto_increment,
1252 `search_index` varchar(30) NOT NULL default '',
1253 `score` int(11) NOT NULL default 0,
1254 PRIMARY KEY (`matchpoint_id`),
1255 CONSTRAINT `matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`)
1256 REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE
1257 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1261 -- Table structure for table `matchpoint_components`
1263 DROP TABLE IF EXISTS `matchpoint_components`;
1264 CREATE TABLE `matchpoint_components` (
1265 `matchpoint_id` int(11) NOT NULL,
1266 `matchpoint_component_id` int(11) NOT NULL auto_increment,
1267 sequence int(11) NOT NULL default 0,
1268 tag varchar(3) NOT NULL default '',
1269 subfields varchar(40) NOT NULL default '',
1270 offset int(4) NOT NULL default 0,
1271 length int(4) NOT NULL default 0,
1272 PRIMARY KEY (`matchpoint_component_id`),
1273 KEY `by_sequence` (`matchpoint_id`, `sequence`),
1274 CONSTRAINT `matchpoint_components_ifbk_1` FOREIGN KEY (`matchpoint_id`)
1275 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
1276 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1279 -- Table structure for table `matcher_component_norms`
1281 DROP TABLE IF EXISTS `matchpoint_component_norms`;
1282 CREATE TABLE `matchpoint_component_norms` (
1283 `matchpoint_component_id` int(11) NOT NULL,
1284 `sequence` int(11) NOT NULL default 0,
1285 `norm_routine` varchar(50) NOT NULL default '',
1286 KEY `matchpoint_component_norms` (`matchpoint_component_id`, `sequence`),
1287 CONSTRAINT `matchpoint_component_norms_ifbk_1` FOREIGN KEY (`matchpoint_component_id`)
1288 REFERENCES `matchpoint_components` (`matchpoint_component_id`) ON DELETE CASCADE ON UPDATE CASCADE
1289 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1292 -- Table structure for table `matcher_matchpoints`
1294 DROP TABLE IF EXISTS `matcher_matchpoints`;
1295 CREATE TABLE `matcher_matchpoints` (
1296 `matcher_id` int(11) NOT NULL,
1297 `matchpoint_id` int(11) NOT NULL,
1298 CONSTRAINT `matcher_matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`)
1299 REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1300 CONSTRAINT `matcher_matchpoints_ifbk_2` FOREIGN KEY (`matchpoint_id`)
1301 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
1302 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1305 -- Table structure for table `matchchecks`
1307 DROP TABLE IF EXISTS `matchchecks`;
1308 CREATE TABLE `matchchecks` (
1309 `matcher_id` int(11) NOT NULL,
1310 `matchcheck_id` int(11) NOT NULL auto_increment,
1311 `source_matchpoint_id` int(11) NOT NULL,
1312 `target_matchpoint_id` int(11) NOT NULL,
1313 PRIMARY KEY (`matchcheck_id`),
1314 CONSTRAINT `matcher_matchchecks_ifbk_1` FOREIGN KEY (`matcher_id`)
1315 REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1316 CONSTRAINT `matcher_matchchecks_ifbk_2` FOREIGN KEY (`source_matchpoint_id`)
1317 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1318 CONSTRAINT `matcher_matchchecks_ifbk_3` FOREIGN KEY (`target_matchpoint_id`)
1319 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
1320 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1323 -- Table structure for table `need_merge_authorities`
1326 DROP TABLE IF EXISTS `need_merge_authorities`;
1327 CREATE TABLE `need_merge_authorities` ( -- keeping track of authority records still to be merged by merge_authority cron job (used only if pref dontmerge is ON)
1328 `id` int NOT NULL auto_increment PRIMARY KEY, -- unique id
1329 `authid` bigint NOT NULL, -- reference to authority record
1330 `done` tinyint DEFAULT 0 -- indication whether merge has been executed (0=not done, 1= done, 2= in progress)
1331 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1334 -- Table structure for table `notifys`
1337 DROP TABLE IF EXISTS `notifys`;
1338 CREATE TABLE `notifys` (
1339 `notify_id` int(11) NOT NULL default 0,
1340 `borrowernumber` int(11) NOT NULL default 0,
1341 `itemnumber` int(11) NOT NULL default 0,
1342 `notify_date` date default NULL,
1343 `notify_send_date` date default NULL,
1344 `notify_level` int(1) NOT NULL default 0,
1345 `method` varchar(20) NOT NULL default ''
1346 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1349 -- Table structure for table `nozebra`
1352 DROP TABLE IF EXISTS `nozebra`;
1353 CREATE TABLE `nozebra` (
1354 `server` varchar(20) NOT NULL,
1355 `indexname` varchar(40) NOT NULL,
1356 `value` varchar(250) NOT NULL,
1357 `biblionumbers` longtext NOT NULL,
1358 KEY `indexname` (`server`,`indexname`),
1359 KEY `value` (`server`,`value`))
1360 ENGINE=InnoDB DEFAULT CHARSET=utf8;
1363 -- Table structure for table `oai_sets`
1366 DROP TABLE IF EXISTS `oai_sets`;
1367 CREATE TABLE `oai_sets` (
1368 `id` int(11) NOT NULL auto_increment,
1369 `spec` varchar(80) NOT NULL UNIQUE,
1370 `name` varchar(80) NOT NULL,
1372 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1375 -- Table structure for table `oai_sets_descriptions`
1378 DROP TABLE IF EXISTS `oai_sets_descriptions`;
1379 CREATE TABLE `oai_sets_descriptions` (
1380 `set_id` int(11) NOT NULL,
1381 `description` varchar(255) NOT NULL,
1382 CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1383 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1386 -- Table structure for table `oai_sets_mappings`
1389 DROP TABLE IF EXISTS `oai_sets_mappings`;
1390 CREATE TABLE `oai_sets_mappings` (
1391 `set_id` int(11) NOT NULL,
1392 `marcfield` char(3) NOT NULL,
1393 `marcsubfield` char(1) NOT NULL,
1394 `marcvalue` varchar(80) NOT NULL,
1395 CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1396 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1399 -- Table structure for table `oai_sets_biblios`
1402 DROP TABLE IF EXISTS `oai_sets_biblios`;
1403 CREATE TABLE `oai_sets_biblios` (
1404 `biblionumber` int(11) NOT NULL,
1405 `set_id` int(11) NOT NULL,
1406 PRIMARY KEY (`biblionumber`, `set_id`),
1407 CONSTRAINT `oai_sets_biblios_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1408 CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1409 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1412 -- Table structure for table `old_issues`
1415 DROP TABLE IF EXISTS `old_issues`;
1416 CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
1417 `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1418 `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
1419 `date_due` date default NULL, -- date the item is due (yyyy-mm-dd)
1420 `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
1421 `issuingbranch` varchar(18) default NULL,
1422 `returndate` date default NULL, -- date the item was returned
1423 `lastreneweddate` date default NULL, -- date the item was last renewed
1424 `return` varchar(4) default NULL,
1425 `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
1426 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1427 `issuedate` date default NULL, -- date the item was checked out or issued
1428 KEY `old_issuesborridx` (`borrowernumber`),
1429 KEY `old_issuesitemidx` (`itemnumber`),
1430 KEY `old_bordate` (`borrowernumber`,`timestamp`),
1431 CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
1432 ON DELETE SET NULL ON UPDATE SET NULL,
1433 CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`)
1434 ON DELETE SET NULL ON UPDATE SET NULL
1435 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1438 -- Table structure for table `old_reserves`
1440 DROP TABLE IF EXISTS `old_reserves`;
1441 CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have been completed (either filled or cancelled)
1442 `borrowernumber` int(11) default NULL, -- foreign key from the borrowers table defining which patron this hold is for
1443 `reservedate` date default NULL, -- the date the hold was places
1444 `biblionumber` int(11) default NULL, -- foreign key from the biblio table defining which bib record this hold is on
1445 `constrainttype` varchar(1) default NULL,
1446 `branchcode` varchar(10) default NULL, -- foreign key from the branches table defining which branch the patron wishes to pick this hold up at
1447 `notificationdate` date default NULL, -- currently unused
1448 `reminderdate` date default NULL, -- currently unused
1449 `cancellationdate` date default NULL, -- the date this hold was cancelled
1450 `reservenotes` mediumtext, -- notes related to this hold
1451 `priority` smallint(6) default NULL, -- where in the queue the patron sits
1452 `found` varchar(1) default NULL, -- a one letter code defining what the status is of the hold is after it has been confirmed
1453 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this hold was last updated
1454 `itemnumber` int(11) default NULL, -- foreign key from the items table defining the specific item the patron has placed on hold or the item this hold was filled with
1455 `waitingdate` date default NULL, -- the date the item was marked as waiting for the patron at the library
1456 `expirationdate` DATE DEFAULT NULL, -- the date the hold expires (usually the date entered by the patron to say they don't need the hold after a certain date)
1457 `lowestPriority` tinyint(1) NOT NULL,
1458 KEY `old_reserves_borrowernumber` (`borrowernumber`),
1459 KEY `old_reserves_biblionumber` (`biblionumber`),
1460 KEY `old_reserves_itemnumber` (`itemnumber`),
1461 KEY `old_reserves_branchcode` (`branchcode`),
1462 CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
1463 ON DELETE SET NULL ON UPDATE SET NULL,
1464 CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`)
1465 ON DELETE SET NULL ON UPDATE SET NULL,
1466 CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`)
1467 ON DELETE SET NULL ON UPDATE SET NULL
1468 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1471 -- Table structure for table `opac_news`
1474 DROP TABLE IF EXISTS `opac_news`;
1475 CREATE TABLE `opac_news` ( -- data from the news tool
1476 `idnew` int(10) unsigned NOT NULL auto_increment, -- unique identifier for the news article
1477 `title` varchar(250) NOT NULL default '', -- title of the news article
1478 `new` text NOT NULL, -- the body of your news article
1479 `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)
1480 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, -- pulibcation date and time
1481 `expirationdate` date default NULL, -- date the article is set to expire or no longer be visible
1482 `number` int(11) default NULL, -- the order in which this article appears in that specific location
1483 PRIMARY KEY (`idnew`)
1484 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1487 -- Table structure for table `overduerules`
1490 DROP TABLE IF EXISTS `overduerules`;
1491 CREATE TABLE `overduerules` ( -- overdue notice status and triggers
1492 `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)
1493 `categorycode` varchar(10) NOT NULL default '', -- foreign key from the categories table to define which patron category this rule is for
1494 `delay1` int(4) default NULL, -- number of days after the item is overdue that the first notice is sent
1495 `letter1` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the first notice
1496 `debarred1` varchar(1) default 0, -- is the patron restricted when the first notice is sent (1 for yes, 0 for no)
1497 `delay2` int(4) default NULL, -- number of days after the item is overdue that the second notice is sent
1498 `debarred2` varchar(1) default 0, -- is the patron restricted when the second notice is sent (1 for yes, 0 for no)
1499 `letter2` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the second notice
1500 `delay3` int(4) default NULL, -- number of days after the item is overdue that the third notice is sent
1501 `letter3` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the third notice
1502 `debarred3` int(1) default 0, -- is the patron restricted when the third notice is sent (1 for yes, 0 for no)
1503 PRIMARY KEY (`branchcode`,`categorycode`)
1504 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1507 -- Table structure for table `patroncards`
1510 DROP TABLE IF EXISTS `patroncards`;
1511 CREATE TABLE `patroncards` (
1512 `cardid` int(11) NOT NULL auto_increment,
1513 `batch_id` varchar(10) NOT NULL default '1',
1514 `borrowernumber` int(11) NOT NULL,
1515 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
1516 PRIMARY KEY (`cardid`),
1517 KEY `patroncards_ibfk_1` (`borrowernumber`),
1518 CONSTRAINT `patroncards_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1519 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1522 -- Table structure for table `patronimage`
1525 DROP TABLE IF EXISTS `patronimage`;
1526 CREATE TABLE `patronimage` (
1527 `cardnumber` varchar(16) NOT NULL,
1528 `mimetype` varchar(15) NOT NULL,
1529 `imagefile` mediumblob NOT NULL,
1530 PRIMARY KEY (`cardnumber`),
1531 CONSTRAINT `patronimage_fk1` FOREIGN KEY (`cardnumber`) REFERENCES `borrowers` (`cardnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1532 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1534 -- Table structure for table `pending_offline_operations`
1536 -- this table is MyISAM, InnoDB tables are growing only and this table is filled/emptied/filled/emptied...
1537 -- so MyISAM is better in this case
1539 CREATE TABLE `pending_offline_operations` (
1540 `operationid` int(11) NOT NULL AUTO_INCREMENT,
1541 `userid` varchar(30) NOT NULL,
1542 `branchcode` varchar(10) NOT NULL,
1543 `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1544 `action` varchar(10) NOT NULL,
1545 `barcode` varchar(20) NOT NULL,
1546 `cardnumber` varchar(16) DEFAULT NULL,
1547 PRIMARY KEY (`operationid`)
1548 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
1553 -- Table structure for table `printers`
1556 DROP TABLE IF EXISTS `printers`;
1557 CREATE TABLE `printers` (
1558 `printername` varchar(40) NOT NULL default '',
1559 `printqueue` varchar(20) default NULL,
1560 `printtype` varchar(20) default NULL,
1561 PRIMARY KEY (`printername`)
1562 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1565 -- Table structure for table `printers_profile`
1568 DROP TABLE IF EXISTS `printers_profile`;
1569 CREATE TABLE `printers_profile` (
1570 `profile_id` int(4) NOT NULL auto_increment,
1571 `printer_name` varchar(40) NOT NULL default 'Default Printer',
1572 `template_id` int(4) NOT NULL default '0',
1573 `paper_bin` varchar(20) NOT NULL default 'Bypass',
1574 `offset_horz` float NOT NULL default '0',
1575 `offset_vert` float NOT NULL default '0',
1576 `creep_horz` float NOT NULL default '0',
1577 `creep_vert` float NOT NULL default '0',
1578 `units` char(20) NOT NULL default 'POINT',
1579 `creator` char(15) NOT NULL DEFAULT 'Labels',
1580 PRIMARY KEY (`profile_id`),
1581 UNIQUE KEY `printername` (`printer_name`,`template_id`,`paper_bin`,`creator`)
1582 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1585 -- Table structure for table `repeatable_holidays`
1588 DROP TABLE IF EXISTS `repeatable_holidays`;
1589 CREATE TABLE `repeatable_holidays` ( -- information for the days the library is closed
1590 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1591 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, defines which branch this closing is for
1592 `weekday` smallint(6) default NULL, -- day of the week (0=Sunday, 1=Monday, etc) this closing is repeated on
1593 `day` smallint(6) default NULL, -- day of the month this closing is on
1594 `month` smallint(6) default NULL, -- month this closing is in
1595 `title` varchar(50) NOT NULL default '', -- title of this closing
1596 `description` text NOT NULL, -- description for this closing
1598 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1601 -- Table structure for table `reports_dictionary`
1604 DROP TABLE IF EXISTS `reports_dictionary`;
1605 CREATE TABLE reports_dictionary ( -- definitions (or snippets of SQL) stored for use in reports
1606 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1607 `name` varchar(255) default NULL, -- name for this definition
1608 `description` text, -- description for this definition
1609 `date_created` datetime default NULL, -- date and time this definition was created
1610 `date_modified` datetime default NULL, -- date and time this definition was last modified
1611 `saved_sql` text, -- SQL snippet for us in reports
1612 `area` int(11) default NULL, -- Koha module this definition is for (1 = Circulation, 2 = Catalog, 3 = Patrons, 4 = Acquistions, 5 = Accounts)
1614 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1617 -- Table structure for table `reserveconstraints`
1620 DROP TABLE IF EXISTS `reserveconstraints`;
1621 CREATE TABLE `reserveconstraints` (
1622 `borrowernumber` int(11) NOT NULL default 0,
1623 `reservedate` date default NULL,
1624 `biblionumber` int(11) NOT NULL default 0,
1625 `biblioitemnumber` int(11) default NULL,
1626 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
1627 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1630 -- Table structure for table `reserves`
1633 DROP TABLE IF EXISTS `reserves`;
1634 CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha
1635 `borrowernumber` int(11) NOT NULL default 0, -- foreign key from the borrowers table defining which patron this hold is for
1636 `reservedate` date default NULL, -- the date the hold was places
1637 `biblionumber` int(11) NOT NULL default 0, -- foreign key from the biblio table defining which bib record this hold is on
1638 `constrainttype` varchar(1) default NULL,
1639 `branchcode` varchar(10) default NULL, -- foreign key from the branches table defining which branch the patron wishes to pick this hold up at
1640 `notificationdate` date default NULL, -- currently unused
1641 `reminderdate` date default NULL, -- currently unused
1642 `cancellationdate` date default NULL, -- the date this hold was cancelled
1643 `reservenotes` mediumtext, -- notes related to this hold
1644 `priority` smallint(6) default NULL, -- where in the queue the patron sits
1645 `found` varchar(1) default NULL, -- a one letter code defining what the status is of the hold is after it has been confirmed
1646 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this hold was last updated
1647 `itemnumber` int(11) default NULL, -- foreign key from the items table defining the specific item the patron has placed on hold or the item this hold was filled with
1648 `waitingdate` date default NULL, -- the date the item was marked as waiting for the patron at the library
1649 `expirationdate` DATE DEFAULT NULL, -- the date the hold expires (usually the date entered by the patron to say they don't need the hold after a certain date)
1650 `lowestPriority` tinyint(1) NOT NULL,
1651 KEY priorityfoundidx (priority,found),
1652 KEY `borrowernumber` (`borrowernumber`),
1653 KEY `biblionumber` (`biblionumber`),
1654 KEY `itemnumber` (`itemnumber`),
1655 KEY `branchcode` (`branchcode`),
1656 CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1657 CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1658 CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1659 CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1660 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1663 -- Table structure for table `reviews`
1666 DROP TABLE IF EXISTS `reviews`;
1667 CREATE TABLE `reviews` ( -- patron opac comments
1668 `reviewid` int(11) NOT NULL auto_increment, -- unique identifier for this comment
1669 `borrowernumber` int(11) default NULL, -- foreign key from the borrowers table defining which patron left this comment
1670 `biblionumber` int(11) default NULL, -- foreign key from the biblio table defining which bibliographic record this comment is for
1671 `review` text, -- the body of the comment
1672 `approved` tinyint(4) default NULL, -- whether this comment has been approved by a librarian (1 for yes, 0 for no)
1673 `datereviewed` datetime default NULL, -- the date the comment was left
1674 PRIMARY KEY (`reviewid`),
1675 CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
1676 CONSTRAINT `reviews_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1677 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1680 -- Table structure for table `roadtype`
1683 DROP TABLE IF EXISTS `roadtype`;
1684 CREATE TABLE `roadtype` ( -- road types defined in administration and used in patron management
1685 `roadtypeid` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha for each road type
1686 `road_type` varchar(100) NOT NULL default '', -- text for road type
1687 PRIMARY KEY (`roadtypeid`)
1688 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1691 -- Table structure for table `saved_sql`
1694 DROP TABLE IF EXISTS `saved_sql`;
1695 CREATE TABLE saved_sql (
1696 `id` int(11) NOT NULL auto_increment,
1697 `borrowernumber` int(11) default NULL,
1698 `date_created` datetime default NULL,
1699 `last_modified` datetime default NULL,
1701 `last_run` datetime default NULL,
1702 `report_name` varchar(255) default NULL,
1703 `type` varchar(255) default NULL,
1706 KEY boridx (`borrowernumber`)
1707 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1711 -- Table structure for `saved_reports`
1714 DROP TABLE IF EXISTS `saved_reports`;
1715 CREATE TABLE saved_reports (
1716 `id` int(11) NOT NULL auto_increment,
1717 `report_id` int(11) default NULL,
1719 `date_run` datetime default NULL,
1721 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1725 -- Table structure for table `search_history`
1728 DROP TABLE IF EXISTS `search_history`;
1729 CREATE TABLE IF NOT EXISTS `search_history` (
1730 `userid` int(11) NOT NULL,
1731 `sessionid` varchar(32) NOT NULL,
1732 `query_desc` varchar(255) NOT NULL,
1733 `query_cgi` varchar(255) NOT NULL,
1734 `total` int(11) NOT NULL,
1735 `time` timestamp NOT NULL default CURRENT_TIMESTAMP,
1736 KEY `userid` (`userid`),
1737 KEY `sessionid` (`sessionid`)
1738 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Opac search history results';
1742 -- Table structure for table `serial`
1745 DROP TABLE IF EXISTS `serial`;
1746 CREATE TABLE `serial` (
1747 `serialid` int(11) NOT NULL auto_increment,
1748 `biblionumber` varchar(100) NOT NULL default '',
1749 `subscriptionid` varchar(100) NOT NULL default '',
1750 `serialseq` varchar(100) NOT NULL default '',
1751 `status` tinyint(4) NOT NULL default 0,
1752 `planneddate` date default NULL,
1754 `publisheddate` date default NULL,
1755 `itemnumber` text default NULL,
1756 `claimdate` date default NULL,
1757 `routingnotes` text,
1758 PRIMARY KEY (`serialid`)
1759 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1762 -- Table structure for table `sessions`
1765 DROP TABLE IF EXISTS sessions;
1766 CREATE TABLE sessions (
1767 `id` varchar(32) NOT NULL,
1768 `a_session` text NOT NULL,
1770 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1773 -- Table structure for table `special_holidays`
1776 DROP TABLE IF EXISTS `special_holidays`;
1777 CREATE TABLE `special_holidays` ( -- non repeatable holidays/library closings
1778 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1779 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, defines which branch this closing is for
1780 `day` smallint(6) NOT NULL default 0, -- day of the month this closing is on
1781 `month` smallint(6) NOT NULL default 0, -- month this closing is in
1782 `year` smallint(6) NOT NULL default 0, -- year this closing is in
1783 `isexception` smallint(1) NOT NULL default 1, -- is this a holiday exception to a repeatable holiday (1 for yes, 0 for no)
1784 `title` varchar(50) NOT NULL default '', -- title for this closing
1785 `description` text NOT NULL, -- description of this closing
1787 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1790 -- Table structure for table `statistics`
1793 DROP TABLE IF EXISTS `statistics`;
1794 CREATE TABLE `statistics` ( -- information related to transactions (circulation and fines) in Koha
1795 `datetime` datetime default NULL, -- date and time of the transaction
1796 `branch` varchar(10) default NULL, -- foreign key, branch where the transaction occurred
1797 `proccode` varchar(4) default NULL, -- proceedure code
1798 `value` double(16,4) default NULL, -- monetary value associated with the transaction
1799 `type` varchar(16) default NULL, -- transaction type (locause, issue, return, renew, writeoff, payment, Credit*)
1801 `usercode` varchar(10) default NULL,
1802 `itemnumber` int(11) default NULL, -- foreign key from the items table, links transaction to a specific item
1803 `itemtype` varchar(10) default NULL, -- foreign key from the itemtypes table, links transaction to a specific item type
1804 `borrowernumber` int(11) default NULL, -- foreign key from the borrowers table, links transaction to a specific borrower
1805 `associatedborrower` int(11) default NULL,
1806 KEY `timeidx` (`datetime`)
1807 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1810 -- Table structure for table `stopwords`
1813 DROP TABLE IF EXISTS `stopwords`;
1814 CREATE TABLE `stopwords` (
1815 `word` varchar(255) default NULL
1816 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1819 -- Table structure for table `subscription`
1822 DROP TABLE IF EXISTS `subscription`;
1823 CREATE TABLE `subscription` (
1824 `biblionumber` int(11) NOT NULL default 0,
1825 `subscriptionid` int(11) NOT NULL auto_increment,
1826 `librarian` varchar(100) default '',
1827 `startdate` date default NULL,
1828 `aqbooksellerid` int(11) default 0,
1829 `cost` int(11) default 0,
1830 `aqbudgetid` int(11) default 0,
1831 `weeklength` int(11) default 0,
1832 `monthlength` int(11) default 0,
1833 `numberlength` int(11) default 0,
1834 `periodicity` tinyint(4) default 0,
1835 `dow` varchar(100) default '',
1836 `numberingmethod` varchar(100) default '',
1838 `status` varchar(100) NOT NULL default '',
1839 `add1` int(11) default 0,
1840 `every1` int(11) default 0,
1841 `whenmorethan1` int(11) default 0,
1842 `setto1` int(11) default NULL,
1843 `lastvalue1` int(11) default NULL,
1844 `add2` int(11) default 0,
1845 `every2` int(11) default 0,
1846 `whenmorethan2` int(11) default 0,
1847 `setto2` int(11) default NULL,
1848 `lastvalue2` int(11) default NULL,
1849 `add3` int(11) default 0,
1850 `every3` int(11) default 0,
1851 `innerloop1` int(11) default 0,
1852 `innerloop2` int(11) default 0,
1853 `innerloop3` int(11) default 0,
1854 `whenmorethan3` int(11) default 0,
1855 `setto3` int(11) default NULL,
1856 `lastvalue3` int(11) default NULL,
1857 `issuesatonce` tinyint(3) NOT NULL default 1,
1858 `firstacquidate` date default NULL,
1859 `manualhistory` tinyint(1) NOT NULL default 0,
1860 `irregularity` text,
1861 `letter` varchar(20) default NULL,
1862 `numberpattern` tinyint(3) default 0,
1863 `distributedto` text,
1864 `internalnotes` longtext,
1866 `location` varchar(80) NULL default '',
1867 `branchcode` varchar(10) NOT NULL default '',
1868 `hemisphere` tinyint(3) default 0,
1869 `lastbranch` varchar(10),
1870 `serialsadditems` tinyint(1) NOT NULL default '0',
1871 `staffdisplaycount` VARCHAR(10) NULL,
1872 `opacdisplaycount` VARCHAR(10) NULL,
1873 `graceperiod` int(11) NOT NULL default '0',
1874 `enddate` date default NULL,
1875 PRIMARY KEY (`subscriptionid`)
1876 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1879 -- Table structure for table `subscriptionhistory`
1882 DROP TABLE IF EXISTS `subscriptionhistory`;
1883 CREATE TABLE `subscriptionhistory` (
1884 `biblionumber` int(11) NOT NULL default 0,
1885 `subscriptionid` int(11) NOT NULL default 0,
1886 `histstartdate` date default NULL,
1887 `histenddate` date default NULL,
1888 `missinglist` longtext NOT NULL,
1889 `recievedlist` longtext NOT NULL,
1890 `opacnote` varchar(150) NOT NULL default '',
1891 `librariannote` varchar(150) NOT NULL default '',
1892 PRIMARY KEY (`subscriptionid`),
1893 KEY `biblionumber` (`biblionumber`)
1894 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1897 -- Table structure for table `subscriptionroutinglist`
1900 DROP TABLE IF EXISTS `subscriptionroutinglist`;
1901 CREATE TABLE `subscriptionroutinglist` ( -- information related to the routing lists attached to subscriptions
1902 `routingid` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1903 `borrowernumber` int(11) NOT NULL, -- foreign key from the borrowers table, defines with patron is on the routing list
1904 `ranking` int(11) default NULL, -- where the patron stands in line to receive the serial
1905 `subscriptionid` int(11) NOT NULL, -- foreign key from the subscription table, defines which subscription this routing list is for
1906 PRIMARY KEY (`routingid`),
1907 UNIQUE (`subscriptionid`, `borrowernumber`),
1908 CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
1909 ON DELETE CASCADE ON UPDATE CASCADE,
1910 CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`)
1911 ON DELETE CASCADE ON UPDATE CASCADE
1912 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1915 -- Table structure for table `suggestions`
1918 DROP TABLE IF EXISTS `suggestions`;
1919 CREATE TABLE `suggestions` ( -- purchase suggestions
1920 `suggestionid` int(8) NOT NULL auto_increment, -- unique identifier assigned automatically by Koha
1921 `suggestedby` int(11) NOT NULL default 0, -- borrowernumber for the person making the suggestion, foreign key linking to the borrowers table
1922 `suggesteddate` date NOT NULL default 0, -- date the suggestion was submitted
1923 `managedby` int(11) default NULL, -- borrowernumber for the librarian managing the suggestion, foreign key linking to the borrowers table
1924 `manageddate` date default NULL, -- date the suggestion was updated
1925 acceptedby INT(11) default NULL, -- borrowernumber for the librarian who accepted the suggestion, foreign key linking to the borrowers table
1926 accepteddate date default NULL, -- date the suggestion was marked as accepted
1927 rejectedby INT(11) default NULL, -- borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table
1928 rejecteddate date default NULL, -- date the suggestion was marked as rejected
1929 `STATUS` varchar(10) NOT NULL default '', -- suggestion status (ASKED, CHECKED, ACCEPTED, or REJECTED)
1930 `note` mediumtext, -- note entered on the suggestion
1931 `author` varchar(80) default NULL, -- author of the suggested item
1932 `title` varchar(80) default NULL, -- title of the suggested item
1933 `copyrightdate` smallint(6) default NULL, -- copyright date of the suggested item
1934 `publishercode` varchar(255) default NULL, -- publisher of the suggested item
1935 `date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time the suggestion was updated
1936 `volumedesc` varchar(255) default NULL,
1937 `publicationyear` smallint(6) default 0,
1938 `place` varchar(255) default NULL, -- publication place of the suggested item
1939 `isbn` varchar(30) default NULL, -- isbn of the suggested item
1940 `mailoverseeing` smallint(1) default 0,
1941 `biblionumber` int(11) default NULL, -- foreign key linking the suggestion to the biblio table after the suggestion has been ordered
1942 `reason` text, -- reason for accepting or rejecting the suggestion
1943 `patronreason` text, -- reason for making the suggestion
1944 budgetid INT(11), -- foreign key linking the suggested budget to the aqbudgets table
1945 branchcode VARCHAR(10) default NULL, -- foreign key linking the suggested branch to the branches table
1946 collectiontitle text default NULL, -- collection name for the suggested item
1947 itemtype VARCHAR(30) default NULL, -- suggested item type
1948 quantity SMALLINT(6) default NULL, -- suggested quantity to be purchased
1949 currency VARCHAR(3) default NULL, -- suggested currency for the suggested price
1950 price DECIMAL(28,6) default NULL, -- suggested price
1951 total DECIMAL(28,6) default NULL, -- suggested total cost (price*quantity updated for currency)
1952 PRIMARY KEY (`suggestionid`),
1953 KEY `suggestedby` (`suggestedby`),
1954 KEY `managedby` (`managedby`)
1955 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1958 -- Table structure for table `systempreferences`
1961 DROP TABLE IF EXISTS `systempreferences`;
1962 CREATE TABLE `systempreferences` ( -- global system preferences
1963 `variable` varchar(50) NOT NULL default '', -- system preference name
1964 `value` text, -- system preference values
1965 `options` mediumtext, -- options for multiple choice system preferences
1966 `explanation` text, -- descriptive text for the system preference
1967 `type` varchar(20) default NULL, -- type of question this preference asks (multiple choice, plain text, yes or no, etc)
1968 PRIMARY KEY (`variable`)
1969 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1972 -- Table structure for table `tags`
1975 DROP TABLE IF EXISTS `tags`;
1976 CREATE TABLE `tags` (
1977 `entry` varchar(255) NOT NULL default '',
1978 `weight` bigint(20) NOT NULL default 0,
1979 PRIMARY KEY (`entry`)
1980 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1983 -- Table structure for table `tags_all`
1986 DROP TABLE IF EXISTS `tags_all`;
1987 CREATE TABLE `tags_all` (
1988 `tag_id` int(11) NOT NULL auto_increment,
1989 `borrowernumber` int(11) NOT NULL,
1990 `biblionumber` int(11) NOT NULL,
1991 `term` varchar(255) NOT NULL,
1992 `language` int(4) default NULL,
1993 `date_created` datetime NOT NULL,
1994 PRIMARY KEY (`tag_id`),
1995 KEY `tags_borrowers_fk_1` (`borrowernumber`),
1996 KEY `tags_biblionumber_fk_1` (`biblionumber`),
1997 CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`)
1998 REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1999 CONSTRAINT `tags_biblionumber_fk_1` FOREIGN KEY (`biblionumber`)
2000 REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2001 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2004 -- Table structure for table `tags_approval`
2007 DROP TABLE IF EXISTS `tags_approval`;
2008 CREATE TABLE `tags_approval` (
2009 `term` varchar(255) NOT NULL,
2010 `approved` int(1) NOT NULL default '0',
2011 `date_approved` datetime default NULL,
2012 `approved_by` int(11) default NULL,
2013 `weight_total` int(9) NOT NULL default '1',
2014 PRIMARY KEY (`term`),
2015 KEY `tags_approval_borrowers_fk_1` (`approved_by`),
2016 CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`)
2017 REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2018 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2021 -- Table structure for table `tags_index`
2024 DROP TABLE IF EXISTS `tags_index`;
2025 CREATE TABLE `tags_index` (
2026 `term` varchar(255) NOT NULL,
2027 `biblionumber` int(11) NOT NULL,
2028 `weight` int(9) NOT NULL default '1',
2029 PRIMARY KEY (`term`,`biblionumber`),
2030 KEY `tags_index_biblionumber_fk_1` (`biblionumber`),
2031 CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`)
2032 REFERENCES `tags_approval` (`term`) ON DELETE CASCADE ON UPDATE CASCADE,
2033 CONSTRAINT `tags_index_biblionumber_fk_1` FOREIGN KEY (`biblionumber`)
2034 REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2035 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2038 -- Table structure for table `userflags`
2041 DROP TABLE IF EXISTS `userflags`;
2042 CREATE TABLE `userflags` (
2043 `bit` int(11) NOT NULL default 0,
2044 `flag` varchar(30) default NULL,
2045 `flagdesc` varchar(255) default NULL,
2046 `defaulton` int(11) default NULL,
2048 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2051 -- Table structure for table `virtualshelves`
2054 DROP TABLE IF EXISTS `virtualshelves`;
2055 CREATE TABLE `virtualshelves` ( -- information about lists (or virtual shelves)
2056 `shelfnumber` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2057 `shelfname` varchar(255) default NULL, -- name of the list
2058 `owner` varchar(80) default NULL, -- foriegn key linking to the borrowers table (using borrowernumber) for the creator of this list
2059 `category` varchar(1) default NULL, -- type of list (public [2], private [1] or open [3])
2060 `sortfield` varchar(16) default NULL, -- the field this list is sorted on
2061 `lastmodified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time the list was last modified
2062 PRIMARY KEY (`shelfnumber`)
2063 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2066 -- Table structure for table `virtualshelfcontents`
2069 DROP TABLE IF EXISTS `virtualshelfcontents`;
2070 CREATE TABLE `virtualshelfcontents` ( -- information about the titles in a list (or virtual shelf)
2071 `shelfnumber` int(11) NOT NULL default 0, -- foreign key linking to the virtualshelves table, defines the list that this record has been added to
2072 `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
2073 `flags` int(11) default NULL,
2074 `dateadded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- date and time this bib record was added to the list
2075 KEY `shelfnumber` (`shelfnumber`),
2076 KEY `biblionumber` (`biblionumber`),
2077 CONSTRAINT `virtualshelfcontents_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2078 CONSTRAINT `shelfcontents_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2079 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2082 -- Table structure for table `z3950servers`
2085 DROP TABLE IF EXISTS `z3950servers`;
2086 CREATE TABLE `z3950servers` ( -- connection information for the Z39.50 targets used in cataloging
2087 `host` varchar(255) default NULL, -- target's host name
2088 `port` int(11) default NULL, -- port number used to connect to target
2089 `db` varchar(255) default NULL, -- target's database name
2090 `userid` varchar(255) default NULL, -- username needed to log in to target
2091 `password` varchar(255) default NULL, -- password needed to log in to target
2092 `name` mediumtext, -- name given to the target by the library
2093 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2094 `checked` smallint(6) default NULL, -- whether this target is checked by default (1 for yes, 0 for no)
2095 `rank` int(11) default NULL, -- where this target appears in the list of targets
2096 `syntax` varchar(80) default NULL, -- marc format provided by this target
2097 `icon` text, -- unused in Koha
2098 `position` enum('primary','secondary','') NOT NULL default 'primary',
2099 `type` enum('zed','opensearch') NOT NULL default 'zed',
2100 `encoding` text default NULL, -- characters encoding provided by this target
2101 `description` text NOT NULL, -- unused in Koha
2103 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2106 -- Table structure for table `zebraqueue`
2109 DROP TABLE IF EXISTS `zebraqueue`;
2110 CREATE TABLE `zebraqueue` (
2111 `id` int(11) NOT NULL auto_increment,
2112 `biblio_auth_number` bigint(20) unsigned NOT NULL default '0',
2113 `operation` char(20) NOT NULL default '',
2114 `server` char(20) NOT NULL default '',
2115 `done` int(11) NOT NULL default '0',
2116 `time` timestamp NOT NULL default CURRENT_TIMESTAMP,
2118 KEY `zebraqueue_lookup` (`server`, `biblio_auth_number`, `operation`, `done`)
2119 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2122 -- Table structure for table `services_throttle`
2125 DROP TABLE IF EXISTS `services_throttle`;
2126 CREATE TABLE `services_throttle` (
2127 `service_type` varchar(10) NOT NULL default '',
2128 `service_count` varchar(45) default NULL,
2129 PRIMARY KEY (`service_type`)
2130 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2133 -- Table structure for table `language_subtag_registry`
2134 -- http://www.w3.org/International/articles/language-tags/
2138 DROP TABLE IF EXISTS language_subtag_registry;
2139 CREATE TABLE language_subtag_registry (
2141 type varchar(25), -- language-script-region-variant-extension-privateuse
2142 description varchar(25), -- only one of the possible descriptions for ease of reference, see language_descriptions for the complete list
2144 id int(11) NOT NULL auto_increment,
2146 KEY `subtag` (`subtag`)
2147 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2150 -- Table structure for table `language_rfc4646_to_iso639`
2151 -- TODO: add suppress_scripts
2152 -- this maps three letter codes defined in iso639.2 back to their
2153 -- two letter equivilents in rfc4646 (LOC maintains iso639+)
2156 DROP TABLE IF EXISTS language_rfc4646_to_iso639;
2157 CREATE TABLE language_rfc4646_to_iso639 (
2158 rfc4646_subtag varchar(25),
2159 iso639_2_code varchar(25),
2160 id int(11) NOT NULL auto_increment,
2162 KEY `rfc4646_subtag` (`rfc4646_subtag`)
2163 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2166 -- Table structure for table `language_descriptions`
2169 DROP TABLE IF EXISTS language_descriptions;
2170 CREATE TABLE language_descriptions (
2174 description varchar(255),
2175 id int(11) NOT NULL auto_increment,
2177 KEY `lang` (`lang`),
2178 KEY `subtag_type_lang` (`subtag`, `type`, `lang`)
2179 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2182 -- Table structure for table `language_script_bidi`
2183 -- bi-directional support, keyed by script subcode
2186 DROP TABLE IF EXISTS language_script_bidi;
2187 CREATE TABLE language_script_bidi (
2188 rfc4646_subtag varchar(25), -- script subtag, Arab, Hebr, etc.
2189 bidi varchar(3), -- rtl ltr
2190 KEY `rfc4646_subtag` (`rfc4646_subtag`)
2191 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2194 -- Table structure for table `language_script_mapping`
2195 -- TODO: need to map language subtags to script subtags for detection
2196 -- of bidi when script is not specified (like ar, he)
2199 DROP TABLE IF EXISTS language_script_mapping;
2200 CREATE TABLE language_script_mapping (
2201 language_subtag varchar(25),
2202 script_subtag varchar(25),
2203 KEY `language_subtag` (`language_subtag`)
2204 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2207 -- Table structure for table `permissions`
2210 DROP TABLE IF EXISTS `permissions`;
2211 CREATE TABLE `permissions` (
2212 `module_bit` int(11) NOT NULL DEFAULT 0,
2213 `code` varchar(64) DEFAULT NULL,
2214 `description` varchar(255) DEFAULT NULL,
2215 PRIMARY KEY (`module_bit`, `code`),
2216 CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`)
2217 ON DELETE CASCADE ON UPDATE CASCADE
2218 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2221 -- Table structure for table `serialitems`
2224 DROP TABLE IF EXISTS `serialitems`;
2225 CREATE TABLE `serialitems` (
2226 `itemnumber` int(11) NOT NULL,
2227 `serialid` int(11) NOT NULL,
2228 UNIQUE KEY `serialitemsidx` (`itemnumber`),
2229 KEY `serialitems_sfk_1` (`serialid`),
2230 CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE,
2231 CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
2232 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2235 -- Table structure for table `user_permissions`
2238 DROP TABLE IF EXISTS `user_permissions`;
2239 CREATE TABLE `user_permissions` (
2240 `borrowernumber` int(11) NOT NULL DEFAULT 0,
2241 `module_bit` int(11) NOT NULL DEFAULT 0,
2242 `code` varchar(64) DEFAULT NULL,
2243 CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
2244 ON DELETE CASCADE ON UPDATE CASCADE,
2245 CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`)
2246 ON DELETE CASCADE ON UPDATE CASCADE
2247 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2250 -- Table structure for table `tmp_holdsqueue`
2253 DROP TABLE IF EXISTS `tmp_holdsqueue`;
2254 CREATE TABLE `tmp_holdsqueue` (
2255 `biblionumber` int(11) default NULL,
2256 `itemnumber` int(11) default NULL,
2257 `barcode` varchar(20) default NULL,
2258 `surname` mediumtext NOT NULL,
2261 `borrowernumber` int(11) NOT NULL,
2262 `cardnumber` varchar(16) default NULL,
2263 `reservedate` date default NULL,
2265 `itemcallnumber` varchar(255) default NULL,
2266 `holdingbranch` varchar(10) default NULL,
2267 `pickbranch` varchar(10) default NULL,
2269 `item_level_request` tinyint(4) NOT NULL default 0
2270 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2273 -- Table structure for table `message_queue`
2276 DROP TABLE IF EXISTS `message_queue`;
2277 CREATE TABLE `message_queue` (
2278 `message_id` int(11) NOT NULL auto_increment,
2279 `borrowernumber` int(11) default NULL,
2282 `metadata` text DEFAULT NULL,
2283 `letter_code` varchar(64) DEFAULT NULL,
2284 `message_transport_type` varchar(20) NOT NULL,
2285 `status` enum('sent','pending','failed','deleted') NOT NULL default 'pending',
2286 `time_queued` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2287 `to_address` mediumtext,
2288 `from_address` mediumtext,
2289 `content_type` text,
2290 KEY `message_id` (`message_id`),
2291 KEY `borrowernumber` (`borrowernumber`),
2292 KEY `message_transport_type` (`message_transport_type`),
2293 CONSTRAINT `messageq_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2294 CONSTRAINT `messageq_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE RESTRICT ON UPDATE CASCADE
2295 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2298 -- Table structure for table `message_transport_types`
2301 DROP TABLE IF EXISTS `message_transport_types`;
2302 CREATE TABLE `message_transport_types` (
2303 `message_transport_type` varchar(20) NOT NULL,
2304 PRIMARY KEY (`message_transport_type`)
2305 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2308 -- Table structure for table `message_attributes`
2311 DROP TABLE IF EXISTS `message_attributes`;
2312 CREATE TABLE `message_attributes` (
2313 `message_attribute_id` int(11) NOT NULL auto_increment,
2314 `message_name` varchar(40) NOT NULL default '',
2315 `takes_days` tinyint(1) NOT NULL default '0',
2316 PRIMARY KEY (`message_attribute_id`),
2317 UNIQUE KEY `message_name` (`message_name`)
2318 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2321 -- Table structure for table `message_transports`
2324 DROP TABLE IF EXISTS `message_transports`;
2325 CREATE TABLE `message_transports` (
2326 `message_attribute_id` int(11) NOT NULL,
2327 `message_transport_type` varchar(20) NOT NULL,
2328 `is_digest` tinyint(1) NOT NULL default '0',
2329 `letter_module` varchar(20) NOT NULL default '',
2330 `letter_code` varchar(20) NOT NULL default '',
2331 `branchcode` varchar(10) NOT NULL default '',
2332 PRIMARY KEY (`message_attribute_id`,`message_transport_type`,`is_digest`),
2333 KEY `message_transport_type` (`message_transport_type`),
2334 KEY `letter_module` (`letter_module`,`letter_code`),
2335 CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2336 CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
2337 CONSTRAINT `message_transports_ibfk_3` FOREIGN KEY (`letter_module`, `letter_code`, `branchcode`) REFERENCES `letter` (`module`, `code`, `branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2338 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2341 -- Table structure for table `borrower_message_preferences`
2344 DROP TABLE IF EXISTS `borrower_message_preferences`;
2345 CREATE TABLE `borrower_message_preferences` (
2346 `borrower_message_preference_id` int(11) NOT NULL auto_increment,
2347 `borrowernumber` int(11) default NULL,
2348 `categorycode` varchar(10) default NULL,
2349 `message_attribute_id` int(11) default '0',
2350 `days_in_advance` int(11) default '0',
2351 `wants_digest` tinyint(1) NOT NULL default '0',
2352 PRIMARY KEY (`borrower_message_preference_id`),
2353 KEY `borrowernumber` (`borrowernumber`),
2354 KEY `categorycode` (`categorycode`),
2355 KEY `message_attribute_id` (`message_attribute_id`),
2356 CONSTRAINT `borrower_message_preferences_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2357 CONSTRAINT `borrower_message_preferences_ibfk_2` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2358 CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
2359 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2362 -- Table structure for table `borrower_message_transport_preferences`
2365 DROP TABLE IF EXISTS `borrower_message_transport_preferences`;
2366 CREATE TABLE `borrower_message_transport_preferences` (
2367 `borrower_message_preference_id` int(11) NOT NULL default '0',
2368 `message_transport_type` varchar(20) NOT NULL default '0',
2369 PRIMARY KEY (`borrower_message_preference_id`,`message_transport_type`),
2370 KEY `message_transport_type` (`message_transport_type`),
2371 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,
2372 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
2373 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2376 -- Table structure for the table branch_transfer_limits
2379 DROP TABLE IF EXISTS `branch_transfer_limits`;
2380 CREATE TABLE branch_transfer_limits (
2381 limitId int(8) NOT NULL auto_increment,
2382 toBranch varchar(10) NOT NULL,
2383 fromBranch varchar(10) NOT NULL,
2384 itemtype varchar(10) NULL,
2385 ccode varchar(10) NULL,
2386 PRIMARY KEY (limitId)
2387 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2390 -- Table structure for table `item_circulation_alert_preferences`
2393 DROP TABLE IF EXISTS `item_circulation_alert_preferences`;
2394 CREATE TABLE `item_circulation_alert_preferences` (
2395 `id` int(11) NOT NULL auto_increment,
2396 `branchcode` varchar(10) NOT NULL,
2397 `categorycode` varchar(10) NOT NULL,
2398 `item_type` varchar(10) NOT NULL,
2399 `notification` varchar(16) NOT NULL,
2401 KEY `branchcode` (`branchcode`,`categorycode`,`item_type`, `notification`)
2402 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2405 -- Table structure for table `messages`
2407 DROP TABLE IF EXISTS `messages`;
2408 CREATE TABLE `messages` ( -- circulation messages left via the patron's check out screen
2409 `message_id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2410 `borrowernumber` int(11) NOT NULL, -- foreign key linking this message to the borrowers table
2411 `branchcode` varchar(10) default NULL, -- foreign key linking the message to the branches table
2412 `message_type` varchar(1) NOT NULL, -- whether the message is for the librarians (L) or the patron (B)
2413 `message` text NOT NULL, -- the text of the message
2414 `message_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- the date and time the message was written
2415 PRIMARY KEY (`message_id`)
2416 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2419 -- Table structure for table `accountlines`
2422 DROP TABLE IF EXISTS `accountlines`;
2423 CREATE TABLE `accountlines` (
2424 `borrowernumber` int(11) NOT NULL default 0,
2425 `accountno` smallint(6) NOT NULL default 0,
2426 `itemnumber` int(11) default NULL,
2427 `date` date default NULL,
2428 `amount` decimal(28,6) default NULL,
2429 `description` mediumtext,
2430 `dispute` mediumtext,
2431 `accounttype` varchar(5) default NULL,
2432 `amountoutstanding` decimal(28,6) default NULL,
2433 `lastincrement` decimal(28,6) default NULL,
2434 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2435 `notify_id` int(11) NOT NULL default 0,
2436 `notify_level` int(2) NOT NULL default 0,
2437 `note` text NULL default NULL,
2438 `manager_id` int(11) NULL,
2439 KEY `acctsborridx` (`borrowernumber`),
2440 KEY `timeidx` (`timestamp`),
2441 KEY `itemnumber` (`itemnumber`),
2442 CONSTRAINT `accountlines_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2443 CONSTRAINT `accountlines_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL
2444 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2447 -- Table structure for table `accountoffsets`
2450 DROP TABLE IF EXISTS `accountoffsets`;
2451 CREATE TABLE `accountoffsets` (
2452 `borrowernumber` int(11) NOT NULL default 0,
2453 `accountno` smallint(6) NOT NULL default 0,
2454 `offsetaccount` smallint(6) NOT NULL default 0,
2455 `offsetamount` decimal(28,6) default NULL,
2456 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2457 CONSTRAINT `accountoffsets_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2458 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2461 -- Table structure for table `action_logs`
2464 DROP TABLE IF EXISTS `action_logs`;
2465 CREATE TABLE `action_logs` (
2466 `action_id` int(11) NOT NULL auto_increment,
2467 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2468 `user` int(11) NOT NULL default 0,
2471 `object` int(11) default NULL,
2473 PRIMARY KEY (`action_id`),
2474 KEY (`timestamp`,`user`)
2475 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2478 -- Table structure for table `alert`
2481 DROP TABLE IF EXISTS `alert`;
2482 CREATE TABLE `alert` (
2483 `alertid` int(11) NOT NULL auto_increment,
2484 `borrowernumber` int(11) NOT NULL default 0,
2485 `type` varchar(10) NOT NULL default '',
2486 `externalid` varchar(20) NOT NULL default '',
2487 PRIMARY KEY (`alertid`),
2488 KEY `borrowernumber` (`borrowernumber`),
2489 KEY `type` (`type`,`externalid`)
2490 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2493 -- Table structure for table `aqbasketgroups`
2496 DROP TABLE IF EXISTS `aqbasketgroups`;
2497 CREATE TABLE `aqbasketgroups` (
2498 `id` int(11) NOT NULL auto_increment,
2499 `name` varchar(50) default NULL,
2500 `closed` tinyint(1) default NULL,
2501 `booksellerid` int(11) NOT NULL,
2502 `deliveryplace` varchar(10) default NULL,
2503 `freedeliveryplace` text default NULL,
2504 `deliverycomment` varchar(255) default NULL,
2505 `billingplace` varchar(10) default NULL,
2507 KEY `booksellerid` (`booksellerid`),
2508 CONSTRAINT `aqbasketgroups_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
2509 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2512 -- Table structure for table `aqbasket`
2515 DROP TABLE IF EXISTS `aqbasket`;
2516 CREATE TABLE `aqbasket` (
2517 `basketno` int(11) NOT NULL auto_increment,
2518 `basketname` varchar(50) default NULL,
2520 `booksellernote` mediumtext,
2521 `contractnumber` int(11),
2522 `creationdate` date default NULL,
2523 `closedate` date default NULL,
2524 `booksellerid` int(11) NOT NULL default 1,
2525 `authorisedby` varchar(10) default NULL,
2526 `booksellerinvoicenumber` mediumtext,
2527 `basketgroupid` int(11),
2528 PRIMARY KEY (`basketno`),
2529 KEY `booksellerid` (`booksellerid`),
2530 KEY `basketgroupid` (`basketgroupid`),
2531 KEY `contractnumber` (`contractnumber`),
2532 CONSTRAINT `aqbasket_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE,
2533 CONSTRAINT `aqbasket_ibfk_2` FOREIGN KEY (`contractnumber`) REFERENCES `aqcontract` (`contractnumber`),
2534 CONSTRAINT `aqbasket_ibfk_3` FOREIGN KEY (`basketgroupid`) REFERENCES `aqbasketgroups` (`id`) ON UPDATE CASCADE
2535 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2538 -- Table structure for table `aqbooksellers`
2541 DROP TABLE IF EXISTS `aqbooksellers`;
2542 CREATE TABLE `aqbooksellers` ( -- information about the vendors listed in acquisitions
2543 `id` int(11) NOT NULL auto_increment, -- primary key and unique identifier assigned by Koha
2544 `name` mediumtext NOT NULL, -- vendor name
2545 `address1` mediumtext, -- first line of vendor physical address
2546 `address2` mediumtext, -- second line of vendor physical address
2547 `address3` mediumtext, -- third line of vendor physical address
2548 `address4` mediumtext, -- fourth line of vendor physical address
2549 `phone` varchar(30) default NULL, -- vendor phone number
2550 `accountnumber` mediumtext, -- unused in Koha
2551 `othersupplier` mediumtext, -- unused in Koha
2552 `currency` varchar(3) NOT NULL default '', -- unused in Koha
2553 `booksellerfax` mediumtext, -- vendor fax number
2554 `notes` mediumtext, -- order notes
2555 `bookselleremail` mediumtext, -- vendor email
2556 `booksellerurl` mediumtext, -- unused in Koha
2557 `contact` varchar(100) default NULL, -- name of contact at vendor
2558 `postal` mediumtext, -- vendor postal address (all lines)
2559 `url` varchar(255) default NULL, -- vendor web address
2560 `contpos` varchar(100) default NULL, -- contact person's position
2561 `contphone` varchar(100) default NULL, -- contact's phone number
2562 `contfax` varchar(100) default NULL, -- contact's fax number
2563 `contaltphone` varchar(100) default NULL, -- contact's alternate phone number
2564 `contemail` varchar(100) default NULL, -- contact's email address
2565 `contnotes` mediumtext, -- notes related to the contact
2566 `active` tinyint(4) default NULL, -- is this vendor active (1 for yes, 0 for no)
2567 `listprice` varchar(10) default NULL, -- currency code for list prices
2568 `invoiceprice` varchar(10) default NULL, -- currency code for invoice prices
2569 `gstreg` tinyint(4) default NULL, -- is your library charged tax (1 for yes, 0 for no)
2570 `listincgst` tinyint(4) default NULL, -- is tax included in list prices (1 for yes, 0 for no)
2571 `invoiceincgst` tinyint(4) default NULL, -- is tax included in invoice prices (1 for yes, 0 for no)
2572 `gstrate` decimal(6,4) default NULL, -- the tax rate the library is charged
2573 `discount` float(6,4) default NULL, -- discount offered on all items ordered from this vendor
2574 `fax` varchar(50) default NULL, -- vendor fax number
2576 KEY `listprice` (`listprice`),
2577 KEY `invoiceprice` (`invoiceprice`),
2578 CONSTRAINT `aqbooksellers_ibfk_1` FOREIGN KEY (`listprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE,
2579 CONSTRAINT `aqbooksellers_ibfk_2` FOREIGN KEY (`invoiceprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE
2580 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2583 -- Table structure for table `aqbudgets`
2586 DROP TABLE IF EXISTS `aqbudgets`;
2587 CREATE TABLE `aqbudgets` (
2588 `budget_id` int(11) NOT NULL auto_increment,
2589 `budget_parent_id` int(11) default NULL,
2590 `budget_code` varchar(30) default NULL,
2591 `budget_name` varchar(80) default NULL,
2592 `budget_branchcode` varchar(10) default NULL,
2593 `budget_amount` decimal(28,6) NULL default '0.00',
2594 `budget_encumb` decimal(28,6) NULL default '0.00',
2595 `budget_expend` decimal(28,6) NULL default '0.00',
2596 `budget_notes` mediumtext,
2597 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2598 `budget_period_id` int(11) default NULL,
2599 `sort1_authcat` varchar(80) default NULL,
2600 `sort2_authcat` varchar(80) default NULL,
2601 `budget_owner_id` int(11) default NULL,
2602 `budget_permission` int(1) default '0',
2603 PRIMARY KEY (`budget_id`)
2604 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2608 -- Table structure for table `aqbudgetperiods`
2612 DROP TABLE IF EXISTS `aqbudgetperiods`;
2613 CREATE TABLE `aqbudgetperiods` (
2614 `budget_period_id` int(11) NOT NULL auto_increment,
2615 `budget_period_startdate` date NOT NULL,
2616 `budget_period_enddate` date NOT NULL,
2617 `budget_period_active` tinyint(1) default '0',
2618 `budget_period_description` mediumtext,
2619 `budget_period_total` decimal(28,6),
2620 `budget_period_locked` tinyint(1) default NULL,
2621 `sort1_authcat` varchar(10) default NULL,
2622 `sort2_authcat` varchar(10) default NULL,
2623 PRIMARY KEY (`budget_period_id`)
2624 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2627 -- Table structure for table `aqbudgets_planning`
2630 DROP TABLE IF EXISTS `aqbudgets_planning`;
2631 CREATE TABLE `aqbudgets_planning` (
2632 `plan_id` int(11) NOT NULL auto_increment,
2633 `budget_id` int(11) NOT NULL,
2634 `budget_period_id` int(11) NOT NULL,
2635 `estimated_amount` decimal(28,6) default NULL,
2636 `authcat` varchar(30) NOT NULL,
2637 `authvalue` varchar(30) NOT NULL,
2638 `display` tinyint(1) DEFAULT 1,
2639 PRIMARY KEY (`plan_id`),
2640 CONSTRAINT `aqbudgets_planning_ifbk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE
2641 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2644 -- Table structure for table 'aqcontract'
2647 DROP TABLE IF EXISTS `aqcontract`;
2648 CREATE TABLE `aqcontract` (
2649 `contractnumber` int(11) NOT NULL auto_increment,
2650 `contractstartdate` date default NULL,
2651 `contractenddate` date default NULL,
2652 `contractname` varchar(50) default NULL,
2653 `contractdescription` mediumtext,
2654 `booksellerid` int(11) not NULL,
2655 PRIMARY KEY (`contractnumber`),
2656 CONSTRAINT `booksellerid_fk1` FOREIGN KEY (`booksellerid`)
2657 REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2658 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
2661 -- Table structure for table `aqorderdelivery`
2664 DROP TABLE IF EXISTS `aqorderdelivery`;
2665 CREATE TABLE `aqorderdelivery` (
2666 `ordernumber` date default NULL,
2667 `deliverynumber` smallint(6) NOT NULL default 0,
2668 `deliverydate` varchar(18) default NULL,
2669 `qtydelivered` smallint(6) default NULL,
2670 `deliverycomments` mediumtext
2671 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2674 -- Table structure for table `aqorders`
2677 DROP TABLE IF EXISTS `aqorders`;
2678 CREATE TABLE `aqorders` (
2679 `ordernumber` int(11) NOT NULL auto_increment,
2680 `biblionumber` int(11) default NULL,
2681 `entrydate` date default NULL,
2682 `quantity` smallint(6) default NULL,
2683 `currency` varchar(3) default NULL,
2684 `listprice` decimal(28,6) default NULL,
2685 `totalamount` decimal(28,6) default NULL,
2686 `datereceived` date default NULL,
2687 `booksellerinvoicenumber` mediumtext,
2688 `freight` decimal(28,6) default NULL,
2689 `unitprice` decimal(28,6) default NULL,
2690 `quantityreceived` smallint(6) NOT NULL default 0,
2691 `cancelledby` varchar(10) default NULL,
2692 `datecancellationprinted` date default NULL,
2694 `supplierreference` mediumtext,
2695 `purchaseordernumber` mediumtext,
2696 `subscription` tinyint(1) default NULL,
2697 `serialid` varchar(30) default NULL,
2698 `basketno` int(11) default NULL,
2699 `biblioitemnumber` int(11) default NULL,
2700 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2701 `rrp` decimal(13,2) default NULL,
2702 `ecost` decimal(13,2) default NULL,
2703 `gst` decimal(13,2) default NULL,
2704 `budget_id` int(11) NOT NULL,
2705 `budgetgroup_id` int(11) NOT NULL,
2706 `budgetdate` date default NULL,
2707 `sort1` varchar(80) default NULL,
2708 `sort2` varchar(80) default NULL,
2709 `sort1_authcat` varchar(10) default NULL,
2710 `sort2_authcat` varchar(10) default NULL,
2711 `uncertainprice` tinyint(1),
2712 `claims_count` int(11) default 0,
2713 `claimed_date` date default NULL,
2714 PRIMARY KEY (`ordernumber`),
2715 KEY `basketno` (`basketno`),
2716 KEY `biblionumber` (`biblionumber`),
2717 KEY `budget_id` (`budget_id`),
2718 CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2719 CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE
2720 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2724 -- Table structure for table `aqorders_items`
2727 DROP TABLE IF EXISTS `aqorders_items`;
2728 CREATE TABLE `aqorders_items` (
2729 `ordernumber` int(11) NOT NULL,
2730 `itemnumber` int(11) NOT NULL,
2731 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2732 PRIMARY KEY (`itemnumber`),
2733 KEY `ordernumber` (`ordernumber`)
2734 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2737 -- Table structure for table `fieldmapping`
2740 DROP TABLE IF EXISTS `fieldmapping`;
2741 CREATE TABLE `fieldmapping` ( -- koha to keyword mapping
2742 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2743 `field` varchar(255) NOT NULL, -- keyword to be mapped to (ex. subtitle)
2744 `frameworkcode` char(4) NOT NULL default '', -- foreign key from the biblio_framework table to link this mapping to a specific framework
2745 `fieldcode` char(3) NOT NULL, -- marc field number to map to this keyword
2746 `subfieldcode` char(1) NOT NULL, -- marc subfield associated with the fieldcode to map to this keyword
2748 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2751 -- Table structure for table `biblioimages`
2754 DROP TABLE IF EXISTS `biblioimages`;
2756 CREATE TABLE `biblioimages` (
2757 `imagenumber` int(11) NOT NULL AUTO_INCREMENT,
2758 `biblionumber` int(11) NOT NULL,
2759 `mimetype` varchar(15) NOT NULL,
2760 `imagefile` mediumblob NOT NULL,
2761 `thumbnail` mediumblob NOT NULL,
2762 PRIMARY KEY (`imagenumber`),
2763 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2764 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2766 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
2767 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
2768 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
2769 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
2770 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
2771 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
2772 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
2773 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;