+--
+-- 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;
+