+--
+-- Table structure for table linktracker
+-- This stores clicks to external links
+--
+
+DROP TABLE IF EXISTS linktracker;
+CREATE TABLE linktracker (
+ id int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
+ biblionumber int(11) DEFAULT NULL, -- biblionumber of the record the link is from
+ itemnumber int(11) DEFAULT NULL, -- itemnumber if applicable that the link was from
+ borrowernumber int(11) DEFAULT NULL, -- borrowernumber who clicked the link
+ url text, -- the link itself
+ timeclicked datetime DEFAULT NULL, -- the date and time the link was clicked
+ PRIMARY KEY (id),
+ KEY bibidx (biblionumber),
+ KEY itemidx (itemnumber),
+ KEY borridx (borrowernumber),
+ KEY dateidx (timeclicked)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table 'plugin_data'
+--
+
+CREATE TABLE IF NOT EXISTS plugin_data (
+ plugin_class varchar(255) NOT NULL,
+ plugin_key varchar(255) NOT NULL,
+ plugin_value text,
+ PRIMARY KEY (plugin_class,plugin_key)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `patron_lists`
+--
+
+DROP TABLE IF EXISTS patron_lists;
+CREATE TABLE patron_lists (
+ patron_list_id int(11) NOT NULL AUTO_INCREMENT, -- unique identifier
+ name varchar(255) CHARACTER SET utf8 NOT NULL, -- the list's name
+ owner int(11) NOT NULL, -- borrowernumber of the list creator
+ PRIMARY KEY (patron_list_id),
+ KEY owner (owner)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- Constraints for table `patron_lists`
+--
+ALTER TABLE `patron_lists`
+ ADD CONSTRAINT patron_lists_ibfk_1 FOREIGN KEY (`owner`) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE;
+
+--
+-- Table structure for table 'patron_list_patrons'
+--
+
+DROP TABLE IF EXISTS patron_list_patrons;
+CREATE TABLE patron_list_patrons (
+ patron_list_patron_id int(11) NOT NULL AUTO_INCREMENT, -- unique identifier
+ patron_list_id int(11) NOT NULL, -- the list this entry is part of
+ borrowernumber int(11) NOT NULL, -- the borrower that is part of this list
+ PRIMARY KEY (patron_list_patron_id),
+ KEY patron_list_id (patron_list_id),
+ KEY borrowernumber (borrowernumber)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- Constraints for table `patron_list_patrons`
+--
+ALTER TABLE `patron_list_patrons`
+ ADD CONSTRAINT patron_list_patrons_ibfk_1 FOREIGN KEY (patron_list_id) REFERENCES patron_lists (patron_list_id) ON DELETE CASCADE ON UPDATE CASCADE,
+ ADD CONSTRAINT patron_list_patrons_ibfk_2 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE;
+
+--
+-- Table structure for table 'marc_modification_templates'
+--
+
+CREATE TABLE IF NOT EXISTS marc_modification_templates (
+ template_id int(11) NOT NULL AUTO_INCREMENT,
+ name text NOT NULL,
+ PRIMARY KEY (template_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table 'marc_modification_template_actions'
+--
+
+CREATE TABLE IF NOT EXISTS marc_modification_template_actions (
+ mmta_id int(11) NOT NULL AUTO_INCREMENT,
+ template_id int(11) NOT NULL,
+ ordering int(3) NOT NULL,
+ action enum('delete_field','update_field','move_field','copy_field') NOT NULL,
+ field_number smallint(6) NOT NULL DEFAULT '0',
+ from_field varchar(3) NOT NULL,
+ from_subfield varchar(1) DEFAULT NULL,
+ field_value varchar(100) DEFAULT NULL,
+ to_field varchar(3) DEFAULT NULL,
+ to_subfield varchar(1) DEFAULT NULL,
+ to_regex_search text,
+ to_regex_replace text,
+ to_regex_modifiers varchar(8) DEFAULT '',
+ conditional enum('if','unless') DEFAULT NULL,
+ conditional_field varchar(3) DEFAULT NULL,
+ conditional_subfield varchar(1) DEFAULT NULL,
+ conditional_comparison enum('exists','not_exists','equals','not_equals') DEFAULT NULL,
+ conditional_value text,
+ conditional_regex tinyint(1) NOT NULL DEFAULT '0',
+ description text,
+ PRIMARY KEY (mmta_id),
+ CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `misc_files`
+--
+
+CREATE TABLE IF NOT EXISTS `misc_files` ( -- miscellaneous files attached to records from various tables
+ `file_id` int(11) NOT NULL AUTO_INCREMENT, -- unique id for the file record
+ `table_tag` varchar(255) NOT NULL, -- usually table name, or arbitrary unique tag
+ `record_id` int(11) NOT NULL, -- record id from the table this file is associated to
+ `file_name` varchar(255) NOT NULL, -- file name
+ `file_type` varchar(255) NOT NULL, -- MIME type of the file
+ `file_description` varchar(255) DEFAULT NULL, -- description given to the file
+ `file_content` longblob NOT NULL, -- file content
+ `date_uploaded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- date and time the file was added
+ PRIMARY KEY (`file_id`),
+ KEY `table_tag` (`table_tag`),
+ KEY `record_id` (`record_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+