At JW's request, made the following changes:
One short-string field named "People" Four one-to-many fields: * Manifesto approach * Manifesto content * Manifesto authorship * Other analysis Also change the title of the current long-text field "Manifesto" to "Manifesto text", that would help differentiate it. As for positioning, ideally, "People" would go after 'Object', 'Other analysis' would go at the very bottom, and the other three would go after 'Manifesto text'.
This is the SQL:
# Manifesto database changes 2011-05-10 # Adding four one-to-many fields, requiring eight new tables, and one new regular short string field in the main table. # First drop all tables in case they already exist. DROP TABLE IF EXISTS `approach_to_revolt`; DROP TABLE IF EXISTS `content_to_revolt`; DROP TABLE IF EXISTS `authorship_to_revolt`; DROP TABLE IF EXISTS `analysis_to_revolt`; DROP TABLE IF EXISTS `approach`; DROP TABLE IF EXISTS `content`; DROP TABLE IF EXISTS `authorship`; DROP TABLE IF EXISTS `analysis`; # Now create four tables. CREATE TABLE IF NOT EXISTS `approach` ( `ap_id` int(11) NOT NULL auto_increment, `ap_name` varchar(128) collate utf8_unicode_ci default NULL, PRIMARY KEY (`ap_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1; CREATE TABLE IF NOT EXISTS `content` ( `co_id` int(11) NOT NULL auto_increment, `co_name` varchar(128) collate utf8_unicode_ci default NULL, PRIMARY KEY (`co_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1; CREATE TABLE IF NOT EXISTS `authorship` ( `au_id` int(11) NOT NULL auto_increment, `au_name` varchar(128) collate utf8_unicode_ci default NULL, PRIMARY KEY (`au_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1; CREATE TABLE IF NOT EXISTS `analysis` ( `an_id` int(11) NOT NULL auto_increment, `an_name` varchar(128) collate utf8_unicode_ci default NULL, PRIMARY KEY (`an_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1; # Now create four linking tables. CREATE TABLE IF NOT EXISTS `approach_to_revolt` ( `apr_apr_id` int(11) NOT NULL auto_increment, `apr_ap_id_fk` int(11) NOT NULL, `apr_rv_id_fk` int(11) NOT NULL, PRIMARY KEY (`apr_apr_id`), KEY `apr_ap_id_fk` (`apr_ap_id_fk`), KEY `apr_rv_id_fk` (`apr_rv_id_fk`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ALTER TABLE `approach_to_revolt` ADD CONSTRAINT `approach_to_revolts_ibfk_1` FOREIGN KEY (`apr_rv_id_fk`) REFERENCES `revolt` (`rv_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `approach_to_revolts_ibfk_2` FOREIGN KEY (`apr_ap_id_fk`) REFERENCES `approach` (`ap_id`) ON DELETE CASCADE ON UPDATE CASCADE; CREATE TABLE IF NOT EXISTS `content_to_revolt` ( `cor_cor_id` int(11) NOT NULL auto_increment, `cor_co_id_fk` int(11) NOT NULL, `cor_rv_id_fk` int(11) NOT NULL, PRIMARY KEY (`cor_cor_id`), KEY `cor_co_id_fk` (`cor_co_id_fk`), KEY `cor_rv_id_fk` (`cor_rv_id_fk`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ALTER TABLE `content_to_revolt` ADD CONSTRAINT `content_to_revolts_ibfk_1` FOREIGN KEY (`cor_rv_id_fk`) REFERENCES `revolt` (`rv_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `content_to_revolts_ibfk_2` FOREIGN KEY (`cor_co_id_fk`) REFERENCES `content` (`co_id`) ON DELETE CASCADE ON UPDATE CASCADE; CREATE TABLE IF NOT EXISTS `authorship_to_revolt` ( `aur_aur_id` int(11) NOT NULL auto_increment, `aur_au_id_fk` int(11) NOT NULL, `aur_rv_id_fk` int(11) NOT NULL, PRIMARY KEY (`aur_aur_id`), KEY `aur_au_id_fk` (`aur_au_id_fk`), KEY `aur_rv_id_fk` (`aur_rv_id_fk`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ALTER TABLE `authorship_to_revolt` ADD CONSTRAINT `authorship_to_revolts_ibfk_1` FOREIGN KEY (`aur_rv_id_fk`) REFERENCES `revolt` (`rv_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `authorship_to_revolts_ibfk_2` FOREIGN KEY (`aur_au_id_fk`) REFERENCES `authorship` (`au_id`) ON DELETE CASCADE ON UPDATE CASCADE; CREATE TABLE IF NOT EXISTS `analysis_to_revolt` ( `anr_anr_id` int(11) NOT NULL auto_increment, `anr_an_id_fk` int(11) NOT NULL, `anr_rv_id_fk` int(11) NOT NULL, PRIMARY KEY (`anr_anr_id`), KEY `anr_an_id_fk` (`anr_an_id_fk`), KEY `anr_rv_id_fk` (`anr_rv_id_fk`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ALTER TABLE `analysis_to_revolt` ADD CONSTRAINT `analysis_to_revolts_ibfk_1` FOREIGN KEY (`anr_rv_id_fk`) REFERENCES `revolt` (`rv_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `analysis_to_revolts_ibfk_2` FOREIGN KEY (`anr_an_id_fk`) REFERENCES `analysis` (`an_id`) ON DELETE CASCADE ON UPDATE CASCADE; # Now add a new field. ALTER TABLE `revolt` ADD COLUMN `rv_people` VARCHAR(128) AFTER `rv_object`;
Also updated the copy_live_to_dev_db.sql script, fixed a bug in dev_to_live_update.sh, and made all the necessary changes in the local_classes.php file.