diff --git a/Scripts/sql-update-2.1.17_to_2.1.18-mysql.sh b/Scripts/sql-update-2.1.17_to_2.1.18-mysql.sh index 0a1dfb522..bd8f3dd77 100755 --- a/Scripts/sql-update-2.1.17_to_2.1.18-mysql.sh +++ b/Scripts/sql-update-2.1.17_to_2.1.18-mysql.sh @@ -3,7 +3,8 @@ set -e # This script only works with MySQL -# updates c_partstates to mediumtext. +# updates c_partstates to mediumtext +# adds c_description to Calendar quick tables # http://www.sogo.nu/bugs/view.php?id=3175 # the field length was actually changed in v2.2.18 @@ -37,11 +38,12 @@ then sqlscript="" -function growVC() { +function adjustSchema() { oldIFS="$IFS" IFS=" " - part="`echo -e \"ALTER TABLE $table MODIFY c_partstates mediumtext;\\n\"`"; - sqlscript="$sqlscript$part" + part1="`echo -e \"ALTER TABLE $table MODIFY c_partstates mediumtext;\\n\"`"; + part2="`echo -e \"ALTER TABLE $table ADD COLUMN c_description mediumtext;\\n\"`"; + sqlscript="$sqlscript$part1$part2" IFS="$oldIFS" } @@ -51,7 +53,7 @@ tables=`mysql -p -s -u $username -h $hostname $database -e "select SUBSTRING_IND for table in $tables; do - growVC + adjustSchema done echo "$sqlscript" | mysql -p -s -u $username -h $hostname $database diff --git a/Scripts/sql-update-2.1.17_to_2.1.18.sh b/Scripts/sql-update-2.1.17_to_2.1.18.sh index 9312a1a33..fb6010d49 100755 --- a/Scripts/sql-update-2.1.17_to_2.1.18.sh +++ b/Scripts/sql-update-2.1.17_to_2.1.18.sh @@ -2,7 +2,8 @@ set -e # This script only works with PostgreSQL -# updates c_partstates to text. +# updates c_partstates to text +# adds c_description to Calendar quick tables # http://www.sogo.nu/bugs/view.php?id=3175 # the field length was actually changed in v2.2.18 @@ -35,11 +36,12 @@ fi sqlscript="" -function growVC() { +function adjustSchema() { oldIFS="$IFS" IFS=" " - part="`echo -e \"ALTER TABLE $table ALTER COLUMN c_partstates TYPE TEXT;\\n\"`"; - sqlscript="$sqlscript$part" + part1="`echo -e \"ALTER TABLE $table ALTER COLUMN c_partstates TYPE TEXT;\\n\"`"; + part2="`echo -e \"ALTER TABLE $table ADD COLUMN c_description TEXT;\\n\"`"; + sqlscript="$sqlscript$part1$part2" IFS="$oldIFS" } @@ -48,7 +50,7 @@ tables=`psql -t -U $username -h $hostname $database -c "select split_part(c_quic for table in $tables; do - growVC + adjustSchema done echo "$sqlscript" | psql -q -e -U $username -h $hostname $database