Before performing these steps it is mandatory to take a backup of the application.
Please connect to the database and execute the following queries.
Step1: Use the following query to get the accountid of the new account.
select org_id,org_name from accountdefinition where org_name=’New Account Name’;
In the above query replace “New Account Name” with the new account name, that you want the sites to be moved.
Step 2: Use the following query to get the siteid of the site to move.
select sd.siteid,name from sitedefinition sd inner join sdorganization so on sd.siteid=so.org_id inner join accountsitemapping asm on sd.siteid=asm.siteid inner join accountdefinition ad on ad.org_id=asm.accountid where name=’Site To Move’ and org_name=’Old Account Name’;
In the above query replace “Site To Move” with the site to move and “Old Account Name” with the old account name, from where the sites to be moved.
Step3: Use the following query to finally move the site to the desired account.
update accountsitemapping set accountid=<accountid> where siteid=<siteid>;
replace <accountid> with the accountid obtained from step 1 and <siteid> with the siteid obtained from step 2.
If there are multiple sites to be moved, please use the below query,
update accountsitemapping set accountid=<accountid> where siteid in (<siteid>,<siteid>);
Note: If you want to move all the sites, then create a dummy site under that account and then move all the other sites.
After this you need to restart the application, in order to see the changes effective.