#!/bin/bash # ----------------------------------------------------------------------------- # # Runs sql scripts to update database from previous release. # # ----------------------------------------------------------------------------- # DB=$1 USER=$2 DB_HOST=$3 INSTITUTION=$4 echo Using host=$DB_HOST echo Using database: $DB echo Using user $USER: echo Institution: $INSTITUTION 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 "Data fix for some IST country units" dataFix.sql IST execute "Create Alumni tables" createAlumniTables.sql execute "Adding key to Alumni in Student" alterTableStudent.sql execute "Adding Formation (extends Qualification)" alterTableQualification.sql execute "Adding fields to Unit" alterTableParty.sql execute "Create Job table" createTableJob.sql execute "Create SupportRequest table" createTableSupportRequest.sql execute "Creating public section for Alumni Registration" intercepted.sql execute "Remove import Data Functionality from residence management" removeImportDataFunctionality.sql execute "Add new columns to IndividualCandidacy table" alterTableIndividualCandidacy.sql execute "Adding residence amount to Sibs reports" addResidenceAmountToReport.sql execute "Altering Inquiries Tables" alterInquiriesTables.sql