From f5103edfe84559ed62829fbf551259bb2e247d8a Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Sat, 18 Sep 2010 15:01:10 -0600 Subject: [PATCH] removing upgrade scripts since we're going to redo the version tags and expect people to set up their database from scratch --- bin/upgrade_1_0_to_2_0 | 46 ---------- bin/upgrade_2_0_to_3_0 | 37 -------- bin/upgrade_3_0_to_4_0 | 33 ------- bin/upgrade_4_0_to_5_0 | 197 ----------------------------------------- 4 files changed, 313 deletions(-) delete mode 100755 bin/upgrade_1_0_to_2_0 delete mode 100755 bin/upgrade_2_0_to_3_0 delete mode 100755 bin/upgrade_3_0_to_4_0 delete mode 100755 bin/upgrade_4_0_to_5_0 diff --git a/bin/upgrade_1_0_to_2_0 b/bin/upgrade_1_0_to_2_0 deleted file mode 100755 index e5a1390..0000000 --- a/bin/upgrade_1_0_to_2_0 +++ /dev/null @@ -1,46 +0,0 @@ -#!/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; -################################################### - -# Add a new 'aaronic' column to the eq_ppi table -$sth = $dbh->prepare("ALTER TABLE `eq_ppi` ADD `aaronic` INT( 16 ) NOT NULL DEFAULT '0' AFTER `elder`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Parse the data out of the eq_interview table and add them to the eq_ppi table -$sth = $dbh->prepare("select * from eq_interview"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; -while($row = $sth->fetchrow_hashref) { - $interviewer = $row->{interviewer}; - $elder = $row->{elder}; - $aaronic = $row->{aaronic}; - $date = $row->{date}; - $notes = $row->{notes}; - $notes =~ s/\'/\\\'/g; - $eqpresppi = 0; - #print "$interviewer $elder $aaronic $date $eqpresppi $notes\n"; - $sth2 = $dbh->prepare("insert into eq_ppi values (NULL,'$interviewer','$elder','$aaronic','$date','$notes','$eqpresppi')"); - $sth2->execute or die "-E- DB error: $DBI::errstr\n"; -} - -print "\n-> Succesfully imported all eq_interview table entries into eq_ppi table...\n"; -print "-> You may drop the eq_interview table once you know all your data was transferred to the eq_ppi table correctly..\n"; - -################################################### -# Disconnect from the database -$dbh->disconnect(); -################################################### - - diff --git a/bin/upgrade_2_0_to_3_0 b/bin/upgrade_2_0_to_3_0 deleted file mode 100755 index c37ba9d..0000000 --- a/bin/upgrade_2_0_to_3_0 +++ /dev/null @@ -1,37 +0,0 @@ -#!/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; -################################################### - -# Add a new 'email' field to the eq_elder table -$sth = $dbh->prepare("ALTER TABLE `eq_elder` ADD `email` VARCHAR( 120 ) NULL AFTER `phone`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Add a new 'indiv_id' field to the eq_elder table -$sth = $dbh->prepare("ALTER TABLE `eq_elder` ADD `indiv_id` INT( 16 ) UNSIGNED NOT NULL AFTER `elder`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Add a new 'location' field to the eq_appointment table -$sth = $dbh->prepare("ALTER TABLE `eq_appointment` ADD `location` VARCHAR( 120 ) NULL AFTER `time`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -print "-> Done!\n"; - -################################################### -# Disconnect from the database -$dbh->disconnect(); -################################################### - - diff --git a/bin/upgrade_3_0_to_4_0 b/bin/upgrade_3_0_to_4_0 deleted file mode 100755 index a7ac6f9..0000000 --- a/bin/upgrade_3_0_to_4_0 +++ /dev/null @@ -1,33 +0,0 @@ -#!/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; -################################################### - -# Add a new 'email' field to the eq_aaronic table -$sth = $dbh->prepare("ALTER TABLE `eq_aaronic` ADD `email` VARCHAR( 120 ) NULL AFTER `phone`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Add a new 'priesthood' field to the eq_elder table -$sth = $dbh->prepare("ALTER TABLE `eq_elder` ADD `priesthood` enum('High Priest','Elder','Priest','Teacher','Deacon','Unordained') NULL AFTER `email`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -print "-> Done!\n"; - -################################################### -# Disconnect from the database -$dbh->disconnect(); -################################################### - - diff --git a/bin/upgrade_4_0_to_5_0 b/bin/upgrade_4_0_to_5_0 deleted file mode 100755 index 8f6d7e6..0000000 --- a/bin/upgrade_4_0_to_5_0 +++ /dev/null @@ -1,197 +0,0 @@ -#!/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; -################################################### - -# Remove eq_aaronic table -$sth = $dbh->prepare("DROP TABLE IF EXISTS `eq_aaronic`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename eq_activity table to tc_activity -$sth = $dbh->prepare("RENAME TABLE `eq_activity` TO `tc_activity`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename eq_appointment table to tc_appointment -$sth = $dbh->prepare("RENAME TABLE `eq_appointment` TO `tc_appointment`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Change elder field in tc_appointment table to indiv -$sth = $dbh->prepare("ALTER TABLE `tc_appointment` CHANGE `elder` `indiv` INT(16)"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename eq_assignment table to tc_assignment -$sth = $dbh->prepare("RENAME TABLE `eq_assignment` TO `tc_assignment`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename eq_attendance table to tc_attendance -$sth = $dbh->prepare("RENAME TABLE `eq_attendance` TO `tc_attendance`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Change elder field in tc_attendance table to indiv -$sth = $dbh->prepare("ALTER TABLE `tc_attendance` CHANGE `elder` `indiv` INT(16)"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename eq_calling table to tc_calling -$sth = $dbh->prepare("RENAME TABLE `eq_calling` TO `tc_calling`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Remove eq_child table -$sth = $dbh->prepare("DROP TABLE IF EXISTS `eq_child`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename eq_companionship table to tc_companionship -$sth = $dbh->prepare("RENAME TABLE `eq_companionship` TO `tc_companionship`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Remove aaronic field from tc_companionship -$sth = $dbh->prepare("ALTER TABLE `tc_companionship` DROP `aaronic`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Change elder field in tc_companionship table to indiv -$sth = $dbh->prepare("ALTER TABLE `tc_companionship` CHANGE `elder` `indiv` INT(16)"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename eq_district table to tc_district -$sth = $dbh->prepare("RENAME TABLE `eq_district` TO `tc_district`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename eq_elder table to tc_indiv -$sth = $dbh->prepare("RENAME TABLE `eq_elder` TO `tc_indiv`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Change elder field in tc_indiv table to indiv -$sth = $dbh->prepare("ALTER TABLE `tc_indiv` CHANGE `elder` `indiv` INT(16) NOT NULL AUTO_INCREMENT"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Add a new 'address' column to the tc_indiv table -$sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `address` VARCHAR( 255 ) NULL DEFAULT NULL AFTER `name`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Add a new 'family' column to the tc_indiv table -$sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `family` INT(16) UNSIGNED NULL DEFAULT NULL AFTER `email`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Add a new 'hh_position' column to the tc_indiv table -$sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `hh_position` ENUM( 'Head of Household', 'Spouse', 'Other' ) NOT NULL DEFAULT 'Other' AFTER `family`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Add a new 'steward' column to the tc_indiv table -$sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `steward` ENUM( 'High Priest', 'Elder', '' ) NULL DEFAULT NULL AFTER `priesthood`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename int_pri column to hti_pri in the tc_indiv table -$sth = $dbh->prepare("ALTER TABLE `tc_indiv` CHANGE `int_pri` `hti_pri` INT( 10 ) UNSIGNED NULL DEFAULT '1'"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename int_notes column to hti_notes in the tc_indiv table -$sth = $dbh->prepare("ALTER TABLE `tc_indiv` CHANGE `int_notes` `hti_notes` VARCHAR( 128 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename eq_family table to tc_family -$sth = $dbh->prepare("RENAME TABLE `eq_family` TO `tc_family`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Change elder_id field in tc_family table to indiv_id -$sth = $dbh->prepare("ALTER TABLE `tc_family` CHANGE `elder_id` `indiv_id` INT(16)"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Remove eq_parent table -$sth = $dbh->prepare("DROP TABLE IF EXISTS `eq_parent`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename eq_participation table to tc_participation -$sth = $dbh->prepare("RENAME TABLE `eq_participation` TO `tc_participation`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Change elder field in tc_participation table to indiv -$sth = $dbh->prepare("ALTER TABLE `tc_participation` CHANGE `elder` `indiv` INT(16)"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename eq_ppi table to tc_interview -$sth = $dbh->prepare("RENAME TABLE `eq_ppi` TO `tc_interview`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Change elder field in tc_interview table to indiv -$sth = $dbh->prepare("ALTER TABLE `tc_interview` CHANGE `elder` `indiv` INT(16)"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Remove aaronic field from tc_interview -$sth = $dbh->prepare("ALTER TABLE `tc_interview` DROP `aaronic`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Change ppi field in tc_interview table to interview -$sth = $dbh->prepare("ALTER TABLE `tc_interview` CHANGE `ppi` `interview` INT(16) NOT NULL AUTO_INCREMENT"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Add a new 'interview_type' column to the tc_interview table -$sth = $dbh->prepare("ALTER TABLE `tc_interview` ADD `interview_type` enum('hti','ppi') NOT NULL DEFAULT 'hti' AFTER `eqpresppi`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# set all interviews to be ppi's if eqpresppi is 1 -$sth = $dbh->prepare("UPDATE tc_interview SET interview_type='ppi' WHERE eqpresppi='1'"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# remove 'eqpresppi' from tc_interview -$sth = $dbh->prepare("ALTER TABLE `tc_interview` DROP `eqpresppi`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename eq_presidency table to tc_presidency -$sth = $dbh->prepare("RENAME TABLE `eq_presidency` TO `tc_presidency`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Change elder field in tc_presidency table to indiv -$sth = $dbh->prepare("ALTER TABLE `tc_presidency` CHANGE `elder` `indiv` INT(16)"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Remove eqpres field from tc_presidency -$sth = $dbh->prepare("ALTER TABLE `tc_presidency` DROP `eqpres`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename eq_visit table to tc_visit -$sth = $dbh->prepare("RENAME TABLE `eq_visit` TO `tc_visit`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Add a new 'companion1' column to the tc_visit table -$sth = $dbh->prepare("ALTER TABLE `tc_visit` ADD `companion1` INT( 16 ) NULL AFTER `companionship`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Add a new 'companion2' column to the tc_visit table -$sth = $dbh->prepare("ALTER TABLE `tc_visit` ADD `companion2` INT( 16 ) NULL AFTER `companion1`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Add a new 'visit_type' column to the tc_visit table -$sth = $dbh->prepare("ALTER TABLE `tc_visit` ADD `visit_type` enum('presidency','hometeaching') NOT NULL DEFAULT 'hometeaching' AFTER `visited`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# set all visits currently marked as companionship=0 with "type" "presidency" and all other visits should set to "hometeaching". -$sth = $dbh->prepare("update tc_visit set visit_type='presidency' where companionship='0'"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Rename eq_willingness table to tc_willingness -$sth = $dbh->prepare("RENAME TABLE `eq_willingness` TO `tc_willingness`"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -# Change elder field in tc_willingness table to indiv -$sth = $dbh->prepare("ALTER TABLE `tc_willingness` CHANGE `elder` `indiv` INT(16)"); -$sth->execute or die "-E- DB error: $DBI::errstr\n"; - -print "-> Done!\n"; - -################################################### -# Disconnect from the database -$dbh->disconnect(); -################################################### - - -- 2.34.1