#!/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 "Migrating FileItem to FileContent" modifyFileItemKeyToFile.sql execute "Transaction: Changing timestamp columns to datetime" AlterTableTransaction.sql execute "GratuitySituation: Changing timestamp columns to datetime" AlterTableGratuitySituation.sql execute "SibsPaymentFileEntry: Changing timestamp columns to datetime" AlterTableSibsPaymentFileEntry.sql execute "GratuityValues: Changing timestamp columns to datetime" AlterTableGratuityValues.sql execute "Changing timestamp columns to datetime in VigilantGroup" alterTableVigilantGroup.sql execute "Changing timestamp columns to datetime in Unavailable Period" alterTableUnavailablePeriod.sql execute "Changing timestamp coulumns to datetime in Deploy Notifier" alterTableDeployNotifier.sql execute "Create candidacy tables" createCandidacyTables.sql execute "Alter candidacy tables" alterCandidacyTables.sql