#!/usr/local/bin/perl
#-----------------------------------------------
# $Id: ckstruct.pl,v 1.1 1998/10/22 19:56:44 shevett Exp $
#-----------------------------------------------
#
# Compare structure files to in-system structures.
#

$mysql			=	"/usr/local/bin/mysql";
$mysqldump	=	"/usr/local/bin/mysqldump";
$mysqlshow	=	"/usr/local/bin/mysqlshow";
$strudir		=	"/apache/htdocs/keystone/struct";
$dbase			=	"keystone";

foreach $i (`ls $strudir/*.mysql`) {
	chop ($i);
	($tname=$i) =~ s/^.*\/([^\/]*).mysql$/$1/ ;
	print "----------------------------------------------------------\n";
	print "Checking table $tname...\n";
	$tmpfile = "/tmp/$$.$tname";
	system("$mysqldump -d $dbase $tname > $tmpfile");
	system("diff $tmpfile $i | grep -v INSERT ");
	system("rm $tmpfile");
}

