How can I upgrade from a single company to a multi company environment?

To upgrade a single company to a multicompany environment where all existing users are placed into the same company, the following actions must be taken:

Make a backup of the Zarafa database. Enable multicompany in the Zarafa configuration files. Restart the Zarafa server. Create a new company, using LDAP or the zarafa-admin tool.

Use zarafa-admin --list-companies to make sure the new company is visible in the new environment. Stop the Zarafa server. Execute the following SQL queries in the Zarafa database:

* UPDATE users SET company = (SELECT id FROM users WHERE object_type=4) WHERE (object_type = 1 OR object_type = 2 OR object_type = 5) AND id > 2;
* UPDATE stores SET company = (SELECT id FROM users WHERE object_type=4) WHERE user_id > 2;

* UPDATE stores SET user_id = (SELECT id FROM users WHERE object_type=4) , user_name = (SELECT externid FROM users WHERE object_type=4) WHERE user_id = 1;

When using the DB plugin, the following query is also required:

* SELECT p.value FROM object AS o JOIN objectproperty AS p ON o.id=p.objectid WHERE o.objecttype = 4 AND p.propname='companyname'

* INSERT INTO objectproperty (objectid, propname, `value`) SELECT id, 'companyid', (SELECT p.value FROM object AS o JOIN objectproperty AS p ON o.id=p.objectid WHERE o.objecttype = 4 AND p.propname='companyname') FROM object WHERE objecttype != 4;

After this the Zarafa server can be started again, and the users should be visible with 'zarafa-admin -l' again.

Make sure you have a correct backup before doing this!


Share |

 
 

Latest News

Newsletter

Click here to unsubscribe