#!/bin/bash # ----------------------------------------------------------------------------- # # Runs sql scripts to update database from previous release. # # ----------------------------------------------------------------------------- # DB=$1 USER=$2 DB_HOST=$3 echo Using host=$DB_HOST echo Using database: $DB echo Using user $USER: function execute() { echo ---------------------------------------- $1 mysql -u$USER -f -h$DB_HOST --default-character-set=latin1 $DB < $2 echo } 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 column RequestDate" AlterTableAcademicServiceRequest.sql execute "Alter Category Table" alterCategoryTable.sql execute "addServiceRequestYearToAcademicServiceRequest" addServiceRequestYearToAcademicServiceRequest.sql execute "addTinyintsToAcademicServiceRequest" addTinyintsToAcademicServiceRequest.sql