summaryrefslogtreecommitdiff
path: root/dumps/load-dumps.sh
blob: 7695a4039574b238d6f6efa8e2a5820cce70ac7a (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 [ "$DB" != "dmp202021_e" ]
    then
        <logoh.sql mysql ${LIGA_MYSQL_CONNECTION_OPTS} $DB
    else
        <logoh.en.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