add lamassu-nuke-db
This commit is contained in:
parent
9783591332
commit
6a1a76ff3b
1 changed files with 26 additions and 0 deletions
26
bin/lamassu-nuke-db
Executable file
26
bin/lamassu-nuke-db
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue