8 die "Must pass one and only one sysname to delete\n"
9 unless scalar @ARGV == 1;
11 use vars qw($dbhost $dbname $dbuser $dbpass $dbport
14 use FindBin qw($RealBin);
15 require "$RealBin/../BuildFarmWeb.pl";
17 die "no dbname" unless $dbname;
18 die "no dbuser" unless $dbuser;
20 my $dsn="dbi:Pg:dbname=$dbname";
21 $dsn .= ";host=$dbhost" if $dbhost;
22 $dsn .= ";port=$dbport" if $dbport;
24 my $db = DBI->connect($dsn,$dbuser,$dbpass);
26 die $DBI::errstr unless $db;
28 my @tables = qw/alerts buildsystems build_status build_status_log
29 build_status_recent_500 dashboard_mat latest_snapshot
30 nrecent_failures personality/;
32 for my $loop (0 .. (scalar @tables - 1) ) {
33 my $field = ($tables[$loop] eq 'personality') ? 'name' :
34 ($tables[$loop] eq 'buildsystems') ? 'name':
36 printf "Deleting from %s with field %s\n", $tables[$loop], $field;
38 DELETE FROM $tables[$loop]
41 $sth->execute($ARGV[0]);