#!/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 "Changing Table Guide" AlterTableGuide.sql execute "Changing Table GuideEntry" AlterTableGuideEntry.sql execute "Changing Table PaymentTransacion" AlterTablePaymentTransaction.sql execute "Changing Table ReimbursementTransaction" AlterTableReimbursementTransaction.sql execute "Changing Table InsuranceValue" AlterTableInsuranceValue.sql execute "Changing Table ReimbursementGuideEntry" AlterTableReimbursementGuideEntry.sql execute "Fix execution course hours." fixExecutionCourseTable.sql execute "alter table ParkingParty" alterTableParkingParty.sql execute "Insert ParkingGroups" insertParkingGroups.sql execute "Add functionality mappings for the unit and position management" AddUnitManagementMappings.sql execute "Adding 'Groups Language' link to manager menu" AddGroupLanguageLink.sql execute "Solve generated script DELETE bug" DeleteConflictingFunctionality.sql execute "Clear and insert new groups in Parking Group" clearAndInsertIntoParkingGroup.sql execute "Alter ROOT_DOMAIN_OBJECT Table" alterRootDomainObjectAndPartyTable.sql echo '------- TODO: IS NECESSARY ASSOCIATE YOUR INSTITUTION UNIT AND EXTERNAL INSTITUTION UNIT TO ROOT_DOMAIN_OBJECT' echo '------------- IST EXAMPLE: update ROOT_DOMAIN_OBJECT set `KEY_EXTERNAL_INSTITUTION_UNIT` = 61558;' echo '-------------------------- update ROOT_DOMAIN_OBJECT set `KEY_INSTITUTION_UNIT` = 61559;' executeWithTempFile "Migrate ExternalPersons To ExternalContracts" migrateExternalPersons.sql execute "Add AccountabilityType To New ExternalContracts" addAccountabilityTypeToExternalPersons.sql