Main Koha release repository https://koha-community.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

3774 lines
191 KiB

-- MySQL dump 10.9
--
-- Host: localhost Database: koha30test
-- ------------------------------------------------------
-- Server version 4.1.22
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `auth_header`
--
DROP TABLE IF EXISTS `auth_header`;
CREATE TABLE `auth_header` (
`authid` bigint(20) unsigned NOT NULL auto_increment,
`authtypecode` varchar(10) NOT NULL default '',
`datecreated` date default NULL,
`modification_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`origincode` varchar(20) default NULL,
`authtrees` mediumtext,
`marc` blob,
`linkid` bigint(20) default NULL,
`marcxml` longtext NOT NULL,
PRIMARY KEY (`authid`),
KEY `origincode` (`origincode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `auth_subfield_structure`
--
DROP TABLE IF EXISTS `auth_subfield_structure`;
CREATE TABLE `auth_subfield_structure` (
`authtypecode` varchar(10) NOT NULL default '',
`tagfield` varchar(3) NOT NULL default '',
`tagsubfield` varchar(1) NOT NULL default '',
`liblibrarian` varchar(255) NOT NULL default '',
`libopac` varchar(255) NOT NULL default '',
`repeatable` tinyint(4) NOT NULL default 0,
`mandatory` tinyint(4) NOT NULL default 0,
`tab` tinyint(1) default NULL,
`authorised_value` varchar(10) default NULL,
`value_builder` varchar(80) default NULL,
`seealso` varchar(255) default NULL,
`isurl` tinyint(1) default NULL,
`hidden` tinyint(3) NOT NULL default 0,
`linkid` tinyint(1) NOT NULL default 0,
`kohafield` varchar(45) NULL default '',
`frameworkcode` varchar(10) NOT NULL default '',
`defaultvalue` TEXT DEFAULT '',
PRIMARY KEY (`authtypecode`,`tagfield`,`tagsubfield`),
KEY `tab` (`authtypecode`,`tab`),
CONSTRAINT `auth_subfield_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `auth_tag_structure`
--
DROP TABLE IF EXISTS `auth_tag_structure`;
CREATE TABLE `auth_tag_structure` (
`authtypecode` varchar(10) NOT NULL default '',
`tagfield` varchar(3) NOT NULL default '',
`liblibrarian` varchar(255) NOT NULL default '',
`libopac` varchar(255) NOT NULL default '',
`repeatable` tinyint(4) NOT NULL default 0,
`mandatory` tinyint(4) NOT NULL default 0,
`authorised_value` varchar(10) default NULL,
PRIMARY KEY (`authtypecode`,`tagfield`),
CONSTRAINT `auth_tag_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `auth_types`
--
DROP TABLE IF EXISTS `auth_types`;
CREATE TABLE `auth_types` (
`authtypecode` varchar(10) NOT NULL default '',
`authtypetext` varchar(255) NOT NULL default '',
`auth_tag_to_report` varchar(3) NOT NULL default '',
`summary` mediumtext NOT NULL,
PRIMARY KEY (`authtypecode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `authorised_values`
--
DROP TABLE IF EXISTS `authorised_values`;
CREATE TABLE `authorised_values` ( -- stores values for authorized values categories and values
`id` int(11) NOT NULL auto_increment, -- unique key, used to identify the authorized value
`category` varchar(32) NOT NULL default '', -- key used to identify the authorized value category
`authorised_value` varchar(80) NOT NULL default '', -- code use to identify the authorized value
`lib` varchar(200) default NULL, -- authorized value description as printed in the staff client
`lib_opac` varchar(200) default NULL, -- authorized value description as printed in the OPAC
`imageurl` varchar(200) default NULL, -- authorized value URL
PRIMARY KEY (`id`),
KEY `name` (`category`),
KEY `lib` (`lib`),
KEY `auth_value_idx` (`authorised_value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `biblio`
--
DROP TABLE IF EXISTS `biblio`;
CREATE TABLE `biblio` ( -- table that stores bibliographic information
`biblionumber` int(11) NOT NULL auto_increment, -- unique identifier assigned to each bibliographic record
`frameworkcode` varchar(4) NOT NULL default '', -- foreign key from the biblio_framework table to identify which framework was used in cataloging this record
`author` mediumtext, -- statement of responsibility from MARC record (100$a in MARC21)
`title` mediumtext, -- title (without the subtitle) from the MARC record (245$a in MARC21)
`unititle` mediumtext, -- uniform title (without the subtitle) from the MARC record (240$a in MARC21)
`notes` mediumtext, -- values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)
`serial` tinyint(1) default NULL, -- Boolean indicating whether biblio is for a serial
`seriestitle` mediumtext,
`copyrightdate` smallint(6) default NULL, -- publication or copyright date from the MARC record
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
`datecreated` DATE NOT NULL, -- the date this record was added to Koha
`abstract` mediumtext, -- summary from the MARC record (520$a in MARC21)
PRIMARY KEY (`biblionumber`),
KEY `blbnoidx` (`biblionumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `biblio_framework`
--
DROP TABLE IF EXISTS `biblio_framework`;
CREATE TABLE `biblio_framework` ( -- information about MARC frameworks
`frameworkcode` varchar(4) NOT NULL default '', -- the unique code assigned to the framework
`frameworktext` varchar(255) NOT NULL default '', -- the description/name given to the framework
PRIMARY KEY (`frameworkcode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `biblioitems`
--
DROP TABLE IF EXISTS `biblioitems`;
CREATE TABLE `biblioitems` ( -- information related to bibliographic records in Koha
`biblioitemnumber` int(11) NOT NULL auto_increment, -- primary key, unique identifier assigned by Koha
`biblionumber` int(11) NOT NULL default 0, -- foreign key linking this table to the biblio table
`volume` mediumtext,
`number` mediumtext,
`itemtype` varchar(10) default NULL, -- biblio level item type (MARC21 942$c)
`isbn` mediumtext, -- ISBN (MARC21 020$a)
`issn` mediumtext, -- ISSN (MARC21 022$a)
`ean` varchar(13) default NULL,
`publicationyear` text,
`publishercode` varchar(255) default NULL, -- publisher (MARC21 260$b)
`volumedate` date default NULL,
`volumedesc` text, -- volume information (MARC21 362$a)
`collectiontitle` mediumtext default NULL,
`collectionissn` text default NULL,
`collectionvolume` mediumtext default NULL,
`editionstatement` text default NULL,
`editionresponsibility` text default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`illus` varchar(255) default NULL, -- illustrations (MARC21 300$b)
`pages` varchar(255) default NULL, -- number of pages (MARC21 300$c)
`notes` mediumtext,
`size` varchar(255) default NULL, -- material size (MARC21 300$c)
`place` varchar(255) default NULL, -- publication place (MARC21 260$a)
`lccn` varchar(25) default NULL, -- library of congress control number (MARC21 010$a)
`marc` longblob, -- full bibliographic MARC record
`url` text default NULL, -- url (MARC21 856$u)
`cn_source` varchar(10) default NULL, -- classification source (MARC21 942$2)
`cn_class` varchar(30) default NULL,
`cn_item` varchar(10) default NULL,
`cn_suffix` varchar(10) default NULL,
`cn_sort` varchar(255) default NULL, -- normalized version of the call number used for sorting
`agerestriction` varchar(255) default NULL, -- target audience/age restriction from the bib record (MARC21 521$a)
`totalissues` int(10),
`marcxml` longtext, -- full bibliographic MARC record in MARCXML
PRIMARY KEY (`biblioitemnumber`),
KEY `bibinoidx` (`biblioitemnumber`),
KEY `bibnoidx` (`biblionumber`),
KEY `itemtype_idx` (`itemtype`),
KEY `isbn` (`isbn`(255)),
KEY `issn` (`issn`(255)),
KEY `publishercode` (`publishercode`),
CONSTRAINT `biblioitems_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `borrowers`
--
DROP TABLE IF EXISTS `borrowers`;
CREATE TABLE `borrowers` ( -- this table includes information about your patrons/borrowers/members
`borrowernumber` int(11) NOT NULL auto_increment, -- primary key, Koha assigned ID number for patrons/borrowers
`cardnumber` varchar(16) default NULL, -- unique key, library assigned ID number for patrons/borrowers
`surname` mediumtext NOT NULL, -- patron/borrower's last name (surname)
`firstname` text, -- patron/borrower's first name
`title` mediumtext, -- patron/borrower's title, for example: Mr. or Mrs.
`othernames` mediumtext, -- any other names associated with the patron/borrower
`initials` text, -- initials for your patron/borrower
`streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's primary address
`streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's primary address
`address` mediumtext NOT NULL, -- the first address line for your patron/borrower's primary address
`address2` text, -- the second address line for your patron/borrower's primary address
`city` mediumtext NOT NULL, -- the city or town for your patron/borrower's primary address
`state` text default NULL, -- the state or province for your patron/borrower's primary address
`zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's primary address
`country` text, -- the country for your patron/borrower's primary address
`email` mediumtext, -- the primary email address for your patron/borrower's primary address
`phone` text, -- the primary phone number for your patron/borrower's primary address
`mobile` varchar(50) default NULL, -- the other phone number for your patron/borrower's primary address
`fax` mediumtext, -- the fax number for your patron/borrower's primary address
`emailpro` text, -- the secondary email addres for your patron/borrower's primary address
`phonepro` text, -- the secondary phone number for your patron/borrower's primary address
`B_streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's alternate address
`B_streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's alternate address
`B_address` varchar(100) default NULL, -- the first address line for your patron/borrower's alternate address
`B_address2` text default NULL, -- the second address line for your patron/borrower's alternate address
`B_city` mediumtext, -- the city or town for your patron/borrower's alternate address
`B_state` text default NULL, -- the state for your patron/borrower's alternate address
`B_zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's alternate address
`B_country` text, -- the country for your patron/borrower's alternate address
`B_email` text, -- the patron/borrower's alternate email address
`B_phone` mediumtext, -- the patron/borrower's alternate phone number
`dateofbirth` date default NULL, -- the patron/borrower's date of birth (YYYY-MM-DD)
`branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, includes the code of the patron/borrower's home branch
`categorycode` varchar(10) NOT NULL default '', -- foreign key from the categories table, includes the code of the patron category
`dateenrolled` date default NULL, -- date the patron was added to Koha (YYYY-MM-DD)
`dateexpiry` date default NULL, -- date the patron/borrower's card is set to expire (YYYY-MM-DD)
`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
`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
`debarred` date default NULL, -- until this date the patron can only check-in (no loans, no holds, etc.), is a fine based on days instead of money (YYY-MM-DD)
`debarredcomment` VARCHAR(255) DEFAULT NULL, -- comment on the stop of the patron
`contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
`contactfirstname` text, -- used for children to include first name of guarentor
`contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
`guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
`borrowernotes` mediumtext, -- a note on the patron/borrower's account that is only visible in the staff client
`relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
`sex` varchar(1) default NULL, -- patron/borrower's gender
`password` varchar(60) default NULL, -- patron/borrower's encrypted password
`flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
`userid` varchar(75) default NULL, -- patron/borrower's opac and/or staff client log in
`opacnote` mediumtext, -- a note on the patron/borrower's account that is visible in the OPAC and staff client
`contactnote` varchar(255) default NULL, -- a note related to the patron/borrower's alternate address
`sort1` varchar(80) default NULL, -- a field that can be used for any information unique to the library
`sort2` varchar(80) default NULL, -- a field that can be used for any information unique to the library
`altcontactfirstname` varchar(255) default NULL, -- first name of alternate contact for the patron/borrower
`altcontactsurname` varchar(255) default NULL, -- surname or last name of the alternate contact for the patron/borrower
`altcontactaddress1` varchar(255) default NULL, -- the first address line for the alternate contact for the patron/borrower
`altcontactaddress2` varchar(255) default NULL, -- the second address line for the alternate contact for the patron/borrower
`altcontactaddress3` varchar(255) default NULL, -- the city for the alternate contact for the patron/borrower
`altcontactstate` text default NULL, -- the state for the alternate contact for the patron/borrower
`altcontactzipcode` varchar(50) default NULL, -- the zipcode for the alternate contact for the patron/borrower
`altcontactcountry` text default NULL, -- the country for the alternate contact for the patron/borrower
`altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
`smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
`sms_provider_id` int(11) DEFAULT NULL, -- the provider of the mobile phone number defined in smsalertnumber
`privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history
`privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT '0', -- controls if relatives can see this patron's checkouts
UNIQUE KEY `cardnumber` (`cardnumber`),
PRIMARY KEY `borrowernumber` (`borrowernumber`),
KEY `categorycode` (`categorycode`),
KEY `branchcode` (`branchcode`),
UNIQUE KEY `userid` (`userid`),
KEY `guarantorid` (`guarantorid`),
KEY `surname_idx` (`surname`(255)),
KEY `firstname_idx` (`firstname`(255)),
KEY `othernames_idx` (`othernames`(255)),
KEY `sms_provider_id` (`sms_provider_id`),
CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`),
CONSTRAINT `borrowers_ibfk_3` FOREIGN KEY (`sms_provider_id`) REFERENCES `sms_providers` (`id`) ON UPDATE CASCADE ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `borrower_attribute_types`
--
DROP TABLE IF EXISTS `borrower_attribute_types`;
CREATE TABLE `borrower_attribute_types` ( -- definitions for custom patron fields known as extended patron attributes
`code` varchar(10) NOT NULL, -- unique key used to identify each custom field
`description` varchar(255) NOT NULL, -- description for each custom field
`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)
`unique_id` tinyint(1) NOT NULL default 0, -- defines if this value needs to be unique (1 for yes, 0 for no)
`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)
`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)
`authorised_value_category` varchar(32) default NULL, -- foreign key from authorised_values that links this custom field to an authorized value category
`display_checkout` tinyint(1) NOT NULL default 0,-- defines if this field displays in checkout screens
`category_code` VARCHAR(10) NULL DEFAULT NULL,-- defines a category for an attribute_type
`class` VARCHAR(255) NOT NULL DEFAULT '',-- defines a class for an attribute_type
PRIMARY KEY (`code`),
KEY `auth_val_cat_idx` (`authorised_value_category`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `borrower_attributes`
--
DROP TABLE IF EXISTS `borrower_attributes`;
CREATE TABLE `borrower_attributes` ( -- values of custom patron fields known as extended patron attributes linked to patrons/borrowers
`borrowernumber` int(11) NOT NULL, -- foreign key from the borrowers table, defines which patron/borrower has this attribute
`code` varchar(10) NOT NULL, -- foreign key from the borrower_attribute_types table, defines which custom field this value was entered for
`attribute` varchar(255) default NULL, -- custom patron field value
KEY `borrowernumber` (`borrowernumber`),
KEY `code_attribute` (`code`, `attribute`),
CONSTRAINT `borrower_attributes_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `borrower_debarments`
--
DROP TABLE IF EXISTS `borrower_debarments`;
CREATE TABLE borrower_debarments ( -- tracks restrictions on the patron's record
borrower_debarment_id int(11) NOT NULL AUTO_INCREMENT, -- unique key for the restriction
borrowernumber int(11) NOT NULL, -- foreign key for borrowers.borrowernumber for patron who is restricted
expiration date DEFAULT NULL, -- expiration date of the restriction
`type` enum('SUSPENSION','OVERDUES','MANUAL','DISCHARGE') NOT NULL DEFAULT 'MANUAL', -- type of restriction
`comment` text, -- comments about the restriction
manager_id int(11) DEFAULT NULL, -- foreign key for borrowers.borrowernumber for the librarian managing the restriction
created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- date the restriction was added
updated timestamp NULL DEFAULT NULL, -- date the restriction was updated
PRIMARY KEY (borrower_debarment_id),
KEY borrowernumber (borrowernumber),
CONSTRAINT `borrower_debarments_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `branch_item_rules`
--
DROP TABLE IF EXISTS `branch_item_rules`;
CREATE TABLE `branch_item_rules` ( -- information entered in the circulation and fine rules under 'Holds policy by item type'
`branchcode` varchar(10) NOT NULL, -- the branch this rule is for (branches.branchcode)
`itemtype` varchar(10) NOT NULL, -- the item type this rule applies to (items.itype)
`holdallowed` tinyint(1) default NULL, -- the number of holds allowed
`returnbranch` varchar(15) default NULL, -- the branch the item returns to (homebranch, holdingbranch, noreturn)
PRIMARY KEY (`itemtype`,`branchcode`),
KEY `branch_item_rules_ibfk_2` (`branchcode`),
CONSTRAINT `branch_item_rules_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`)
ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `branch_item_rules_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `borrower_password_recovery`
--
DROP TABLE IF EXISTS `borrower_password_recovery`;
CREATE TABLE IF NOT EXISTS `borrower_password_recovery` ( -- holds information about password recovery attempts
`borrowernumber` int(11) NOT NULL, -- the user asking a password recovery
`uuid` varchar(128) NOT NULL, -- a unique string to identify a password recovery attempt
`valid_until` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- a time limit on the password recovery attempt
PRIMARY KEY (`borrowernumber`),
KEY borrowernumber (borrowernumber)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table borrower_sync
--
DROP TABLE IF EXISTS `borrower_sync`;
CREATE TABLE borrower_sync (
borrowersyncid int(11) NOT NULL AUTO_INCREMENT, -- Primary key, unique identifier
borrowernumber int(11) NOT NULL, -- Connects data about synchronisations to a borrower
synctype varchar(32) NOT NULL, -- There could potentially be more than one kind of syncing going on, a text string here can be used to tell them apart. E.g.: The Norwegian national patron database uses 'norwegianpatrondb' in this column
sync tinyint(1) NOT NULL DEFAULT '0', -- A boolean (1/0) for turning syncing off and on for individual borrowers
syncstatus varchar(10) DEFAULT NULL, -- The sync status for any given borrower. Could be text strings like 'new', 'edited', 'synced' etc. The values used here will depend on the actual syncing being done.
lastsync varchar(50) DEFAULT NULL, -- Date of the last successfull sync. The date format might be different depending on the service that is being used, so no special date format is being enforced here.
hashed_pin varchar(64) DEFAULT NULL, -- Perhaps specific to The Norwegian national patron database, this column holds a hashed PIN code
PRIMARY KEY (borrowersyncid),
KEY borrowernumber (borrowernumber),
CONSTRAINT borrower_sync_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `branchcategories`
--
DROP TABLE IF EXISTS `branchcategories`;
CREATE TABLE `branchcategories` ( -- information related to library/branch groups
`categorycode` varchar(10) NOT NULL default '', -- unique identifier for the library/branch group
`categoryname` varchar(32), -- name of the library/branch group
`codedescription` mediumtext, -- longer description of the library/branch group
`categorytype` varchar(16), -- says whether this is a search group or a properties group
`show_in_pulldown` tinyint(1) NOT NULL DEFAULT '0', -- says this group should be in the opac libararies pulldown if it is enabled
PRIMARY KEY (`categorycode`),
KEY `show_in_pulldown` (`show_in_pulldown`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `branches`
--
DROP TABLE IF EXISTS `branches`;
CREATE TABLE `branches` ( -- information about your libraries or branches are stored here
`branchcode` varchar(10) NOT NULL default '', -- a unique key assigned to each branch
`branchname` mediumtext NOT NULL, -- the name of your library or branch
`branchaddress1` mediumtext, -- the first address line of for your library or branch
`branchaddress2` mediumtext, -- the second address line of for your library or branch
`branchaddress3` mediumtext, -- the third address line of for your library or branch
`branchzip` varchar(25) default NULL, -- the zip or postal code for your library or branch
`branchcity` mediumtext, -- the city or province for your library or branch
`branchstate` mediumtext, -- the state for your library or branch
`branchcountry` text, -- the county for your library or branch
`branchphone` mediumtext, -- the primary phone for your library or branch
`branchfax` mediumtext, -- the fax number for your library or branch
`branchemail` mediumtext, -- the primary email address for your library or branch
`branchreplyto` mediumtext, -- the email to be used as a Reply-To
`branchreturnpath` mediumtext, -- the email to be used as Return-Path
`branchurl` mediumtext, -- the URL for your library or branch's website
`issuing` tinyint(4) default NULL, -- unused in Koha
`branchip` varchar(15) default NULL, -- the IP address for your library or branch
`branchprinter` varchar(100) default NULL, -- unused in Koha
`branchnotes` mediumtext, -- notes related to your library or branch
opac_info text, -- HTML that displays in OPAC
PRIMARY KEY (`branchcode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `branchrelations`
--
DROP TABLE IF EXISTS `branchrelations`;
CREATE TABLE `branchrelations` ( -- this table links libraries/branches to groups
`branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table to identify the branch
`categorycode` varchar(10) NOT NULL default '', -- foreign key from the branchcategories table to identify the group
PRIMARY KEY (`branchcode`,`categorycode`),
KEY `branchcode` (`branchcode`),
KEY `categorycode` (`categorycode`),
CONSTRAINT `branchrelations_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `branchrelations_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `branchcategories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `branchtransfers`
--
DROP TABLE IF EXISTS `branchtransfers`;
CREATE TABLE `branchtransfers` ( -- information for items that are in transit between branches
`itemnumber` int(11) NOT NULL default 0, -- the itemnumber that it is in transit (items.itemnumber)
`datesent` datetime default NULL, -- the date the transfer was initialized
`frombranch` varchar(10) NOT NULL default '', -- the branch the transfer is coming from
`datearrived` datetime default NULL, -- the date the transfer arrived at its destination
`tobranch` varchar(10) NOT NULL default '', -- the branch the transfer was going to
`comments` mediumtext, -- any comments related to the transfer
KEY `frombranch` (`frombranch`),
KEY `tobranch` (`tobranch`),
KEY `itemnumber` (`itemnumber`),
CONSTRAINT `branchtransfers_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `branchtransfers_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `branchtransfers_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `browser`
--
DROP TABLE IF EXISTS `browser`;
CREATE TABLE `browser` (
`level` int(11) NOT NULL,
`classification` varchar(20) NOT NULL,
`description` varchar(255) NOT NULL,
`number` bigint(20) NOT NULL,
`endnode` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `categories`
--
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories` ( -- this table shows information related to Koha patron categories
`categorycode` varchar(10) NOT NULL default '', -- unique primary key used to idenfity the patron category
`description` mediumtext, -- description of the patron category
`enrolmentperiod` smallint(6) default NULL, -- number of months the patron is enrolled for (will be NULL if enrolmentperioddate is set)
`enrolmentperioddate` DATE NULL DEFAULT NULL, -- date the patron is enrolled until (will be NULL if enrolmentperiod is set)
`upperagelimit` smallint(6) default NULL, -- age limit for the patron
`dateofbirthrequired` tinyint(1) default NULL, -- the minimum age required for the patron category
`finetype` varchar(30) default NULL, -- unused in Koha
`bulk` tinyint(1) default NULL,
`enrolmentfee` decimal(28,6) default NULL, -- enrollment fee for the patron
`overduenoticerequired` tinyint(1) default NULL, -- are overdue notices sent to this patron category (1 for yes, 0 for no)
`issuelimit` smallint(6) default NULL, -- unused in Koha
`reservefee` decimal(28,6) default NULL, -- cost to place holds
`hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
`category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
`BlockExpiredPatronOpacActions` tinyint(1) NOT NULL default '-1', -- wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions
`default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category
PRIMARY KEY (`categorycode`),
UNIQUE KEY `categorycode` (`categorycode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table: collections
--
DROP TABLE IF EXISTS collections;
CREATE TABLE collections (
colId integer(11) NOT NULL auto_increment,
colTitle varchar(100) NOT NULL DEFAULT '',
colDesc text NOT NULL,
colBranchcode varchar(10) DEFAULT NULL, -- 'branchcode for branch where item should be held.'
PRIMARY KEY (colId)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Constraints for table `collections`
--
ALTER TABLE `collections`
ADD CONSTRAINT `collections_ibfk_1` FOREIGN KEY (`colBranchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Table: collections_tracking
--
DROP TABLE IF EXISTS collections_tracking;
CREATE TABLE collections_tracking (
collections_tracking_id integer(11) NOT NULL auto_increment,
colId integer(11) NOT NULL DEFAULT 0 comment 'collections.colId',
itemnumber integer(11) NOT NULL DEFAULT 0 comment 'items.itemnumber',
PRIMARY KEY (collections_tracking_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `courses`
--
-- The courses table stores the courses created for the
-- course reserves feature.
DROP TABLE IF EXISTS courses;
CREATE TABLE `courses` (
`course_id` int(11) NOT NULL AUTO_INCREMENT, -- unique id for the course
`department` varchar(80) DEFAULT NULL, -- the authorised value for the DEPARTMENT
`course_number` varchar(255) DEFAULT NULL, -- the "course number" assigned to a course
`section` varchar(255) DEFAULT NULL, -- the 'section' of a course
`course_name` varchar(255) DEFAULT NULL, -- the name of the course
`term` varchar(80) DEFAULT NULL, -- the authorised value for the TERM
`staff_note` mediumtext, -- the text of the staff only note
`public_note` mediumtext, -- the text of the public / opac note
`students_count` varchar(20) DEFAULT NULL, -- how many students will be taking this course/section
`enabled` enum('yes','no') NOT NULL DEFAULT 'yes', -- determines whether the course is active
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`course_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `course_instructors`
--
-- The course instructors table links Koha borrowers to the
-- courses they are teaching. Many instructors can teach many
-- courses. course_instructors is just a many-to-many join table.
DROP TABLE IF EXISTS course_instructors;
CREATE TABLE `course_instructors` (
`course_id` int(11) NOT NULL, -- foreign key to link to courses.course_id
`borrowernumber` int(11) NOT NULL, -- foreign key to link to borrowers.borrowernumber for instructor information
PRIMARY KEY (`course_id`,`borrowernumber`),
KEY `borrowernumber` (`borrowernumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Constraints for table `course_instructors`
--
ALTER TABLE `course_instructors`
ADD CONSTRAINT `course_instructors_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`),
ADD CONSTRAINT `course_instructors_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Table structure for table `course_items`
--
-- If an item is placed on course reserve for one or more courses
-- it will have an entry in this table. No matter how many courses an item
-- is part of, it will only have one row in this table.
DROP TABLE IF EXISTS course_items;
CREATE TABLE `course_items` (
`ci_id` int(11) NOT NULL AUTO_INCREMENT, -- course item id
`itemnumber` int(11) NOT NULL, -- items.itemnumber for the item on reserve
`itype` varchar(10) DEFAULT NULL, -- new itemtype for the item to have while on reserve (optional)
`ccode` varchar(10) DEFAULT NULL, -- new category code for the item to have while on reserve (optional)
`holdingbranch` varchar(10) DEFAULT NULL, -- new holding branch for the item to have while on reserve (optional)
`location` varchar(80) DEFAULT NULL, -- new shelving location for the item to have while on reseve (optional)
`enabled` enum('yes','no') NOT NULL DEFAULT 'no', -- if at least one enabled course has this item on reseve, this field will be 'yes', otherwise it will be 'no'
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ci_id`),
UNIQUE KEY `itemnumber` (`itemnumber`),
KEY `holdingbranch` (`holdingbranch`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Constraints for table `course_items`
--
ALTER TABLE `course_items`
ADD CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Table structure for table `course_reserves`
--
-- This table connects an item placed on course reserve to a course it is on reserve for.
-- There will be a row in this table for each course an item is on reserve for.
DROP TABLE IF EXISTS course_reserves;
CREATE TABLE `course_reserves` (
`cr_id` int(11) NOT NULL AUTO_INCREMENT,
`course_id` int(11) NOT NULL, -- foreign key to link to courses.course_id
`ci_id` int(11) NOT NULL, -- foreign key to link to courses_items.ci_id
`staff_note` mediumtext, -- staff only note
`public_note` mediumtext, -- public, OPAC visible note
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`cr_id`),
UNIQUE KEY `pseudo_key` (`course_id`,`ci_id`),
KEY `course_id` (`course_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Constraints for table `course_reserves`
--
ALTER TABLE `course_reserves`
ADD CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`),
ADD CONSTRAINT `course_reserves_ibfk_2` FOREIGN KEY (`ci_id`) REFERENCES `course_items` (`ci_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Table structure for table `branch_borrower_circ_rules`
--
DROP TABLE IF EXISTS `branch_borrower_circ_rules`;
CREATE TABLE `branch_borrower_circ_rules` ( -- includes default circulation rules for patron categories found under "Checkout limit by patron category"
`branchcode` VARCHAR(10) NOT NULL, -- the branch this rule applies to (branches.branchcode)
`categorycode` VARCHAR(10) NOT NULL, -- the patron category this rule applies to (categories.categorycode)
`maxissueqty` int(4) default NULL, -- the maximum number of checkouts this patron category can have at this branch
`maxonsiteissueqty` int(4) default NULL, -- the maximum number of on-site checkouts this patron category can have at this branch
PRIMARY KEY (`categorycode`, `branchcode`),
CONSTRAINT `branch_borrower_circ_rules_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`)
ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `branch_borrower_circ_rules_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `default_borrower_circ_rules`
--
DROP TABLE IF EXISTS `default_borrower_circ_rules`;
CREATE TABLE `default_borrower_circ_rules` ( -- default checkout rules found under "Default checkout, hold and return policy"
`categorycode` VARCHAR(10) NOT NULL, -- patron category this rul
`maxissueqty` int(4) default NULL,
`maxonsiteissueqty` int(4) default NULL,
PRIMARY KEY (`categorycode`),
CONSTRAINT `borrower_borrower_circ_rules_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `default_branch_circ_rules`
--
DROP TABLE IF EXISTS `default_branch_circ_rules`;
CREATE TABLE `default_branch_circ_rules` (
`branchcode` VARCHAR(10) NOT NULL,
`maxissueqty` int(4) default NULL,
`maxonsiteissueqty` int(4) default NULL,
`holdallowed` tinyint(1) default NULL,
`returnbranch` varchar(15) default NULL,
PRIMARY KEY (`branchcode`),
CONSTRAINT `default_branch_circ_rules_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `default_branch_item_rules`
--
DROP TABLE IF EXISTS `default_branch_item_rules`;
CREATE TABLE `default_branch_item_rules` (
`itemtype` varchar(10) NOT NULL,
`holdallowed` tinyint(1) default NULL,
`returnbranch` varchar(15) default NULL,
PRIMARY KEY (`itemtype`),
CONSTRAINT `default_branch_item_rules_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `default_circ_rules`
--
DROP TABLE IF EXISTS `default_circ_rules`;
CREATE TABLE `default_circ_rules` (
`singleton` enum('singleton') NOT NULL default 'singleton',
`maxissueqty` int(4) default NULL,
`maxonsiteissueqty` int(4) default NULL,
`holdallowed` int(1) default NULL,
`returnbranch` varchar(15) default NULL,
PRIMARY KEY (`singleton`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `cities`
--
DROP TABLE IF EXISTS `cities`;
CREATE TABLE `cities` ( -- authorized values for cities/states/countries to choose when adding/editing a patron/borrower
`cityid` int(11) NOT NULL auto_increment, -- unique identifier added by Koha
`city_name` varchar(100) NOT NULL default '', -- name of the city
`city_state` VARCHAR( 100 ) NULL DEFAULT NULL, -- name of the state/province
`city_country` VARCHAR( 100 ) NULL DEFAULT NULL, -- name of the country
`city_zipcode` varchar(20) default NULL, -- zip or postal code
PRIMARY KEY (`cityid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `class_sort_rules`
--
DROP TABLE IF EXISTS `class_sort_rules`;
CREATE TABLE `class_sort_rules` (
`class_sort_rule` varchar(10) NOT NULL default '',
`description` mediumtext,
`sort_routine` varchar(30) NOT NULL default '',
PRIMARY KEY (`class_sort_rule`),
UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `class_sources`
--
DROP TABLE IF EXISTS `class_sources`;
CREATE TABLE `class_sources` (
`cn_source` varchar(10) NOT NULL default '',
`description` mediumtext,
`used` tinyint(4) NOT NULL default 0,
`class_sort_rule` varchar(10) NOT NULL default '',
PRIMARY KEY (`cn_source`),
UNIQUE KEY `cn_source_idx` (`cn_source`),
KEY `used_idx` (`used`),
CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `currency`
--
DROP TABLE IF EXISTS `currency`;
CREATE TABLE `currency` (
`currency` varchar(10) NOT NULL default '',
`symbol` varchar(5) default NULL,
`isocode` varchar(5) default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`rate` float(15,5) default NULL,
`active` tinyint(1) default NULL,
`archived` tinyint(1) DEFAULT 0,
PRIMARY KEY (`currency`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `deletedbiblio`
--
DROP TABLE IF EXISTS `deletedbiblio`;
CREATE TABLE `deletedbiblio` ( -- stores information about bibliographic records that have been deleted
`biblionumber` int(11) NOT NULL auto_increment, -- unique identifier assigned to each bibliographic record
`frameworkcode` varchar(4) NOT NULL default '', -- foriegn key from the biblio_framework table to identify which framework was used in cataloging this record
`author` mediumtext, -- statement of responsibility from MARC record (100$a in MARC21)
`title` mediumtext, -- title (without the subtitle) from the MARC record (245$a in MARC21)
`unititle` mediumtext, -- uniform title (without the subtitle) from the MARC record (240$a in MARC21)
`notes` mediumtext, -- values from the general notes field in the MARC record (500$a in MARC21) split by bar (|)
`serial` tinyint(1) default NULL, -- Boolean indicating whether biblio is for a serial
`seriestitle` mediumtext,
`copyrightdate` smallint(6) default NULL, -- publication or copyright date from the MARC record
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched
`datecreated` DATE NOT NULL, -- the date this record was added to Koha
`abstract` mediumtext, -- summary from the MARC record (520$a in MARC21)
PRIMARY KEY (`biblionumber`),
KEY `blbnoidx` (`biblionumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `deletedbiblioitems`
--
DROP TABLE IF EXISTS `deletedbiblioitems`;
CREATE TABLE `deletedbiblioitems` ( -- information about bibliographic records that have been deleted
`biblioitemnumber` int(11) NOT NULL default 0, -- primary key, unique identifier assigned by Koha
`biblionumber` int(11) NOT NULL default 0, -- foreign key linking this table to the biblio table
`volume` mediumtext,
`number` mediumtext,
`itemtype` varchar(10) default NULL, -- biblio level item type (MARC21 942$c)
`isbn` mediumtext default NULL, -- ISBN (MARC21 020$a)
`issn` mediumtext default NULL, -- ISSN (MARC21 022$a)
`ean` varchar(13) default NULL,
`publicationyear` text,
`publishercode` varchar(255) default NULL, -- publisher (MARC21 260$b)
`volumedate` date default NULL,
`volumedesc` text, -- volume information (MARC21 362$a)
`collectiontitle` mediumtext default NULL,
`collectionissn` text default NULL,
`collectionvolume` mediumtext default NULL,
`editionstatement` text default NULL,
`editionresponsibility` text default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`illus` varchar(255) default NULL, -- illustrations (MARC21 300$b)
`pages` varchar(255) default NULL, -- number of pages (MARC21 300$c)
`notes` mediumtext,
`size` varchar(255) default NULL, -- material size (MARC21 300$c)
`place` varchar(255) default NULL, -- publication place (MARC21 260$a)
`lccn` varchar(25) default NULL, -- library of congress control number (MARC21 010$a)
`marc` longblob, -- full bibliographic MARC record
`url` text default NULL, -- url (MARC21 856$u)
`cn_source` varchar(10) default NULL, -- classification source (MARC21 942$2)
`cn_class` varchar(30) default NULL,
`cn_item` varchar(10) default NULL,
`cn_suffix` varchar(10) default NULL,
`cn_sort` varchar(255) default NULL, -- normalized version of the call number used for sorting
`agerestriction` varchar(255) default NULL, -- target audience/age restriction from the bib record (MARC21 521$a)
`totalissues` int(10),
`marcxml` longtext, -- full bibliographic MARC record in MARCXML
PRIMARY KEY (`biblioitemnumber`),
KEY `bibinoidx` (`biblioitemnumber`),
KEY `bibnoidx` (`biblionumber`),
KEY `itemtype_idx` (`itemtype`),
KEY `isbn` (`isbn`(255)),
KEY `publishercode` (`publishercode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `deletedborrowers`
--
DROP TABLE IF EXISTS `deletedborrowers`;
CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrowers you have deleted
`borrowernumber` int(11) NOT NULL default 0, -- primary key, Koha assigned ID number for patrons/borrowers
`cardnumber` varchar(16) default NULL, -- unique key, library assigned ID number for patrons/borrowers
`surname` mediumtext NOT NULL, -- patron/borrower's last name (surname)
`firstname` text, -- patron/borrower's first name
`title` mediumtext, -- patron/borrower's title, for example: Mr. or Mrs.
`othernames` mediumtext, -- any other names associated with the patron/borrower
`initials` text, -- initials for your patron/borrower
`streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's primary address
`streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's primary address
`address` mediumtext NOT NULL, -- the first address line for your patron/borrower's primary address
`address2` text, -- the second address line for your patron/borrower's primary address
`city` mediumtext NOT NULL, -- the city or town for your patron/borrower's primary address
`state` text default NULL, -- the state or province for your patron/borrower's primary address
`zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's primary address
`country` text, -- the country for your patron/borrower's primary address
`email` mediumtext, -- the primary email address for your patron/borrower's primary address
`phone` text, -- the primary phone number for your patron/borrower's primary address
`mobile` varchar(50) default NULL, -- the other phone number for your patron/borrower's primary address
`fax` mediumtext, -- the fax number for your patron/borrower's primary address
`emailpro` text, -- the secondary email addres for your patron/borrower's primary address
`phonepro` text, -- the secondary phone number for your patron/borrower's primary address
`B_streetnumber` varchar(10) default NULL, -- the house number for your patron/borrower's alternate address
`B_streettype` varchar(50) default NULL, -- the street type (Rd., Blvd, etc) for your patron/borrower's alternate address
`B_address` varchar(100) default NULL, -- the first address line for your patron/borrower's alternate address
`B_address2` text default NULL, -- the second address line for your patron/borrower's alternate address
`B_city` mediumtext, -- the city or town for your patron/borrower's alternate address
`B_state` text default NULL, -- the state for your patron/borrower's alternate address
`B_zipcode` varchar(25) default NULL, -- the zip or postal code for your patron/borrower's alternate address
`B_country` text, -- the country for your patron/borrower's alternate address
`B_email` text, -- the patron/borrower's alternate email address
`B_phone` mediumtext, -- the patron/borrower's alternate phone number
`dateofbirth` date default NULL, -- the patron/borrower's date of birth (YYYY-MM-DD)
`branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, includes the code of the patron/borrower's home branch
`categorycode` varchar(10) NOT NULL default '', -- foreign key from the categories table, includes the code of the patron category
`dateenrolled` date default NULL, -- date the patron was added to Koha (YYYY-MM-DD)
`dateexpiry` date default NULL, -- date the patron/borrower's card is set to expire (YYYY-MM-DD)
`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
`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
`debarred` date default NULL, -- until this date the patron can only check-in (no loans, no holds, etc.), is a fine based on days instead of money (YYY-MM-DD)
`debarredcomment` VARCHAR(255) DEFAULT NULL, -- comment on the stop of patron
`contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
`contactfirstname` text, -- used for children to include first name of guarentor
`contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
`guarantorid` int(11) default NULL, -- borrowernumber used for children or professionals to link them to guarentors or organizations
`borrowernotes` mediumtext, -- a note on the patron/borrower's account that is only visible in the staff client
`relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarentor
`sex` varchar(1) default NULL, -- patron/borrower's gender
`password` varchar(60) default NULL, -- patron/borrower's encrypted password
`flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
`userid` varchar(75) default NULL, -- patron/borrower's opac and/or staff client log in
`opacnote` mediumtext, -- a note on the patron/borrower's account that is visible in the OPAC and staff client
`contactnote` varchar(255) default NULL, -- a note related to the patron/borrower's alternate address
`sort1` varchar(80) default NULL, -- a field that can be used for any information unique to the library
`sort2` varchar(80) default NULL, -- a field that can be used for any information unique to the library
`altcontactfirstname` varchar(255) default NULL, -- first name of alternate contact for the patron/borrower
`altcontactsurname` varchar(255) default NULL, -- surname or last name of the alternate contact for the patron/borrower
`altcontactaddress1` varchar(255) default NULL, -- the first address line for the alternate contact for the patron/borrower
`altcontactaddress2` varchar(255) default NULL, -- the second address line for the alternate contact for the patron/borrower
`altcontactaddress3` varchar(255) default NULL, -- the city for the alternate contact for the patron/borrower
`altcontactstate` text default NULL, -- the state for the alternate contact for the patron/borrower
`altcontactzipcode` varchar(50) default NULL, -- the zipcode for the alternate contact for the patron/borrower
`altcontactcountry` text default NULL, -- the country for the alternate contact for the patron/borrower
`altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
`smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
`sms_provider_id` int(11) DEFAULT NULL, -- the provider of the mobile phone number defined in smsalertnumber
`privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history KEY `borrowernumber` (`borrowernumber`),
`privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT '0', -- controls if relatives can see this patron's checkouts
KEY borrowernumber (borrowernumber),
KEY `cardnumber` (`cardnumber`),
KEY `sms_provider_id` (`sms_provider_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `deleteditems`
--
DROP TABLE IF EXISTS `deleteditems`;
CREATE TABLE `deleteditems` (
`itemnumber` int(11) NOT NULL default 0, -- primary key and unique identifier added by Koha
`biblionumber` int(11) NOT NULL default 0, -- foreign key from biblio table used to link this item to the right bib record
`biblioitemnumber` int(11) NOT NULL default 0, -- foreign key from the biblioitems table to link to item to additional information
`barcode` varchar(20) default NULL, -- item barcode (MARC21 952$p)
`dateaccessioned` date default NULL, -- date the item was acquired or added to Koha (MARC21 952$d)
`booksellerid` mediumtext default NULL, -- where the item was purchased (MARC21 952$e)
`homebranch` varchar(10) default NULL, -- foreign key from the branches table for the library that owns this item (MARC21 952$a)
`price` decimal(8,2) default NULL, -- purchase price (MARC21 952$g)
`replacementprice` decimal(8,2) default NULL, -- cost the library charges to replace the item if it has been marked lost (MARC21 952$v)
`replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w)
`datelastborrowed` date default NULL, -- the date the item was last checked out
`datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done)
`stack` tinyint(1) default NULL,
`notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
`damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
`itemlost` tinyint(1) NOT NULL default 0, -- authorized value defining this item as lost (MARC21 952$1)
`itemlost_on` datetime DEFAULT NULL, -- the date and time an item was last marked as lost, NULL if not lost
`withdrawn` tinyint(1) NOT NULL default 0, -- authorized value defining this item as withdrawn (MARC21 952$0)
`withdrawn_on` datetime DEFAULT NULL, -- the date and time an item was last marked as withdrawn, NULL if not withdrawn
`itemcallnumber` varchar(255) default NULL, -- call number for this item (MARC21 952$o)
`coded_location_qualifier` varchar(10) default NULL, -- coded location qualifier(MARC21 952$f)
`issues` smallint(6) default NULL, -- number of times this item has been checked out
`renewals` smallint(6) default NULL, -- number of times this item has been renewed
`reserves` smallint(6) default NULL, -- number of times this item has been placed on hold/reserved
`restricted` tinyint(1) default NULL, -- authorized value defining use restrictions for this item (MARC21 952$5)
`itemnotes` mediumtext, -- public notes on this item (MARC21 952$x)
`itemnotes_nonpublic` mediumtext default NULL,
`holdingbranch` varchar(10) default NULL, -- foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)
`paidfor` mediumtext,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this item was last altered
`location` varchar(80) default NULL, -- authorized value for the shelving location for this item (MARC21 952$c)
`permanent_location` varchar(80) default NULL, -- linked to the CART and PROC temporary locations feature, stores the permanent shelving location
`onloan` date default NULL, -- defines if item is checked out (NULL for not checked out, and checkout date for checked out)
`cn_source` varchar(10) default NULL, -- classification source used on this item (MARC21 952$2)
`cn_sort` varchar(255) default NULL, -- normalized form of the call number (MARC21 952$o) used for sorting
`ccode` varchar(10) default NULL, -- authorized value for the collection code associated with this item (MARC21 952$8)
`materials` text default NULL, -- materials specified (MARC21 952$3)
`uri` varchar(255) default NULL, -- URL for the item (MARC21 952$u)
`itype` varchar(10) default NULL, -- foreign key from the itemtypes table defining the type for this item (MARC21 952$y)
`more_subfields_xml` longtext default NULL, -- additional 952 subfields in XML format
`enumchron` text default NULL, -- serial enumeration/chronology for the item (MARC21 952$h)
`copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t)
`stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i)
`new_status` VARCHAR(32) DEFAULT NULL, -- 'new' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob.
PRIMARY KEY (`itemnumber`),
KEY `delitembarcodeidx` (`barcode`),
KEY `delitemstocknumberidx` (`stocknumber`),
KEY `delitembinoidx` (`biblioitemnumber`),
KEY `delitembibnoidx` (`biblionumber`),
KEY `delhomebranch` (`homebranch`),
KEY `delholdingbranch` (`holdingbranch`),
KEY `itype_idx` (`itype`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `export_format`
--
DROP TABLE IF EXISTS `export_format`;
CREATE TABLE `export_format` (
`export_format_id` int(11) NOT NULL auto_increment,
`profile` varchar(255) NOT NULL,
`description` mediumtext NOT NULL,
`content` mediumtext NOT NULL,
`csv_separator` varchar(2) NOT NULL,
`field_separator` varchar(2) NOT NULL,
`subfield_separator` varchar(2) NOT NULL,
`encoding` varchar(255) NOT NULL,
`type` varchar(255) DEFAULT 'marc',
PRIMARY KEY (`export_format_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Used for CSV export';
--
-- Table structure for table `hold_fill_targets`
--
DROP TABLE IF EXISTS `hold_fill_targets`;
CREATE TABLE hold_fill_targets (
`borrowernumber` int(11) NOT NULL,
`biblionumber` int(11) NOT NULL,
`itemnumber` int(11) NOT NULL,
`source_branchcode` varchar(10) default NULL,
`item_level_request` tinyint(4) NOT NULL default 0,
PRIMARY KEY `itemnumber` (`itemnumber`),
KEY `bib_branch` (`biblionumber`, `source_branchcode`),
CONSTRAINT `hold_fill_targets_ibfk_1` FOREIGN KEY (`borrowernumber`)
REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `hold_fill_targets_ibfk_2` FOREIGN KEY (`biblionumber`)
REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `hold_fill_targets_ibfk_3` FOREIGN KEY (`itemnumber`)
REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `hold_fill_targets_ibfk_4` FOREIGN KEY (`source_branchcode`)
REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `import_batches`
--
DROP TABLE IF EXISTS `import_batches`;
CREATE TABLE `import_batches` ( -- information about batches of marc records that have been imported
`import_batch_id` int(11) NOT NULL auto_increment, -- unique identifier and primary key
`matcher_id` int(11) default NULL, -- the id of the match rule used (matchpoints.matcher_id)
`template_id` int(11) default NULL,
`branchcode` varchar(10) default NULL,
`num_records` int(11) NOT NULL default 0, -- number of records in the file
`num_items` int(11) NOT NULL default 0, -- number of items in the file
`upload_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, -- date and time the file was uploaded
`overlay_action` enum('replace', 'create_new', 'use_template', 'ignore') NOT NULL default 'create_new', -- how to handle duplicate records
`nomatch_action` enum('create_new', 'ignore') NOT NULL default 'create_new', -- how to handle records where no match is found
`item_action` enum('always_add', 'add_only_for_matches', 'add_only_for_new', 'ignore', 'replace') NOT NULL default 'always_add', -- what to do with item records
`import_status` enum('staging', 'staged', 'importing', 'imported', 'reverting', 'reverted', 'cleaned') NOT NULL default 'staging', -- the status of the imported file
`batch_type` enum('batch', 'z3950', 'webservice') NOT NULL default 'batch', -- where this batch has come from
`record_type` enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio', -- type of record in the batch
`file_name` varchar(100), -- the name of the file uploaded
`comments` mediumtext, -- any comments added when the file was uploaded
PRIMARY KEY (`import_batch_id`),
KEY `branchcode` (`branchcode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `import_records`
--
DROP TABLE IF EXISTS `import_records`;
CREATE TABLE `import_records` (
`import_record_id` int(11) NOT NULL auto_increment,
`import_batch_id` int(11) NOT NULL,
`branchcode` varchar(10) default NULL,
`record_sequence` int(11) NOT NULL default 0,
`upload_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
`import_date` DATE default NULL,
`marc` longblob NOT NULL,
`marcxml` longtext NOT NULL,
`marcxml_old` longtext NOT NULL,
`record_type` enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio',
`overlay_status` enum('no_match', 'auto_match', 'manual_match', 'match_applied') NOT NULL default 'no_match',
`status` enum('error', 'staged', 'imported', 'reverted', 'items_reverted', 'ignored') NOT NULL default 'staged',
`import_error` mediumtext,
`encoding` varchar(40) NOT NULL default '',
`z3950random` varchar(40) default NULL,
PRIMARY KEY (`import_record_id`),
CONSTRAINT `import_records_ifbk_1` FOREIGN KEY (`import_batch_id`)
REFERENCES `import_batches` (`import_batch_id`) ON DELETE CASCADE ON UPDATE CASCADE,
KEY `branchcode` (`branchcode`),
KEY `batch_sequence` (`import_batch_id`, `record_sequence`),
KEY `batch_id_record_type` (`import_batch_id`,`record_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for `import_record_matches`
--
DROP TABLE IF EXISTS `import_record_matches`;
CREATE TABLE `import_record_matches` ( -- matches found when importing a batch of records
`import_record_id` int(11) NOT NULL, -- the id given to the imported bib record (import_records.import_record_id)
`candidate_match_id` int(11) NOT NULL, -- the biblio the imported record matches (biblio.biblionumber)
`score` int(11) NOT NULL default 0, -- the match score
CONSTRAINT `import_record_matches_ibfk_1` FOREIGN KEY (`import_record_id`)
REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
KEY `record_score` (`import_record_id`, `score`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `import_auths`
--
DROP TABLE IF EXISTS `import_auths`;
CREATE TABLE `import_auths` (
`import_record_id` int(11) NOT NULL,
`matched_authid` int(11) default NULL,
`control_number` varchar(25) default NULL,
`authorized_heading` varchar(128) default NULL,
`original_source` varchar(25) default NULL,
CONSTRAINT `import_auths_ibfk_1` FOREIGN KEY (`import_record_id`)
REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
KEY `matched_authid` (`matched_authid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `import_biblios`
--
DROP TABLE IF EXISTS `import_biblios`;
CREATE TABLE `import_biblios` (
`import_record_id` int(11) NOT NULL,
`matched_biblionumber` int(11) default NULL,
`control_number` varchar(25) default NULL,
`original_source` varchar(25) default NULL,
`title` varchar(128) default NULL,
`author` varchar(80) default NULL,
`isbn` varchar(30) default NULL,
`issn` varchar(9) default NULL,
`has_items` tinyint(1) NOT NULL default 0,
CONSTRAINT `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`)
REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
KEY `matched_biblionumber` (`matched_biblionumber`),
KEY `title` (`title`),
KEY `isbn` (`isbn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `import_items`
--
DROP TABLE IF EXISTS `import_items`;
CREATE TABLE `import_items` (
`import_items_id` int(11) NOT NULL auto_increment,
`import_record_id` int(11) NOT NULL,
`itemnumber` int(11) default NULL,
`branchcode` varchar(10) default NULL,
`status` enum('error', 'staged', 'imported', 'reverted', 'ignored') NOT NULL default 'staged',
`marcxml` longtext NOT NULL,
`import_error` mediumtext,
PRIMARY KEY (`import_items_id`),
CONSTRAINT `import_items_ibfk_1` FOREIGN KEY (`import_record_id`)
REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE,
KEY `itemnumber` (`itemnumber`),
KEY `branchcode` (`branchcode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `issues`
--
DROP TABLE IF EXISTS `issues`;
CREATE TABLE `issues` ( -- information related to check outs or issues
`issue_id` int(11) NOT NULL AUTO_INCREMENT, -- primary key for issues table
`borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to
`itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out
`date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss)
`branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
`returndate` datetime default NULL, -- date the item was returned, will be NULL until moved to old_issues
`lastreneweddate` datetime default NULL, -- date the item was last renewed
`return` varchar(4) default NULL,
`renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
`auto_renew` BOOLEAN default FALSE, -- automatic renewal
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
`issuedate` datetime default NULL, -- date the item was checked out or issued
`onsite_checkout` int(1) NOT NULL default 0, -- in house use flag
PRIMARY KEY (`issue_id`),
UNIQUE KEY `itemnumber` (`itemnumber`),
KEY `issuesborridx` (`borrowernumber`),
KEY `itemnumber_idx` (`itemnumber`),
KEY `branchcode_idx` (`branchcode`),
KEY `bordate` (`borrowernumber`,`timestamp`),
CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `issuingrules`
--
DROP TABLE IF EXISTS `issuingrules`;
CREATE TABLE `issuingrules` ( -- circulation and fine rules
`categorycode` varchar(10) NOT NULL default '', -- patron category this rule is for (categories.categorycode)
`itemtype` varchar(10) NOT NULL default '', -- item type this rule is for (itemtypes.itemtype)
`restrictedtype` tinyint(1) default NULL, -- not used? always NULL
`rentaldiscount` decimal(28,6) default NULL, -- percent discount on the rental charge for this item
`reservecharge` decimal(28,6) default NULL,
`fine` decimal(28,6) default NULL, -- fine amount
`finedays` int(11) default NULL, -- suspension in days
`maxsuspensiondays` int(11) default NULL, -- max suspension days
`firstremind` int(11) default NULL, -- fine grace period
`chargeperiod` int(11) default NULL, -- how often the fine amount is charged
`chargeperiod_charge_at` tinyint(1) NOT NULL DEFAULT '0', -- Should fine be given at the start ( 1 ) or the end ( 0 ) of the period
`accountsent` int(11) default NULL, -- not used? always NULL
`chargename` varchar(100) default NULL, -- not used? always NULL
`maxissueqty` int(4) default NULL, -- total number of checkouts allowed
`maxonsiteissueqty` int(4) default NULL, -- total number of on-site checkouts allowed
`issuelength` int(4) default NULL, -- length of checkout in the unit set in issuingrules.lengthunit
`lengthunit` varchar(10) default 'days', -- unit of checkout length (days, hours)
`hardduedate` date default NULL, -- hard due date
`hardduedatecompare` tinyint NOT NULL default "0", -- type of hard due date (1 = after, 0 = on, -1 = before)
`renewalsallowed` smallint(6) NOT NULL default "0", -- how many renewals are allowed
`renewalperiod` int(4) default NULL, -- renewal period in the unit set in issuingrules.lengthunit
`norenewalbefore` int(4) default NULL, -- no renewal allowed until X days or hours before due date.
`auto_renew` BOOLEAN default FALSE, -- automatic renewal
`reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed
`branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode)
overduefinescap decimal(28,6) default NULL, -- the maximum amount of an overdue fine
cap_fine_to_replacement_price BOOLEAN NOT NULL DEFAULT '0', -- cap the fine based on item's replacement price
onshelfholds tinyint(1) NOT NULL default 0, -- allow holds for items that are on shelf
opacitemholds char(1) NOT NULL default 'N', -- allow opac users to place specific items on hold
PRIMARY KEY (`branchcode`,`categorycode`,`itemtype`),
KEY `categorycode` (`categorycode`),
KEY `itemtype` (`itemtype`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `items`
--
DROP TABLE IF EXISTS `items`;
CREATE TABLE `items` ( -- holdings/item information
`itemnumber` int(11) NOT NULL auto_increment, -- primary key and unique identifier added by Koha
`biblionumber` int(11) NOT NULL default 0, -- foreign key from biblio table used to link this item to the right bib record
`biblioitemnumber` int(11) NOT NULL default 0, -- foreign key from the biblioitems table to link to item to additional information
`barcode` varchar(20) default NULL, -- item barcode (MARC21 952$p)
`dateaccessioned` date default NULL, -- date the item was acquired or added to Koha (MARC21 952$d)
`booksellerid` mediumtext default NULL, -- where the item was purchased (MARC21 952$e)
`homebranch` varchar(10) default NULL, -- foreign key from the branches table for the library that owns this item (MARC21 952$a)
`price` decimal(8,2) default NULL, -- purchase price (MARC21 952$g)
`replacementprice` decimal(8,2) default NULL, -- cost the library charges to replace the item if it has been marked lost (MARC21 952$v)
`replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w)
`datelastborrowed` date default NULL, -- the date the item was last checked out/issued
`datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done)
`stack` tinyint(1) default NULL,
`notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
`damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
`itemlost` tinyint(1) NOT NULL default 0, -- authorized value defining this item as lost (MARC21 952$1)
`itemlost_on` datetime DEFAULT NULL, -- the date and time an item was last marked as lost, NULL if not lost
`withdrawn` tinyint(1) NOT NULL default 0, -- authorized value defining this item as withdrawn (MARC21 952$0)
`withdrawn_on` datetime DEFAULT NULL, -- the date and time an item was last marked as withdrawn, NULL if not withdrawn
`itemcallnumber` varchar(255) default NULL, -- call number for this item (MARC21 952$o)
`coded_location_qualifier` varchar(10) default NULL, -- coded location qualifier(MARC21 952$f)
`issues` smallint(6) default NULL, -- number of times this item has been checked out/issued
`renewals` smallint(6) default NULL, -- number of times this item has been renewed
`reserves` smallint(6) default NULL, -- number of times this item has been placed on hold/reserved
`restricted` tinyint(1) default NULL, -- authorized value defining use restrictions for this item (MARC21 952$5)
`itemnotes` mediumtext, -- public notes on this item (MARC21 952$x)
`itemnotes_nonpublic` mediumtext default NULL,
`holdingbranch` varchar(10) default NULL, -- foreign key from the branches table for the library that is currently in possession item (MARC21 952$b)
`paidfor` mediumtext,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this item was last altered
`location` varchar(80) default NULL, -- authorized value for the shelving location for this item (MARC21 952$c)
`permanent_location` varchar(80) default NULL, -- linked to the CART and PROC temporary locations feature, stores the permanent shelving location
`onloan` date default NULL, -- defines if item is checked out (NULL for not checked out, and checkout date for checked out)
`cn_source` varchar(10) default NULL, -- classification source used on this item (MARC21 952$2)
`cn_sort` varchar(255) default NULL, -- normalized form of the call number (MARC21 952$o) used for sorting
`ccode` varchar(10) default NULL, -- authorized value for the collection code associated with this item (MARC21 952$8)
`materials` text default NULL, -- materials specified (MARC21 952$3)
`uri` varchar(255) default NULL, -- URL for the item (MARC21 952$u)
`itype` varchar(10) default NULL, -- foreign key from the itemtypes table defining the type for this item (MARC21 952$y)
`more_subfields_xml` longtext default NULL, -- additional 952 subfields in XML format
`enumchron` text default NULL, -- serial enumeration/chronology for the item (MARC21 952$h)
`copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t)
`stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i)
`new_status` VARCHAR(32) DEFAULT NULL, -- 'new' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob.
PRIMARY KEY (`itemnumber`),
UNIQUE KEY `itembarcodeidx` (`barcode`),
KEY `itemstocknumberidx` (`stocknumber`),
KEY `itembinoidx` (`biblioitemnumber`),
KEY `itembibnoidx` (`biblionumber`),
KEY `homebranch` (`homebranch`),
KEY `holdingbranch` (`holdingbranch`),
KEY `itemcallnumber` (`itemcallnumber`),
KEY `items_location` (`location`),
KEY `items_ccode` (`ccode`),
KEY `itype_idx` (`itype`),
CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `items_last_borrower`
--
CREATE TABLE IF NOT EXISTS `items_last_borrower` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`itemnumber` int(11) NOT NULL,
`borrowernumber` int(11) NOT NULL,
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `itemnumber` (`itemnumber`),
KEY `borrowernumber` (`borrowernumber`),
CONSTRAINT `items_last_borrower_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `items_last_borrower_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `itemtypes`
--
DROP TABLE IF EXISTS `itemtypes`;
CREATE TABLE `itemtypes` ( -- defines the item types
itemtype varchar(10) NOT NULL default '', -- unique key, a code associated with the item type
description mediumtext, -- a plain text explanation of the item type
rentalcharge double(16,4) default NULL, -- the amount charged when this item is checked out/issued
notforloan smallint(6) default NULL, -- 1 if the item is not for loan, 0 if the item is available for loan
imageurl varchar(200) default NULL, -- URL for the item type icon
summary text, -- information from the summary field, may include HTML
checkinmsg VARCHAR(255), -- message that is displayed when an item with the given item type is checked in
checkinmsgtype CHAR(16) DEFAULT 'message' NOT NULL, -- type (CSS class) for the checkinmsg, can be "alert" or "message"
sip_media_type VARCHAR(3) DEFAULT NULL, -- SIP2 protocol media type for this itemtype
hideinopac tinyint(1) NOT NULL DEFAULT 0, -- Hide the item type from the search options in OPAC
searchcategory varchar(80) default NULL, -- Group this item type with others with the same value on OPAC search options
PRIMARY KEY (`itemtype`),
UNIQUE KEY `itemtype` (`itemtype`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `creator_batches`
--
DROP TABLE IF EXISTS `creator_batches`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `creator_batches` (
`label_id` int(11) NOT NULL AUTO_INCREMENT,
`batch_id` int(10) NOT NULL DEFAULT '1',
`item_number` int(11) DEFAULT NULL,
`borrower_number` int(11) DEFAULT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`branch_code` varchar(10) NOT NULL DEFAULT 'NB',
`creator` char(15) NOT NULL DEFAULT 'Labels',
PRIMARY KEY (`label_id`),
KEY `branch_fk_constraint` (`branch_code`),
KEY `item_fk_constraint` (`item_number`),
KEY `borrower_fk_constraint` (`borrower_number`),
CONSTRAINT `creator_batches_ibfk_1` FOREIGN KEY (`borrower_number`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `creator_batches_ibfk_2` FOREIGN KEY (`branch_code`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE,
CONSTRAINT `creator_batches_ibfk_3` FOREIGN KEY (`item_number`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `creator_images`
--
DROP TABLE IF EXISTS `creator_images`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `creator_images` (
`image_id` int(4) NOT NULL AUTO_INCREMENT,
`imagefile` mediumblob,
`image_name` char(20) NOT NULL DEFAULT 'DEFAULT',
PRIMARY KEY (`image_id`),
UNIQUE KEY `image_name_index` (`image_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `creator_layouts`
--
DROP TABLE IF EXISTS `creator_layouts`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `creator_layouts` (
`layout_id` int(4) NOT NULL AUTO_INCREMENT,
`barcode_type` char(100) NOT NULL DEFAULT 'CODE39',
`start_label` int(2) NOT NULL DEFAULT '1',
`printing_type` char(32) NOT NULL DEFAULT 'BAR',
`layout_name` char(20) NOT NULL DEFAULT 'DEFAULT',
`guidebox` int(1) DEFAULT '0',
`oblique_title` int(1) DEFAULT '1',
`font` char(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'TR',
`font_size` int(4) NOT NULL DEFAULT '10',
`units` char(20) NOT NULL DEFAULT 'POINT',
`callnum_split` int(1) DEFAULT '0',
`text_justify` char(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'L',
`format_string` varchar(210) NOT NULL DEFAULT 'barcode',
`layout_xml` text NOT NULL,
`creator` char(15) NOT NULL DEFAULT 'Labels',
PRIMARY KEY (`layout_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `creator_templates`
--
DROP TABLE IF EXISTS `creator_templates`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `creator_templates` (
`template_id` int(4) NOT NULL AUTO_INCREMENT,
`profile_id` int(4) DEFAULT NULL,
`template_code` char(100) NOT NULL DEFAULT 'DEFAULT TEMPLATE',
`template_desc` char(100) NOT NULL DEFAULT 'Default description',
`page_width` float NOT NULL DEFAULT '0',
`page_height` float NOT NULL DEFAULT '0',
`label_width` float NOT NULL DEFAULT '0',
`label_height` float NOT NULL DEFAULT '0',
`top_text_margin` float NOT NULL DEFAULT '0',
`left_text_margin` float NOT NULL DEFAULT '0',
`top_margin` float NOT NULL DEFAULT '0',
`left_margin` float NOT NULL DEFAULT '0',
`cols` int(2) NOT NULL DEFAULT '0',
`rows` int(2) NOT NULL DEFAULT '0',
`col_gap` float NOT NULL DEFAULT '0',
`row_gap` float NOT NULL DEFAULT '0',
`units` char(20) NOT NULL DEFAULT 'POINT',
`creator` char(15) NOT NULL DEFAULT 'Labels',
PRIMARY KEY (`template_id`),
KEY `template_profile_fk_constraint` (`profile_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `letter`
--
DROP TABLE IF EXISTS `letter`;
CREATE TABLE `letter` ( -- table for all notice templates in Koha
`module` varchar(20) NOT NULL default '', -- Koha module that triggers this notice or slip
`code` varchar(20) NOT NULL default '', -- unique identifier for this notice or slip
`branchcode` varchar(10) default NULL, -- the branch this notice or slip is used at (branches.branchcode)
`name` varchar(100) NOT NULL default '', -- plain text name for this notice or slip
`is_html` tinyint(1) default 0, -- does this notice or slip use HTML (1 for yes, 0 for no)
`title` varchar(200) NOT NULL default '', -- subject line of the notice
`content` text, -- body text for the notice or slip
`message_transport_type` varchar(20) NOT NULL DEFAULT 'email', -- transport type for this notice
PRIMARY KEY (`module`,`code`, `branchcode`, `message_transport_type`),
CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`)
REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `marc_subfield_structure`
--
DROP TABLE IF EXISTS `marc_subfield_structure`;
CREATE TABLE `marc_subfield_structure` (
`tagfield` varchar(3) NOT NULL default '',
`tagsubfield` varchar(1) NOT NULL default '' COLLATE utf8_bin,
`liblibrarian` varchar(255) NOT NULL default '',
`libopac` varchar(255) NOT NULL default '',
`repeatable` tinyint(4) NOT NULL default 0,
`mandatory` tinyint(4) NOT NULL default 0,
`kohafield` varchar(40) default NULL,
`tab` tinyint(1) default NULL,
`authorised_value` varchar(20) default NULL,
`authtypecode` varchar(20) default NULL,
`value_builder` varchar(80) default NULL,
`isurl` tinyint(1) default NULL,
`hidden` tinyint(1) default NULL,
`frameworkcode` varchar(4) NOT NULL default '',
`seealso` varchar(1100) default NULL,
`link` varchar(80) default NULL,
`defaultvalue` text default NULL,
`maxlength` int(4) NOT NULL DEFAULT '9999',
PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`),
KEY `kohafield_2` (`kohafield`),
KEY `tab` (`frameworkcode`,`tab`),
KEY `kohafield` (`frameworkcode`,`kohafield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `marc_tag_structure`
--
DROP TABLE IF EXISTS `marc_tag_structure`;
CREATE TABLE `marc_tag_structure` (
`tagfield` varchar(3) NOT NULL default '',
`liblibrarian` varchar(255) NOT NULL default '',
`libopac` varchar(255) NOT NULL default '',
`repeatable` tinyint(4) NOT NULL default 0,
`mandatory` tinyint(4) NOT NULL default 0,
`authorised_value` varchar(10) default NULL,
`frameworkcode` varchar(4) NOT NULL default '',
PRIMARY KEY (`frameworkcode`,`tagfield`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `marc_matchers`
--
DROP TABLE IF EXISTS `marc_matchers`;
CREATE TABLE `marc_matchers` (
`matcher_id` int(11) NOT NULL auto_increment,
`code` varchar(10) NOT NULL default '',
`description` varchar(255) NOT NULL default '',
`record_type` varchar(10) NOT NULL default 'biblio',
`threshold` int(11) NOT NULL default 0,
PRIMARY KEY (`matcher_id`),
KEY `code` (`code`),
KEY `record_type` (`record_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `matchpoints`
--
DROP TABLE IF EXISTS `matchpoints`;
CREATE TABLE `matchpoints` (
`matcher_id` int(11) NOT NULL,
`matchpoint_id` int(11) NOT NULL auto_increment,
`search_index` varchar(30) NOT NULL default '',
`score` int(11) NOT NULL default 0,
PRIMARY KEY (`matchpoint_id`),
CONSTRAINT `matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`)
REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `matchpoint_components`
--
DROP TABLE IF EXISTS `matchpoint_components`;
CREATE TABLE `matchpoint_components` (
`matchpoint_id` int(11) NOT NULL,
`matchpoint_component_id` int(11) NOT NULL auto_increment,
sequence int(11) NOT NULL default 0,
tag varchar(3) NOT NULL default '',
subfields varchar(40) NOT NULL default '',
offset int(4) NOT NULL default 0,
length int(4) NOT NULL default 0,
PRIMARY KEY (`matchpoint_component_id`),
KEY `by_sequence` (`matchpoint_id`, `sequence`),
CONSTRAINT `matchpoint_components_ifbk_1` FOREIGN KEY (`matchpoint_id`)
REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `matcher_component_norms`
--
DROP TABLE IF EXISTS `matchpoint_component_norms`;
CREATE TABLE `matchpoint_component_norms` (
`matchpoint_component_id` int(11) NOT NULL,
`sequence` int(11) NOT NULL default 0,
`norm_routine` varchar(50) NOT NULL default '',
KEY `matchpoint_component_norms` (`matchpoint_component_id`, `sequence`),
CONSTRAINT `matchpoint_component_norms_ifbk_1` FOREIGN KEY (`matchpoint_component_id`)
REFERENCES `matchpoint_components` (`matchpoint_component_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `matcher_matchpoints`
--
DROP TABLE IF EXISTS `matcher_matchpoints`;
CREATE TABLE `matcher_matchpoints` (
`matcher_id` int(11) NOT NULL,
`matchpoint_id` int(11) NOT NULL,
CONSTRAINT `matcher_matchpoints_ifbk_1` FOREIGN KEY (`matcher_id`)
REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `matcher_matchpoints_ifbk_2` FOREIGN KEY (`matchpoint_id`)
REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `matchchecks`
--
DROP TABLE IF EXISTS `matchchecks`;
CREATE TABLE `matchchecks` (
`matcher_id` int(11) NOT NULL,
`matchcheck_id` int(11) NOT NULL auto_increment,
`source_matchpoint_id` int(11) NOT NULL,
`target_matchpoint_id` int(11) NOT NULL,
PRIMARY KEY (`matchcheck_id`),
CONSTRAINT `matcher_matchchecks_ifbk_1` FOREIGN KEY (`matcher_id`)
REFERENCES `marc_matchers` (`matcher_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `matcher_matchchecks_ifbk_2` FOREIGN KEY (`source_matchpoint_id`)
REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `matcher_matchchecks_ifbk_3` FOREIGN KEY (`target_matchpoint_id`)
REFERENCES `matchpoints` (`matchpoint_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `need_merge_authorities`
--
DROP TABLE IF EXISTS `need_merge_authorities`;
CREATE TABLE `need_merge_authorities` ( -- keeping track of authority records still to be merged by merge_authority cron job (used only if pref dontmerge is ON)
`id` int NOT NULL auto_increment PRIMARY KEY, -- unique id
`authid` bigint NOT NULL, -- reference to authority record
`done` tinyint DEFAULT 0 -- indication whether merge has been executed (0=not done, 1= done, 2= in progress)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `notifys`
--
DROP TABLE IF EXISTS `notifys`;
CREATE TABLE `notifys` (
`notify_id` int(11) NOT NULL default 0,
`borrowernumber` int(11) NOT NULL default 0,
`itemnumber` int(11) NOT NULL default 0,
`notify_date` date default NULL,
`notify_send_date` date default NULL,
`notify_level` int(1) NOT NULL default 0,
`method` varchar(20) NOT NULL default ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `oai_sets`
--
DROP TABLE IF EXISTS `oai_sets`;
CREATE TABLE `oai_sets` (
`id` int(11) NOT NULL auto_increment,
`spec` varchar(80) NOT NULL UNIQUE,
`name` varchar(80) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `oai_sets_descriptions`
--
DROP TABLE IF EXISTS `oai_sets_descriptions`;
CREATE TABLE `oai_sets_descriptions` (
`set_id` int(11) NOT NULL,
`description` varchar(255) NOT NULL,
CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `oai_sets_mappings`
--
DROP TABLE IF EXISTS `oai_sets_mappings`;
CREATE TABLE `oai_sets_mappings` (
`set_id` int(11) NOT NULL,
`marcfield` char(3) NOT NULL,
`marcsubfield` char(1) NOT NULL,
`operator` varchar(8) NOT NULL default 'equal',
`marcvalue` varchar(80) NOT NULL,
CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `oai_sets_biblios`
--
DROP TABLE IF EXISTS `oai_sets_biblios`;
CREATE TABLE `oai_sets_biblios` (
`biblionumber` int(11) NOT NULL,
`set_id` int(11) NOT NULL,
PRIMARY KEY (`biblionumber`, `set_id`),
CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `old_issues`
--
DROP TABLE IF EXISTS `old_issues`;
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
`issue_id` int(11) NOT NULL, -- primary key for issues table
`borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
`itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
`date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd)
`branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
`returndate` datetime default NULL, -- date the item was returned
`lastreneweddate` datetime default NULL, -- date the item was last renewed
`return` varchar(4) default NULL,
`renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
`auto_renew` BOOLEAN default FALSE, -- automatic renewal
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
`issuedate` datetime default NULL, -- date the item was checked out or issued
`onsite_checkout` int(1) NOT NULL default 0, -- in house use flag
PRIMARY KEY (`issue_id`),
KEY `old_issuesborridx` (`borrowernumber`),
KEY `old_issuesitemidx` (`itemnumber`),
KEY `branchcode_idx` (`branchcode`),
KEY `old_bordate` (`borrowernumber`,`timestamp`),
CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
ON DELETE SET NULL ON UPDATE SET NULL,
CONSTRAINT `old_issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`)
ON DELETE SET NULL ON UPDATE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `old_reserves`
--
DROP TABLE IF EXISTS `old_reserves`;
CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have been completed (either filled or cancelled)
`reserve_id` int(11) NOT NULL, -- primary key
`borrowernumber` int(11) default NULL, -- foreign key from the borrowers table defining which patron this hold is for
`reservedate` date default NULL, -- the date the hold was places
`biblionumber` int(11) default NULL, -- foreign key from the biblio table defining which bib record this hold is on
`branchcode` varchar(10) default NULL, -- foreign key from the branches table defining which branch the patron wishes to pick this hold up at
`notificationdate` date default NULL, -- currently unused
`reminderdate` date default NULL, -- currently unused
`cancellationdate` date default NULL, -- the date this hold was cancelled
`reservenotes` mediumtext, -- notes related to this hold
`priority` smallint(6) default NULL, -- where in the queue the patron sits
`found` varchar(1) default NULL, -- a one letter code defining what the status is of the hold is after it has been confirmed
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this hold was last updated
`itemnumber` int(11) default NULL, -- foreign key from the items table defining the specific item the patron has placed on hold or the item this hold was filled with
`waitingdate` date default NULL, -- the date the item was marked as waiting for the patron at the library
`expirationdate` DATE DEFAULT NULL, -- the date the hold expires (usually the date entered by the patron to say they don't need the hold after a certain date)
`lowestPriority` tinyint(1) NOT NULL, -- has this hold been pinned to the lowest priority in the holds queue (1 for yes, 0 for no)
`suspend` BOOLEAN NOT NULL DEFAULT 0, -- in this hold suspended (1 for yes, 0 for no)
`suspend_until` DATETIME NULL DEFAULT NULL, -- the date this hold is suspended until (NULL for infinitely)
PRIMARY KEY (`reserve_id`),
KEY `old_reserves_borrowernumber` (`borrowernumber`),
KEY `old_reserves_biblionumber` (`biblionumber`),
KEY `old_reserves_itemnumber` (`itemnumber`),
KEY `old_reserves_branchcode` (`branchcode`),
CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
ON DELETE SET NULL ON UPDATE SET NULL,
CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`)
ON DELETE SET NULL ON UPDATE SET NULL,
CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`)
ON DELETE SET NULL ON UPDATE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `opac_news`
--
DROP TABLE IF EXISTS `opac_news`;
CREATE TABLE `opac_news` ( -- data from the news tool
`idnew` int(10) unsigned NOT NULL auto_increment, -- unique identifier for the news article
`branchcode` varchar(10) default NULL, -- branch code users to create branch specific news, NULL is every branch.
`title` varchar(250) NOT NULL default '', -- title of the news article
`new` text NOT NULL, -- the body of your news article
`lang` varchar(25) NOT NULL default '', -- location for the article (koha is the staff client, slip is the circulation receipt and language codes are for the opac)
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, -- pulibcation date and time
`expirationdate` date default NULL, -- date the article is set to expire or no longer be visible
`number` int(11) default NULL, -- the order in which this article appears in that specific location
`borrowernumber` int(11) default NULL, -- The user who created the news article
PRIMARY KEY (`idnew`),
CONSTRAINT `borrowernumber_fk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT opac_news_branchcode_ibfk FOREIGN KEY (branchcode) REFERENCES branches (branchcode)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `overduerules`
--
DROP TABLE IF EXISTS `overduerules`;
CREATE TABLE `overduerules` ( -- overdue notice status and triggers
`overduerules_id` int(11) NOT NULL AUTO_INCREMENT, -- unique identifier for the overduerules
`branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table to define which branch this rule is for (if blank it's all libraries)
`categorycode` varchar(10) NOT NULL default '', -- foreign key from the categories table to define which patron category this rule is for
`delay1` int(4) default NULL, -- number of days after the item is overdue that the first notice is sent
`letter1` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the first notice
`debarred1` varchar(1) default 0, -- is the patron restricted when the first notice is sent (1 for yes, 0 for no)
`delay2` int(4) default NULL, -- number of days after the item is overdue that the second notice is sent
`debarred2` varchar(1) default 0, -- is the patron restricted when the second notice is sent (1 for yes, 0 for no)
`letter2` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the second notice
`delay3` int(4) default NULL, -- number of days after the item is overdue that the third notice is sent
`letter3` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the third notice
`debarred3` int(1) default 0, -- is the patron restricted when the third notice is sent (1 for yes, 0 for no)
PRIMARY KEY (`overduerules_id`),
UNIQUE KEY `overduerules_branch_cat` (`branchcode`,`categorycode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `patronimage`
--
DROP TABLE IF EXISTS `patronimage`;
CREATE TABLE `patronimage` ( -- information related to patron images
`borrowernumber` int(11) NOT NULL, -- the borrowernumber of the patron this image is attached to (borrowers.borrowernumber)
`mimetype` varchar(15) NOT NULL, -- the format of the image (png, jpg, etc)
`imagefile` mediumblob NOT NULL, -- the image
PRIMARY KEY (`borrowernumber`),
CONSTRAINT `patronimage_fk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Table structure for table `pending_offline_operations`
--
-- this table is MyISAM, InnoDB tables are growing only and this table is filled/emptied/filled/emptied...
-- so MyISAM is better in this case
DROP TABLE IF EXISTS `pending_offline_operations`;
CREATE TABLE pending_offline_operations (
operationid int(11) NOT NULL AUTO_INCREMENT,
userid varchar(30) NOT NULL,
branchcode varchar(10) NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`action` varchar(10) NOT NULL,
barcode varchar(20) DEFAULT NULL,
cardnumber varchar(16) DEFAULT NULL,
amount decimal(28,6) DEFAULT NULL,
PRIMARY KEY (operationid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `printers`
--
DROP TABLE IF EXISTS `printers`;
CREATE TABLE `printers` (
`printername` varchar(40) NOT NULL default '',
`printqueue` varchar(20) default NULL,
`printtype` varchar(20) default NULL,
PRIMARY KEY (`printername`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `printers_profile`
--
DROP TABLE IF EXISTS `printers_profile`;
CREATE TABLE `printers_profile` (
`profile_id` int(4) NOT NULL auto_increment,
`printer_name` varchar(40) NOT NULL default 'Default Printer',
`template_id` int(4) NOT NULL default '0',
`paper_bin` varchar(20) NOT NULL default 'Bypass',
`offset_horz` float NOT NULL default '0',
`offset_vert` float NOT NULL default '0',
`creep_horz` float NOT NULL default '0',
`creep_vert` float NOT NULL default '0',
`units` char(20) NOT NULL default 'POINT',
`creator` char(15) NOT NULL DEFAULT 'Labels',
PRIMARY KEY (`profile_id`),
UNIQUE KEY `printername` (`printer_name`,`template_id`,`paper_bin`,`creator`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `repeatable_holidays`
--
DROP TABLE IF EXISTS `repeatable_holidays`;
CREATE TABLE `repeatable_holidays` ( -- information for the days the library is closed
`id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
`branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table, defines which branch this closing is for
`weekday` smallint(6) default NULL, -- day of the week (0=Sunday, 1=Monday, etc) this closing is repeated on
`day` smallint(6) default NULL, -- day of the month this closing is on
`month` smallint(6) default NULL, -- month this closing is in
`title` varchar(50) NOT NULL default '', -- title of this closing
`description` text NOT NULL, -- description for this closing
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `reports_dictionary`
--
DROP TABLE IF EXISTS `reports_dictionary`;
CREATE TABLE reports_dictionary ( -- definitions (or snippets of SQL) stored for use in reports
`id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
`name` varchar(255) default NULL, -- name for this definition
`description` text, -- description for this definition
`date_created` datetime default NULL, -- date and time this definition was created
`date_modified` datetime default NULL, -- date and time this definition was last modified
`saved_sql` text, -- SQL snippet for us in reports
report_area varchar(6) DEFAULT NULL, -- Koha module this definition is for Circulation, Catalog, Patrons, Acquistions, Accounts)
PRIMARY KEY (id),
KEY dictionary_area_idx (report_area)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `reserves`
--
DROP TABLE IF EXISTS `reserves`;
CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha
`reserve_id` int(11) NOT NULL auto_increment, -- primary key
`borrowernumber` int(11) NOT NULL default 0, -- foreign key from the borrowers table defining which patron this hold is for
`reservedate` date default NULL, -- the date the hold was places
`biblionumber` int(11) NOT NULL default 0, -- foreign key from the biblio table defining which bib record this hold is on
`branchcode` varchar(10) default NULL, -- foreign key from the branches table defining which branch the patron wishes to pick this hold up at
`notificationdate` date default NULL, -- currently unused
`reminderdate` date default NULL, -- currently unused
`cancellationdate` date default NULL, -- the date this hold was cancelled
`reservenotes` mediumtext, -- notes related to this hold
`priority` smallint(6) default NULL, -- where in the queue the patron sits
`found` varchar(1) default NULL, -- a one letter code defining what the status is of the hold is after it has been confirmed
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this hold was last updated
`itemnumber` int(11) default NULL, -- foreign key from the items table defining the specific item the patron has placed on hold or the item this hold was filled with
`waitingdate` date default NULL, -- the date the item was marked as waiting for the patron at the library
`expirationdate` DATE DEFAULT NULL, -- the date the hold expires (usually the date entered by the patron to say they don't need the hold after a certain date)
`lowestPriority` tinyint(1) NOT NULL,
`suspend` BOOLEAN NOT NULL DEFAULT 0,
`suspend_until` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`reserve_id`),
KEY priorityfoundidx (priority,found),
KEY `borrowernumber` (`borrowernumber`),
KEY `biblionumber` (`biblionumber`),
KEY `itemnumber` (`itemnumber`),
KEY `branchcode` (`branchcode`),
CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Table structure for table `reviews`
--
DROP TABLE IF EXISTS `reviews`;
CREATE TABLE `reviews` ( -- patron opac comments
`reviewid` int(11) NOT NULL auto_increment, -- unique identifier for this comment
`borrowernumber` int(11) default NULL, -- foreign key from the borrowers table defining which patron left this comment
`biblionumber` int(11) default NULL, -- foreign key from the biblio table defining which bibliographic record this comment is for
`review` text, -- the body of the comment
`approved` tinyint(4) default NULL, -- whether this comment has been approved by a librarian (1 for yes, 0 for no)
`datereviewed` datetime default NULL, -- the date the comment was left
PRIMARY KEY (`reviewid`),
CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `reviews_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;