Skip to content

Commit cfd4bb9

Browse files
author
Thomas Noe
committed
allow for database NOT to be flushed
1 parent 5640000 commit cfd4bb9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

entrypoint_scripts/common/dojo-shared-resources.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,18 @@ function ensure_mysql_application_db() {
247247
if mysql -fs --protocol=TCP -h "$SQLHOST" -P "$SQLPORT" -u"$SQLUSER" -p"$SQLPWD" "$DBNAME" >/dev/null 2>&1 </dev/null; then
248248
echo "Database $DBNAME already exists!"
249249
echo
250-
read -p "Drop database $DBNAME? [Y/n] " DELETE
250+
if [ "$AUTO_DOCKER" == "yes" ]; then
251+
if [ -z "$FLUSHDB" ]; then
252+
DELETE="yes"
253+
else
254+
DELETE="$FLUSHDB"
255+
fi
256+
else
257+
read -p "Drop database $DBNAME? [Y/n] " DELETE
258+
fi
251259
if [[ ! $DELETE =~ ^[nN]$ ]]; then
252260
mysqladmin -f --protocol=TCP --host="$SQLHOST" --port="$SQLPORT" --user="$SQLUSER" --password="$SQLPWD" drop "$DBNAME"
253261
mysqladmin --protocol=TCP --host="$SQLHOST" --port="$SQLPORT" --user="$SQLUSER" --password="$SQLPWD" create "$DBNAME"
254-
else
255-
echo "Error! Must supply an empty database to proceed."
256-
echo
257-
ensure_mysql_application_db
258262
fi
259263
else
260264
# Set the root password for mysql - install has it blank

0 commit comments

Comments
 (0)