added cleanup functionality for tc_scheduling_priority during import of new data
[eq/.git] / bin / upgrade_2_0_to_3_0
1 #!/usr/bin/perl
2
3 use DBI;
4 use Getopt::Std;
5
6 $mydir = `cd \$(dirname $0) 2>/dev/null; pwd`; chomp($mydir);
7 unshift @INC,("$mydir/../setup");
8 if( -f "$mydir/../setup/db_config.local") { require "db_config.local"; }
9 else { require "db_config"; }
10
11 ###################################################
12 # Connect to the database
13 $dbh=DBI->connect("dbi:mysql:dbname=$dbname:host=$dbhost:port=$dbport",$dbuser,$dbpass,{
14     AutoCommit=>0,
15     PrintError=>0}) or print "Connect Failure:".$DBI::errstr."\n" and exit 2;
16 ###################################################
17
18 # Add a new 'email' field to the eq_elder table
19 $sth = $dbh->prepare("ALTER TABLE `eq_elder` ADD `email` VARCHAR( 120 ) NULL AFTER `phone`");
20 $sth->execute or die "-E- DB error: $DBI::errstr\n";
21
22 # Add a new 'indiv_id' field to the eq_elder table
23 $sth = $dbh->prepare("ALTER TABLE `eq_elder` ADD `indiv_id` INT( 16 ) UNSIGNED NOT NULL AFTER `elder`");
24 $sth->execute or die "-E- DB error: $DBI::errstr\n";
25
26 # Add a new 'location' field to the eq_appointment table
27 $sth = $dbh->prepare("ALTER TABLE `eq_appointment` ADD `location` VARCHAR( 120 ) NULL AFTER `time`");
28 $sth->execute or die "-E- DB error: $DBI::errstr\n";
29
30 print "-> Done!\n";
31
32 ###################################################
33 # Disconnect from the database
34 $dbh->disconnect();
35 ###################################################
36
37