From 01bb23e6f5ae192ffaa6afbbd94b21b2b37f2138 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Sun, 30 May 2010 13:46:37 +0200 Subject: [PATCH] Use mysql_run, mysql_exec in update scripts MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Barrois --- upgrade/0.10.0/update.sh | 4 +--- upgrade/0.10.1/update.sh | 4 +--- upgrade/0.10.2/update.sh | 4 +--- upgrade/0.10.3/update.sh | 4 +--- upgrade/1.0.0/update.sh | 10 +++++----- 5 files changed, 9 insertions(+), 17 deletions(-) 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 -- 2.1.4