From 445e068c4c7f5edb7e6d04de439d6b30c74c8133 Mon Sep 17 00:00:00 2001 From: Daniel <daniel@harvey> Date: Mon, 25 Mar 2019 11:28:21 +0100 Subject: [PATCH] ENH: make_db now can insert database dumps. --- make_db | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/make_db b/make_db index 2d9b183..9ce63e9 100755 --- a/make_db +++ b/make_db @@ -59,6 +59,12 @@ Call 'make drop-$DATABASE_NAME' to delete that database or reconfigure with sed "s/db_2_0/$DATABASE_NAME/g" "$INSTALL_SQL_FILE" | $SQL } +# Inserts the dump (arg 1) into the database +function restore_db() { + SQL_FILE="$1" + $SQL -D "$DATABASE_NAME" < "$SQL_FILE" +} + function test-connection() { $SQL -e "select 0;" } @@ -135,9 +141,10 @@ SQL="$MYSQL_CMD $MYSQL_CONNECTION" case $1 in "drop") drop $2 ;; - "grant") grant $2;; + "grant") grant $2 ;; "test-connection") test-connection ;; "install_db") install_db ;; + "restore_db") restore_db $2 ;; # "prep_sql") prepare_sql ;; *) echo "Unknown action: $1" esac -- GitLab