Skip to content
Snippets Groups Projects
Commit 445e068c authored by Daniel's avatar Daniel
Browse files

ENH: make_db now can insert database dumps.

parent 25ef8d02
Branches
Tags
No related merge requests found
...@@ -59,6 +59,12 @@ Call 'make drop-$DATABASE_NAME' to delete that database or reconfigure with ...@@ -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 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() { function test-connection() {
$SQL -e "select 0;" $SQL -e "select 0;"
} }
...@@ -135,9 +141,10 @@ SQL="$MYSQL_CMD $MYSQL_CONNECTION" ...@@ -135,9 +141,10 @@ SQL="$MYSQL_CMD $MYSQL_CONNECTION"
case $1 in case $1 in
"drop") drop $2 ;; "drop") drop $2 ;;
"grant") grant $2;; "grant") grant $2 ;;
"test-connection") test-connection ;; "test-connection") test-connection ;;
"install_db") install_db ;; "install_db") install_db ;;
"restore_db") restore_db $2 ;;
# "prep_sql") prepare_sql ;; # "prep_sql") prepare_sql ;;
*) echo "Unknown action: $1" *) echo "Unknown action: $1"
esac esac
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment