diff options
author | Lukas Fleischer <archlinux@cryptocrack.de> | 2014-02-06 19:09:15 +0100 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2014-02-06 19:11:25 +0100 |
commit | b7b586a8c405e6e5967c5febcab67caab581ca0c (patch) | |
tree | fcdaf036a036b7e554b07734d7ce32918b67c192 /schema/reloadtestdb.sh | |
parent | d0c927c940435bad3da922f727713e1b06b6c936 (diff) | |
download | aur-b7b586a8c405e6e5967c5febcab67caab581ca0c.tar.gz aur-b7b586a8c405e6e5967c5febcab67caab581ca0c.tar.xz |
Move support/schema/ to schema/
There aren't any other subdirectories in support/. Reduce the nesting
depth by moving schema/ to the top-level source directory.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'schema/reloadtestdb.sh')
-rwxr-xr-x | schema/reloadtestdb.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/schema/reloadtestdb.sh b/schema/reloadtestdb.sh new file mode 100755 index 00000000..ecaaaa86 --- /dev/null +++ b/schema/reloadtestdb.sh @@ -0,0 +1,29 @@ +#!/bin/bash -e + +DB_NAME=${DB_NAME:-AUR} +DB_USER=${DB_USER:-aur} +# Password should allow empty definition +DB_PASS=${DB_PASS-aur} +DB_HOST=${DB_HOST:-localhost} +DATA_FILE=${DATA_FILE:-dummy-data.sql} + +echo "Using database $DB_NAME, user $DB_USER, host $DB_HOST" + +mydir=$(pwd) +if [ $(basename $mydir) != "schema" ]; then + echo "you must be in the aur/schema directory to run this script" + exit 1 +fi + +echo "recreating database..." +mysql -h $DB_HOST -u $DB_USER -p$DB_PASS < aur-schema.sql + +if [ ! -f $DATA_FILE ]; then + echo "creating dumy-data..." + python3 gendummydata.py $DATA_FILE +fi + +echo "loading dummy-data..." +mysql -h $DB_HOST -u $DB_USER -p$DB_PASS $DB_NAME < $DATA_FILE + +echo "done." |