X-Git-Url: http://git.pippins.net/embedvideo/.git/static/gitweb.js?a=blobdiff_plain;f=bin%2Fupgrade_1_1_0_to_1_1_1;h=5c934cbdfa31b88ad68be282123757844c65bd55;hb=b5c74cd3f678ed412df81cda7f8f77344d374d7a;hp=942472891d7a918a93bb0a983ab7bf432fbcc481;hpb=6164e3a3c2d19b4e1d718ccafd7dddf6da27d270;p=eq%2F.git diff --git a/bin/upgrade_1_1_0_to_1_1_1 b/bin/upgrade_1_1_0_to_1_1_1 index 9424728..5c934cb 100755 --- a/bin/upgrade_1_1_0_to_1_1_1 +++ b/bin/upgrade_1_1_0_to_1_1_1 @@ -48,6 +48,33 @@ $sth->execute or die "-E- DB error: $DBI::errstr\n"; $sth = $dbh->prepare("ALTER TABLE `tc_district_sandbox` CHANGE `supervisor` `leader` INT( 16 ) UNSIGNED NULL DEFAULT NULL"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; +# rename presidency field in tc_appointment to leader +$sth = $dbh->prepare("ALTER TABLE `tc_appointment` CHANGE `presidency` `leader` INT( 16 ) UNSIGNED NOT NULL DEFAULT '0'"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; + +# rename presidency field in tc_leader to leader +$sth = $dbh->prepare("ALTER TABLE `tc_presidency` CHANGE `presidency` `leader` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; + +# rename tc_presidency to tc_leader +$sth = $dbh->prepare("RENAME TABLE `tc_presidency` TO `tc_leader`"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; + +# add type field to tc_leader in place of president, counselor, secretary fields +$sth = $dbh->prepare("ALTER TABLE `tc_leader` ADD `type` ENUM( 'P', 'C', 'S', 'D' ) NOT NULL AFTER `email`"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; +$sth = $dbh->prepare("UPDATE tc_leader SET type='P' WHERE president=1"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; +$sth = $dbh->prepare("UPDATE tc_leader SET type='C' WHERE counselor=1"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; +$sth = $dbh->prepare("UPDATE tc_leader SET type='S' WHERE secretary=1"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; +$sth = $dbh->prepare("UPDATE tc_leader SET type='D' WHERE president=0 AND counselor=0 AND secretary=0"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; +$sth = $dbh->prepare("ALTER TABLE `tc_leader` DROP `president`, DROP `counselor`, DROP `secretary`"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; + + print "-> Done!\n"; ###################################################