head	1.1;
access;
symbols
	TIGRIS_1_1_0RC2:1.1
	TIGRIS_1_1_0RC1:1.1
	TIGRIS_1_1:1.1.0.4
	TIGRIS_1_0_8:1.1
	TIGRIS_1_0_8RC3:1.1
	TIGRIS_1_0_8RC2:1.1
	TIGRIS_1_0_8RC1:1.1
	TIGRIS_1_0_7:1.1
	TIGRIS_1_0_7RC3:1.1
	TIGRIS_1_0_7RC2:1.1
	TIGRIS_1_0_7RC1:1.1
	TIGRIS_1_0_6:1.1
	TIGRIS_1_0_6RC5:1.1
	TIGRIS_1_0_6RC4:1.1
	TIGRIS_1_0_6RC3:1.1
	TIGRIS_1_0_6RC2:1.1
	TIGRIS_1_0_6RC1:1.1
	TIGRIS_1_0_5:1.1
	TIGRIS_1_0_5RC6:1.1
	TIGRIS_1_0_5RC5:1.1
	TIGRIS_1_0_5RC4:1.1
	TIGRIS_1_0_5RC3:1.1
	TIGRIS_1_0_5RC2:1.1
	TIGRIS_1_0_5RC1:1.1
	TIGRIS_1_0_4:1.1
	TIGRIS_1_0_3:1.1
	TIGRIS_1_0_2:1.1
	TIGRIS_1_0_1:1.1
	TIGRIS_1_0:1.1.0.6
	TIGRIS_1_0_0:1.1
	TIGRIS_1_0_0_RC1:1.1.0.2;
locks; strict;
comment	@# @;


1.1
date	2001.03.23.00.12.36;	author kmaples;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Added the relevant scripts for the issuezilla portion of upgrade.  These
scripts superceede those previously locted in issuezilla/patches/
@
text
@#!/usr/bin/perl

#use DBI;
use Getopt::Std;

my %opts;
getopts("t:u:p:t:i:",\%opts);

unless(%opts){
    print "Usage:
    -t [tigris db name]
    -u [db user]
    -p [db password]
    -i [issues db name (target)]\n";
    exit(0);
}

my @@joist_tables = qw(
    DeletedUser    
    Message     
    Permission      
    PermissionExtent
    Role  
    RolePermission
    User  
    UserRole   
);

# a unique, but temporary name for the sql dump:
my $temp_sqldump = '/tmp/'. $opts{'t'} .'.' . $$ . '.sql';

#print $temp_sqldump;
#exit;

# 1. dump the existing db:
system("mysqldump -u $opts{'u'} -p$opts{'p'} $opts{'t'} > $temp_sqldump");
# 2. create the new db:
system("mysql -u $opts{'u'} -p$opts{'p'} -e 'create database $opts{'i'};'");
# 3. populate the new db:
system("mysql -u $opts{'u'} -p$opts{'p'} $opts{'i'} < $temp_sqldump");
# 4. drop irrelevant tables:
foreach(@@joist_tables){
    system("mysql -u $opts{'u'} -p$opts{'p'} $opts{'i'} -e 'drop table $_;'");
}

# TODO: begin altering tables


unlink($temp_sqldump) or warn "warn: $!\n";



@
