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";
}
}
$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";
###################################################
shape = "record"
];
visit [
- label = "visit||<v> visit|<f> family|<c> companionship|<c1> companion1|<c2> companion2|<t> date|<n> notes|<v> visited|<vt> visit_type"
+ label = "visit||<v> visit|<f> family|<c> companionship|<c1> companion1|<c2> companion2|<t> date|<n> notes|<v> visited|<vt> type"
shape = "record"
];
willingness [
`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;