#!/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 "Receipt: Adding column receiptDate and setting value to whenCreated" AlterTableReceipt.sql execute "Transaction: Data fix please delete this script after running" dataFixTransaction.sql execute "AccountingTransaction: Removing restriction to force responsible user" AlterAccountingTransaction.sql execute "Removing Treasury Portal Payments Functionalities" RemoveTreasuryPaymentsFunctionalities.sql execute "Changing Party Contact" alterPartyContact.sql execute "Fixing data inconsistency in Researchers" fixResearcherData.sql execute "updateWeightInOldEnrolments" updateWeightInOldEnrolments.sql