#!/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 "Photograph changes" add-photo-rejection-reason.sql execute "SEF support" sef-support.sql