#!/bin/sh
set -e

echo "resetting main database"
$MYSQL -h$HOST -P$PORT -u$USER -p$PASSWORD $DB <resetdata.tables.sql

echo "resetting RIPADMIN database"
$MYSQL -h$RIPADMIN_DBHOST -P$RIPADMIN_DBPORT -u$RIPADMIN_DBUSER -p$RIPADMIN_DBPASS $RIPADMIN_DBNAME <resetdata.RIPADMIN.sql

echo "resetting CURRENTSERIAL to 1"
$MYSQL -h$HOST -P$PORT -u$USER -p$PASSWORD $DB <<EOM
INSERT serials SET serial_id=1, object_id=0, operation=4
EOM
