how to merge 2 Joomla databases

SilverNodashi

Expert Member
Joined
Oct 12, 2007
Messages
3,340
Reaction score
48
Location
Johannesburg, South Africa
Hi all,

Has anyone attempted to merge 2x individual Joomla databases with existing content? I need to move all articles, categories, sections and menu's from one Joomla site to another one. But the other site also already has articles, sections, categories and menu's loaded.

The biggest obvious problem I face is that both sites would already use the same unique ID's for the data.

Any pointers or feedback from from someone who's attempted this before?
 
This is like any other database merge.
Pick one side and determine the highest ID number.
Update the other side so that all the ID numbers are their current ID number + the highest ID number above + a safety gap.

The update statement looks something like this:
Update tablename, set ID = ID + 500754;

Then do an SQL data export on both.
Then edit the export scripts, remove code that clears the data from the tables in the one script.
Then run the clearing data-import script on a third database.
Then run the non-clearing data-import script on the same third database.
Now tell Joomla to use the third database.

Do this on a test setup first mkay.
And TEST properly before you decide it's cool.
And then TEST again.
 
Last edited:
This is like any other database merge.
Pick one side and determine the highest ID number.
Update the other side so that all the ID numbers are their current ID number + the highest ID number above + a safety gap.

The update statement looks something like this:
Update tablename, set ID = ID + 500754;

Then do an SQL data export on both.
Then edit the export scripts, remove code that clears the data from the tables in the one script.
Then run the clearing data-import script on a third database.
Then run the non-clearing data-import script on the same third database.
Now tell Joomla to use the third database.

Do this on a test setup first mkay.
And TEST properly before you decide it's cool.
And then TEST again.


It's not quite that simple. The menu's reference the articles (content) so if I change the article's ID's in the DB, then the menu items needs to know about the new ID's as well. At the same time, the articles are linked to categories & sections - so the same will apply, I would need to dynamically change the section ID's & categories
 
or you could use a Joomla extension - Ive used this http://extensions.joomla.org/extensions/migration-a-conversion/joomla-migration/4054?qh=YTo3OntpOjA7czo2OiJleHBvcnQiO2k6MTtzOjc6ImV4cG9ydHMiO2k6MjtzOjk6ImV4cG9ydGluZyI7aTozO3M6ODoiZXhwb3J0ZWQiO2k6NDtzOjg6ImV4cG9ydGVyIjtpOjU7czoxMToiZXhwb3J0YXRpb24iO2k6NjtzOjEwOiJleHBvcnRhYmxlIjt9 to export from one site and import to another

If that one doesn't work for you - I'm pretty sure there would be one in the extensions directory that will

That's just an easy component to export DB :)
 
It's not quite that simple. The menu's reference the articles (content) so if I change the article's ID's in the DB, then the menu items needs to know about the new ID's as well. At the same time, the articles are linked to categories & sections - so the same will apply, I would need to dynamically change the section ID's & categories
Yup, all the ID's.
 
:(

I was hoping someone found an easy way todo this, instead of going through each article individually and updating all the ID's.
The updates themselves are not difficult.
The difficult part is identifying the ID's in all the tables, including the comments, logs and and other added modules.
Joomla must have an entity relationship diagram somewhere that will point out the links (keys) between the tables.
 
Top
Sign up to the MyBroadband newsletter
X