#!/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 "Refactor Equivalency Plan Stuff" refactorEquivalencyPlanEntries.sql execute "Add Resource Manager Role" addedResourceManagerRole.sql execute "Change SOP Role To ResourcesManager" changeSopRoleToResourceAllocationManager.sql execute "Update Resource exam_capacity and normal_capacity values" updateResourceCapacity.sql execute "Alter Table SPACE" alterTableSpace.sql execute "Fill SpaceOccupations With RoomOccupations" fillSpaceOccupationWithRoomOccupations.sql executeWithTempFile "Fill Lesson Space Occupation Key" alterTableLesson.sql execute "Changed Functionalities" changes-20070330115513.sql executeWithTempFile "Alter Resource Table" alterResourceTable.sql execute "Alter Resource Allocation Table" alterResourceAllocationTable.sql execute "Alter table Space Responsibility" alterSpaceResponsibilityTable.sql executeWithTempFile "Alter Resource Table 2" alterResourceTable2.sql execute "Changed Functionalities 2" changes-20070621160050.sql