summaryrefslogtreecommitdiff
path: root/dumps/load-dumps.sh
blob: a365c1664f69cb449c17713af6253a6bde0b3326 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
pushd $(dirname $0) >> /dev/null
grep -v '^#' .mapping | while read DB DUMP
do
    grep -v 'CREATE DATABASE' $DUMP | grep -vi '^Use ' | sed 's/SET NAMES cp1250/SET NAMES utf8mb4/g' | mysql ${LIGA_MYSQL_CONNECTION_OPTS} $DB
    if [[ $(mysql ${LIGA_MYSQL_CONNECTION_OPTS} $DB -N -e "SELECT language FROM params;") == *"english.language"* ]]
    then
        <logoh.en.sql mysql ${LIGA_MYSQL_CONNECTION_OPTS} $DB
    else
        <logoh.sql mysql ${LIGA_MYSQL_CONNECTION_OPTS} $DB
    fi
    cat .queries | while read -r QUERY
    do
        mysql ${LIGA_MYSQL_CONNECTION_OPTS} -N -e "$QUERY" $DB
    done
done
popd >> /dev/null