Skip to content
Snippets Groups Projects
Unverified Commit e7bbc8d0 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

Merge branch 'merge_docker_sss' of...

Merge branch 'merge_docker_sss' of gitlab.gwdg.de:bmp-caosdb/caosdb-mysqlbackend into merge_docker_sss
parents 8187d9b3 445e068c
Branches
Tags
No related merge requests found
......@@ -46,7 +46,7 @@ function backup {
failure "dumpfile already exists."
fi
echo "Dumping database $NARG_NAME to $NARG_FILE ... "
$MYSQLDUMP_CMD $* --opt --default-character-set=utf8 --routines $NARG_NAME > $NARG_FILE
$CMD_MYSQL_DUMP $MYSQL_CONNECTION_NO_DB $* --opt --default-character-set=utf8 --routines $NARG_NAME > $NARG_FILE
success
}
......@@ -62,6 +62,6 @@ function backup {
DATE=$(date -u --rfc-3339=ns | sed 's/ /T/g')
BACKUPFILE=${BACKUPDIR}/${DATABASE_NAME}.${DATE}.dump.sql
backup $DATABASE_NAME $BACKUPFILE $MYSQL_CONNECTION
backup $DATABASE_NAME $BACKUPFILE
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment