Increase mail column size of Contacts quick tables

Fixes #4322
This commit is contained in:
Francis Lachapelle
2017-10-24 14:19:25 -04:00
parent b56df72992
commit f5aeed444d
4 changed files with 76 additions and 3 deletions
+21 -1
View File
@@ -10,6 +10,11 @@ set -e
defaultusername=$USER
defaulthostname=127.0.0.1
defaultdatabase=sogo
indextable=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
if [ -z "$indextable" ]; then
echo "Couldn't fetch OCSFolderInfoURL value, aborting" >&2
exit 1
fi
read -p "Username ($defaultusername): " username
read -p "Hostname ($defaulthostname): " hostname
@@ -42,8 +47,23 @@ function growUserProfile() {
IFS="$oldIFS"
}
echo "This script will ask for the sql password twice" >&2
function growContactsQuick() {
oldIFS="$IFS"
IFS=" "
part="`echo -e \"ALTER TABLE $table MODIFY c_mail text;\\n\"`";
sqlscript="$sqlscript$part"
IFS="$oldIFS"
}
echo "This script will ask for the database password twice" >&2
echo "Converting c_content from TEXT to LONGTEXT in the sogo_user_profile table" >&2
growUserProfile
echo "Converting c_mail from VARCHAR(255) to TEXT in Contacts quick tables" >&2
tables=`mysql -p -s -u $username -h $hostname $database -e "select SUBSTRING_INDEX(c_quick_location, '/', -1) from $indextable where c_path3 = 'Contacts';"`
for table in $tables;
do
growContactsQuick
done
echo "$sqlscript" | mysql -p -s -u $username -h $hostname $database