diff --git a/SOPE/GDLContentStore/contact-oracle.ocs b/SOPE/GDLContentStore/contact-oracle.ocs index 22d23e97c..fd0158b4b 100644 --- a/SOPE/GDLContentStore/contact-oracle.ocs +++ b/SOPE/GDLContentStore/contact-oracle.ocs @@ -104,5 +104,10 @@ sqlType = "VARCHAR2(10)"; allowsNull = NO; }, + { + columnName = c_hascertificate; + sqlType = "INTEGER"; + allowsNull = YES; + }, ); } diff --git a/SOPE/GDLContentStore/contact.ocs b/SOPE/GDLContentStore/contact.ocs index db06e1dac..1180b6b2d 100644 --- a/SOPE/GDLContentStore/contact.ocs +++ b/SOPE/GDLContentStore/contact.ocs @@ -104,5 +104,10 @@ sqlType = "VARCHAR(10)"; allowsNull = NO; }, + { + columnName = c_hascertificate; + sqlType = "INT"; + allowsNull = YES; + }, ); } diff --git a/Scripts/sql-update-3.2.10_to_3.3.0-mysql.sh b/Scripts/sql-update-3.2.10_to_3.3.0-mysql.sh index 086910d53..3bca45f02 100755 --- a/Scripts/sql-update-3.2.10_to_3.3.0-mysql.sh +++ b/Scripts/sql-update-3.2.10_to_3.3.0-mysql.sh @@ -2,10 +2,12 @@ set -e -# This script only works with MySQL -# updates c_defaults and c_settings to longtext in the sogo_user_profile table -# to avoid truncation of data at 64k - +# This script only works with MySQL - it does: +# +# 1- updates c_defaults and c_settings to longtext in the sogo_user_profile table +# to avoid truncation of data at 64k +# 2- increase the c_mail column to text to contact quick table +# 3- add the c_hascertificate column to contact quick table defaultusername=$USER defaulthostname=127.0.0.1 @@ -47,7 +49,7 @@ function growUserProfile() { IFS="$oldIFS" } -function growContactsQuick() { +function growMailInContactsQuick() { oldIFS="$IFS" IFS=" " part="`echo -e \"ALTER TABLE $table MODIFY c_mail text;\\n\"`"; @@ -55,6 +57,15 @@ function growContactsQuick() { IFS="$oldIFS" } +function addCertificateInContactsQuick() { + oldIFS="$IFS" + IFS=" " + part="`echo -e \"ALTER TABLE $table ADD c_hascertificate INT4 DEFAULT 0;\\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 @@ -63,7 +74,8 @@ 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 + growMailInContactsQuick + addCertificateInContactsQuick done echo "$sqlscript" | mysql -p -s -u $username -h $hostname $database diff --git a/Scripts/sql-update-3.2.10_to_3.3.0.sh b/Scripts/sql-update-3.2.10_to_3.3.0.sh index b38bd1f4c..e8dc3e129 100755 --- a/Scripts/sql-update-3.2.10_to_3.3.0.sh +++ b/Scripts/sql-update-3.2.10_to_3.3.0.sh @@ -1,9 +1,11 @@ #!/bin/bash set -e -# This script only works with PostgreSQL -# updates c_mail to text in Contacts quick table -# http://www.sogo.nu/bugs/view.php?id=4322 + +# This script only works with PostgreSQL - it does: +# +# 1- increase the c_mail column to text to contact quick table +# 2- add the c_hascertificate column to contact quick table defaultusername=$USER defaulthostname=localhost @@ -33,7 +35,7 @@ fi sqlscript="" -function growContactsQuick() { +function growMailInContactsQuick() { oldIFS="$IFS" IFS=" " part="`echo -e \"ALTER TABLE $table ALTER COLUMN c_mail TYPE TEXT;\\n\"`"; @@ -41,13 +43,22 @@ function growContactsQuick() { IFS="$oldIFS" } +function addCertificateInContactsQuick() { + oldIFS="$IFS" + IFS=" " + part="`echo -e \"ALTER TABLE $table ADD c_hascertificate INT4 DEFAULT 0;\\n\"`"; + sqlscript="$sqlscript$part" + IFS="$oldIFS" +} + echo "This script will ask for the database password twice" >&2 echo "Converting c_mail from VARCHAR(255) to TEXT in Contacts quick tables" >&2 tables=`psql -t -U $username -h $hostname $database -c "select split_part(c_quick_location, '/', 5) from $indextable where c_path3 = 'Contacts';"` for table in $tables; do - growContactsQuick + growMailInContactsQuick + addCertificateInContactsQuick done echo "$sqlscript" | psql -q -e -U $username -h $hostname $database