#!/bin/sh

# Set this to be the same as your mysql base directory
MYSQL_BIN=/usr/local/mysql/bin

# Set this to be the name of the database
DB=Scripted

if [ ! -n "$1" ]
then
  echo "Usage: $0 <password>"
  exit 1
fi

# Set this to be the same as your mysql base directory
MYSQL_HOME=/usr/local/mysql
MYSQL_BIN=$MYSQL_HOME/bin

echo "Dropping $DB"
$MYSQL_BIN/mysqladmin -u root --password=$1 -f drop $DB

echo "Making $DB"
$MYSQL_BIN/mysqladmin -u root --password=$1 create $DB

echo -n "Executing table creation scripts: "
for f in `ls *.db` 
do
  echo -n "$f "
  $MYSQL_BIN/mysql -u root --password=$1 -D $DB < $f
done

echo "(done)"

# make this non-executable
#/bin/chmod a-x $0

