X-Git-Url: http://git.pippins.net/embedvideo/.git/?a=blobdiff_plain;f=bin%2Fupgrade_1_1_0_to_1_1_1;fp=bin%2Fupgrade_1_1_0_to_1_1_1;h=904133d92afd622feaabd529268be7abff6a338d;hb=40bab501e1ba7d982bead980469dcd975d141130;hp=0000000000000000000000000000000000000000;hpb=5ae6b075235ebca24477826e45076cf5542d18b9;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 new file mode 100755 index 0000000..904133d --- /dev/null +++ b/bin/upgrade_1_1_0_to_1_1_1 @@ -0,0 +1,34 @@ +#!/usr/bin/perl + +use DBI; +use Getopt::Std; + +$mydir = `cd \$(dirname $0) 2>/dev/null; pwd`; chomp($mydir); +unshift @INC,("$mydir/../setup"); + +if( -f "$mydir/../setup/db_config.local") { require "db_config.local"; } +else { require "db_config"; } + +################################################### +# Connect to the database +$dbh=DBI->connect("dbi:mysql:dbname=$dbname:host=$dbhost:port=$dbport",$dbuser,$dbpass,{ + AutoCommit=>0, + PrintError=>0}) or print "Connect Failure:".$DBI::errstr."\n" and exit 2; +################################################### + +# Change interview_type field in tc_interview table to type, change enum to use 'H','P' +$sth = $dbh->prepare("ALTER TABLE `tc_interview` ADD `type` ENUM( 'H', 'P' ) NOT NULL AFTER `interview_type`"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; +$sth = $dbh->prepare("UPDATE tc_interview SET type='H' WHERE interview_type='hti'"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; +$sth = $dbh->prepare("UPDATE tc_interview SET type='P' WHERE interview_type='ppi'"); +$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"; + +print "-> Done!\n"; + +################################################### +# Disconnect from the database +$dbh->disconnect(); +###################################################