Skip to main content
4 of 6
added 504 characters in body

Sql-sync prefixed multi-site installations within the same database with Drush?

I am running several Drupal 7 multi-sites that share same code base as well as the same database with prefixed tables per multi-site (some tables are shared too).

I chose this setup, because i need several sites, each representing a region. They share the same code but not the same content. (This is why i didn't chose Domain Access). The reason, why all multi-sites share the same database instance with prefixed tables is because i need cross-multi-site queries to aggregate global information. A context-switch within one database (by changing the table prefix whith db_set_active) is much "cheaper" than initializing a new database connection for every of the N regions.

Now I need to sync the data of one multi-site with the data of another multi-site within the same database. I thought Drush could easily do the job with:

drush sql-sync [from multi-site1] [to multi-site2] 

But i recognized, that the sync is done per database and not based on prefixed tables... That sounds logical!

So the command above would sync [same_database] with [same_database], but what i need is a script that runs like this:

sync [all prefixed1_ tables] with [all prefixed2_ tables] within same database

Now my question: Has anyone worked on synchronization of multi-sites within the same database before, or has anyone a hint on best practice for my synchronization-needs ?