I'm planning to install Domain to replace an existing multisite setup where I have the user tables shared and separate tables for content, blocks etc.
My problem is how do I merge the two sites into one?
Once all of the content is within a single set of tables I can easily use Domain to separate out the sites again (http://drupal.org/node/210862) but my issue is how to get the content into the one site?
Is it possible to do this at the db table level or do I need to choose one site as the master and import the subsite to import using node_import (and some manual labour to move across settings etc)?
This would be a useful additional section in the readme/install as I'm sure many folks will look at moving to using domain from an existing multisite solution and be wondering how they can merge existing sites.
Thanks in advance for any suggestions, Stephen
Comments
Comment #1
agentrickardAgreed. But I simply do not have the time to work this out. It would be great if you could document what you do.
I am not certain how the content migration would go. There are numerous issues -- mostly having to do with the sequences of ID numbers. Node export / import is probably the best bet. But that will only get you so far. Blocks, variables and so forth are going to be an issue.
Probably the best path is to declare one of the current sites the "master" site. Leave it alone. Install Domain Access there and set that site as the 'primary domain.' Then use whatever tools you can to import the data you need. I would expect that some of your non-essential data might need to be discarded.
I suspect you may need to do quite a bit of direct database manipulation, depending on how much data is associated with each site.
Comment #2
scedwar commentedKen, Thanks for confirming the complexity! I'll look at making the largest the master and try move everything else across.
I'll put something together for the readme based on my findings.
Comment #3
agentrickardIf you're coming to DrupalCON, we might be able to huddle together and look at this. Otherwise, I'm pretty unreachable for awhile.
Comment #4
scedwar commentedSadly not, I'll be the other side of the atlantic! :-(
Comment #5
scedwar commentedI'm going to note down my progress on this issue in this thread so that I don't forget. If anyone wishes to chip in with comments, please do but this is more for keeping a record to maybe produce a howto.
PROBLEM
Multisite setup 3 domains with prefixed tables (user tables shared).
Domain 1 (primary install no prefix)
Domain 2 (prefixed with dom2)
Domain 3 (prefixed with dom3)
I want to put all 3 domains on one "Domain" managed setup with shared tables.
The primary domain (no table prefix) has little content so can be scrapped. Domain 3 has the most complex configuration so I'm going to make that my new primary domain and then move the content around using the affiliate batch publishing. Domain 2 will then need to be imported/merged into the primary tables.
SOLUTION
You'll need a bit of sql knowledge to manipulate the tables. I'm approaching this from the point of view of trying to create a system that can be run as a set of batch processes whilst a live site is down.
Before I started this I removed some unnecessary tables and did some general housekeeping to clean up and remove orphaned tables (from unused modules) and remove some modules (mostly for admin purposes) I don't need, clean the watchdog table etc. Furthermore, some of the approach to this, on a live site, can be done in phases before installing Domain. In essence, preparing your live site and then experimenting on a dev site copy. Make sure you disable caching, put the site offline etc etc.
- Step 1-
I removed all of my dom1 tables apart from the shared tables (note, if you are keeping the dom1 site, unlike me, you may need to rename them).
Use the sql commmand "Show tables" to get a list of tables. With a bit of automatic text manipulation you can end up with a list of
rename commands for your db such as:
You will need to look in your sequences table (it is straightforward enough) and remove records for the dom1_ tables (if you deleted them as I did) and change the handful of records that point to dom3_ tables to remove the prefix. If you don't do this, you can get very odd behaviour, such as new nodes trying to write over existing node ids.
Modify the relevant settings.php files to remove the table prefix settings (arrays of prefixes are incompatible with domain in any case)
Install Domain.
Dom1 will be gone. dom2 will now appear where dom1 was, and dom3 continues as a prefixed installation (without Domain).
....to be continued.
Comment #6
agentrickard