From 70ba7af395eca53fbd711b375949eb0a13021c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Fri, 8 Jul 2016 20:10:16 +0200 Subject: [PATCH] [Backport] Prevent accidental deletions of the database --- regenerate.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/regenerate.sh b/regenerate.sh index 47f9c962c6..0fff7efefa 100755 --- a/regenerate.sh +++ b/regenerate.sh @@ -1,6 +1,25 @@ #!/bin/bash -# For postgresql +show_answer=true +while [ $# -gt 0 ]; do + case "$1" in + -y) + show_answer=false + ;; + esac + shift +done + +if $show_answer ; then + echo "WARNING!! This script REMOVE your Taiga's database and you LOSE all the data." + read -p "Are you sure you want to delete all data? (Pres Y to continue): " -n 1 -r + echo # (optional) move to a new line + if [[ ! $REPLY =~ ^[Yy]$ ]] ; then + exit 1 + fi +fi + + echo "-> Remove taiga DB" dropdb taiga echo "-> Create taiga DB"