From: Owen Leonard Date: Sat, 30 Oct 2010 04:05:23 +0000 (-0600) Subject: changed visit_type to type X-Git-Url: http://git.pippins.net/embedvideo/.git/static/images/%7Bedit%7D?a=commitdiff_plain;h=10d31609e9f447202816d2721333e0d83f5c4f0a;p=eq%2F.git changed visit_type to type --- diff --git a/bin/import_ward_data b/bin/import_ward_data index 57d450f..3f08fc0 100755 --- a/bin/import_ward_data +++ b/bin/import_ward_data @@ -615,7 +615,7 @@ sub update_tc_visit_table if ($importing_status ne '') { # add visit if it doesn't exist in tc_visit - $sth = $dbh->prepare("insert into tc_visit values (NULL, '$family_id', '$comp_id', '', '', '$visit_date', '', '$importing_status', 'hometeaching')"); + $sth = $dbh->prepare("insert into tc_visit values (NULL, '$family_id', '$comp_id', '', '', '$visit_date', '', '$importing_status', 'H')"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; } } diff --git a/bin/upgrade_1_1_0_to_1_1_1 b/bin/upgrade_1_1_0_to_1_1_1 index 904133d..9bb7ff6 100755 --- a/bin/upgrade_1_1_0_to_1_1_1 +++ b/bin/upgrade_1_1_0_to_1_1_1 @@ -26,6 +26,16 @@ $sth->execute or die "-E- DB error: $DBI::errstr\n"; $sth = $dbh->prepare("ALTER TABLE `tc_interview` DROP `interview_type` "); $sth->execute or die "-E- DB error: $DBI::errstr\n"; +# Change visit_type field in tc_visit table to type, change enum to use 'H','P' +$sth = $dbh->prepare("ALTER TABLE `tc_visit` ADD `type` ENUM( 'H', 'P' ) NOT NULL AFTER `visit_type`"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; +$sth = $dbh->prepare("UPDATE tc_visit SET type='H' WHERE visit_type='hometeaching'"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; +$sth = $dbh->prepare("UPDATE tc_visit SET type='P' WHERE visit_type='presidency'"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; +$sth = $dbh->prepare("ALTER TABLE `tc_visit` DROP `visit_type` "); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; + print "-> Done!\n"; ################################################### diff --git a/sql/schema.dot b/sql/schema.dot index ec23ab7..9f5e512 100644 --- a/sql/schema.dot +++ b/sql/schema.dot @@ -55,7 +55,7 @@ digraph schema { shape = "record" ]; visit [ - label = "visit|| visit| family| companionship| companion1| companion2| date| notes| visited| visit_type" + label = "visit|| visit| family| companionship| companion1| companion2| date| notes| visited| type" shape = "record" ]; willingness [ diff --git a/sql/tc.sql b/sql/tc.sql index d66b728..f5520db 100644 --- a/sql/tc.sql +++ b/sql/tc.sql @@ -182,7 +182,7 @@ CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_visit` ( `date` date default NULL, `notes` text, `visited` enum('y','n','') default NULL, - `visit_type` enum('presidency','hometeaching') not null default 'hometeaching', + `type` enum('P','H') not null default 'H', PRIMARY KEY (`visit`) ) ENGINE=MyISAM AUTO_INCREMENT=9513 DEFAULT CHARSET=latin1;