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