Update co-maintainers when disowning a package
[aur.git] / schema / reloadtestdb.sh
blobecaaaa8672c6eb266f8331d1a399920e7339a946
1 #!/bin/bash -e
3 DB_NAME=${DB_NAME:-AUR}
4 DB_USER=${DB_USER:-aur}
5 # Password should allow empty definition
6 DB_PASS=${DB_PASS-aur}
7 DB_HOST=${DB_HOST:-localhost}
8 DATA_FILE=${DATA_FILE:-dummy-data.sql}
10 echo "Using database $DB_NAME, user $DB_USER, host $DB_HOST"
12 mydir=$(pwd)
13 if [ $(basename $mydir) != "schema" ]; then
14 echo "you must be in the aur/schema directory to run this script"
15 exit 1
18 echo "recreating database..."
19 mysql -h $DB_HOST -u $DB_USER -p$DB_PASS < aur-schema.sql
21 if [ ! -f $DATA_FILE ]; then
22 echo "creating dumy-data..."
23 python3 gendummydata.py $DATA_FILE
26 echo "loading dummy-data..."
27 mysql -h $DB_HOST -u $DB_USER -p$DB_PASS $DB_NAME < $DATA_FILE
29 echo "done."