Upgrade SOGo SQL schema

With default SOGo settings in iRedMail-0.9.5-1 and earlier releases, SOGo creates 3 SQL tables for each user, this introduces some issues:

We need few steps to migrate SOGo to use 9 SQL tables in total instead of creating 3 tables for each user. This solution was first introduced in SOGo-3.0.0.

Warning and Disclaimer

It's strongly recommended to try steps below on a testing machine BEFORE you do it in production, we (iRedMail team) don't take any responsibility for data lose. You have been warned.

# rpm -ql sogo | grep 'combined'
/usr/share/doc/sogo-3.1.5.20160928/sql-update-3.0.0-to-combined-mysql.sh
/usr/share/doc/sogo-3.1.5.20160928/sql-update-3.0.0-to-combined.sh

If you are running iRedMail with OpenLDAP or MySQL/MariaDB backend, you need the first one with mysql in file name: sql-update-3.0.0-to-combined-mysql.sh, if you are running iRedMail with PostgreSQL backend, you need the second one (sql-update-3.0.0-to-combined.sh). We use MySQL one for example.

Now run the script as root user (or with sudo):

bash /usr/share/doc/sogo-3.1.5.20160928/sql-update-3.0.0-to-combined-mysql.sh
OCSCacheFolderURL = "mysql://sogo:<password>@127.0.0.1:3306/sogo/sogo_cache_folder";
OCSStoreURL = "mysql://sogo:<password>@127.0.0.1:3306/sogo/sogo_store";
OCSAclURL = "mysql://sogo:<password>@127.0.0.1:3306/sogo/sogo_acl";

If there's something wrong, please check SOGo log file (/var/log/sogo/sogo.log) to see whether or not it reports some error. Report errors, issues, questions in our online support forum: https://forum.iredmail.org/.