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


1.1
date	2001.04.26.18.48.52;	author kmaples;	state Exp;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2001.05.02.19.54.31;	author kmaples;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Rewrote in perl; now can iterate over a list of issues databases or all
issues databases.
@
text
@#!/usr/bin/perl -w
# -*- Perl -*- script to take simple 'snapshots' of databases
#
# $Id: snapshot_db_counts.pl,v 1.1 2001/04/26 05:06:43 kmaples Exp $

use DBI;
use strict;
use Getopt::Long;

BEGIN {
    unshift(@@INC, "$ENV{SANDBOX}/scripts");
}
use HelmDB;

unless(@@ARGV){
    print qq[
validate_iz_1.0_data.pl: checks counts on IssueZilla data altered
to SourceCast 1.0.  All counts should be zero if run against 
properly upgraded 1.0 issue databases.
Usage:
    
    validate_iz_1.0_data.pl {database1} ... {databaseN}
    validate_iz_1.0_data.pl --all  
];
    exit;
}

my $all_dbs; 
my @@databases;

GetOptions(
    'all' => \$all_dbs,
);

# Get handle to database:
my $dbh = HelmDB::connect(
    'mysql', $ENV{DATABASE_ADMIN_USER}, $ENV{DATABASE_ADMIN_PASSWORD});

if($all_dbs){
    my @@refs = HelmDB::runQuery($dbh,'show databases');
    foreach(@@refs){
    	if($_->[0] =~ m/^$ENV{IZ_DATABASE_NAME}/){
            push(@@databases, $_->[0]);
    	}
    }
} else {
    @@databases = @@ARGV;
}

foreach(@@databases){
    my $current_db = $_;
    my $count;
    
    # Bail unless we can use the named database:
    unless(HelmDB::runSQL($dbh, "use $current_db")){
        warn "Unable to use $current_db: $!\n";
        next;   
    }
    print $current_db . ': checking login_name from profiles ... ' . "\n";
    $count = (
        HelmDB::runQuery($dbh, 
        "select count(login_name) 
        from profiles 
        where login_name not like '%$ENV{DOMAIN}'")
        )[0]->[0];
    print "\t$count bad records\n";    
        
    print $current_db . ': checking password from profiles ... ' . "\n";
    $count = (
        HelmDB::runQuery($dbh, 
        "select count(password) from profiles where password != 'password'")
        )[0]->[0];
    print "\t$count bad records\n";    
    
    print $current_db . ': checking issue_status from issues ... ' . "\n";
    $count = (
        HelmDB::runQuery($dbh, 
        "select count(issue_status) from issues where issue_status = 'ASSIGNED' or issue_status = ''")
        )[0]->[0];   
    print "\t$count bad records\n";    
        
    print $current_db . ': checking oldvalue, newvalue in issues_activity ... ' . "\n";
    $count = (
        HelmDB::runQuery($dbh, 
        "select count(issue_id) from issues_activity where oldvalue = 'ASSIGNED' or newvalue = 'ASSIGNED'")
        )[0]->[0];   
    print "\t$count bad records\n";    
        
}
$dbh->disconnect();
print "Done.\n";
__END__
@


1.1.2.1
log
@Modified migration scripts to change the bugs@@ user to issues@@; added a script
which attempts to reconcile existing helm accounts with older issuezilla
accounts upon upgrade from versions prior to 0.8.4; removed the sql statement
which attempted a brute-force transformation of user accounts in favor of
the aforementioned script; added data validation tools in helm/tests; added
the shared perl db library that these scripts use (HelmDB.pm) in previous
commit.
@
text
@d4 1
a4 1
# $Id: validate_iz_1.0_data.pl,v 1.1 2001/04/26 18:48:52 kmaples Exp $
@

