#!/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 $DB < $2 echo } function executeWithTempFile() { echo ---------------------------------------- $1 mysql -u$USER -f -p$password $DB < $2 > tmp.sql mysql -u$USER -f -p$password $DB < tmp.sql rm tmp.sql echo } execute "Changing table CurriculumModule" AlterTableCurriculumModule.sql execute "Changing table PrecendentDegreeInformation" AlterTablePrecedentDegreeInformation.sql execute "Changing table Candidacy" AlterTableCandidacy.sql execute "Changing table PARTY (key_pais to key_nationality)" AlterTableParty.sql execute "Changing table CandidacySituation" AlterTableCandidacySituation.sql executeWithTempFile "Updating Candidacy Situation" UpdateCandidacySituation.sql execute "Changing table CandidacySituation" AlterTableCandidacySituation2.sql execute "Creating shift distribution tables" CreateShiftDistributionTables.sql execute "Changing table ExecutionYear" AlterTableExecutionYear.sql execute "Changing table Registration" AlterTableRegistration.sql execute "Add Codes for Bolonha Degrees" AddCodesForBolonhaDegrees.sql execute "add column KEY_LESSON in SUMMARY table" alterSummaryTable.sql execute "alter table Grouping, change column Name" alterTableGroupingChangeName.sql execute "Alter table result participation" alterTableResultParticipation.sql execute "Alter table Role" insertParkingManagerRole.sql