0

I have several Drupal sites hosted on my shared hosting server. Each site has a dev, test and production instances, with separate Docroots and Apache Vhosts and separate mysql db instances. Not using features module.

Production db has real live data in it. dev and test dbs have dummy data. But as per the development workflow, if a new module has to be installed the developers do it in dev and test instances. That creates a new table and some records in the dev/test db instances.

Now that if they want to have the same module installed in the production site, I want them to able to run an operation via web which takes that particular table/data to the production instance from dev/test.

To explain bit more: This is what I need.

A ==> Test Site

B ==> Production Site ==> Real Data

A new module is installed in A. This creates a table and some records in A. We should be able to take that particular table/data from A and import into B keeping all the B's data consistent. And we dont really know what table is created in A. This is all done by the developers.

In a nut shell. B = (A U B) i.e. B should become A Union B

I tried mysqldiff but that works only for schema but not data.

Ideas please.

  • You say "Not using features module" -> question tagged with features ? – pico34 Sep 25 '13 at 13:29
  • To highlight the same I have done so. Should i remove the tag? – Medhamsh Sep 26 '13 at 7:27
0

This is a huge question.

I just can share my experience

First i export mysql data from live site with Backup and Migrate module.

I do restore it in my dev site. In this dev site, i beware to not send infortunetly emails, so i install Reroute email module. (great because the settings are not in database but in settings.php file)

Then i make my own dev on localhost with real datas

Depends if your have the abilities to do that, and if the datas are not so confidential to do so.

But to stick with your question, db diff is impossible is guess. And you have to upload the new module files and enabled them manually (or with drush). Settigs in drupal are totally encapsulated in db

|improve this answer|||||
0

You may want to look into Percona Toolkit.

There are two particular tools you may want to use

  • pt-table-checksum : This tool can be used to determine which tables have a different checksum between a Master and Slave.
  • pt-table-sync : This tool will actually find the row and column differences in data based on PRIMARY KEY values. I would suggest using the --print and --sync-to-master options to output the generated SQL to a text file.

CAVEAT

I can see from the question that you do not have MySQL Replication set up. Therefore, I would suggest the following:

  • STEP 01) Get two DB Servers
    • Server MDB : A copy of Test DB
    • Server SDB : A copy of Prod DB
  • STEP 02) Setup Master/Slave Replication
    • MDB as Master
    • SDB as Slave
  • STEP 03) Execute pt-table-checksum against the Master. The program should autodetect connected Slaves.
  • STEP 04) Use pt-table-chekcksum output to see which table on the Master (Test) has a different checksum on the Slave (Prod)
  • STEP 05) For every table that have mismatched checksum values, run pt-table-sync and send output to a text file.
  • STEP 06) Take the generated SQL and execute it on the Slave.

When you are done with STEP 05, the Slave's data content should be the B = (A U B) you are looking for.

WARNING : Thoroughly backup all your data on Test and Prod before doing this !!!

Give it a Try !!!

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.