#!/bin/bash # ----------------------------------------------------------------------------- # # Runs sql scripts to update database from previous release. # # ----------------------------------------------------------------------------- # DB=$1 USER=$2 DB_HOST=$3 INSTITUTION=$4 PASSWORD=$5 echo Using host: $DB_HOST echo Using database: $DB echo Using user: $USER echo Institution: $INSTITUTION echo Password: $PASSWORD function execute() { if [ -z $3 ] then echo ---------------------------------------- $1 mysql -u$USER -f -h$DB_HOST --default-character-set=latin1 $DB < $2 echo else if [ "$INSTITUTION" == "$3" ] then echo ---------------------------------------- $1 specific for $3 mysql -u$USER -f -h$DB_HOST --default-character-set=latin1 $DB < $2 echo fi fi } function executeWithTempFile() { echo ---------------------------------------- $1 mysql -u$USER -f -h$DB_HOST --default-character-set=latin1 $DB < $2 > tmp.sql mysql -u$USER -f -h$DB_HOST --default-character-set=latin1 $DB < tmp.sql rm tmp.sql echo } execute "Add Queue Job Columns for alumni reports" addQueueJobColumns.sql execute "Reverting last granting of Senior Statute (script granted some false positives)." revertSeniorStatuteGrantingStrikesBack.sql IST execute "Drop old employee professional information tables" dropOldEmployeeProfessionalInformationTables.sql IST execute "Create person professional information tables" createPersonProfessionalInformationTables.sql execute "Create and update new countries" updateCoutries.sql IST execute "Drops the unique CardNumber ParkingParty key" dropParkingPartyKey.sql IST