From: Raphaël Barrois Date: Sun, 30 May 2010 11:46:37 +0000 (+0200) Subject: Use mysql_run, mysql_exec in update scripts X-Git-Tag: xorg/1.0.0~160 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=01bb23e6f5ae192ffaa6afbbd94b21b2b37f2138;p=platal.git Use mysql_run, mysql_exec in update scripts Signed-off-by: Raphaël Barrois --- diff --git a/upgrade/0.10.0/update.sh b/upgrade/0.10.0/update.sh index 0e99620..e1b0ccb 100755 --- a/upgrade/0.10.0/update.sh +++ b/upgrade/0.10.0/update.sh @@ -10,9 +10,7 @@ mailman_start ########################################################### for sql in *.sql do - echo -n $sql - $MYSQL x4dat < $sql &>/dev/null || echo -n " ERROR" - echo . + mysql_run $sql done ########################################################### diff --git a/upgrade/0.10.1/update.sh b/upgrade/0.10.1/update.sh index ec3f93b..0010654 100755 --- a/upgrade/0.10.1/update.sh +++ b/upgrade/0.10.1/update.sh @@ -9,7 +9,5 @@ mailman_start ########################################################### for sql in *.sql do - echo -n $sql - $MYSQL x4dat < $sql &>/dev/null || echo -n " ERROR" - echo . + mysql_run $sql done diff --git a/upgrade/0.10.2/update.sh b/upgrade/0.10.2/update.sh index 928d1e4..0010654 100755 --- a/upgrade/0.10.2/update.sh +++ b/upgrade/0.10.2/update.sh @@ -9,7 +9,5 @@ mailman_start ########################################################### for sql in *.sql do - echo -n $sql - $MYSQL $DATABASE < $sql &>/dev/null || echo -n " ERROR" - echo . + mysql_run $sql done diff --git a/upgrade/0.10.3/update.sh b/upgrade/0.10.3/update.sh index bdf8f4f..0010654 100755 --- a/upgrade/0.10.3/update.sh +++ b/upgrade/0.10.3/update.sh @@ -9,7 +9,5 @@ mailman_start ########################################################### for sql in *.sql do - echo -n $sql - (sed -e "s/#\([0-9a-z]*\)#/${DBPREFIX}\1/g" < $sql | $MYSQL $DATABASE &>/dev/null) || echo -n " ERROR" - echo . + mysql_run $sql done diff --git a/upgrade/1.0.0/update.sh b/upgrade/1.0.0/update.sh index 3c3a41e..d7f6f65 100755 --- a/upgrade/1.0.0/update.sh +++ b/upgrade/1.0.0/update.sh @@ -7,12 +7,12 @@ confirm "Setting up new database: target db is \"$DATABASE\", source prefix is \"$DBPREFIX\"" -echo -n "* create database " -(echo "CREATE DATABASE IF NOT EXISTS $DATABASE;" | mysql_pipe) || die "ERROR" +echo "* create database" +mysql_exec "CREATE DATABASE IF NOT EXISTS $DATABASE;" echo "OK" -echo -n "* copying tables " -(../account/copy_tables.sh | mysql_pipe) || die "ERROR" +echo "* copying tables " +(../account/copy_tables.sh | while read line; do mysql_exec "$line"; done) || die "ERROR" echo "OK" mysql_run_directory ../newdirectory-0.0.1 @@ -20,7 +20,7 @@ mysql_run_directory ../account mysql_run_directory . ########################################################### -confirm "Running upgrade scripts" +confirm "* Running upgrade scripts" script_run ../newdirectory-0.0.1/phones.php script_run ../newdirectory-0.0.1/addresses.php script_run ../newdirectory-0.0.1/alternate_subsubsectors.php