summaryrefslogtreecommitdiff
path: root/dumps/load-dumps.sh
blob: 28370e694ea27cb34094b9b383938ef96867e31b (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
cat .mapping | while read DB DUMP
do
    grep -v 'CREATE DATABASE' $DUMP | grep -vi '^Use ' | 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