add lamassu-nuke-db

This commit is contained in:
Josh Harvey 2017-04-26 01:12:08 +03:00
parent 9783591332
commit 6a1a76ff3b

26
bin/lamassu-nuke-db Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -e
if [ "$(whoami)" != "root" ]; then
echo -e "This script has to be run as \033[1mroot\033[0m user"
exit 3
fi
read -p "This will DELETE ALL YOUR DATA! Sure? (y/n) " answer
case ${answer:0:1} in
y|Y )
echo "Deleting database..."
su -l postgres <<EOF
dropdb lamassu
createdb lamassu
EOF
CURRENT_DIR=`dirname $0`
rm "$CURRENT_DIR/../migrations/.migrate"
lamassu-migrate
echo "Done."
;;
* )
echo "No harm done."
;;
esac