X-Git-Url: http://git.pippins.net/embedvideo/.git/static/git-logo.png?a=blobdiff_plain;f=bin%2Fupgrade_4_0_to_5_0;h=8f6d7e604cebd3f20ac265b12139734de0e74812;hb=90140f92cb6d1c31d7ef617796b580d22b10ab47;hp=7401ea4310af265a3e47fc659892754c59492637;hpb=80739f4c39deff0ff28e20be40871a30eb58664a;p=eq%2F.git diff --git a/bin/upgrade_4_0_to_5_0 b/bin/upgrade_4_0_to_5_0 index 7401ea4..8f6d7e6 100755 --- a/bin/upgrade_4_0_to_5_0 +++ b/bin/upgrade_4_0_to_5_0 @@ -16,7 +16,7 @@ $dbh=DBI->connect("dbi:mysql:dbname=$dbname:host=$dbhost:port=$dbport",$dbuser,$ ################################################### # Remove eq_aaronic table -$sth = $dbh->prepare("DROP TABLE `eq_aaronic` IF EXISTS"); +$sth = $dbh->prepare("DROP TABLE IF EXISTS `eq_aaronic`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; # Rename eq_activity table to tc_activity @@ -48,7 +48,7 @@ $sth = $dbh->prepare("RENAME TABLE `eq_calling` TO `tc_calling`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; # Remove eq_child table -$sth = $dbh->prepare("DROP TABLE `eq_child` IF EXISTS"); +$sth = $dbh->prepare("DROP TABLE IF EXISTS `eq_child`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; # Rename eq_companionship table to tc_companionship @@ -56,7 +56,7 @@ $sth = $dbh->prepare("RENAME TABLE `eq_companionship` TO `tc_companionship`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; # Remove aaronic field from tc_companionship -$sth = $dbh->prepare("ALTER TABLE 'tc_companionship' DROP 'aaronic'"); +$sth = $dbh->prepare("ALTER TABLE `tc_companionship` DROP `aaronic`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; # Change elder field in tc_companionship table to indiv @@ -72,25 +72,33 @@ $sth = $dbh->prepare("RENAME TABLE `eq_elder` TO `tc_indiv`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; # Change elder field in tc_indiv table to indiv -$sth = $dbh->prepare("ALTER TABLE `tc_indiv` CHANGE `elder` `indiv` INT(16)"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Add a new 'birthday' column to the tc_indiv table -$sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `birthday` DATE NULL DEFAULT NULL AFTER `name` "); +$sth = $dbh->prepare("ALTER TABLE `tc_indiv` CHANGE `elder` `indiv` INT(16) NOT NULL AUTO_INCREMENT"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; # Add a new 'address' column to the tc_indiv table -$sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `address` VARCHAR( 255 ) NULL DEFAULT NULL AFTER `birthday`"); +$sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `address` VARCHAR( 255 ) NULL DEFAULT NULL AFTER `name`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; # Add a new 'family' column to the tc_indiv table $sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `family` INT(16) UNSIGNED NULL DEFAULT NULL AFTER `email`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; -# Add a new 'family' column to the tc_indiv table +# Add a new 'hh_position' column to the tc_indiv table $sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `hh_position` ENUM( 'Head of Household', 'Spouse', 'Other' ) NOT NULL DEFAULT 'Other' AFTER `family`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; +# Add a new 'steward' column to the tc_indiv table +$sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `steward` ENUM( 'High Priest', 'Elder', '' ) NULL DEFAULT NULL AFTER `priesthood`"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; + +# Rename int_pri column to hti_pri in the tc_indiv table +$sth = $dbh->prepare("ALTER TABLE `tc_indiv` CHANGE `int_pri` `hti_pri` INT( 10 ) UNSIGNED NULL DEFAULT '1'"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; + +# Rename int_notes column to hti_notes in the tc_indiv table +$sth = $dbh->prepare("ALTER TABLE `tc_indiv` CHANGE `int_notes` `hti_notes` VARCHAR( 128 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; + # Rename eq_family table to tc_family $sth = $dbh->prepare("RENAME TABLE `eq_family` TO `tc_family`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; @@ -100,7 +108,7 @@ $sth = $dbh->prepare("ALTER TABLE `tc_family` CHANGE `elder_id` `indiv_id` INT(1 $sth->execute or die "-E- DB error: $DBI::errstr\n"; # Remove eq_parent table -$sth = $dbh->prepare("DROP TABLE `eq_parent` IF EXISTS"); +$sth = $dbh->prepare("DROP TABLE IF EXISTS `eq_parent`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; # Rename eq_participation table to tc_participation @@ -120,11 +128,11 @@ $sth = $dbh->prepare("ALTER TABLE `tc_interview` CHANGE `elder` `indiv` INT(16)" $sth->execute or die "-E- DB error: $DBI::errstr\n"; # Remove aaronic field from tc_interview -$sth = $dbh->prepare("ALTER TABLE 'tc_interview' DROP 'aaronic'"); +$sth = $dbh->prepare("ALTER TABLE `tc_interview` DROP `aaronic`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; # Change ppi field in tc_interview table to interview -$sth = $dbh->prepare("ALTER TABLE `tc_interview` CHANGE `ppi` `interview` INT(16)"); +$sth = $dbh->prepare("ALTER TABLE `tc_interview` CHANGE `ppi` `interview` INT(16) NOT NULL AUTO_INCREMENT"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; # Add a new 'interview_type' column to the tc_interview table @@ -147,6 +155,10 @@ $sth->execute or die "-E- DB error: $DBI::errstr\n"; $sth = $dbh->prepare("ALTER TABLE `tc_presidency` CHANGE `elder` `indiv` INT(16)"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; +# Remove eqpres field from tc_presidency +$sth = $dbh->prepare("ALTER TABLE `tc_presidency` DROP `eqpres`"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; + # Rename eq_visit table to tc_visit $sth = $dbh->prepare("RENAME TABLE `eq_visit` TO `tc_visit`"); $sth->execute or die "-E- DB error: $DBI::errstr\n";