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?
Edit: I found out, what my needs really are. Drush's sync is not a real "sync" it is more like a "export from and import to". So it is quite more simple than a complete synchronization-task with "insert", "merge" and "delete". So i am going to write my own drush's script to fulfill my needs.