#!/bin/sh # ----------------------------------------------------------------------------- # # Runs sql scripts to update database from previous release. # # ----------------------------------------------------------------------------- # DB=$1 USER=$2 echo Using database: $DB echo Enter password for $USER: read -s password function execute() { echo ---------------------------------------- $1 mysql -u$USER -f -p$password --default-character-set=latin1 $DB < $2 echo } function executeWithTempFile() { echo ---------------------------------------- $1 mysql -u$USER -f -p$password --default-character-set=latin1 $DB < $2 > tmp.sql mysql -u$USER -f -p$password --default-character-set=latin1 $DB < tmp.sql rm tmp.sql echo } execute "Moving to scientific journals from national to international due to user request" fixScientificJournalsByRequest.sql execute "Create RESEARCH_EVENT table." createResearchEventTable.sql execute "Create EVENT_CONFERENCE_ARTICLES_ASSOCIATION table." createEventConferenceArticlesAssociationsTable.sql execute "Alter RESULT table, adding KEY_EVENT_CONFERENCE_ARTICLES_ASSOCIATION column." alterResearchResultTable.sql execute "Alter RESEARCH_ACTIVITY table, droping EVENT_LOCATION column." alterResearchActivityTable.sql execute "Alter RoomOccupation Table" alterTableRoomOccupation.sql execute "Fixing Administrative office for Gratuity Events with Payment Plan" FixAdministrativeOfficeForGratuityEventsWithPaymentPlan.sql execute "Changing Table Receipt" AlterTableReceipt.sql execute "Adding Treasury Functionalities" AddTreasuryFunctionalities.sql execute "Changing Table PenaltyExemptionJustification" ChangeTablePenaltyExemptionJustification.sql execute "Renaming Table PenaltyExemptionJustification ExemptionJustification" RenameTablePenaltyExemptionJustificationToExemptionJustification.sql execute "Changing Table Exemption" AlterTableExemption.sql execute "Changing Table Exemption Justification" AlterTableExemptionJustification.sql execute "Migrating GratuityExemptionType to GratuityExemptionJustification" MigrateGratuityExemptionTypeToGratuityExemptionJustification.sql executeWithTempFile "Updating GratuityExemption to GratuityExemptionJustification keys" UpdateGratuityExemptionToGratuityExemptionJustificationKeys.sql executeWithTempFile "Fixing Exemption Justification Broken Keys to Exemption" FixExemptionJustificationToExemptionBrokenKeys.sql