summaryrefslogtreecommitdiff
path: root/dumps/load-dumps.sh
blob: a94f50085767f9a1f3c6debcbfd725d9f8f5aca2 (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 ' | 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