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(16) 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(200) default NULL, -- authorized value description as printed in the staff client
103 `lib_opac` varchar(200) 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` ( -- information about MARC frameworks
139 `frameworkcode` varchar(4) NOT NULL default '', -- the unique code assigned to the framework
140 `frameworktext` varchar(255) NOT NULL default '', -- the description/name given to the framework
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 `ean` varchar(13) default NULL,
158 `publicationyear` text,
159 `publishercode` varchar(255) default NULL, -- publisher (MARC21 260$b)
160 `volumedate` date default NULL,
161 `volumedesc` text, -- volume information (MARC21 362$a)
162 `collectiontitle` mediumtext default NULL,
163 `collectionissn` text default NULL,
164 `collectionvolume` mediumtext default NULL,
165 `editionstatement` text default NULL,
166 `editionresponsibility` text default NULL,
167 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
168 `illus` varchar(255) default NULL, -- illustrations (MARC21 300$b)
169 `pages` varchar(255) default NULL, -- number of pages (MARC21 300$c)
171 `size` varchar(255) default NULL, -- material size (MARC21 300$c)
172 `place` varchar(255) default NULL, -- publication place (MARC21 260$a)
173 `lccn` varchar(25) default NULL, -- library of congress control number (MARC21 010$a)
174 `marc` longblob, -- full bibliographic MARC record
175 `url` varchar(255) default NULL, -- url (MARC21 856$u)
176 `cn_source` varchar(10) default NULL, -- classification source (MARC21 942$2)
177 `cn_class` varchar(30) default NULL,
178 `cn_item` varchar(10) default NULL,
179 `cn_suffix` varchar(10) default NULL,
180 `cn_sort` varchar(30) default NULL, -- normalized version of the call number used for sorting
181 `agerestriction` varchar(255) default NULL, -- target audience/age restriction from the bib record (MARC21 521$a)
182 `totalissues` int(10),
183 `marcxml` longtext NOT NULL, -- full bibliographic MARC record in MARCXML
184 PRIMARY KEY (`biblioitemnumber`),
185 KEY `bibinoidx` (`biblioitemnumber`),
186 KEY `bibnoidx` (`biblionumber`),
187 KEY `itemtype_idx` (`itemtype`),
190 KEY `publishercode` (`publishercode`),
191 CONSTRAINT `biblioitems_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
192 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
195 -- Table structure for table `borrowers`
198 DROP TABLE IF EXISTS `borrowers`;
199 CREATE TABLE `borrowers` ( -- this table includes information about your patrons/borrowers/members
200 `borrowernumber` int(11) NOT NULL auto_increment, -- primary key, Koha assigned ID number for patrons/borrowers
201 `cardnumber` varchar(16) default NULL, -- unique key, library assigned ID number for patrons/borrowers
202 `surname` mediumtext NOT NULL, -- patron/borrower's last name (surname)
203 `firstname` text, -- patron/borrower's first name
204 `title` mediumtext, -- patron/borrower's title, for example: Mr. or Mrs.
205 `othernames` mediumtext, -- any other names associated with the patron/borrower
206 `initials` text, -- initials for your patron/borrower
207 `streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's primary address
208 `streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's primary address
209 `address` mediumtext NOT NULL, -- the first address line for your patron/borrower's primary address
210 `address2` text, -- the second address line for your patron/borrower's primary address
211 `city` mediumtext NOT NULL, -- the city or town for your patron/borrower's primary address
212 `state` text default NULL, -- the state or province for your patron/borrower's primary address
213 `zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's primary address
214 `country` text, -- the country for your patron/borrower's primary address
215 `email` mediumtext, -- the primary email address for your patron/borrower's primary address
216 `phone` text, -- the primary phone number for your patron/borrower's primary address
217 `mobile` varchar(50) default NULL, -- the other phone number for your patron/borrower's primary address
218 `fax` mediumtext, -- the fax number for your patron/borrower's primary address
219 `emailpro` text, -- the secondary email addres for your patron/borrower's primary address
220 `phonepro` text, -- the secondary phone number for your patron/borrower's primary address
221 `B_streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's alternate address
222 `B_streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's alternate address
223 `B_address` varchar(100) default NULL, -- the first address line for your patron/borrower's alternate address
224 `B_address2` text default NULL, -- the second address line for your patron/borrower's alternate address
225 `B_city` mediumtext, -- the city or town for your patron/borrower's alternate address
226 `B_state` text default NULL, -- the state for your patron/borrower's alternate address
227 `B_zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's alternate address
228 `B_country` text, -- the country for your patron/borrower's alternate address
229 `B_email` text, -- the patron/borrower's alternate email address
230 `B_phone` mediumtext, -- the patron/borrower's alternate phone number
231 `dateofbirth` date default NULL, -- the patron/borrower's date of birth (YYYY-MM-DD)
232 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, includes the code of the patron/borrower's home branch
233 `categorycode` varchar(10) NOT NULL default '', -- foreign key from the categories table, includes the code of the patron category
234 `dateenrolled` date default NULL, -- date the patron was added to Koha (YYYY-MM-DD)
235 `dateexpiry` date default NULL, -- date the patron/borrower's card is set to expire (YYYY-MM-DD)
236 `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
237 `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
238 `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)
239 `debarredcomment` VARCHAR(255) DEFAULT NULL, -- comment on the stop of the patron
240 `contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
241 `contactfirstname` text, -- used for children to include first name of guarentor
242 `contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
243 `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
244 `borrowernotes` mediumtext, -- a note on the patron/borroewr's account that is only visible in the staff client
245 `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
246 `ethnicity` varchar(50) default NULL, -- unused in Koha
247 `ethnotes` varchar(255) default NULL, -- unused in Koha
248 `sex` varchar(1) default NULL, -- patron/borrower's gender
249 `password` varchar(30) default NULL, -- patron/borrower's encrypted password
250 `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
251 `userid` varchar(75) default NULL, -- patron/borrower's opac and/or staff client log in
252 `opacnote` mediumtext, -- a note on the patron/borrower's account that is visible in the OPAC and staff client
253 `contactnote` varchar(255) default NULL, -- a note related to the patron/borrower's alternate address
254 `sort1` varchar(80) default NULL, -- a field that can be used for any information unique to the library
255 `sort2` varchar(80) default NULL, -- a field that can be used for any information unique to the library
256 `altcontactfirstname` varchar(255) default NULL, -- first name of alternate contact for the patron/borrower
257 `altcontactsurname` varchar(255) default NULL, -- surname or last name of the alternate contact for the patron/borrower
258 `altcontactaddress1` varchar(255) default NULL, -- the first address line for the alternate contact for the patron/borrower
259 `altcontactaddress2` varchar(255) default NULL, -- the second address line for the alternate contact for the patron/borrower
260 `altcontactaddress3` varchar(255) default NULL, -- the city for the alternate contact for the patron/borrower
261 `altcontactstate` text default NULL, -- the state for the alternate contact for the patron/borrower
262 `altcontactzipcode` varchar(50) default NULL, -- the zipcode for the alternate contact for the patron/borrower
263 `altcontactcountry` text default NULL, -- the country for the alternate contact for the patron/borrower
264 `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
265 `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
266 `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history
267 UNIQUE KEY `cardnumber` (`cardnumber`),
268 PRIMARY KEY `borrowernumber` (`borrowernumber`),
269 KEY `categorycode` (`categorycode`),
270 KEY `branchcode` (`branchcode`),
271 KEY `userid` (`userid`),
272 KEY `guarantorid` (`guarantorid`),
273 CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
274 CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
275 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
278 -- Table structure for table `borrower_attribute_types`
281 DROP TABLE IF EXISTS `borrower_attribute_types`;
282 CREATE TABLE `borrower_attribute_types` ( -- definitions for custom patron fields known as extended patron attributes
283 `code` varchar(10) NOT NULL, -- unique key used to identify each custom field
284 `description` varchar(255) NOT NULL, -- description for each custom field
285 `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)
286 `unique_id` tinyint(1) NOT NULL default 0, -- defines if this value needs to be unique (1 for yes, 0 for no)
287 `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)
288 `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)
289 `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)
290 `authorised_value_category` varchar(10) default NULL, -- foreign key from authorised_values that links this custom field to an authorized value category
291 `display_checkout` tinyint(1) NOT NULL default 0,-- defines if this field displays in checkout screens
292 `category_code` VARCHAR(10) NULL DEFAULT NULL,-- defines a category for an attribute_type
293 `class` VARCHAR(255) NOT NULL DEFAULT '',-- defines a class for an attribute_type
294 PRIMARY KEY (`code`),
295 KEY `auth_val_cat_idx` (`authorised_value_category`)
296 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
299 -- Table structure for table `borrower_attributes`
302 DROP TABLE IF EXISTS `borrower_attributes`;
303 CREATE TABLE `borrower_attributes` ( -- values of custom patron fields known as extended patron attributes linked to patrons/borrowers
304 `borrowernumber` int(11) NOT NULL, -- foreign key from the borrowers table, defines which patron/borrower has this attribute
305 `code` varchar(10) NOT NULL, -- foreign key from the borrower_attribute_types table, defines which custom field this value was entered for
306 `attribute` varchar(255) default NULL, -- custom patron field value
307 `password` varchar(64) default NULL, -- password associated with this field
308 KEY `borrowernumber` (`borrowernumber`),
309 KEY `code_attribute` (`code`, `attribute`),
310 CONSTRAINT `borrower_attributes_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
311 ON DELETE CASCADE ON UPDATE CASCADE,
312 CONSTRAINT `borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`)
313 ON DELETE CASCADE ON UPDATE CASCADE
314 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
317 -- Table structure for table `branch_item_rules`
320 DROP TABLE IF EXISTS `branch_item_rules`;
321 CREATE TABLE `branch_item_rules` ( -- information entered in the circulation and fine rules under 'Holds policy by item type'
322 `branchcode` varchar(10) NOT NULL, -- the branch this rule is for (branches.branchcode)
323 `itemtype` varchar(10) NOT NULL, -- the item type this rule applies to (items.itype)
324 `holdallowed` tinyint(1) default NULL, -- the number of holds allowed
325 `returnbranch` varchar(15) default NULL, -- the branch the item returns to (homebranch, holdingbranch, noreturn)
326 PRIMARY KEY (`itemtype`,`branchcode`),
327 KEY `branch_item_rules_ibfk_2` (`branchcode`),
328 CONSTRAINT `branch_item_rules_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`)
329 ON DELETE CASCADE ON UPDATE CASCADE,
330 CONSTRAINT `branch_item_rules_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
331 ON DELETE CASCADE ON UPDATE CASCADE
332 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
335 -- Table structure for table `branchcategories`
338 DROP TABLE IF EXISTS `branchcategories`;
339 CREATE TABLE `branchcategories` ( -- information related to library/branch groups
340 `categorycode` varchar(10) NOT NULL default '', -- unique identifier for the library/branch group
341 `categoryname` varchar(32), -- name of the library/branch group
342 `codedescription` mediumtext, -- longer description of the library/branch group
343 `categorytype` varchar(16), -- says whether this is a search group or a properties group
344 `show_in_pulldown` tinyint(1) NOT NULL DEFAULT '0', -- says this group should be in the opac libararies pulldown if it is enabled
345 PRIMARY KEY (`categorycode`),
346 KEY `show_in_pulldown` (`show_in_pulldown`)
347 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
350 -- Table structure for table `branches`
353 DROP TABLE IF EXISTS `branches`;
354 CREATE TABLE `branches` ( -- information about your libraries or branches are stored here
355 `branchcode` varchar(10) NOT NULL default '', -- a unique key assigned to each branch
356 `branchname` mediumtext NOT NULL, -- the name of your library or branch
357 `branchaddress1` mediumtext, -- the first address line of for your library or branch
358 `branchaddress2` mediumtext, -- the second address line of for your library or branch
359 `branchaddress3` mediumtext, -- the third address line of for your library or branch
360 `branchzip` varchar(25) default NULL, -- the zip or postal code for your library or branch
361 `branchcity` mediumtext, -- the city or province for your library or branch
362 `branchstate` mediumtext, -- the state for your library or branch
363 `branchcountry` text, -- the county for your library or branch
364 `branchphone` mediumtext, -- the primary phone for your library or branch
365 `branchfax` mediumtext, -- the fax number for your library or branch
366 `branchemail` mediumtext, -- the primary email address for your library or branch
367 `branchurl` mediumtext, -- the URL for your library or branch's website
368 `issuing` tinyint(4) default NULL, -- unused in Koha
369 `branchip` varchar(15) default NULL, -- the IP address for your library or branch
370 `branchprinter` varchar(100) default NULL, -- unused in Koha
371 `branchnotes` mediumtext, -- notes related to your library or branch
372 opac_info text, -- HTML that displays in OPAC
373 PRIMARY KEY (`branchcode`)
374 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
377 -- Table structure for table `branchrelations`
380 DROP TABLE IF EXISTS `branchrelations`;
381 CREATE TABLE `branchrelations` ( -- this table links libraries/branches to groups
382 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table to identify the branch
383 `categorycode` varchar(10) NOT NULL default '', -- foreign key from the branchcategories table to identify the group
384 PRIMARY KEY (`branchcode`,`categorycode`),
385 KEY `branchcode` (`branchcode`),
386 KEY `categorycode` (`categorycode`),
387 CONSTRAINT `branchrelations_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
388 CONSTRAINT `branchrelations_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `branchcategories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
389 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
392 -- Table structure for table `branchtransfers`
395 DROP TABLE IF EXISTS `branchtransfers`;
396 CREATE TABLE `branchtransfers` ( -- information for items that are in transit between branches
397 `itemnumber` int(11) NOT NULL default 0, -- the itemnumber that it is in transit (items.itemnumber)
398 `datesent` datetime default NULL, -- the date the transfer was initialized
399 `frombranch` varchar(10) NOT NULL default '', -- the branch the transfer is coming from
400 `datearrived` datetime default NULL, -- the date the transfer arrived at its destination
401 `tobranch` varchar(10) NOT NULL default '', -- the branch the transfer was going to
402 `comments` mediumtext, -- any comments related to the transfer
403 KEY `frombranch` (`frombranch`),
404 KEY `tobranch` (`tobranch`),
405 KEY `itemnumber` (`itemnumber`),
406 CONSTRAINT `branchtransfers_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
407 CONSTRAINT `branchtransfers_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
408 CONSTRAINT `branchtransfers_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
409 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
413 -- Table structure for table `browser`
415 DROP TABLE IF EXISTS `browser`;
416 CREATE TABLE `browser` (
417 `level` int(11) NOT NULL,
418 `classification` varchar(20) NOT NULL,
419 `description` varchar(255) NOT NULL,
420 `number` bigint(20) NOT NULL,
421 `endnode` tinyint(4) NOT NULL
422 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
425 -- Table structure for table `categories`
428 DROP TABLE IF EXISTS `categories`;
429 CREATE TABLE `categories` ( -- this table shows information related to Koha patron categories
430 `categorycode` varchar(10) NOT NULL default '', -- unique primary key used to idenfity the patron category
431 `description` mediumtext, -- description of the patron category
432 `enrolmentperiod` smallint(6) default NULL, -- number of months the patron is enrolled for (will be NULL if enrolmentperioddate is set)
433 `enrolmentperioddate` DATE NULL DEFAULT NULL, -- date the patron is enrolled until (will be NULL if enrolmentperiod is set)
434 `upperagelimit` smallint(6) default NULL, -- age limit for the patron
435 `dateofbirthrequired` tinyint(1) default NULL,
436 `finetype` varchar(30) default NULL, -- unused in Koha
437 `bulk` tinyint(1) default NULL,
438 `enrolmentfee` decimal(28,6) default NULL, -- enrollment fee for the patron
439 `overduenoticerequired` tinyint(1) default NULL, -- are overdue notices sent to this patron category (1 for yes, 0 for no)
440 `issuelimit` smallint(6) default NULL, -- unused in Koha
441 `reservefee` decimal(28,6) default NULL, -- cost to place holds
442 `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
443 `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
444 PRIMARY KEY (`categorycode`),
445 UNIQUE KEY `categorycode` (`categorycode`)
446 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
449 -- Table: collections
451 DROP TABLE IF EXISTS collections;
452 CREATE TABLE collections (
453 colId integer(11) NOT NULL auto_increment,
454 colTitle varchar(100) NOT NULL DEFAULT '',
455 colDesc text NOT NULL,
456 colBranchcode varchar(4) DEFAULT NULL comment 'branchcode for branch where item should be held.',
458 ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
461 -- Table: collections_tracking
463 DROP TABLE IF EXISTS collections_tracking;
464 CREATE TABLE collections_tracking (
465 ctId integer(11) NOT NULL auto_increment,
466 colId integer(11) NOT NULL DEFAULT 0 comment 'collections.colId',
467 itemnumber integer(11) NOT NULL DEFAULT 0 comment 'items.itemnumber',
469 ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
472 -- Table structure for table `branch_borrower_circ_rules`
475 DROP TABLE IF EXISTS `branch_borrower_circ_rules`;
476 CREATE TABLE `branch_borrower_circ_rules` ( -- includes default circulation rules for patron categories found under "Checkout limit by patron category"
477 `branchcode` VARCHAR(10) NOT NULL, -- the branch this rule applies to (branches.branchcode)
478 `categorycode` VARCHAR(10) NOT NULL, -- the patron category this rule applies to (categories.categorycode)
479 `maxissueqty` int(4) default NULL, -- the maximum number of checkouts this patron category can have at this branch
480 PRIMARY KEY (`categorycode`, `branchcode`),
481 CONSTRAINT `branch_borrower_circ_rules_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`)
482 ON DELETE CASCADE ON UPDATE CASCADE,
483 CONSTRAINT `branch_borrower_circ_rules_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
484 ON DELETE CASCADE ON UPDATE CASCADE
485 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
488 -- Table structure for table `default_borrower_circ_rules`
491 DROP TABLE IF EXISTS `default_borrower_circ_rules`;
492 CREATE TABLE `default_borrower_circ_rules` ( -- default checkout rules found under "Default checkout, hold and return policy"
493 `categorycode` VARCHAR(10) NOT NULL, -- patron category this rul
494 `maxissueqty` int(4) default NULL,
495 PRIMARY KEY (`categorycode`),
496 CONSTRAINT `borrower_borrower_circ_rules_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`)
497 ON DELETE CASCADE ON UPDATE CASCADE
498 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
501 -- Table structure for table `default_branch_circ_rules`
504 DROP TABLE IF EXISTS `default_branch_circ_rules`;
505 CREATE TABLE `default_branch_circ_rules` (
506 `branchcode` VARCHAR(10) NOT NULL,
507 `maxissueqty` int(4) default NULL,
508 `holdallowed` tinyint(1) default NULL,
509 `returnbranch` varchar(15) default NULL,
510 PRIMARY KEY (`branchcode`),
511 CONSTRAINT `default_branch_circ_rules_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
512 ON DELETE CASCADE ON UPDATE CASCADE
513 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
516 -- Table structure for table `default_branch_item_rules`
518 DROP TABLE IF EXISTS `default_branch_item_rules`;
519 CREATE TABLE `default_branch_item_rules` (
520 `itemtype` varchar(10) NOT NULL,
521 `holdallowed` tinyint(1) default NULL,
522 `returnbranch` varchar(15) default NULL,
523 PRIMARY KEY (`itemtype`),
524 CONSTRAINT `default_branch_item_rules_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`)
525 ON DELETE CASCADE ON UPDATE CASCADE
526 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
529 -- Table structure for table `default_circ_rules`
532 DROP TABLE IF EXISTS `default_circ_rules`;
533 CREATE TABLE `default_circ_rules` (
534 `singleton` enum('singleton') NOT NULL default 'singleton',
535 `maxissueqty` int(4) default NULL,
536 `holdallowed` int(1) default NULL,
537 `returnbranch` varchar(15) default NULL,
538 PRIMARY KEY (`singleton`)
539 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
542 -- Table structure for table `cities`
545 DROP TABLE IF EXISTS `cities`;
546 CREATE TABLE `cities` ( -- authorized values for cities/states/countries to choose when adding/editing a patron/borrower
547 `cityid` int(11) NOT NULL auto_increment, -- unique identifier added by Koha
548 `city_name` varchar(100) NOT NULL default '', -- name of the city
549 `city_state` VARCHAR( 100 ) NULL DEFAULT NULL, -- name of the state/province
550 `city_country` VARCHAR( 100 ) NULL DEFAULT NULL, -- name of the country
551 `city_zipcode` varchar(20) default NULL, -- zip or postal code
552 PRIMARY KEY (`cityid`)
553 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
556 -- Table structure for table `class_sort_rules`
559 DROP TABLE IF EXISTS `class_sort_rules`;
560 CREATE TABLE `class_sort_rules` (
561 `class_sort_rule` varchar(10) NOT NULL default '',
562 `description` mediumtext,
563 `sort_routine` varchar(30) NOT NULL default '',
564 PRIMARY KEY (`class_sort_rule`),
565 UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
566 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
569 -- Table structure for table `class_sources`
572 DROP TABLE IF EXISTS `class_sources`;
573 CREATE TABLE `class_sources` (
574 `cn_source` varchar(10) NOT NULL default '',
575 `description` mediumtext,
576 `used` tinyint(4) NOT NULL default 0,
577 `class_sort_rule` varchar(10) NOT NULL default '',
578 PRIMARY KEY (`cn_source`),
579 UNIQUE KEY `cn_source_idx` (`cn_source`),
580 KEY `used_idx` (`used`),
581 CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`)
582 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
585 -- Table structure for table `currency`
588 DROP TABLE IF EXISTS `currency`;
589 CREATE TABLE `currency` (
590 `currency` varchar(10) NOT NULL default '',
591 `symbol` varchar(5) default NULL,
592 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
593 `rate` float(15,5) default NULL,
594 `active` tinyint(1) default NULL,
595 PRIMARY KEY (`currency`)
596 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
599 -- Table structure for table `deletedbiblio`
602 DROP TABLE IF EXISTS `deletedbiblio`;
603 CREATE TABLE `deletedbiblio` ( -- stores information about bibliographic records that have been deleted
604 `biblionumber` int(11) NOT NULL auto_increment, -- unique identifier assigned to each bibliographic record
605 `frameworkcode` varchar(4) NOT NULL default '', -- foriegn key from the biblio_framework table to identify which framework was used in cataloging this record
606 `author` mediumtext, -- statement of responsibility from MARC record (100$a in MARC21)
607 `title` mediumtext, -- title (without the subtitle) from the MARC record (245$a in MARC21)
608 `unititle` mediumtext, -- uniform title (without the subtitle) from the MARC record (240$a in MARC21)
609 `notes` mediumtext, -- values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)
610 `serial` tinyint(1) default NULL, -- foreign key, linking to the subscriptionid in the serial table
611 `seriestitle` mediumtext,
612 `copyrightdate` smallint(6) default NULL, -- publication or copyright date from the MARC record
613 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
614 `datecreated` DATE NOT NULL, -- the date this record was added to Koha
615 `abstract` mediumtext, -- summary from the MARC record (520$a in MARC21)
616 PRIMARY KEY (`biblionumber`),
617 KEY `blbnoidx` (`biblionumber`)
618 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
621 -- Table structure for table `deletedbiblioitems`
624 DROP TABLE IF EXISTS `deletedbiblioitems`;
625 CREATE TABLE `deletedbiblioitems` ( -- information about bibliographic records that have been deleted
626 `biblioitemnumber` int(11) NOT NULL default 0, -- primary key, unique identifier assigned by Koha
627 `biblionumber` int(11) NOT NULL default 0, -- foreign key linking this table to the biblio table
630 `itemtype` varchar(10) default NULL, -- biblio level item type (MARC21 942$c)
631 `isbn` varchar(30) default NULL, -- ISBN (MARC21 020$a)
632 `issn` varchar(9) default NULL, -- ISSN (MARC21 022$a)
633 `ean` varchar(13) default NULL,
634 `publicationyear` text,
635 `publishercode` varchar(255) default NULL, -- publisher (MARC21 260$b)
636 `volumedate` date default NULL,
637 `volumedesc` text, -- volume information (MARC21 362$a)
638 `collectiontitle` mediumtext default NULL,
639 `collectionissn` text default NULL,
640 `collectionvolume` mediumtext default NULL,
641 `editionstatement` text default NULL,
642 `editionresponsibility` text default NULL,
643 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
644 `illus` varchar(255) default NULL, -- illustrations (MARC21 300$b)
645 `pages` varchar(255) default NULL, -- number of pages (MARC21 300$c)
647 `size` varchar(255) default NULL, -- material size (MARC21 300$c)
648 `place` varchar(255) default NULL, -- publication place (MARC21 260$a)
649 `lccn` varchar(25) default NULL, -- library of congress control number (MARC21 010$a)
650 `marc` longblob, -- full bibliographic MARC record
651 `url` varchar(255) default NULL, -- url (MARC21 856$u)
652 `cn_source` varchar(10) default NULL, -- classification source (MARC21 942$2)
653 `cn_class` varchar(30) default NULL,
654 `cn_item` varchar(10) default NULL,
655 `cn_suffix` varchar(10) default NULL,
656 `cn_sort` varchar(30) default NULL, -- normalized version of the call number used for sorting
657 `agerestriction` varchar(255) default NULL, -- target audience/age restriction from the bib record (MARC21 521$a)
658 `totalissues` int(10),
659 `marcxml` longtext NOT NULL, -- full bibliographic MARC record in MARCXML
660 PRIMARY KEY (`biblioitemnumber`),
661 KEY `bibinoidx` (`biblioitemnumber`),
662 KEY `bibnoidx` (`biblionumber`),
663 KEY `itemtype_idx` (`itemtype`),
665 KEY `publishercode` (`publishercode`)
666 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
669 -- Table structure for table `deletedborrowers`
672 DROP TABLE IF EXISTS `deletedborrowers`;
673 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrowers you have deleted
674 `borrowernumber` int(11) NOT NULL default 0, -- primary key, Koha assigned ID number for patrons/borrowers
675 `cardnumber` varchar(16) default NULL, -- unique key, library assigned ID number for patrons/borrowers
676 `surname` mediumtext NOT NULL, -- patron/borrower's last name (surname)
677 `firstname` text, -- patron/borrower's first name
678 `title` mediumtext, -- patron/borrower's title, for example: Mr. or Mrs.
679 `othernames` mediumtext, -- any other names associated with the patron/borrower
680 `initials` text, -- initials for your patron/borrower
681 `streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's primary address
682 `streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's primary address
683 `address` mediumtext NOT NULL, -- the first address line for your patron/borrower's primary address
684 `address2` text, -- the second address line for your patron/borrower's primary address
685 `city` mediumtext NOT NULL, -- the city or town for your patron/borrower's primary address
686 `state` text default NULL, -- the state or province for your patron/borrower's primary address
687 `zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's primary address
688 `country` text, -- the country for your patron/borrower's primary address
689 `email` mediumtext, -- the primary email address for your patron/borrower's primary address
690 `phone` text, -- the primary phone number for your patron/borrower's primary address
691 `mobile` varchar(50) default NULL, -- the other phone number for your patron/borrower's primary address
692 `fax` mediumtext, -- the fax number for your patron/borrower's primary address
693 `emailpro` text, -- the secondary email addres for your patron/borrower's primary address
694 `phonepro` text, -- the secondary phone number for your patron/borrower's primary address
695 `B_streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's alternate address
696 `B_streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's alternate address
697 `B_address` varchar(100) default NULL, -- the first address line for your patron/borrower's alternate address
698 `B_address2` text default NULL, -- the second address line for your patron/borrower's alternate address
699 `B_city` mediumtext, -- the city or town for your patron/borrower's alternate address
700 `B_state` text default NULL, -- the state for your patron/borrower's alternate address
701 `B_zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's alternate address
702 `B_country` text, -- the country for your patron/borrower's alternate address
703 `B_email` text, -- the patron/borrower's alternate email address
704 `B_phone` mediumtext, -- the patron/borrower's alternate phone number
705 `dateofbirth` date default NULL, -- the patron/borrower's date of birth (YYYY-MM-DD)
706 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, includes the code of the patron/borrower's home branch
707 `categorycode` varchar(10) NOT NULL default '', -- foreign key from the categories table, includes the code of the patron category
708 `dateenrolled` date default NULL, -- date the patron was added to Koha (YYYY-MM-DD)
709 `dateexpiry` date default NULL, -- date the patron/borrower's card is set to expire (YYYY-MM-DD)
710 `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
711 `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
712 `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)
713 `debarredcomment` VARCHAR(255) DEFAULT NULL, -- comment on the stop of patron
714 `contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
715 `contactfirstname` text, -- used for children to include first name of guarentor
716 `contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
717 `guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
718 `borrowernotes` mediumtext, -- a note on the patron/borroewr's account that is only visible in the staff client
719 `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
720 `ethnicity` varchar(50) default NULL, -- unused in Koha
721 `ethnotes` varchar(255) default NULL, -- unused in Koha
722 `sex` varchar(1) default NULL, -- patron/borrower's gender
723 `password` varchar(30) default NULL, -- patron/borrower's encrypted password
724 `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
725 `userid` varchar(30) default NULL, -- patron/borrower's opac and/or staff client log in
726 `opacnote` mediumtext, -- a note on the patron/borrower's account that is visible in the OPAC and staff client
727 `contactnote` varchar(255) default NULL, -- a note related to the patron/borrower's alternate address
728 `sort1` varchar(80) default NULL, -- a field that can be used for any information unique to the library
729 `sort2` varchar(80) default NULL, -- a field that can be used for any information unique to the library
730 `altcontactfirstname` varchar(255) default NULL, -- first name of alternate contact for the patron/borrower
731 `altcontactsurname` varchar(255) default NULL, -- surname or last name of the alternate contact for the patron/borrower
732 `altcontactaddress1` varchar(255) default NULL, -- the first address line for the alternate contact for the patron/borrower
733 `altcontactaddress2` varchar(255) default NULL, -- the second address line for the alternate contact for the patron/borrower
734 `altcontactaddress3` varchar(255) default NULL, -- the city for the alternate contact for the patron/borrower
735 `altcontactstate` text default NULL, -- the state for the alternate contact for the patron/borrower
736 `altcontactzipcode` varchar(50) default NULL, -- the zipcode for the alternate contact for the patron/borrower
737 `altcontactcountry` text default NULL, -- the country for the alternate contact for the patron/borrower
738 `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
739 `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
740 `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history KEY `borrowernumber` (`borrowernumber`),
741 KEY borrowernumber (borrowernumber),
742 KEY `cardnumber` (`cardnumber`)
743 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
746 -- Table structure for table `deleteditems`
749 DROP TABLE IF EXISTS `deleteditems`;
750 CREATE TABLE `deleteditems` (
751 `itemnumber` int(11) NOT NULL default 0, -- primary key and unique identifier added by Koha
752 `biblionumber` int(11) NOT NULL default 0, -- foreign key from biblio table used to link this item to the right bib record
753 `biblioitemnumber` int(11) NOT NULL default 0, -- foreign key from the biblioitems table to link to item to additional information
754 `barcode` varchar(20) default NULL, -- item barcode (MARC21 952$p)
755 `dateaccessioned` date default NULL, -- date the item was acquired or added to Koha (MARC21 952$d)
756 `booksellerid` mediumtext default NULL, -- where the item was purchased (MARC21 952$e)
757 `homebranch` varchar(10) default NULL, -- foreign key from the branches table for the library that owns this item (MARC21 952$a)
758 `price` decimal(8,2) default NULL, -- purchase price (MARC21 952$g)
759 `replacementprice` decimal(8,2) default NULL, -- cost the library charges to replace the item if it has been marked lost (MARC21 952$v)
760 `replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w)
761 `datelastborrowed` date default NULL, -- the date the item was last checked out
762 `datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done)
763 `stack` tinyint(1) default NULL,
764 `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
765 `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
766 `itemlost` tinyint(1) NOT NULL default 0, -- authorized value defining this item as lost (MARC21 952$1)
767 `wthdrawn` tinyint(1) NOT NULL default 0, -- authorized value defining this item as withdrawn (MARC21 952$0)
768 `itemcallnumber` varchar(255) default NULL, -- call number for this item (MARC21 952$o)
769 `coded_location_qualifier` varchar(10) default NULL, -- coded location qualifier(MARC21 952$f)
770 `issues` smallint(6) default NULL, -- number of times this item has been checked out
771 `renewals` smallint(6) default NULL, -- number of times this item has been renewed
772 `reserves` smallint(6) default NULL, -- number of times this item has been placed on hold/reserved
773 `restricted` tinyint(1) default NULL, -- authorized value defining use restrictions for this item (MARC21 952$5)
774 `itemnotes` mediumtext, -- public notes on this item (MARC21 952$x)
775 `holdingbranch` varchar(10) default NULL, -- foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)
776 `paidfor` mediumtext,
777 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this item was last altered
778 `location` varchar(80) default NULL, -- authorized value for the shelving location for this item (MARC21 952$c)
779 `permanent_location` varchar(80) default NULL, -- linked to the CART and PROC temporary locations feature, stores the permanent shelving location
780 `onloan` date default NULL, -- defines if item is checked out (NULL for not checked out, and checkout date for checked out)
781 `cn_source` varchar(10) default NULL, -- classification source used on this item (MARC21 952$2)
782 `cn_sort` varchar(30) default NULL, -- normalized form of the call number (MARC21 952$o) used for sorting
783 `ccode` varchar(10) default NULL, -- authorized value for the collection code associated with this item (MARC21 952$8)
784 `materials` varchar(10) default NULL, -- materials specified (MARC21 952$3)
785 `uri` varchar(255) default NULL, -- URL for the item (MARC21 952$u)
786 `itype` varchar(10) default NULL, -- foreign key from the itemtypes table defining the type for this item (MARC21 952$y)
787 `more_subfields_xml` longtext default NULL, -- additional 952 subfields in XML format
788 `enumchron` text default NULL, -- serial enumeration/chronology for the item (MARC21 952$h)
789 `copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t)
790 `stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i)
791 `marc` longblob, -- unused in Koha
792 PRIMARY KEY (`itemnumber`),
793 KEY `delitembarcodeidx` (`barcode`),
794 KEY `delitemstocknumberidx` (`stocknumber`),
795 KEY `delitembinoidx` (`biblioitemnumber`),
796 KEY `delitembibnoidx` (`biblionumber`),
797 KEY `delhomebranch` (`homebranch`),
798 KEY `delholdingbranch` (`holdingbranch`),
799 KEY `itype_idx` (`itype`)
800 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
803 -- Table structure for table `ethnicity`
806 DROP TABLE IF EXISTS `ethnicity`;
807 CREATE TABLE `ethnicity` (
808 `code` varchar(10) NOT NULL default '',
809 `name` varchar(255) default NULL,
811 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
814 -- Table structure for table `export_format`
817 DROP TABLE IF EXISTS `export_format`;
818 CREATE TABLE `export_format` (
819 `export_format_id` int(11) NOT NULL auto_increment,
820 `profile` varchar(255) NOT NULL,
821 `description` mediumtext NOT NULL,
822 `marcfields` mediumtext NOT NULL,
823 `csv_separator` varchar(2) NOT NULL,
824 `field_separator` varchar(2) NOT NULL,
825 `subfield_separator` varchar(2) NOT NULL,
826 `encoding` varchar(255) NOT NULL,
827 PRIMARY KEY (`export_format_id`)
828 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Used for CSV export';
832 -- Table structure for table `hold_fill_targets`
835 DROP TABLE IF EXISTS `hold_fill_targets`;
836 CREATE TABLE hold_fill_targets (
837 `borrowernumber` int(11) NOT NULL,
838 `biblionumber` int(11) NOT NULL,
839 `itemnumber` int(11) NOT NULL,
840 `source_branchcode` varchar(10) default NULL,
841 `item_level_request` tinyint(4) NOT NULL default 0,
842 PRIMARY KEY `itemnumber` (`itemnumber`),
843 KEY `bib_branch` (`biblionumber`, `source_branchcode`),
844 CONSTRAINT `hold_fill_targets_ibfk_1` FOREIGN KEY (`borrowernumber`)
845 REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
846 CONSTRAINT `hold_fill_targets_ibfk_2` FOREIGN KEY (`biblionumber`)
847 REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
848 CONSTRAINT `hold_fill_targets_ibfk_3` FOREIGN KEY (`itemnumber`)
849 REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
850 CONSTRAINT `hold_fill_targets_ibfk_4` FOREIGN KEY (`source_branchcode`)
851 REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
852 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
855 -- Table structure for table `import_batches`
858 DROP TABLE IF EXISTS `import_batches`;
859 CREATE TABLE `import_batches` ( -- information about batches of marc records that have been imported
860 `import_batch_id` int(11) NOT NULL auto_increment, -- unique identifier and primary key
861 `matcher_id` int(11) default NULL, -- the id of the match rule used (matchpoints.matcher_id)
862 `template_id` int(11) default NULL,
863 `branchcode` varchar(10) default NULL,
864 `num_records` int(11) NOT NULL default 0, -- number of records in the file
865 `num_items` int(11) NOT NULL default 0, -- number of items in the file
866 `upload_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, -- date and time the file was uploaded
867 `overlay_action` enum('replace', 'create_new', 'use_template', 'ignore') NOT NULL default 'create_new', -- how to handle duplicate records
868 `nomatch_action` enum('create_new', 'ignore') NOT NULL default 'create_new', -- how to handle records where no match is found
869 `item_action` enum('always_add', 'add_only_for_matches', 'add_only_for_new', 'ignore') NOT NULL default 'always_add', -- what to do with item records
870 `import_status` enum('staging', 'staged', 'importing', 'imported', 'reverting', 'reverted', 'cleaned') NOT NULL default 'staging', -- the status of the imported file
871 `batch_type` enum('batch', 'z3950', 'webservice') NOT NULL default 'batch', -- where this batch has come from
872 `record_type` enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio', -- type of record in the batch
873 `file_name` varchar(100), -- the name of the file uploaded
874 `comments` mediumtext, -- any comments added when the file was uploaded
875 PRIMARY KEY (`import_batch_id`),
876 KEY `branchcode` (`branchcode`)
877 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
880 -- Table structure for table `import_records`
883 DROP TABLE IF EXISTS `import_records`;
884 CREATE TABLE `import_records` (
885 `import_record_id` int(11) NOT NULL auto_increment,
886 `import_batch_id` int(11) NOT NULL,
887 `branchcode` varchar(10) default NULL,
888 `record_sequence` int(11) NOT NULL default 0,
889 `upload_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
890 `import_date` DATE default NULL,
891 `marc` longblob NOT NULL,
892 `marcxml` longtext NOT NULL,
893 `marcxml_old` longtext NOT NULL,
894 `record_type` enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio',
895 `overlay_status` enum('no_match', 'auto_match', 'manual_match', 'match_applied') NOT NULL default 'no_match',
896 `status` enum('error', 'staged', 'imported', 'reverted', 'items_reverted', 'ignored') NOT NULL default 'staged',
897 `import_error` mediumtext,
898 `encoding` varchar(40) NOT NULL default '',
899 `z3950random` varchar(40) default NULL,
900 PRIMARY KEY (`import_record_id`),
901 CONSTRAINT `import_records_ifbk_1` FOREIGN KEY (`import_batch_id`)
902 REFERENCES `import_batches` (`import_batch_id`) ON DELETE CASCADE ON UPDATE CASCADE,
903 KEY `branchcode` (`branchcode`),
904 KEY `batch_sequence` (`import_batch_id`, `record_sequence`),
905 KEY `batch_id_record_type` (`import_batch_id`,`record_type`)
906 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
909 -- Table structure for `import_record_matches`
911 DROP TABLE IF EXISTS `import_record_matches`;
912 CREATE TABLE `import_record_matches` ( -- matches found when importing a batch of records
913 `import_record_id` int(11) NOT NULL, -- the id given to the imported bib record (import_records.import_record_id)
914 `candidate_match_id` int(11) NOT NULL, -- the biblio the imported record matches (biblio.biblionumber)
915 `score` int(11) NOT NULL default 0, -- the match score
916 CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`)
917 REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
918 KEY `record_score` (`import_record_id`, `score`)
919 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
922 -- Table structure for table `import_auths`
925 DROP TABLE IF EXISTS `import_auths`;
926 CREATE TABLE `import_auths` (
927 `import_record_id` int(11) NOT NULL,
928 `matched_authid` int(11) default NULL,
929 `control_number` varchar(25) default NULL,
930 `authorized_heading` varchar(128) default NULL,
931 `original_source` varchar(25) default NULL,
932 CONSTRAINT `import_auths_ibfk_1` FOREIGN KEY (`import_record_id`)
933 REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
934 KEY `matched_authid` (`matched_authid`)
935 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
938 -- Table structure for table `import_biblios`
941 DROP TABLE IF EXISTS `import_biblios`;
942 CREATE TABLE `import_biblios` (
943 `import_record_id` int(11) NOT NULL,
944 `matched_biblionumber` int(11) default NULL,
945 `control_number` varchar(25) default NULL,
946 `original_source` varchar(25) default NULL,
947 `title` varchar(128) default NULL,
948 `author` varchar(80) default NULL,
949 `isbn` varchar(30) default NULL,
950 `issn` varchar(9) default NULL,
951 `has_items` tinyint(1) NOT NULL default 0,
952 CONSTRAINT `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`)
953 REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
954 KEY `matched_biblionumber` (`matched_biblionumber`),
955 KEY `title` (`title`),
957 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
960 -- Table structure for table `import_items`
963 DROP TABLE IF EXISTS `import_items`;
964 CREATE TABLE `import_items` (
965 `import_items_id` int(11) NOT NULL auto_increment,
966 `import_record_id` int(11) NOT NULL,
967 `itemnumber` int(11) default NULL,
968 `branchcode` varchar(10) default NULL,
969 `status` enum('error', 'staged', 'imported', 'reverted', 'ignored') NOT NULL default 'staged',
970 `marcxml` longtext NOT NULL,
971 `import_error` mediumtext,
972 PRIMARY KEY (`import_items_id`),
973 CONSTRAINT `import_items_ibfk_1` FOREIGN KEY (`import_record_id`)
974 REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
975 KEY `itemnumber` (`itemnumber`),
976 KEY `branchcode` (`branchcode`)
977 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
980 -- Table structure for table `issues`
983 DROP TABLE IF EXISTS `issues`;
984 CREATE TABLE `issues` ( -- information related to check outs or issues
985 `borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to
986 `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out
987 `date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss)
988 `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
989 `issuingbranch` varchar(18) default NULL,
990 `returndate` datetime default NULL, -- date the item was returned, will be NULL until moved to old_issues
991 `lastreneweddate` datetime default NULL, -- date the item was last renewed
992 `return` varchar(4) default NULL,
993 `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
994 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
995 `issuedate` datetime default NULL, -- date the item was checked out or issued
996 KEY `issuesborridx` (`borrowernumber`),
997 KEY `itemnumber_idx` (`itemnumber`),
998 KEY `branchcode_idx` (`branchcode`),
999 KEY `issuingbranch_idx` (`issuingbranch`),
1000 KEY `bordate` (`borrowernumber`,`timestamp`),
1001 CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE RESTRICT ON UPDATE CASCADE,
1002 CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE RESTRICT ON UPDATE CASCADE
1003 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1006 -- Table structure for table `issuingrules`
1009 DROP TABLE IF EXISTS `issuingrules`;
1010 CREATE TABLE `issuingrules` ( -- circulation and fine rules
1011 `categorycode` varchar(10) NOT NULL default '', -- patron category this rule is for (categories.categorycode)
1012 `itemtype` varchar(10) NOT NULL default '', -- item type this rule is for (itemtypes.itemtype)
1013 `restrictedtype` tinyint(1) default NULL, -- not used? always NULL
1014 `rentaldiscount` decimal(28,6) default NULL, -- percent discount on the rental charge for this item
1015 `reservecharge` decimal(28,6) default NULL,
1016 `fine` decimal(28,6) default NULL, -- fine amount
1017 `finedays` int(11) default NULL, -- suspension in days
1018 `firstremind` int(11) default NULL, -- fine grace period
1019 `chargeperiod` int(11) default NULL, -- how often the fine amount is charged
1020 `accountsent` int(11) default NULL, -- not used? always NULL
1021 `chargename` varchar(100) default NULL, -- not used? always NULL
1022 `maxissueqty` int(4) default NULL, -- total number of checkouts allowed
1023 `issuelength` int(4) default NULL, -- length of checkout in the unit set in issuingrules.lengthunit
1024 `lengthunit` varchar(10) default 'days', -- unit of checkout length (days, hours)
1025 `hardduedate` date default NULL, -- hard due date
1026 `hardduedatecompare` tinyint NOT NULL default "0", -- type of hard due date (1 = after, 0 = on, -1 = before)
1027 `renewalsallowed` smallint(6) NOT NULL default "0", -- how many renewals are allowed
1028 `renewalperiod` int(4) default NULL, -- renewal period in the unit set in issuingrules.lengthunit
1029 `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed
1030 `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode)
1031 overduefinescap decimal default NULL, -- the maximum amount of an overdue fine
1032 PRIMARY KEY (`branchcode`,`categorycode`,`itemtype`),
1033 KEY `categorycode` (`categorycode`),
1034 KEY `itemtype` (`itemtype`)
1035 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1038 -- Table structure for table `items`
1041 DROP TABLE IF EXISTS `items`;
1042 CREATE TABLE `items` ( -- holdings/item information
1043 `itemnumber` int(11) NOT NULL auto_increment, -- primary key and unique identifier added by Koha
1044 `biblionumber` int(11) NOT NULL default 0, -- foreign key from biblio table used to link this item to the right bib record
1045 `biblioitemnumber` int(11) NOT NULL default 0, -- foreign key from the biblioitems table to link to item to additional information
1046 `barcode` varchar(20) default NULL, -- item barcode (MARC21 952$p)
1047 `dateaccessioned` date default NULL, -- date the item was acquired or added to Koha (MARC21 952$d)
1048 `booksellerid` mediumtext default NULL, -- where the item was purchased (MARC21 952$e)
1049 `homebranch` varchar(10) default NULL, -- foreign key from the branches table for the library that owns this item (MARC21 952$a)
1050 `price` decimal(8,2) default NULL, -- purchase price (MARC21 952$g)
1051 `replacementprice` decimal(8,2) default NULL, -- cost the library charges to replace the item if it has been marked lost (MARC21 952$v)
1052 `replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w)
1053 `datelastborrowed` date default NULL, -- the date the item was last checked out/issued
1054 `datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done)
1055 `stack` tinyint(1) default NULL,
1056 `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
1057 `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
1058 `itemlost` tinyint(1) NOT NULL default 0, -- authorized value defining this item as lost (MARC21 952$1)
1059 `wthdrawn` tinyint(1) NOT NULL default 0, -- authorized value defining this item as withdrawn (MARC21 952$0)
1060 `itemcallnumber` varchar(255) default NULL, -- call number for this item (MARC21 952$o)
1061 `coded_location_qualifier` varchar(10) default NULL, -- coded location qualifier(MARC21 952$f)
1062 `issues` smallint(6) default NULL, -- number of times this item has been checked out/issued
1063 `renewals` smallint(6) default NULL, -- number of times this item has been renewed
1064 `reserves` smallint(6) default NULL, -- number of times this item has been placed on hold/reserved
1065 `restricted` tinyint(1) default NULL, -- authorized value defining use restrictions for this item (MARC21 952$5)
1066 `itemnotes` mediumtext, -- public notes on this item (MARC21 952$x)
1067 `holdingbranch` varchar(10) default NULL, -- foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)
1068 `paidfor` mediumtext,
1069 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this item was last altered
1070 `location` varchar(80) default NULL, -- authorized value for the shelving location for this item (MARC21 952$c)
1071 `permanent_location` varchar(80) default NULL, -- linked to the CART and PROC temporary locations feature, stores the permanent shelving location
1072 `onloan` date default NULL, -- defines if item is checked out (NULL for not checked out, and checkout date for checked out)
1073 `cn_source` varchar(10) default NULL, -- classification source used on this item (MARC21 952$2)
1074 `cn_sort` varchar(30) default NULL, -- normalized form of the call number (MARC21 952$o) used for sorting
1075 `ccode` varchar(10) default NULL, -- authorized value for the collection code associated with this item (MARC21 952$8)
1076 `materials` text default NULL, -- materials specified (MARC21 952$3)
1077 `uri` varchar(255) default NULL, -- URL for the item (MARC21 952$u)
1078 `itype` varchar(10) default NULL, -- foreign key from the itemtypes table defining the type for this item (MARC21 952$y)
1079 `more_subfields_xml` longtext default NULL, -- additional 952 subfields in XML format
1080 `enumchron` text default NULL, -- serial enumeration/chronology for the item (MARC21 952$h)
1081 `copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t)
1082 `stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i)
1083 PRIMARY KEY (`itemnumber`),
1084 UNIQUE KEY `itembarcodeidx` (`barcode`),
1085 KEY `itemstocknumberidx` (`stocknumber`),
1086 KEY `itembinoidx` (`biblioitemnumber`),
1087 KEY `itembibnoidx` (`biblionumber`),
1088 KEY `homebranch` (`homebranch`),
1089 KEY `holdingbranch` (`holdingbranch`),
1090 KEY `itemcallnumber` (`itemcallnumber`),
1091 KEY `items_location` (`location`),
1092 KEY `items_ccode` (`ccode`),
1093 KEY `itype_idx` (`itype`),
1094 CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1095 CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
1096 CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE
1097 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1100 -- Table structure for table `itemtypes`
1103 DROP TABLE IF EXISTS `itemtypes`;
1104 CREATE TABLE `itemtypes` ( -- defines the item types
1105 `itemtype` varchar(10) NOT NULL default '', -- unique key, a code associated with the item type
1106 `description` mediumtext, -- a plain text explanation of the item type
1107 `rentalcharge` double(16,4) default NULL, -- the amount charged when this item is checked out/issued
1108 `notforloan` smallint(6) default NULL, -- 1 if the item is not for loan, 0 if the item is available for loan
1109 `imageurl` varchar(200) default NULL, -- URL for the item type icon
1110 `summary` text, -- information from the summary field, may include HTML
1111 PRIMARY KEY (`itemtype`),
1112 UNIQUE KEY `itemtype` (`itemtype`)
1113 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1116 -- Table structure for table `creator_batches`
1119 DROP TABLE IF EXISTS `creator_batches`;
1120 SET @saved_cs_client = @@character_set_client;
1121 SET character_set_client = utf8;
1122 CREATE TABLE `creator_batches` (
1123 `label_id` int(11) NOT NULL AUTO_INCREMENT,
1124 `batch_id` int(10) NOT NULL DEFAULT '1',
1125 `item_number` int(11) DEFAULT NULL,
1126 `borrower_number` int(11) DEFAULT NULL,
1127 `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1128 `branch_code` varchar(10) NOT NULL DEFAULT 'NB',
1129 `creator` char(15) NOT NULL DEFAULT 'Labels',
1130 PRIMARY KEY (`label_id`),
1131 KEY `branch_fk_constraint` (`branch_code`),
1132 KEY `item_fk_constraint` (`item_number`),
1133 KEY `borrower_fk_constraint` (`borrower_number`),
1134 CONSTRAINT `creator_batches_ibfk_1` FOREIGN KEY (`borrower_number`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1135 CONSTRAINT `creator_batches_ibfk_2` FOREIGN KEY (`branch_code`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
1136 CONSTRAINT `creator_batches_ibfk_3` FOREIGN KEY (`item_number`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE
1137 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1140 -- Table structure for table `creator_images`
1143 DROP TABLE IF EXISTS `creator_images`;
1144 SET @saved_cs_client = @@character_set_client;
1145 SET character_set_client = utf8;
1146 CREATE TABLE `creator_images` (
1147 `image_id` int(4) NOT NULL AUTO_INCREMENT,
1148 `imagefile` mediumblob,
1149 `image_name` char(20) NOT NULL DEFAULT 'DEFAULT',
1150 PRIMARY KEY (`image_id`),
1151 UNIQUE KEY `image_name_index` (`image_name`)
1152 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1155 -- Table structure for table `creator_layouts`
1158 DROP TABLE IF EXISTS `creator_layouts`;
1159 SET @saved_cs_client = @@character_set_client;
1160 SET character_set_client = utf8;
1161 CREATE TABLE `creator_layouts` (
1162 `layout_id` int(4) NOT NULL AUTO_INCREMENT,
1163 `barcode_type` char(100) NOT NULL DEFAULT 'CODE39',
1164 `start_label` int(2) NOT NULL DEFAULT '1',
1165 `printing_type` char(32) NOT NULL DEFAULT 'BAR',
1166 `layout_name` char(20) NOT NULL DEFAULT 'DEFAULT',
1167 `guidebox` int(1) DEFAULT '0',
1168 `font` char(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'TR',
1169 `font_size` int(4) NOT NULL DEFAULT '10',
1170 `units` char(20) NOT NULL DEFAULT 'POINT',
1171 `callnum_split` int(1) DEFAULT '0',
1172 `text_justify` char(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'L',
1173 `format_string` varchar(210) NOT NULL DEFAULT 'barcode',
1174 `layout_xml` text NOT NULL,
1175 `creator` char(15) NOT NULL DEFAULT 'Labels',
1176 PRIMARY KEY (`layout_id`)
1177 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1180 -- Table structure for table `creator_templates`
1183 DROP TABLE IF EXISTS `creator_templates`;
1184 SET @saved_cs_client = @@character_set_client;
1185 SET character_set_client = utf8;
1186 CREATE TABLE `creator_templates` (
1187 `template_id` int(4) NOT NULL AUTO_INCREMENT,
1188 `profile_id` int(4) DEFAULT NULL,
1189 `template_code` char(100) NOT NULL DEFAULT 'DEFAULT TEMPLATE',
1190 `template_desc` char(100) NOT NULL DEFAULT 'Default description',
1191 `page_width` float NOT NULL DEFAULT '0',
1192 `page_height` float NOT NULL DEFAULT '0',
1193 `label_width` float NOT NULL DEFAULT '0',
1194 `label_height` float NOT NULL DEFAULT '0',
1195 `top_text_margin` float NOT NULL DEFAULT '0',
1196 `left_text_margin` float NOT NULL DEFAULT '0',
1197 `top_margin` float NOT NULL DEFAULT '0',
1198 `left_margin` float NOT NULL DEFAULT '0',
1199 `cols` int(2) NOT NULL DEFAULT '0',
1200 `rows` int(2) NOT NULL DEFAULT '0',
1201 `col_gap` float NOT NULL DEFAULT '0',
1202 `row_gap` float NOT NULL DEFAULT '0',
1203 `units` char(20) NOT NULL DEFAULT 'POINT',
1204 `creator` char(15) NOT NULL DEFAULT 'Labels',
1205 PRIMARY KEY (`template_id`),
1206 KEY `template_profile_fk_constraint` (`profile_id`)
1207 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1210 -- Table structure for table `letter`
1213 DROP TABLE IF EXISTS `letter`;
1214 CREATE TABLE `letter` ( -- table for all notice templates in Koha
1215 `module` varchar(20) NOT NULL default '', -- Koha module that triggers this notice or slip
1216 `code` varchar(20) NOT NULL default '', -- unique identifier for this notice or slip
1217 `branchcode` varchar(10) default NULL, -- the branch this notice or slip is used at (branches.branchcode)
1218 `name` varchar(100) NOT NULL default '', -- plain text name for this notice or slip
1219 `is_html` tinyint(1) default 0, -- does this notice or slip use HTML (1 for yes, 0 for no)
1220 `title` varchar(200) NOT NULL default '', -- subject line of the notice
1221 `content` text, -- body text for the notice or slip
1222 PRIMARY KEY (`module`,`code`, `branchcode`)
1223 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1226 -- Table structure for table `marc_subfield_structure`
1229 DROP TABLE IF EXISTS `marc_subfield_structure`;
1230 CREATE TABLE `marc_subfield_structure` (
1231 `tagfield` varchar(3) NOT NULL default '',
1232 `tagsubfield` varchar(1) NOT NULL default '' COLLATE utf8_bin,
1233 `liblibrarian` varchar(255) NOT NULL default '',
1234 `libopac` varchar(255) NOT NULL default '',
1235 `repeatable` tinyint(4) NOT NULL default 0,
1236 `mandatory` tinyint(4) NOT NULL default 0,
1237 `kohafield` varchar(40) default NULL,
1238 `tab` tinyint(1) default NULL,
1239 `authorised_value` varchar(20) default NULL,
1240 `authtypecode` varchar(20) default NULL,
1241 `value_builder` varchar(80) default NULL,
1242 `isurl` tinyint(1) default NULL,
1243 `hidden` tinyint(1) default NULL,
1244 `frameworkcode` varchar(4) NOT NULL default '',
1245 `seealso` varchar(1100) default NULL,
1246 `link` varchar(80) default NULL,
1247 `defaultvalue` text default NULL,
1248 `maxlength` int(4) NOT NULL DEFAULT '9999',
1249 PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`),
1250 KEY `kohafield_2` (`kohafield`),
1251 KEY `tab` (`frameworkcode`,`tab`),
1252 KEY `kohafield` (`frameworkcode`,`kohafield`)
1253 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1256 -- Table structure for table `marc_tag_structure`
1259 DROP TABLE IF EXISTS `marc_tag_structure`;
1260 CREATE TABLE `marc_tag_structure` (
1261 `tagfield` varchar(3) NOT NULL default '',
1262 `liblibrarian` varchar(255) NOT NULL default '',
1263 `libopac` varchar(255) NOT NULL default '',
1264 `repeatable` tinyint(4) NOT NULL default 0,
1265 `mandatory` tinyint(4) NOT NULL default 0,
1266 `authorised_value` varchar(10) default NULL,
1267 `frameworkcode` varchar(4) NOT NULL default '',
1268 PRIMARY KEY (`frameworkcode`,`tagfield`)
1269 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1272 -- Table structure for table `marc_matchers`
1275 DROP TABLE IF EXISTS `marc_matchers`;
1276 CREATE TABLE `marc_matchers` (
1277 `matcher_id` int(11) NOT NULL auto_increment,
1278 `code` varchar(10) NOT NULL default '',
1279 `description` varchar(255) NOT NULL default '',
1280 `record_type` varchar(10) NOT NULL default 'biblio',
1281 `threshold` int(11) NOT NULL default 0,
1282 PRIMARY KEY (`matcher_id`),
1283 KEY `code` (`code`),
1284 KEY `record_type` (`record_type`)
1285 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1288 -- Table structure for table `matchpoints`
1290 DROP TABLE IF EXISTS `matchpoints`;
1291 CREATE TABLE `matchpoints` (
1292 `matcher_id` int(11) NOT NULL,
1293 `matchpoint_id` int(11) NOT NULL auto_increment,
1294 `search_index` varchar(30) NOT NULL default '',
1295 `score` int(11) NOT NULL default 0,
1296 PRIMARY KEY (`matchpoint_id`),
1297 CONSTRAINT `matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`)
1298 REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE
1299 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1303 -- Table structure for table `matchpoint_components`
1305 DROP TABLE IF EXISTS `matchpoint_components`;
1306 CREATE TABLE `matchpoint_components` (
1307 `matchpoint_id` int(11) NOT NULL,
1308 `matchpoint_component_id` int(11) NOT NULL auto_increment,
1309 sequence int(11) NOT NULL default 0,
1310 tag varchar(3) NOT NULL default '',
1311 subfields varchar(40) NOT NULL default '',
1312 offset int(4) NOT NULL default 0,
1313 length int(4) NOT NULL default 0,
1314 PRIMARY KEY (`matchpoint_component_id`),
1315 KEY `by_sequence` (`matchpoint_id`, `sequence`),
1316 CONSTRAINT `matchpoint_components_ifbk_1` FOREIGN KEY (`matchpoint_id`)
1317 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
1318 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1321 -- Table structure for table `matcher_component_norms`
1323 DROP TABLE IF EXISTS `matchpoint_component_norms`;
1324 CREATE TABLE `matchpoint_component_norms` (
1325 `matchpoint_component_id` int(11) NOT NULL,
1326 `sequence` int(11) NOT NULL default 0,
1327 `norm_routine` varchar(50) NOT NULL default '',
1328 KEY `matchpoint_component_norms` (`matchpoint_component_id`, `sequence`),
1329 CONSTRAINT `matchpoint_component_norms_ifbk_1` FOREIGN KEY (`matchpoint_component_id`)
1330 REFERENCES `matchpoint_components` (`matchpoint_component_id`) ON DELETE CASCADE ON UPDATE CASCADE
1331 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1334 -- Table structure for table `matcher_matchpoints`
1336 DROP TABLE IF EXISTS `matcher_matchpoints`;
1337 CREATE TABLE `matcher_matchpoints` (
1338 `matcher_id` int(11) NOT NULL,
1339 `matchpoint_id` int(11) NOT NULL,
1340 CONSTRAINT `matcher_matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`)
1341 REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1342 CONSTRAINT `matcher_matchpoints_ifbk_2` FOREIGN KEY (`matchpoint_id`)
1343 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
1344 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1347 -- Table structure for table `matchchecks`
1349 DROP TABLE IF EXISTS `matchchecks`;
1350 CREATE TABLE `matchchecks` (
1351 `matcher_id` int(11) NOT NULL,
1352 `matchcheck_id` int(11) NOT NULL auto_increment,
1353 `source_matchpoint_id` int(11) NOT NULL,
1354 `target_matchpoint_id` int(11) NOT NULL,
1355 PRIMARY KEY (`matchcheck_id`),
1356 CONSTRAINT `matcher_matchchecks_ifbk_1` FOREIGN KEY (`matcher_id`)
1357 REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1358 CONSTRAINT `matcher_matchchecks_ifbk_2` FOREIGN KEY (`source_matchpoint_id`)
1359 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE,
1360 CONSTRAINT `matcher_matchchecks_ifbk_3` FOREIGN KEY (`target_matchpoint_id`)
1361 REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
1362 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1365 -- Table structure for table `need_merge_authorities`
1368 DROP TABLE IF EXISTS `need_merge_authorities`;
1369 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)
1370 `id` int NOT NULL auto_increment PRIMARY KEY, -- unique id
1371 `authid` bigint NOT NULL, -- reference to authority record
1372 `done` tinyint DEFAULT 0 -- indication whether merge has been executed (0=not done, 1= done, 2= in progress)
1373 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1376 -- Table structure for table `notifys`
1379 DROP TABLE IF EXISTS `notifys`;
1380 CREATE TABLE `notifys` (
1381 `notify_id` int(11) NOT NULL default 0,
1382 `borrowernumber` int(11) NOT NULL default 0,
1383 `itemnumber` int(11) NOT NULL default 0,
1384 `notify_date` date default NULL,
1385 `notify_send_date` date default NULL,
1386 `notify_level` int(1) NOT NULL default 0,
1387 `method` varchar(20) NOT NULL default ''
1388 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1391 -- Table structure for table `oai_sets`
1394 DROP TABLE IF EXISTS `oai_sets`;
1395 CREATE TABLE `oai_sets` (
1396 `id` int(11) NOT NULL auto_increment,
1397 `spec` varchar(80) NOT NULL UNIQUE,
1398 `name` varchar(80) NOT NULL,
1400 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1403 -- Table structure for table `oai_sets_descriptions`
1406 DROP TABLE IF EXISTS `oai_sets_descriptions`;
1407 CREATE TABLE `oai_sets_descriptions` (
1408 `set_id` int(11) NOT NULL,
1409 `description` varchar(255) NOT NULL,
1410 CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1411 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1414 -- Table structure for table `oai_sets_mappings`
1417 DROP TABLE IF EXISTS `oai_sets_mappings`;
1418 CREATE TABLE `oai_sets_mappings` (
1419 `set_id` int(11) NOT NULL,
1420 `marcfield` char(3) NOT NULL,
1421 `marcsubfield` char(1) NOT NULL,
1422 `marcvalue` varchar(80) NOT NULL,
1423 CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1424 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1427 -- Table structure for table `oai_sets_biblios`
1430 DROP TABLE IF EXISTS `oai_sets_biblios`;
1431 CREATE TABLE `oai_sets_biblios` (
1432 `biblionumber` int(11) NOT NULL,
1433 `set_id` int(11) NOT NULL,
1434 PRIMARY KEY (`biblionumber`, `set_id`),
1435 CONSTRAINT `oai_sets_biblios_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1436 CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1437 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1440 -- Table structure for table `old_issues`
1443 DROP TABLE IF EXISTS `old_issues`;
1444 CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
1445 `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1446 `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
1447 `date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd)
1448 `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
1449 `issuingbranch` varchar(18) default NULL,
1450 `returndate` datetime default NULL, -- date the item was returned
1451 `lastreneweddate` datetime default NULL, -- date the item was last renewed
1452 `return` varchar(4) default NULL,
1453 `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
1454 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1455 `issuedate` datetime default NULL, -- date the item was checked out or issued
1456 KEY `old_issuesborridx` (`borrowernumber`),
1457 KEY `old_issuesitemidx` (`itemnumber`),
1458 KEY `branchcode_idx` (`branchcode`),
1459 KEY `issuingbranch_idx` (`issuingbranch`),
1460 KEY `old_bordate` (`borrowernumber`,`timestamp`),
1461 CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
1462 ON DELETE SET NULL ON UPDATE SET NULL,
1463 CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`)
1464 ON DELETE SET NULL ON UPDATE SET NULL
1465 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1468 -- Table structure for table `old_reserves`
1470 DROP TABLE IF EXISTS `old_reserves`;
1471 CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have been completed (either filled or cancelled)
1472 `reserve_id` int(11) NOT NULL, -- primary key
1473 `borrowernumber` int(11) default NULL, -- foreign key from the borrowers table defining which patron this hold is for
1474 `reservedate` date default NULL, -- the date the hold was places
1475 `biblionumber` int(11) default NULL, -- foreign key from the biblio table defining which bib record this hold is on
1476 `constrainttype` varchar(1) default NULL,
1477 `branchcode` varchar(10) default NULL, -- foreign key from the branches table defining which branch the patron wishes to pick this hold up at
1478 `notificationdate` date default NULL, -- currently unused
1479 `reminderdate` date default NULL, -- currently unused
1480 `cancellationdate` date default NULL, -- the date this hold was cancelled
1481 `reservenotes` mediumtext, -- notes related to this hold
1482 `priority` smallint(6) default NULL, -- where in the queue the patron sits
1483 `found` varchar(1) default NULL, -- a one letter code defining what the status is of the hold is after it has been confirmed
1484 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this hold was last updated
1485 `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
1486 `waitingdate` date default NULL, -- the date the item was marked as waiting for the patron at the library
1487 `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)
1488 `lowestPriority` tinyint(1) NOT NULL, -- has this hold been pinned to the lowest priority in the holds queue (1 for yes, 0 for no)
1489 `suspend` BOOLEAN NOT NULL DEFAULT 0, -- in this hold suspended (1 for yes, 0 for no)
1490 `suspend_until` DATETIME NULL DEFAULT NULL, -- the date this hold is suspended until (NULL for infinitely)
1491 PRIMARY KEY (`reserve_id`),
1492 KEY `old_reserves_borrowernumber` (`borrowernumber`),
1493 KEY `old_reserves_biblionumber` (`biblionumber`),
1494 KEY `old_reserves_itemnumber` (`itemnumber`),
1495 KEY `old_reserves_branchcode` (`branchcode`),
1496 CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
1497 ON DELETE SET NULL ON UPDATE SET NULL,
1498 CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`)
1499 ON DELETE SET NULL ON UPDATE SET NULL,
1500 CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`)
1501 ON DELETE SET NULL ON UPDATE SET NULL
1502 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1505 -- Table structure for table `opac_news`
1508 DROP TABLE IF EXISTS `opac_news`;
1509 CREATE TABLE `opac_news` ( -- data from the news tool
1510 `idnew` int(10) unsigned NOT NULL auto_increment, -- unique identifier for the news article
1511 `title` varchar(250) NOT NULL default '', -- title of the news article
1512 `new` text NOT NULL, -- the body of your news article
1513 `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)
1514 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, -- pulibcation date and time
1515 `expirationdate` date default NULL, -- date the article is set to expire or no longer be visible
1516 `number` int(11) default NULL, -- the order in which this article appears in that specific location
1517 PRIMARY KEY (`idnew`)
1518 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1521 -- Table structure for table `overduerules`
1524 DROP TABLE IF EXISTS `overduerules`;
1525 CREATE TABLE `overduerules` ( -- overdue notice status and triggers
1526 `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)
1527 `categorycode` varchar(10) NOT NULL default '', -- foreign key from the categories table to define which patron category this rule is for
1528 `delay1` int(4) default NULL, -- number of days after the item is overdue that the first notice is sent
1529 `letter1` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the first notice
1530 `debarred1` varchar(1) default 0, -- is the patron restricted when the first notice is sent (1 for yes, 0 for no)
1531 `delay2` int(4) default NULL, -- number of days after the item is overdue that the second notice is sent
1532 `debarred2` varchar(1) default 0, -- is the patron restricted when the second notice is sent (1 for yes, 0 for no)
1533 `letter2` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the second notice
1534 `delay3` int(4) default NULL, -- number of days after the item is overdue that the third notice is sent
1535 `letter3` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the third notice
1536 `debarred3` int(1) default 0, -- is the patron restricted when the third notice is sent (1 for yes, 0 for no)
1537 PRIMARY KEY (`branchcode`,`categorycode`)
1538 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1541 -- Table structure for table `patroncards`
1544 DROP TABLE IF EXISTS `patroncards`;
1545 CREATE TABLE `patroncards` (
1546 `cardid` int(11) NOT NULL auto_increment,
1547 `batch_id` varchar(10) NOT NULL default '1',
1548 `borrowernumber` int(11) NOT NULL,
1549 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
1550 PRIMARY KEY (`cardid`),
1551 KEY `patroncards_ibfk_1` (`borrowernumber`),
1552 CONSTRAINT `patroncards_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
1553 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1556 -- Table structure for table `patronimage`
1559 DROP TABLE IF EXISTS `patronimage`;
1560 CREATE TABLE `patronimage` ( -- information related to patron images
1561 `cardnumber` varchar(16) NOT NULL, -- the cardnumber of the patron this image is attached to (borrowers.cardnumber)
1562 `mimetype` varchar(15) NOT NULL, -- the format of the image (png, jpg, etc)
1563 `imagefile` mediumblob NOT NULL, -- the image
1564 PRIMARY KEY (`cardnumber`),
1565 CONSTRAINT `patronimage_fk1` FOREIGN KEY (`cardnumber`) REFERENCES `borrowers` (`cardnumber`) ON DELETE CASCADE ON UPDATE CASCADE
1566 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1568 -- Table structure for table `pending_offline_operations`
1570 -- this table is MyISAM, InnoDB tables are growing only and this table is filled/emptied/filled/emptied...
1571 -- so MyISAM is better in this case
1573 DROP TABLE IF EXISTS `pending_offline_operations`;
1574 CREATE TABLE pending_offline_operations (
1575 operationid int(11) NOT NULL AUTO_INCREMENT,
1576 userid varchar(30) NOT NULL,
1577 branchcode varchar(10) NOT NULL,
1578 `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1579 `action` varchar(10) NOT NULL,
1580 barcode varchar(20) DEFAULT NULL,
1581 cardnumber varchar(16) DEFAULT NULL,
1582 amount decimal(28,6) DEFAULT NULL,
1583 PRIMARY KEY (operationid)
1584 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
1588 -- Table structure for table `printers`
1591 DROP TABLE IF EXISTS `printers`;
1592 CREATE TABLE `printers` (
1593 `printername` varchar(40) NOT NULL default '',
1594 `printqueue` varchar(20) default NULL,
1595 `printtype` varchar(20) default NULL,
1596 PRIMARY KEY (`printername`)
1597 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1600 -- Table structure for table `printers_profile`
1603 DROP TABLE IF EXISTS `printers_profile`;
1604 CREATE TABLE `printers_profile` (
1605 `profile_id` int(4) NOT NULL auto_increment,
1606 `printer_name` varchar(40) NOT NULL default 'Default Printer',
1607 `template_id` int(4) NOT NULL default '0',
1608 `paper_bin` varchar(20) NOT NULL default 'Bypass',
1609 `offset_horz` float NOT NULL default '0',
1610 `offset_vert` float NOT NULL default '0',
1611 `creep_horz` float NOT NULL default '0',
1612 `creep_vert` float NOT NULL default '0',
1613 `units` char(20) NOT NULL default 'POINT',
1614 `creator` char(15) NOT NULL DEFAULT 'Labels',
1615 PRIMARY KEY (`profile_id`),
1616 UNIQUE KEY `printername` (`printer_name`,`template_id`,`paper_bin`,`creator`)
1617 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1620 -- Table structure for table `repeatable_holidays`
1623 DROP TABLE IF EXISTS `repeatable_holidays`;
1624 CREATE TABLE `repeatable_holidays` ( -- information for the days the library is closed
1625 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1626 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, defines which branch this closing is for
1627 `weekday` smallint(6) default NULL, -- day of the week (0=Sunday, 1=Monday, etc) this closing is repeated on
1628 `day` smallint(6) default NULL, -- day of the month this closing is on
1629 `month` smallint(6) default NULL, -- month this closing is in
1630 `title` varchar(50) NOT NULL default '', -- title of this closing
1631 `description` text NOT NULL, -- description for this closing
1633 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1636 -- Table structure for table `reports_dictionary`
1639 DROP TABLE IF EXISTS `reports_dictionary`;
1640 CREATE TABLE reports_dictionary ( -- definitions (or snippets of SQL) stored for use in reports
1641 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1642 `name` varchar(255) default NULL, -- name for this definition
1643 `description` text, -- description for this definition
1644 `date_created` datetime default NULL, -- date and time this definition was created
1645 `date_modified` datetime default NULL, -- date and time this definition was last modified
1646 `saved_sql` text, -- SQL snippet for us in reports
1647 report_area varchar(6) DEFAULT NULL, -- Koha module this definition is for Circulation, Catalog, Patrons, Acquistions, Accounts)
1649 KEY dictionary_area_idx (report_area)
1650 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1653 -- Table structure for table `reserveconstraints`
1656 DROP TABLE IF EXISTS `reserveconstraints`;
1657 CREATE TABLE `reserveconstraints` (
1658 `borrowernumber` int(11) NOT NULL default 0,
1659 `reservedate` date default NULL,
1660 `biblionumber` int(11) NOT NULL default 0,
1661 `biblioitemnumber` int(11) default NULL,
1662 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
1663 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1666 -- Table structure for table `reserves`
1669 DROP TABLE IF EXISTS `reserves`;
1670 CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha
1671 `reserve_id` int(11) NOT NULL auto_increment, -- primary key
1672 `borrowernumber` int(11) NOT NULL default 0, -- foreign key from the borrowers table defining which patron this hold is for
1673 `reservedate` date default NULL, -- the date the hold was places
1674 `biblionumber` int(11) NOT NULL default 0, -- foreign key from the biblio table defining which bib record this hold is on
1675 `constrainttype` varchar(1) default NULL,
1676 `branchcode` varchar(10) default NULL, -- foreign key from the branches table defining which branch the patron wishes to pick this hold up at
1677 `notificationdate` date default NULL, -- currently unused
1678 `reminderdate` date default NULL, -- currently unused
1679 `cancellationdate` date default NULL, -- the date this hold was cancelled
1680 `reservenotes` mediumtext, -- notes related to this hold
1681 `priority` smallint(6) default NULL, -- where in the queue the patron sits
1682 `found` varchar(1) default NULL, -- a one letter code defining what the status is of the hold is after it has been confirmed
1683 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this hold was last updated
1684 `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
1685 `waitingdate` date default NULL, -- the date the item was marked as waiting for the patron at the library
1686 `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)
1687 `lowestPriority` tinyint(1) NOT NULL,
1688 `suspend` BOOLEAN NOT NULL DEFAULT 0,
1689 `suspend_until` DATETIME NULL DEFAULT NULL,
1690 PRIMARY KEY (`reserve_id`),
1691 KEY priorityfoundidx (priority,found),
1692 KEY `borrowernumber` (`borrowernumber`),
1693 KEY `biblionumber` (`biblionumber`),
1694 KEY `itemnumber` (`itemnumber`),
1695 KEY `branchcode` (`branchcode`),
1696 CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1697 CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1698 CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1699 CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
1700 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1703 -- Table structure for table `reviews`
1706 DROP TABLE IF EXISTS `reviews`;
1707 CREATE TABLE `reviews` ( -- patron opac comments
1708 `reviewid` int(11) NOT NULL auto_increment, -- unique identifier for this comment
1709 `borrowernumber` int(11) default NULL, -- foreign key from the borrowers table defining which patron left this comment
1710 `biblionumber` int(11) default NULL, -- foreign key from the biblio table defining which bibliographic record this comment is for
1711 `review` text, -- the body of the comment
1712 `approved` tinyint(4) default NULL, -- whether this comment has been approved by a librarian (1 for yes, 0 for no)
1713 `datereviewed` datetime default NULL, -- the date the comment was left
1714 PRIMARY KEY (`reviewid`),
1715 CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
1716 CONSTRAINT `reviews_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
1717 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1720 -- Table structure for table `roadtype`
1723 DROP TABLE IF EXISTS `roadtype`;
1724 CREATE TABLE `roadtype` ( -- road types defined in administration and used in patron management
1725 `roadtypeid` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha for each road type
1726 `road_type` varchar(100) NOT NULL default '', -- text for road type
1727 PRIMARY KEY (`roadtypeid`)
1728 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1731 -- Table structure for table `saved_sql`
1734 DROP TABLE IF EXISTS `saved_sql`;
1735 CREATE TABLE saved_sql ( -- saved sql reports
1736 `id` int(11) NOT NULL auto_increment, -- unique id and primary key assigned by Koha
1737 `borrowernumber` int(11) default NULL, -- the staff member who created this report (borrowers.borrowernumber)
1738 `date_created` datetime default NULL, -- the date this report was created
1739 `last_modified` datetime default NULL, -- the date this report was last edited
1740 `savedsql` text, -- the SQL for this report
1741 `last_run` datetime default NULL,
1742 `report_name` varchar(255) default NULL, -- the name of this report
1743 `type` varchar(255) default NULL, -- always 1 for tabular
1744 `notes` text, -- the notes or description given to this report
1745 `cache_expiry` int NOT NULL default 300,
1746 `public` boolean NOT NULL default FALSE,
1747 report_area varchar(6) default NULL,
1748 report_group varchar(80) default NULL,
1749 report_subgroup varchar(80) default NULL,
1751 KEY sql_area_group_idx (report_group, report_subgroup),
1752 KEY boridx (`borrowernumber`)
1753 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1757 -- Table structure for `saved_reports`
1760 DROP TABLE IF EXISTS `saved_reports`;
1761 CREATE TABLE saved_reports (
1762 `id` int(11) NOT NULL auto_increment,
1763 `report_id` int(11) default NULL,
1765 `date_run` datetime default NULL,
1767 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1771 -- Table structure for table `search_history`
1774 DROP TABLE IF EXISTS `search_history`;
1775 CREATE TABLE IF NOT EXISTS `search_history` ( -- patron's opac search history
1776 `userid` int(11) NOT NULL, -- the patron who performed the search (borrowers.borrowernumber)
1777 `sessionid` varchar(32) NOT NULL, -- a system generated session id
1778 `query_desc` varchar(255) NOT NULL, -- the search that was performed
1779 `query_cgi` text NOT NULL, -- the string to append to the search url to rerun the search
1780 `total` int(11) NOT NULL, -- the total of results found
1781 `time` timestamp NOT NULL default CURRENT_TIMESTAMP, -- the date and time the search was run
1782 KEY `userid` (`userid`),
1783 KEY `sessionid` (`sessionid`)
1784 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Opac search history results';
1788 -- Table structure for table `serial`
1791 DROP TABLE IF EXISTS `serial`;
1792 CREATE TABLE `serial` (
1793 `serialid` int(11) NOT NULL auto_increment,
1794 `biblionumber` varchar(100) NOT NULL default '',
1795 `subscriptionid` varchar(100) NOT NULL default '',
1796 `serialseq` varchar(100) NOT NULL default '',
1797 `status` tinyint(4) NOT NULL default 0,
1798 `planneddate` date default NULL,
1800 `publisheddate` date default NULL,
1801 `itemnumber` text default NULL,
1802 `claimdate` date default NULL,
1803 `routingnotes` text,
1804 PRIMARY KEY (`serialid`)
1805 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1808 -- Table structure for table `sessions`
1811 DROP TABLE IF EXISTS sessions;
1812 CREATE TABLE sessions (
1813 `id` varchar(32) NOT NULL,
1814 `a_session` text NOT NULL,
1816 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1819 -- Table structure for table `special_holidays`
1822 DROP TABLE IF EXISTS `special_holidays`;
1823 CREATE TABLE `special_holidays` ( -- non repeatable holidays/library closings
1824 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1825 `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, defines which branch this closing is for
1826 `day` smallint(6) NOT NULL default 0, -- day of the month this closing is on
1827 `month` smallint(6) NOT NULL default 0, -- month this closing is in
1828 `year` smallint(6) NOT NULL default 0, -- year this closing is in
1829 `isexception` smallint(1) NOT NULL default 1, -- is this a holiday exception to a repeatable holiday (1 for yes, 0 for no)
1830 `title` varchar(50) NOT NULL default '', -- title for this closing
1831 `description` text NOT NULL, -- description of this closing
1833 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1836 -- Table structure for table `statistics`
1839 DROP TABLE IF EXISTS `statistics`;
1840 CREATE TABLE `statistics` ( -- information related to transactions (circulation and fines) in Koha
1841 `datetime` datetime default NULL, -- date and time of the transaction
1842 `branch` varchar(10) default NULL, -- foreign key, branch where the transaction occurred
1843 `proccode` varchar(4) default NULL, -- proceedure code
1844 `value` double(16,4) default NULL, -- monetary value associated with the transaction
1845 `type` varchar(16) default NULL, -- transaction type (locause, issue, return, renew, writeoff, payment, Credit*)
1847 `usercode` varchar(10) default NULL,
1848 `itemnumber` int(11) default NULL, -- foreign key from the items table, links transaction to a specific item
1849 `itemtype` varchar(10) default NULL, -- foreign key from the itemtypes table, links transaction to a specific item type
1850 `borrowernumber` int(11) default NULL, -- foreign key from the borrowers table, links transaction to a specific borrower
1851 `associatedborrower` int(11) default NULL,
1852 `ccode` varchar(10) default NULL, -- foreign key from the items table, links transaction to a specific collection code
1853 KEY `timeidx` (`datetime`),
1854 KEY `branch_idx` (`branch`),
1855 KEY `proccode_idx` (`proccode`),
1856 KEY `type_idx` (`type`),
1857 KEY `usercode_idx` (`usercode`),
1858 KEY `itemnumber_idx` (`itemnumber`),
1859 KEY `itemtype_idx` (`itemtype`),
1860 KEY `borrowernumber_idx` (`borrowernumber`),
1861 KEY `associatedborrower_idx` (`associatedborrower`),
1862 KEY `ccode_idx` (`ccode`)
1863 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1866 -- Table structure for table `stopwords`
1869 DROP TABLE IF EXISTS `stopwords`;
1870 CREATE TABLE `stopwords` (
1871 `word` varchar(255) default NULL
1872 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1875 -- Table structure for table `subscription`
1878 DROP TABLE IF EXISTS `subscription`;
1879 CREATE TABLE `subscription` (
1880 `biblionumber` int(11) NOT NULL default 0,
1881 `subscriptionid` int(11) NOT NULL auto_increment,
1882 `librarian` varchar(100) default '',
1883 `startdate` date default NULL,
1884 `aqbooksellerid` int(11) default 0,
1885 `cost` int(11) default 0,
1886 `aqbudgetid` int(11) default 0,
1887 `weeklength` int(11) default 0,
1888 `monthlength` int(11) default 0,
1889 `numberlength` int(11) default 0,
1890 `periodicity` tinyint(4) default 0,
1891 `dow` varchar(100) default '',
1892 `numberingmethod` varchar(100) default '',
1894 `status` varchar(100) NOT NULL default '',
1895 `add1` int(11) default 0,
1896 `every1` int(11) default 0,
1897 `whenmorethan1` int(11) default 0,
1898 `setto1` int(11) default NULL,
1899 `lastvalue1` int(11) default NULL,
1900 `add2` int(11) default 0,
1901 `every2` int(11) default 0,
1902 `whenmorethan2` int(11) default 0,
1903 `setto2` int(11) default NULL,
1904 `lastvalue2` int(11) default NULL,
1905 `add3` int(11) default 0,
1906 `every3` int(11) default 0,
1907 `innerloop1` int(11) default 0,
1908 `innerloop2` int(11) default 0,
1909 `innerloop3` int(11) default 0,
1910 `whenmorethan3` int(11) default 0,
1911 `setto3` int(11) default NULL,
1912 `lastvalue3` int(11) default NULL,
1913 `issuesatonce` tinyint(3) NOT NULL default 1,
1914 `firstacquidate` date default NULL,
1915 `manualhistory` tinyint(1) NOT NULL default 0,
1916 `irregularity` text,
1917 `letter` varchar(20) default NULL,
1918 `numberpattern` tinyint(3) default 0,
1919 `distributedto` text,
1920 `internalnotes` longtext,
1922 `location` varchar(80) NULL default '',
1923 `branchcode` varchar(10) NOT NULL default '',
1924 `hemisphere` tinyint(3) default 0,
1925 `lastbranch` varchar(10),
1926 `serialsadditems` tinyint(1) NOT NULL default '0',
1927 `staffdisplaycount` VARCHAR(10) NULL,
1928 `opacdisplaycount` VARCHAR(10) NULL,
1929 `graceperiod` int(11) NOT NULL default '0',
1930 `enddate` date default NULL,
1931 `closed` INT(1) NOT NULL DEFAULT 0,
1932 `reneweddate` date default NULL,
1933 PRIMARY KEY (`subscriptionid`)
1934 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1937 -- Table structure for table `subscriptionhistory`
1940 DROP TABLE IF EXISTS `subscriptionhistory`;
1941 CREATE TABLE `subscriptionhistory` (
1942 `biblionumber` int(11) NOT NULL default 0,
1943 `subscriptionid` int(11) NOT NULL default 0,
1944 `histstartdate` date default NULL,
1945 `histenddate` date default NULL,
1946 `missinglist` longtext NOT NULL,
1947 `recievedlist` longtext NOT NULL,
1948 `opacnote` varchar(150) NOT NULL default '',
1949 `librariannote` varchar(150) NOT NULL default '',
1950 PRIMARY KEY (`subscriptionid`),
1951 KEY `biblionumber` (`biblionumber`)
1952 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1955 -- Table structure for table `subscriptionroutinglist`
1958 DROP TABLE IF EXISTS `subscriptionroutinglist`;
1959 CREATE TABLE `subscriptionroutinglist` ( -- information related to the routing lists attached to subscriptions
1960 `routingid` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
1961 `borrowernumber` int(11) NOT NULL, -- foreign key from the borrowers table, defines with patron is on the routing list
1962 `ranking` int(11) default NULL, -- where the patron stands in line to receive the serial
1963 `subscriptionid` int(11) NOT NULL, -- foreign key from the subscription table, defines which subscription this routing list is for
1964 PRIMARY KEY (`routingid`),
1965 UNIQUE (`subscriptionid`, `borrowernumber`),
1966 CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
1967 ON DELETE CASCADE ON UPDATE CASCADE,
1968 CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`)
1969 ON DELETE CASCADE ON UPDATE CASCADE
1970 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1973 -- Table structure for table `suggestions`
1976 DROP TABLE IF EXISTS `suggestions`;
1977 CREATE TABLE `suggestions` ( -- purchase suggestions
1978 `suggestionid` int(8) NOT NULL auto_increment, -- unique identifier assigned automatically by Koha
1979 `suggestedby` int(11) NOT NULL default 0, -- borrowernumber for the person making the suggestion, foreign key linking to the borrowers table
1980 `suggesteddate` date NOT NULL default 0, -- date the suggestion was submitted
1981 `managedby` int(11) default NULL, -- borrowernumber for the librarian managing the suggestion, foreign key linking to the borrowers table
1982 `manageddate` date default NULL, -- date the suggestion was updated
1983 acceptedby INT(11) default NULL, -- borrowernumber for the librarian who accepted the suggestion, foreign key linking to the borrowers table
1984 accepteddate date default NULL, -- date the suggestion was marked as accepted
1985 rejectedby INT(11) default NULL, -- borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table
1986 rejecteddate date default NULL, -- date the suggestion was marked as rejected
1987 `STATUS` varchar(10) NOT NULL default '', -- suggestion status (ASKED, CHECKED, ACCEPTED, or REJECTED)
1988 `note` mediumtext, -- note entered on the suggestion
1989 `author` varchar(80) default NULL, -- author of the suggested item
1990 `title` varchar(255) default NULL, -- title of the suggested item
1991 `copyrightdate` smallint(6) default NULL, -- copyright date of the suggested item
1992 `publishercode` varchar(255) default NULL, -- publisher of the suggested item
1993 `date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time the suggestion was updated
1994 `volumedesc` varchar(255) default NULL,
1995 `publicationyear` smallint(6) default 0,
1996 `place` varchar(255) default NULL, -- publication place of the suggested item
1997 `isbn` varchar(30) default NULL, -- isbn of the suggested item
1998 `mailoverseeing` smallint(1) default 0,
1999 `biblionumber` int(11) default NULL, -- foreign key linking the suggestion to the biblio table after the suggestion has been ordered
2000 `reason` text, -- reason for accepting or rejecting the suggestion
2001 `patronreason` text, -- reason for making the suggestion
2002 budgetid INT(11), -- foreign key linking the suggested budget to the aqbudgets table
2003 branchcode VARCHAR(10) default NULL, -- foreign key linking the suggested branch to the branches table
2004 collectiontitle text default NULL, -- collection name for the suggested item
2005 itemtype VARCHAR(30) default NULL, -- suggested item type
2006 quantity SMALLINT(6) default NULL, -- suggested quantity to be purchased
2007 currency VARCHAR(3) default NULL, -- suggested currency for the suggested price
2008 price DECIMAL(28,6) default NULL, -- suggested price
2009 total DECIMAL(28,6) default NULL, -- suggested total cost (price*quantity updated for currency)
2010 PRIMARY KEY (`suggestionid`),
2011 KEY `suggestedby` (`suggestedby`),
2012 KEY `managedby` (`managedby`)
2013 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2016 -- Table structure for table `systempreferences`
2019 DROP TABLE IF EXISTS `systempreferences`;
2020 CREATE TABLE `systempreferences` ( -- global system preferences
2021 `variable` varchar(50) NOT NULL default '', -- system preference name
2022 `value` text, -- system preference values
2023 `options` mediumtext, -- options for multiple choice system preferences
2024 `explanation` text, -- descriptive text for the system preference
2025 `type` varchar(20) default NULL, -- type of question this preference asks (multiple choice, plain text, yes or no, etc)
2026 PRIMARY KEY (`variable`)
2027 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2030 -- Table structure for table `tags`
2033 DROP TABLE IF EXISTS `tags`;
2034 CREATE TABLE `tags` (
2035 `entry` varchar(255) NOT NULL default '',
2036 `weight` bigint(20) NOT NULL default 0,
2037 PRIMARY KEY (`entry`)
2038 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2041 -- Table structure for table `tags_all`
2044 DROP TABLE IF EXISTS `tags_all`;
2045 CREATE TABLE `tags_all` ( -- all of the tags
2046 `tag_id` int(11) NOT NULL auto_increment, -- unique id and primary key
2047 `borrowernumber` int(11) NOT NULL, -- the patron who added the tag (borrowers.borrowernumber)
2048 `biblionumber` int(11) NOT NULL, -- the bib record this tag was left on (biblio.biblionumber)
2049 `term` varchar(255) NOT NULL, -- the tag
2050 `language` int(4) default NULL, -- the language the tag was left in
2051 `date_created` datetime NOT NULL, -- the date the tag was added
2052 PRIMARY KEY (`tag_id`),
2053 KEY `tags_borrowers_fk_1` (`borrowernumber`),
2054 KEY `tags_biblionumber_fk_1` (`biblionumber`),
2055 CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`)
2056 REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2057 CONSTRAINT `tags_biblionumber_fk_1` FOREIGN KEY (`biblionumber`)
2058 REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2059 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2062 -- Table structure for table `tags_approval`
2065 DROP TABLE IF EXISTS `tags_approval`;
2066 CREATE TABLE `tags_approval` ( -- approved tags
2067 `term` varchar(255) NOT NULL, -- the tag
2068 `approved` int(1) NOT NULL default '0', -- whether the tag is approved or not (1=yes, 0=pending, -1=rejected)
2069 `date_approved` datetime default NULL, -- the date this tag was approved
2070 `approved_by` int(11) default NULL, -- the librarian who approved the tag (borrowers.borrowernumber)
2071 `weight_total` int(9) NOT NULL default '1', -- the total number of times this tag was used
2072 PRIMARY KEY (`term`),
2073 KEY `tags_approval_borrowers_fk_1` (`approved_by`),
2074 CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`)
2075 REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2076 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2079 -- Table structure for table `tags_index`
2082 DROP TABLE IF EXISTS `tags_index`;
2083 CREATE TABLE `tags_index` ( -- a weighted list of all tags and where they are used
2084 `term` varchar(255) NOT NULL, -- the tag
2085 `biblionumber` int(11) NOT NULL, -- the bib record this tag was used on (biblio.biblionumber)
2086 `weight` int(9) NOT NULL default '1', -- the number of times this term was used on this bib record
2087 PRIMARY KEY (`term`,`biblionumber`),
2088 KEY `tags_index_biblionumber_fk_1` (`biblionumber`),
2089 CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`)
2090 REFERENCES `tags_approval` (`term`) ON DELETE CASCADE ON UPDATE CASCADE,
2091 CONSTRAINT `tags_index_biblionumber_fk_1` FOREIGN KEY (`biblionumber`)
2092 REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2093 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2096 -- Table structure for table `userflags`
2099 DROP TABLE IF EXISTS `userflags`;
2100 CREATE TABLE `userflags` (
2101 `bit` int(11) NOT NULL default 0,
2102 `flag` varchar(30) default NULL,
2103 `flagdesc` varchar(255) default NULL,
2104 `defaulton` int(11) default NULL,
2106 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2109 -- Table structure for table `virtualshelves`
2112 DROP TABLE IF EXISTS `virtualshelves`;
2113 CREATE TABLE `virtualshelves` ( -- information about lists (or virtual shelves)
2114 `shelfnumber` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2115 `shelfname` varchar(255) default NULL, -- name of the list
2116 `owner` int default NULL, -- foreign key linking to the borrowers table (using borrowernumber) for the creator of this list (changed from varchar(80) to int)
2117 `category` varchar(1) default NULL, -- type of list (private [1], public [2])
2118 `sortfield` varchar(16) default NULL, -- the field this list is sorted on
2119 `lastmodified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time the list was last modified
2120 `allow_add` tinyint(1) default 0, -- permission for adding entries to list
2121 `allow_delete_own` tinyint(1) default 1, -- permission for deleting entries frm list that you added yourself
2122 `allow_delete_other` tinyint(1) default 0, -- permission for deleting entries from list that another person added
2123 PRIMARY KEY (`shelfnumber`),
2124 CONSTRAINT `virtualshelves_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL -- no cascaded delete, please see HandleDelBorrower in VirtualShelves.pm
2125 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2128 -- Table structure for table `virtualshelfcontents`
2131 DROP TABLE IF EXISTS `virtualshelfcontents`;
2132 CREATE TABLE `virtualshelfcontents` ( -- information about the titles in a list (or virtual shelf)
2133 `shelfnumber` int(11) NOT NULL default 0, -- foreign key linking to the virtualshelves table, defines the list that this record has been added to
2134 `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
2135 `flags` int(11) default NULL,
2136 `dateadded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- date and time this bib record was added to the list
2137 `borrowernumber` int, -- borrower number that created this list entry (only the first one is saved: no need for use in/as key)
2138 KEY `shelfnumber` (`shelfnumber`),
2139 KEY `biblionumber` (`biblionumber`),
2140 CONSTRAINT `virtualshelfcontents_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2141 CONSTRAINT `shelfcontents_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2142 CONSTRAINT `shelfcontents_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL -- no cascaded delete, please see HandleDelBorrower in VirtualShelves.pm
2143 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2146 -- Table structure for table `virtualshelfshares`
2149 DROP TABLE IF EXISTS `virtualshelfshares`;
2150 CREATE TABLE `virtualshelfshares` ( -- shared private lists
2151 `id` int AUTO_INCREMENT PRIMARY KEY, -- unique key
2152 `shelfnumber` int NOT NULL, -- foreign key for virtualshelves
2153 `borrowernumber` int, -- borrower that accepted access to this list
2154 `invitekey` varchar(10), -- temporary string used in accepting the invitation to access thist list; not-empty means that the invitation has not been accepted yet
2155 `sharedate` datetime, -- date of invitation or acceptance of invitation
2156 CONSTRAINT `virtualshelfshares_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2157 CONSTRAINT `virtualshelfshares_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL -- no cascaded delete, please see HandleDelBorrower in VirtualShelves.pm
2158 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2161 -- Table structure for table `z3950servers`
2164 DROP TABLE IF EXISTS `z3950servers`;
2165 CREATE TABLE `z3950servers` ( -- connection information for the Z39.50 targets used in cataloging
2166 `host` varchar(255) default NULL, -- target's host name
2167 `port` int(11) default NULL, -- port number used to connect to target
2168 `db` varchar(255) default NULL, -- target's database name
2169 `userid` varchar(255) default NULL, -- username needed to log in to target
2170 `password` varchar(255) default NULL, -- password needed to log in to target
2171 `name` mediumtext, -- name given to the target by the library
2172 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2173 `checked` smallint(6) default NULL, -- whether this target is checked by default (1 for yes, 0 for no)
2174 `rank` int(11) default NULL, -- where this target appears in the list of targets
2175 `syntax` varchar(80) default NULL, -- marc format provided by this target
2176 `timeout` int(11) NOT NULL DEFAULT '0', -- number of seconds before Koha stops trying to access this server
2177 `icon` text, -- unused in Koha
2178 `position` enum('primary','secondary','') NOT NULL default 'primary',
2179 `type` enum('zed','opensearch') NOT NULL default 'zed',
2180 `encoding` text default NULL, -- characters encoding provided by this target
2181 `description` text NOT NULL, -- unused in Koha
2183 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2186 -- Table structure for table `zebraqueue`
2189 DROP TABLE IF EXISTS `zebraqueue`;
2190 CREATE TABLE `zebraqueue` (
2191 `id` int(11) NOT NULL auto_increment,
2192 `biblio_auth_number` bigint(20) unsigned NOT NULL default '0',
2193 `operation` char(20) NOT NULL default '',
2194 `server` char(20) NOT NULL default '',
2195 `done` int(11) NOT NULL default '0',
2196 `time` timestamp NOT NULL default CURRENT_TIMESTAMP,
2198 KEY `zebraqueue_lookup` (`server`, `biblio_auth_number`, `operation`, `done`)
2199 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2202 -- Table structure for table `services_throttle`
2205 DROP TABLE IF EXISTS `services_throttle`;
2206 CREATE TABLE `services_throttle` (
2207 `service_type` varchar(10) NOT NULL default '',
2208 `service_count` varchar(45) default NULL,
2209 PRIMARY KEY (`service_type`)
2210 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2213 -- Table structure for table `language_subtag_registry`
2214 -- http://www.w3.org/International/articles/language-tags/
2218 DROP TABLE IF EXISTS language_subtag_registry;
2219 CREATE TABLE language_subtag_registry (
2221 type varchar(25), -- language-script-region-variant-extension-privateuse
2222 description varchar(25), -- only one of the possible descriptions for ease of reference, see language_descriptions for the complete list
2224 id int(11) NOT NULL auto_increment,
2226 KEY `subtag` (`subtag`)
2227 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2230 -- Table structure for table `language_rfc4646_to_iso639`
2231 -- TODO: add suppress_scripts
2232 -- this maps three letter codes defined in iso639.2 back to their
2233 -- two letter equivilents in rfc4646 (LOC maintains iso639+)
2236 DROP TABLE IF EXISTS language_rfc4646_to_iso639;
2237 CREATE TABLE language_rfc4646_to_iso639 (
2238 rfc4646_subtag varchar(25),
2239 iso639_2_code varchar(25),
2240 id int(11) NOT NULL auto_increment,
2242 KEY `rfc4646_subtag` (`rfc4646_subtag`)
2243 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2246 -- Table structure for table `language_descriptions`
2249 DROP TABLE IF EXISTS language_descriptions;
2250 CREATE TABLE language_descriptions (
2254 description varchar(255),
2255 id int(11) NOT NULL auto_increment,
2257 KEY `lang` (`lang`),
2258 KEY `subtag_type_lang` (`subtag`, `type`, `lang`)
2259 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2262 -- Table structure for table `language_script_bidi`
2263 -- bi-directional support, keyed by script subcode
2266 DROP TABLE IF EXISTS language_script_bidi;
2267 CREATE TABLE language_script_bidi (
2268 rfc4646_subtag varchar(25), -- script subtag, Arab, Hebr, etc.
2269 bidi varchar(3), -- rtl ltr
2270 KEY `rfc4646_subtag` (`rfc4646_subtag`)
2271 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2274 -- Table structure for table `language_script_mapping`
2275 -- TODO: need to map language subtags to script subtags for detection
2276 -- of bidi when script is not specified (like ar, he)
2279 DROP TABLE IF EXISTS language_script_mapping;
2280 CREATE TABLE language_script_mapping (
2281 language_subtag varchar(25),
2282 script_subtag varchar(25),
2283 KEY `language_subtag` (`language_subtag`)
2284 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2287 -- Table structure for table `permissions`
2290 DROP TABLE IF EXISTS `permissions`;
2291 CREATE TABLE `permissions` (
2292 `module_bit` int(11) NOT NULL DEFAULT 0,
2293 `code` varchar(64) DEFAULT NULL,
2294 `description` varchar(255) DEFAULT NULL,
2295 PRIMARY KEY (`module_bit`, `code`),
2296 CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`)
2297 ON DELETE CASCADE ON UPDATE CASCADE
2298 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2301 -- Table structure for table `serialitems`
2304 DROP TABLE IF EXISTS `serialitems`;
2305 CREATE TABLE `serialitems` (
2306 `itemnumber` int(11) NOT NULL,
2307 `serialid` int(11) NOT NULL,
2308 UNIQUE KEY `serialitemsidx` (`itemnumber`),
2309 KEY `serialitems_sfk_1` (`serialid`),
2310 CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE,
2311 CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
2312 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2315 -- Table structure for table `user_permissions`
2318 DROP TABLE IF EXISTS `user_permissions`;
2319 CREATE TABLE `user_permissions` (
2320 `borrowernumber` int(11) NOT NULL DEFAULT 0,
2321 `module_bit` int(11) NOT NULL DEFAULT 0,
2322 `code` varchar(64) DEFAULT NULL,
2323 CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
2324 ON DELETE CASCADE ON UPDATE CASCADE,
2325 CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`)
2326 ON DELETE CASCADE ON UPDATE CASCADE
2327 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2330 -- Table structure for table `tmp_holdsqueue`
2333 DROP TABLE IF EXISTS `tmp_holdsqueue`;
2334 CREATE TABLE `tmp_holdsqueue` (
2335 `biblionumber` int(11) default NULL,
2336 `itemnumber` int(11) default NULL,
2337 `barcode` varchar(20) default NULL,
2338 `surname` mediumtext NOT NULL,
2341 `borrowernumber` int(11) NOT NULL,
2342 `cardnumber` varchar(16) default NULL,
2343 `reservedate` date default NULL,
2345 `itemcallnumber` varchar(255) default NULL,
2346 `holdingbranch` varchar(10) default NULL,
2347 `pickbranch` varchar(10) default NULL,
2349 `item_level_request` tinyint(4) NOT NULL default 0
2350 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2353 -- Table structure for table `message_queue`
2356 DROP TABLE IF EXISTS `message_queue`;
2357 CREATE TABLE `message_queue` (
2358 `message_id` int(11) NOT NULL auto_increment,
2359 `borrowernumber` int(11) default NULL,
2362 `metadata` text DEFAULT NULL,
2363 `letter_code` varchar(64) DEFAULT NULL,
2364 `message_transport_type` varchar(20) NOT NULL,
2365 `status` enum('sent','pending','failed','deleted') NOT NULL default 'pending',
2366 `time_queued` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2367 `to_address` mediumtext,
2368 `from_address` mediumtext,
2369 `content_type` text,
2370 KEY `message_id` (`message_id`),
2371 KEY `borrowernumber` (`borrowernumber`),
2372 KEY `message_transport_type` (`message_transport_type`),
2373 CONSTRAINT `messageq_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2374 CONSTRAINT `messageq_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE RESTRICT ON UPDATE CASCADE
2375 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2378 -- Table structure for table `message_transport_types`
2381 DROP TABLE IF EXISTS `message_transport_types`;
2382 CREATE TABLE `message_transport_types` (
2383 `message_transport_type` varchar(20) NOT NULL,
2384 PRIMARY KEY (`message_transport_type`)
2385 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2388 -- Table structure for table `message_attributes`
2391 DROP TABLE IF EXISTS `message_attributes`;
2392 CREATE TABLE `message_attributes` (
2393 `message_attribute_id` int(11) NOT NULL auto_increment,
2394 `message_name` varchar(40) NOT NULL default '',
2395 `takes_days` tinyint(1) NOT NULL default '0',
2396 PRIMARY KEY (`message_attribute_id`),
2397 UNIQUE KEY `message_name` (`message_name`)
2398 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2401 -- Table structure for table `message_transports`
2404 DROP TABLE IF EXISTS `message_transports`;
2405 CREATE TABLE `message_transports` (
2406 `message_attribute_id` int(11) NOT NULL,
2407 `message_transport_type` varchar(20) NOT NULL,
2408 `is_digest` tinyint(1) NOT NULL default '0',
2409 `letter_module` varchar(20) NOT NULL default '',
2410 `letter_code` varchar(20) NOT NULL default '',
2411 `branchcode` varchar(10) NOT NULL default '',
2412 PRIMARY KEY (`message_attribute_id`,`message_transport_type`,`is_digest`),
2413 KEY `message_transport_type` (`message_transport_type`),
2414 KEY `letter_module` (`letter_module`,`letter_code`),
2415 CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2416 CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
2417 CONSTRAINT `message_transports_ibfk_3` FOREIGN KEY (`letter_module`, `letter_code`, `branchcode`) REFERENCES `letter` (`module`, `code`, `branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2418 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2421 -- Table structure for table `borrower_message_preferences`
2424 DROP TABLE IF EXISTS `borrower_message_preferences`;
2425 CREATE TABLE `borrower_message_preferences` (
2426 `borrower_message_preference_id` int(11) NOT NULL auto_increment,
2427 `borrowernumber` int(11) default NULL,
2428 `categorycode` varchar(10) default NULL,
2429 `message_attribute_id` int(11) default '0',
2430 `days_in_advance` int(11) default '0',
2431 `wants_digest` tinyint(1) NOT NULL default '0',
2432 PRIMARY KEY (`borrower_message_preference_id`),
2433 KEY `borrowernumber` (`borrowernumber`),
2434 KEY `categorycode` (`categorycode`),
2435 KEY `message_attribute_id` (`message_attribute_id`),
2436 CONSTRAINT `borrower_message_preferences_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2437 CONSTRAINT `borrower_message_preferences_ibfk_2` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2438 CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
2439 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2442 -- Table structure for table `borrower_message_transport_preferences`
2445 DROP TABLE IF EXISTS `borrower_message_transport_preferences`;
2446 CREATE TABLE `borrower_message_transport_preferences` (
2447 `borrower_message_preference_id` int(11) NOT NULL default '0',
2448 `message_transport_type` varchar(20) NOT NULL default '0',
2449 PRIMARY KEY (`borrower_message_preference_id`,`message_transport_type`),
2450 KEY `message_transport_type` (`message_transport_type`),
2451 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,
2452 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
2453 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2456 -- Table structure for the table branch_transfer_limits
2459 DROP TABLE IF EXISTS `branch_transfer_limits`;
2460 CREATE TABLE branch_transfer_limits (
2461 limitId int(8) NOT NULL auto_increment,
2462 toBranch varchar(10) NOT NULL,
2463 fromBranch varchar(10) NOT NULL,
2464 itemtype varchar(10) NULL,
2465 ccode varchar(10) NULL,
2466 PRIMARY KEY (limitId)
2467 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2470 -- Table structure for table `item_circulation_alert_preferences`
2473 DROP TABLE IF EXISTS `item_circulation_alert_preferences`;
2474 CREATE TABLE `item_circulation_alert_preferences` (
2475 `id` int(11) NOT NULL auto_increment,
2476 `branchcode` varchar(10) NOT NULL,
2477 `categorycode` varchar(10) NOT NULL,
2478 `item_type` varchar(10) NOT NULL,
2479 `notification` varchar(16) NOT NULL,
2481 KEY `branchcode` (`branchcode`,`categorycode`,`item_type`, `notification`)
2482 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2485 -- Table structure for table `messages`
2487 DROP TABLE IF EXISTS `messages`;
2488 CREATE TABLE `messages` ( -- circulation messages left via the patron's check out screen
2489 `message_id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2490 `borrowernumber` int(11) NOT NULL, -- foreign key linking this message to the borrowers table
2491 `branchcode` varchar(10) default NULL, -- foreign key linking the message to the branches table
2492 `message_type` varchar(1) NOT NULL, -- whether the message is for the librarians (L) or the patron (B)
2493 `message` text NOT NULL, -- the text of the message
2494 `message_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- the date and time the message was written
2495 PRIMARY KEY (`message_id`)
2496 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2499 -- Table structure for table `accountlines`
2502 DROP TABLE IF EXISTS `accountlines`;
2503 CREATE TABLE `accountlines` (
2504 `accountlines_id` int(11) NOT NULL AUTO_INCREMENT,
2505 `borrowernumber` int(11) NOT NULL default 0,
2506 `accountno` smallint(6) NOT NULL default 0,
2507 `itemnumber` int(11) default NULL,
2508 `date` date default NULL,
2509 `amount` decimal(28,6) default NULL,
2510 `description` mediumtext,
2511 `dispute` mediumtext,
2512 `accounttype` varchar(5) default NULL,
2513 `amountoutstanding` decimal(28,6) default NULL,
2514 `lastincrement` decimal(28,6) default NULL,
2515 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2516 `notify_id` int(11) NOT NULL default 0,
2517 `notify_level` int(2) NOT NULL default 0,
2518 `note` text NULL default NULL,
2519 `manager_id` int(11) NULL,
2520 PRIMARY KEY (`accountlines_id`),
2521 KEY `acctsborridx` (`borrowernumber`),
2522 KEY `timeidx` (`timestamp`),
2523 KEY `itemnumber` (`itemnumber`),
2524 CONSTRAINT `accountlines_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2525 CONSTRAINT `accountlines_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL
2526 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2529 -- Table structure for table `accountoffsets`
2532 DROP TABLE IF EXISTS `accountoffsets`;
2533 CREATE TABLE `accountoffsets` (
2534 `borrowernumber` int(11) NOT NULL default 0,
2535 `accountno` smallint(6) NOT NULL default 0,
2536 `offsetaccount` smallint(6) NOT NULL default 0,
2537 `offsetamount` decimal(28,6) default NULL,
2538 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2539 CONSTRAINT `accountoffsets_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2540 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2543 -- Table structure for table `action_logs`
2546 DROP TABLE IF EXISTS `action_logs`;
2547 CREATE TABLE `action_logs` ( -- logs of actions taken in Koha (requires that the logs be turned on)
2548 `action_id` int(11) NOT NULL auto_increment, -- unique identifier for each action
2549 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time the action took place
2550 `user` int(11) NOT NULL default 0, -- the staff member who performed the action (borrowers.borrowernumber)
2551 `module` text, -- the module this action was taken against
2552 `action` text, -- the action (includes things like DELETED, ADDED, MODIFY, etc)
2553 `object` int(11) default NULL, -- the object that the action was taken against (could be a borrowernumber, itemnumber, etc)
2554 `info` text, -- information about the action (usually includes SQL statement)
2555 PRIMARY KEY (`action_id`),
2556 KEY (`timestamp`,`user`)
2557 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2560 -- Table structure for table `alert`
2563 DROP TABLE IF EXISTS `alert`;
2564 CREATE TABLE `alert` (
2565 `alertid` int(11) NOT NULL auto_increment,
2566 `borrowernumber` int(11) NOT NULL default 0,
2567 `type` varchar(10) NOT NULL default '',
2568 `externalid` varchar(20) NOT NULL default '',
2569 PRIMARY KEY (`alertid`),
2570 KEY `borrowernumber` (`borrowernumber`),
2571 KEY `type` (`type`,`externalid`)
2572 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2575 -- Table structure for table `aqbasketgroups`
2578 DROP TABLE IF EXISTS `aqbasketgroups`;
2579 CREATE TABLE `aqbasketgroups` (
2580 `id` int(11) NOT NULL auto_increment,
2581 `name` varchar(50) default NULL,
2582 `closed` tinyint(1) default NULL,
2583 `booksellerid` int(11) NOT NULL,
2584 `deliveryplace` varchar(10) default NULL,
2585 `freedeliveryplace` text default NULL,
2586 `deliverycomment` varchar(255) default NULL,
2587 `billingplace` varchar(10) default NULL,
2589 KEY `booksellerid` (`booksellerid`),
2590 CONSTRAINT `aqbasketgroups_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
2591 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2594 -- Table structure for table `aqbasket`
2597 DROP TABLE IF EXISTS `aqbasket`;
2598 CREATE TABLE `aqbasket` ( -- stores data about baskets in acquisitions
2599 `basketno` int(11) NOT NULL auto_increment, -- primary key, Koha defined number
2600 `basketname` varchar(50) default NULL, -- name given to the basket at creation
2601 `note` mediumtext, -- the internal note added at basket creation
2602 `booksellernote` mediumtext, -- the vendor note added at basket creation
2603 `contractnumber` int(11), -- links this basket to the aqcontract table (aqcontract.contractnumber)
2604 `creationdate` date default NULL, -- the date the basket was created
2605 `closedate` date default NULL, -- the date the basket was closed
2606 `booksellerid` int(11) NOT NULL default 1, -- the Koha assigned ID for the vendor (aqbooksellers.id)
2607 `authorisedby` varchar(10) default NULL, -- the borrowernumber of the person who created the basket
2608 `booksellerinvoicenumber` mediumtext, -- appears to always be NULL
2609 `basketgroupid` int(11), -- links this basket to its group (aqbasketgroups.id)
2610 `deliveryplace` varchar(10) default NULL, -- basket delivery place
2611 `billingplace` varchar(10) default NULL, -- basket billing place
2612 PRIMARY KEY (`basketno`),
2613 KEY `booksellerid` (`booksellerid`),
2614 KEY `basketgroupid` (`basketgroupid`),
2615 KEY `contractnumber` (`contractnumber`),
2616 CONSTRAINT `aqbasket_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE,
2617 CONSTRAINT `aqbasket_ibfk_2` FOREIGN KEY (`contractnumber`) REFERENCES `aqcontract` (`contractnumber`),
2618 CONSTRAINT `aqbasket_ibfk_3` FOREIGN KEY (`basketgroupid`) REFERENCES `aqbasketgroups` (`id`) ON UPDATE CASCADE
2619 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2622 -- Table structure for table `aqbooksellers`
2625 DROP TABLE IF EXISTS `aqbooksellers`;
2626 CREATE TABLE `aqbooksellers` ( -- information about the vendors listed in acquisitions
2627 `id` int(11) NOT NULL auto_increment, -- primary key and unique identifier assigned by Koha
2628 `name` mediumtext NOT NULL, -- vendor name
2629 `address1` mediumtext, -- first line of vendor physical address
2630 `address2` mediumtext, -- second line of vendor physical address
2631 `address3` mediumtext, -- third line of vendor physical address
2632 `address4` mediumtext, -- fourth line of vendor physical address
2633 `phone` varchar(30) default NULL, -- vendor phone number
2634 `accountnumber` mediumtext, -- unused in Koha
2635 `othersupplier` mediumtext, -- unused in Koha
2636 `currency` varchar(3) NOT NULL default '', -- unused in Koha
2637 `booksellerfax` mediumtext, -- vendor fax number
2638 `notes` mediumtext, -- order notes
2639 `bookselleremail` mediumtext, -- vendor email
2640 `booksellerurl` mediumtext, -- unused in Koha
2641 `contact` varchar(100) default NULL, -- name of contact at vendor
2642 `postal` mediumtext, -- vendor postal address (all lines)
2643 `url` varchar(255) default NULL, -- vendor web address
2644 `contpos` varchar(100) default NULL, -- contact person's position
2645 `contphone` varchar(100) default NULL, -- contact's phone number
2646 `contfax` varchar(100) default NULL, -- contact's fax number
2647 `contaltphone` varchar(100) default NULL, -- contact's alternate phone number
2648 `contemail` varchar(100) default NULL, -- contact's email address
2649 `contnotes` mediumtext, -- notes related to the contact
2650 `active` tinyint(4) default NULL, -- is this vendor active (1 for yes, 0 for no)
2651 `listprice` varchar(10) default NULL, -- currency code for list prices
2652 `invoiceprice` varchar(10) default NULL, -- currency code for invoice prices
2653 `gstreg` tinyint(4) default NULL, -- is your library charged tax (1 for yes, 0 for no)
2654 `listincgst` tinyint(4) default NULL, -- is tax included in list prices (1 for yes, 0 for no)
2655 `invoiceincgst` tinyint(4) default NULL, -- is tax included in invoice prices (1 for yes, 0 for no)
2656 `gstrate` decimal(6,4) default NULL, -- the tax rate the library is charged
2657 `discount` float(6,4) default NULL, -- discount offered on all items ordered from this vendor
2658 `fax` varchar(50) default NULL, -- vendor fax number
2659 deliverytime int(11) default NULL, -- vendor delivery time
2661 KEY `listprice` (`listprice`),
2662 KEY `invoiceprice` (`invoiceprice`),
2663 CONSTRAINT `aqbooksellers_ibfk_1` FOREIGN KEY (`listprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE,
2664 CONSTRAINT `aqbooksellers_ibfk_2` FOREIGN KEY (`invoiceprice`) REFERENCES `currency` (`currency`) ON DELETE CASCADE ON UPDATE CASCADE
2665 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2668 -- Table structure for table `aqbudgets`
2671 DROP TABLE IF EXISTS `aqbudgets`;
2672 CREATE TABLE `aqbudgets` ( -- information related to Funds
2673 `budget_id` int(11) NOT NULL auto_increment, -- primary key and unique number assigned to each fund by Koha
2674 `budget_parent_id` int(11) default NULL, -- if this fund is a child of another this will include the parent id (aqbudgets.budget_id)
2675 `budget_code` varchar(30) default NULL, -- code assigned to the fund by the user
2676 `budget_name` varchar(80) default NULL, -- name assigned to the fund by the user
2677 `budget_branchcode` varchar(10) default NULL, -- branch that this fund belongs to (branches.branchcode)
2678 `budget_amount` decimal(28,6) NULL default '0.00', -- total amount for this fund
2679 `budget_encumb` decimal(28,6) NULL default '0.00', -- not used in the code
2680 `budget_expend` decimal(28,6) NULL default '0.00', -- not used in the code
2681 `budget_notes` mediumtext, -- notes related to this fund
2682 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this fund was last touched (created or modified)
2683 `budget_period_id` int(11) default NULL, -- id of the budget that this fund belongs to (aqbudgetperiods.budget_period_id)
2684 `sort1_authcat` varchar(80) default NULL, -- statistical category for this fund
2685 `sort2_authcat` varchar(80) default NULL, -- second statistical category for this fund
2686 `budget_owner_id` int(11) default NULL, -- borrowernumber of the person who owns this fund (borrowers.borrowernumber)
2687 `budget_permission` int(1) default '0', -- level of permission for this fund (used only by the owner, only by the library, or anyone)
2688 PRIMARY KEY (`budget_id`)
2689 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2692 -- Table structure for table aqbudgetborrowers
2695 DROP TABLE IF EXISTS aqbudgetborrowers;
2696 CREATE TABLE aqbudgetborrowers (
2697 budget_id int(11) NOT NULL,
2698 borrowernumber int(11) NOT NULL,
2699 PRIMARY KEY (budget_id, borrowernumber),
2700 CONSTRAINT aqbudgetborrowers_ibfk_1 FOREIGN KEY (budget_id)
2701 REFERENCES aqbudgets (budget_id)
2702 ON DELETE CASCADE ON UPDATE CASCADE,
2703 CONSTRAINT aqbudgetborrowers_ibfk_2 FOREIGN KEY (borrowernumber)
2704 REFERENCES borrowers (borrowernumber)
2705 ON DELETE CASCADE ON UPDATE CASCADE
2706 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2709 -- Table structure for table `aqbudgetperiods`
2713 DROP TABLE IF EXISTS `aqbudgetperiods`;
2714 CREATE TABLE `aqbudgetperiods` ( -- information related to Budgets
2715 `budget_period_id` int(11) NOT NULL auto_increment, -- primary key and unique number assigned by Koha
2716 `budget_period_startdate` date NOT NULL, -- date when the budget starts
2717 `budget_period_enddate` date NOT NULL, -- date when the budget ends
2718 `budget_period_active` tinyint(1) default '0', -- whether this budget is active or not (1 for yes, 0 for no)
2719 `budget_period_description` mediumtext, -- description assigned to this budget
2720 `budget_period_total` decimal(28,6), -- total amount available in this budget
2721 `budget_period_locked` tinyint(1) default NULL, -- whether this budget is locked or not (1 for yes, 0 for no)
2722 `sort1_authcat` varchar(10) default NULL, -- statistical category for this budget
2723 `sort2_authcat` varchar(10) default NULL, -- second statistical category for this budget
2724 PRIMARY KEY (`budget_period_id`)
2725 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2728 -- Table structure for table `aqbudgets_planning`
2731 DROP TABLE IF EXISTS `aqbudgets_planning`;
2732 CREATE TABLE `aqbudgets_planning` (
2733 `plan_id` int(11) NOT NULL auto_increment,
2734 `budget_id` int(11) NOT NULL,
2735 `budget_period_id` int(11) NOT NULL,
2736 `estimated_amount` decimal(28,6) default NULL,
2737 `authcat` varchar(30) NOT NULL,
2738 `authvalue` varchar(30) NOT NULL,
2739 `display` tinyint(1) DEFAULT 1,
2740 PRIMARY KEY (`plan_id`),
2741 CONSTRAINT `aqbudgets_planning_ifbk_1` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE
2742 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2745 -- Table structure for table 'aqcontract'
2748 DROP TABLE IF EXISTS `aqcontract`;
2749 CREATE TABLE `aqcontract` (
2750 `contractnumber` int(11) NOT NULL auto_increment,
2751 `contractstartdate` date default NULL,
2752 `contractenddate` date default NULL,
2753 `contractname` varchar(50) default NULL,
2754 `contractdescription` mediumtext,
2755 `booksellerid` int(11) not NULL,
2756 PRIMARY KEY (`contractnumber`),
2757 CONSTRAINT `booksellerid_fk1` FOREIGN KEY (`booksellerid`)
2758 REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
2759 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
2762 -- Table structure for table `aqorderdelivery`
2765 DROP TABLE IF EXISTS `aqorderdelivery`;
2766 CREATE TABLE `aqorderdelivery` (
2767 `ordernumber` date default NULL,
2768 `deliverynumber` smallint(6) NOT NULL default 0,
2769 `deliverydate` varchar(18) default NULL,
2770 `qtydelivered` smallint(6) default NULL,
2771 `deliverycomments` mediumtext
2772 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2775 -- Table structure for table `aqorders`
2778 DROP TABLE IF EXISTS `aqorders`;
2779 CREATE TABLE `aqorders` ( -- information related to the basket line items
2780 `ordernumber` int(11) NOT NULL auto_increment, -- primary key and unique identifier assigned by Koha to each line
2781 `biblionumber` int(11) default NULL, -- links the order to the biblio being ordered (biblio.biblionumber)
2782 `entrydate` date default NULL, -- the date the bib was added to the basket
2783 `quantity` smallint(6) default NULL, -- the quantity ordered
2784 `currency` varchar(3) default NULL, -- the currency used for the purchase
2785 `listprice` decimal(28,6) default NULL, -- the vendor price for this line item
2786 `totalamount` decimal(28,6) default NULL, -- not used? always NULL
2787 `datereceived` date default NULL, -- the date this order was received
2788 invoiceid int(11) default NULL, -- id of invoice
2789 `freight` decimal(28,6) default NULL, -- shipping costs (not used)
2790 `unitprice` decimal(28,6) default NULL, -- the actual cost entered when receiving this line item
2791 `quantityreceived` smallint(6) NOT NULL default 0, -- the quantity that have been received so far
2792 `cancelledby` varchar(10) default NULL, -- not used? always NULL
2793 `datecancellationprinted` date default NULL, -- the date the line item was deleted
2794 `notes` mediumtext, -- notes related to this order line
2795 `supplierreference` mediumtext, -- not used? always NULL
2796 `purchaseordernumber` mediumtext, -- not used? always NULL
2797 `basketno` int(11) default NULL, -- links this order line to a specific basket (aqbasket.basketno)
2798 `biblioitemnumber` int(11) default NULL, -- links this order line the biblioitems table (biblioitems.biblioitemnumber)
2799 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order line was last modified
2800 `rrp` decimal(13,2) default NULL, -- the replacement cost for this line item
2801 `ecost` decimal(13,2) default NULL, -- the estimated cost for this line item
2802 `gstrate` decimal(6,4) default NULL, -- the tax rate for this line item
2803 `discount` float(6,4) default NULL, -- the discount for this line item
2804 `budget_id` int(11) NOT NULL, -- the fund this order goes against (aqbudgets.budget_id)
2805 `budgetgroup_id` int(11) NOT NULL, -- not used? always zero
2806 `budgetdate` date default NULL, -- not used? always NULL
2807 `sort1` varchar(80) default NULL, -- statistical field
2808 `sort2` varchar(80) default NULL, -- second statistical field
2809 `sort1_authcat` varchar(10) default NULL,
2810 `sort2_authcat` varchar(10) default NULL,
2811 `uncertainprice` tinyint(1), -- was this price uncertain (1 for yes, 0 for no)
2812 `claims_count` int(11) default 0, -- count of claim letters generated
2813 `claimed_date` date default NULL, -- last date a claim was generated
2814 `subscriptionid` int(11) default NULL, -- links this order line to a subscription (subscription.subscriptionid)
2815 parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2816 PRIMARY KEY (`ordernumber`),
2817 KEY `basketno` (`basketno`),
2818 KEY `biblionumber` (`biblionumber`),
2819 KEY `budget_id` (`budget_id`),
2820 CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2821 CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
2822 CONSTRAINT aqorders_ibfk_3 FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE SET NULL ON UPDATE CASCADE,
2823 CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
2824 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2828 -- Table structure for table `aqorders_items`
2831 DROP TABLE IF EXISTS `aqorders_items`;
2832 CREATE TABLE `aqorders_items` ( -- information on items entered in the acquisitions process
2833 `ordernumber` int(11) NOT NULL, -- the order this item is attached to (aqorders.ordernumber)
2834 `itemnumber` int(11) NOT NULL, -- the item number for this item (items.itemnumber)
2835 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order item was last touched
2836 PRIMARY KEY (`itemnumber`),
2837 KEY `ordernumber` (`ordernumber`),
2838 CONSTRAINT aqorders_items_ibfk_1 FOREIGN KEY (ordernumber) REFERENCES aqorders (ordernumber) ON DELETE CASCADE ON UPDATE CASCADE
2839 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2843 -- Table structure for table aqinvoices
2846 DROP TABLE IF EXISTS aqinvoices;
2847 CREATE TABLE aqinvoices (
2848 invoiceid int(11) NOT NULL AUTO_INCREMENT, -- ID of the invoice, primary key
2849 invoicenumber mediumtext NOT NULL, -- Name of invoice
2850 booksellerid int(11) NOT NULL, -- foreign key to aqbooksellers
2851 shipmentdate date default NULL, -- date of shipment
2852 billingdate date default NULL, -- date of billing
2853 closedate date default NULL, -- invoice close date, NULL means the invoice is open
2854 shipmentcost decimal(28,6) default NULL, -- shipment cost
2855 shipmentcost_budgetid int(11) default NULL, -- foreign key to aqbudgets, link the shipment cost to a budget
2856 PRIMARY KEY (invoiceid),
2857 CONSTRAINT aqinvoices_fk_aqbooksellerid FOREIGN KEY (booksellerid) REFERENCES aqbooksellers (id) ON DELETE CASCADE ON UPDATE CASCADE,
2858 CONSTRAINT aqinvoices_fk_shipmentcost_budgetid FOREIGN KEY (shipmentcost_budgetid) REFERENCES aqbudgets (budget_id) ON DELETE SET NULL ON UPDATE CASCADE
2859 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2863 -- Table structure for table `fieldmapping`
2866 DROP TABLE IF EXISTS `fieldmapping`;
2867 CREATE TABLE `fieldmapping` ( -- koha to keyword mapping
2868 `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2869 `field` varchar(255) NOT NULL, -- keyword to be mapped to (ex. subtitle)
2870 `frameworkcode` char(4) NOT NULL default '', -- foreign key from the biblio_framework table to link this mapping to a specific framework
2871 `fieldcode` char(3) NOT NULL, -- marc field number to map to this keyword
2872 `subfieldcode` char(1) NOT NULL, -- marc subfield associated with the fieldcode to map to this keyword
2874 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2877 -- Table structure for table `transport_cost`
2880 DROP TABLE IF EXISTS transport_cost;
2881 CREATE TABLE transport_cost (
2882 frombranch varchar(10) NOT NULL,
2883 tobranch varchar(10) NOT NULL,
2884 cost decimal(6,2) NOT NULL,
2885 disable_transfer tinyint(1) NOT NULL DEFAULT 0,
2886 CHECK ( frombranch <> tobranch ), -- a dud check, mysql does not support that
2887 PRIMARY KEY (frombranch, tobranch),
2888 CONSTRAINT transport_cost_ibfk_1 FOREIGN KEY (frombranch) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE,
2889 CONSTRAINT transport_cost_ibfk_2 FOREIGN KEY (tobranch) REFERENCES branches (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2890 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2893 -- Table structure for table `biblioimages`
2896 DROP TABLE IF EXISTS `biblioimages`;
2898 CREATE TABLE `biblioimages` (
2899 `imagenumber` int(11) NOT NULL AUTO_INCREMENT,
2900 `biblionumber` int(11) NOT NULL,
2901 `mimetype` varchar(15) NOT NULL,
2902 `imagefile` mediumblob NOT NULL,
2903 `thumbnail` mediumblob NOT NULL,
2904 PRIMARY KEY (`imagenumber`),
2905 CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
2906 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2909 -- Table structure for table `social_data`
2912 DROP TABLE IF EXISTS `social_data`;
2913 CREATE TABLE IF NOT EXISTS `social_data` (
2916 `num_critics_pro` INT,
2917 `num_quotations` INT,
2919 `score_avg` DECIMAL(5,2),
2921 PRIMARY KEY (`isbn`)
2922 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2925 -- 'Ratings' table. This tracks the star ratings set by borrowers.
2928 DROP TABLE IF EXISTS ratings;
2929 CREATE TABLE ratings ( -- information related to the star ratings in the OPAC
2930 borrowernumber int(11) NOT NULL, -- the borrowernumber of the patron who left this rating (borrowers.borrowernumber)
2931 biblionumber int(11) NOT NULL, -- the biblio this rating is for (biblio.biblionumber)
2932 rating_value tinyint(1) NOT NULL, -- the rating, from 1 to 5
2933 timestamp timestamp NOT NULL default CURRENT_TIMESTAMP,
2934 PRIMARY KEY (borrowernumber,biblionumber),
2935 CONSTRAINT ratings_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE,
2936 CONSTRAINT ratings_ibfk_2 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE
2937 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2940 -- Table structure for table `quotes`
2943 DROP TABLE IF EXISTS quotes;
2944 CREATE TABLE `quotes` (
2945 `id` int(11) NOT NULL AUTO_INCREMENT,
2946 `source` text DEFAULT NULL,
2947 `text` mediumtext NOT NULL,
2948 `timestamp` datetime NOT NULL,
2950 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2953 -- Table structure for table categories_branches
2956 DROP TABLE IF EXISTS categories_branches;
2957 CREATE TABLE categories_branches( -- association table between categories and branches
2958 categorycode VARCHAR(10),
2959 branchcode VARCHAR(10),
2960 FOREIGN KEY (categorycode) REFERENCES categories(categorycode) ON DELETE CASCADE,
2961 FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE
2962 ) ENGINE=INNODB DEFAULT CHARSET=utf8;
2965 -- Table structure for table authorised_values_branches
2968 DROP TABLE IF EXISTS authorised_values_branches;
2969 CREATE TABLE authorised_values_branches( -- association table between authorised_values and branches
2971 branchcode VARCHAR(10),
2972 FOREIGN KEY (av_id) REFERENCES authorised_values(id) ON DELETE CASCADE,
2973 FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE
2974 ) ENGINE=INNODB DEFAULT CHARSET=utf8;
2978 -- Table structure for table borrower_attribute_types_branches
2981 DROP TABLE IF EXISTS borrower_attribute_types_branches;
2982 CREATE TABLE borrower_attribute_types_branches( -- association table between borrower_attribute_types and branches
2983 bat_code VARCHAR(10),
2984 b_branchcode VARCHAR(10),
2985 FOREIGN KEY (bat_code) REFERENCES borrower_attribute_types(code) ON DELETE CASCADE,
2986 FOREIGN KEY (b_branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE
2987 ) ENGINE=INNODB DEFAULT CHARSET=utf8;
2990 -- Table structure for table `borrower_modifications`
2993 CREATE TABLE IF NOT EXISTS `borrower_modifications` (
2994 `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
2995 `verification_token` varchar(255) NOT NULL DEFAULT '',
2996 `borrowernumber` int(11) NOT NULL DEFAULT '0',
2997 `cardnumber` varchar(16) DEFAULT NULL,
2998 `surname` mediumtext,
3001 `othernames` mediumtext,
3003 `streetnumber` varchar(10) DEFAULT NULL,
3004 `streettype` varchar(50) DEFAULT NULL,
3005 `address` mediumtext,
3009 `zipcode` varchar(25) DEFAULT NULL,
3013 `mobile` varchar(50) DEFAULT NULL,
3017 `B_streetnumber` varchar(10) DEFAULT NULL,
3018 `B_streettype` varchar(50) DEFAULT NULL,
3019 `B_address` varchar(100) DEFAULT NULL,
3021 `B_city` mediumtext,
3023 `B_zipcode` varchar(25) DEFAULT NULL,
3026 `B_phone` mediumtext,
3027 `dateofbirth` date DEFAULT NULL,
3028 `branchcode` varchar(10) DEFAULT NULL,
3029 `categorycode` varchar(10) DEFAULT NULL,
3030 `dateenrolled` date DEFAULT NULL,
3031 `dateexpiry` date DEFAULT NULL,
3032 `gonenoaddress` tinyint(1) DEFAULT NULL,
3033 `lost` tinyint(1) DEFAULT NULL,
3034 `debarred` date DEFAULT NULL,
3035 `debarredcomment` varchar(255) DEFAULT NULL,
3036 `contactname` mediumtext,
3037 `contactfirstname` text,
3038 `contacttitle` text,
3039 `guarantorid` int(11) DEFAULT NULL,
3040 `borrowernotes` mediumtext,
3041 `relationship` varchar(100) DEFAULT NULL,
3042 `ethnicity` varchar(50) DEFAULT NULL,
3043 `ethnotes` varchar(255) DEFAULT NULL,
3044 `sex` varchar(1) DEFAULT NULL,
3045 `password` varchar(30) DEFAULT NULL,
3046 `flags` int(11) DEFAULT NULL,
3047 `userid` varchar(75) DEFAULT NULL,
3048 `opacnote` mediumtext,
3049 `contactnote` varchar(255) DEFAULT NULL,
3050 `sort1` varchar(80) DEFAULT NULL,
3051 `sort2` varchar(80) DEFAULT NULL,
3052 `altcontactfirstname` varchar(255) DEFAULT NULL,
3053 `altcontactsurname` varchar(255) DEFAULT NULL,
3054 `altcontactaddress1` varchar(255) DEFAULT NULL,
3055 `altcontactaddress2` varchar(255) DEFAULT NULL,
3056 `altcontactaddress3` varchar(255) DEFAULT NULL,
3057 `altcontactstate` text,
3058 `altcontactzipcode` varchar(50) DEFAULT NULL,
3059 `altcontactcountry` text,
3060 `altcontactphone` varchar(50) DEFAULT NULL,
3061 `smsalertnumber` varchar(50) DEFAULT NULL,
3062 `privacy` int(11) DEFAULT NULL,
3063 PRIMARY KEY (`verification_token`,`borrowernumber`),
3064 KEY `verification_token` (`verification_token`),
3065 KEY `borrowernumber` (`borrowernumber`)
3066 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3069 -- Table structure for table linktracker
3070 -- This stores clicks to external links
3073 DROP TABLE IF EXISTS linktracker;
3074 CREATE TABLE linktracker (
3075 id int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
3076 biblionumber int(11) DEFAULT NULL, -- biblionumber of the record the link is from
3077 itemnumber int(11) DEFAULT NULL, -- itemnumber if applicable that the link was from
3078 borrowernumber int(11) DEFAULT NULL, -- borrowernumber who clicked the link
3079 url text, -- the link itself
3080 timeclicked datetime DEFAULT NULL, -- the date and time the link was clicked
3082 KEY bibidx (biblionumber),
3083 KEY itemidx (itemnumber),
3084 KEY borridx (borrowernumber),
3085 KEY dateidx (timeclicked)
3086 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3089 -- Table structure for table 'plugin_data'
3092 CREATE TABLE IF NOT EXISTS plugin_data (
3093 plugin_class varchar(255) NOT NULL,
3094 plugin_key varchar(255) NOT NULL,
3096 PRIMARY KEY (plugin_class,plugin_key)
3097 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3099 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
3100 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
3101 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
3102 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
3103 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
3104 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
3105 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
3106 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;