#!/bin/sh # ----------------------------------------------------------------------------- # # Runs sql scripts to update database from previous release. # # ----------------------------------------------------------------------------- # DB=$1 USER=$2 DB_HOST=$3 INSTITUTION=fd-unl echo Using host=$DB_HOST echo Using database: $DB echo Using user $USER: echo Institution: $INSTITUTION # Linkare - Added to read the password read -s password function execute() { if [ -z $3 ] then echo $1 mysql -u$USER -p$password -f -h$DB_HOST --default-character-set=latin1 $DB < $2 echo else if [ "$INSTITUTION" == "$3" ] then echo $1 mysql -u$USER -p$password -f -h$DB_HOST --default-character-set=latin1 $DB < $2 echo fi fi } function executeWithTempFile() { echo $1 mysql -u$USER -p$password -f -h$DB_HOST --default-character-set=latin1 $DB < $2 > tmp.sql mysql -u$USER -p$password -f -h$DB_HOST --default-character-set=latin1 $DB < tmp.sql rm tmp.sql echo } execute "CreateTableCompetenceCourseUnits.sql" CreateTableCompetenceCourseUnits.sql execute "AlterTableParty.sql" AlterTableParty.sql execute "CreateTablePersonResidence.sql" CreateTablePersonResidence.sql