#!/bin/bash # ----------------------------------------------------------------------------- # # Runs sql scripts to update database from previous release. # # ----------------------------------------------------------------------------- # DB=$1 USER=$2 HOST=`if [ -z $3 ]; then echo "localhost"; else echo $3 ; fi` echo Using database: $DB echo Enter password for $USER: read -s password function execute() { echo ---------------------------------------- $1 mysql -h$HOST -u$USER -f -p$password --default-character-set=latin1 $DB < $2 echo } function executeWithTempFile() { echo ---------------------------------------- $1 mysql -h$HOST -u$USER -f -p$password --default-character-set=latin1 $DB < $2 > tmp.sql mysql -h$HOST -u$USER -f -p$password --default-character-set=latin1 $DB < tmp.sql rm tmp.sql echo } execute "Add tables for contact management and license software management" updates.sql execute "Add visa fields required by the passport document id type to Person entity" add-visa.sql execute "Change country flags remove eee/ch and add eee" fix-country-flags.sql