Le Jeudi 15 Juillet 2010 15:09 CEST, Donny Brooks <[email protected]> a 
écrit:

> Back right after the official 1.2.2 there was the announcement of a few
> database changes and there was a release of scripts to upgrade the
> postgres installs but nothing for the mysql ones. Is there a script so
> we can upgrade and safely load the nightlys again and test new features?
> I look forward to 1.3 but don't want to wait till then to test some of
> the new features.
>

I resend the script, my smtp is complaining a little too much about attached 
scripts.

   Pierre

mysql-update-1.2.2_to_1.2.3.sh
---
#!/bin/bash

# this script only works with MySQL

defaultusername=$USER
defaulthostname=localhost
defaultdatabase=$USER
indextable=sogo_folder_info

read -p "Username ($defaultusername): " username
read -p "Hostname ($defaulthostname): " hostname
read -p "Database ($defaultdatabase): " database

if [ -z "$username" ]
then
  username=$defaultusername
fi
if [ -z "$hostname" ]
then
  hostname=$defaulthostname
fi
if [ -z "$database" ]
then
  database=$defaultdatabase
fi

sqlscript=""

function addField() {
    oldIFS="$IFS"
    IFS=" "
    part="`echo -e \"ALTER TABLE $table ADD COLUMN c_category 
VARCHAR(255);\\n\"`";
    sqlscript="$sqlscript$part"
    IFS="$oldIFS"
}

tables=`mysql -p -N -B -u $username -h $hostname $database -e "select 
SUBSTRING_INDEX(c_quick_location, '/', -1) from $indextable where c_folder_type 
= 'Appointment';"`

for table in $tables;
do
  addField
done

echo "$sqlscript" | mysql -p -s -u $username -h $hostname $database > /dev/null
---


-- 
[email protected]
https://inverse.ca/sogo/lists

Reply via email to