0

I have two sites using Wordpress with WooCommerce, one is LIVE (An taking orders) and the other is on Development.

The development one is been updated with content and has had existing products removed and readded as well as other content.

I have been asked that I merge the dev data onto live but without losing transactional data or users.

Normally I would have done the following:

  1. Put live site into maintenance mode
  2. Get a mysqldump backup of the live and development site
  3. Export all the wp data using the export tool on the DEV site EXCEPT the users.
  4. Import the data onto live.
  5. Upload the media directory from dev to live (There are new images on the dev site)
  6. Check live and put back into production if all is good.

Problems I have though are:

  1. I dont have phpmyadmin to use for custom SQL related work.
  2. The client has removed existing products which are linked to transactional data, and then re-added those products (I dont know the reason why this was done, I was given this task without been involved from the start)
  3. Due to point 2 I think I will end up with transactions/orders on live pointing to products which do not exist.

What is the easiest way to merge the changes on dev into live without losing users or order related data and then reconcile any orphaned transactions.

Below is an example of what I am aiming for:

Site A1 (Current site)      Site A2 (Staging)      Site A2 After Merging
=================================================================
ID Name                    ID Name                 ID Name
=================================================================
1  Product A            |  1  Product A         |  1  Product A
2  Product B            |                       |  2  Product B
3  Product C            |  3  Product C         |  3  Product C
                        |  4  Product D         |  4  Product D
6
  • there is a new plugin called mergebot that was created to solve problems like this, maybe worth a look
    – majick
    Jun 29, 2017 at 8:36
  • @majick, cheers I will look into it.
    – John Cogan
    Jun 29, 2017 at 8:38
  • Mergebot requires a subscription (No trial available) which I cannot sort out on such short notice as my manager will not pay for something without proof that its something we can use. From what I can see in the future I'd use mergebot but with 2 days to do this I doubt I will be able to use Mergebot.
    – John Cogan
    Jun 29, 2017 at 9:22
  • @ianmjones did supply a very good answer as to why mergebot would not be suitable in my particular situation I still need any pointer anyone might have on how to go about this.
    – John Cogan
    Jun 29, 2017 at 12:51
  • export the new product post records and import them, then deactivate the old products without deleting them? that seems to be the main hurdle?
    – majick
    Jun 29, 2017 at 13:35

1 Answer 1

2

With the current state of the development database you're going to have to manually re-apply your changes to either live, or preferably a staging environment that has been set up to use something like Mergebot, I can't see any clean way of automating your deployment otherwise.

Why Mergebot can't help given the current state of the database:

Mergebot is a great solution for the problem of working with a dev site that is a copy of a live site with transaction data such as WooCommerce orders being created while working on dev. It's one of the prime reasons it was created.

However, Mergebot works by recording changes to the dev site and needs the dev site to have been a clean copy of the live site when recording started. Usually you create a copy of the live site with something like WP Migrate DB Pro (bundled with Mergebot subscription) and then start recording, when finished you deploy to live via Mergebot which takes care of merging and walks you through conflict resolution where needed.

In the above scenario the dev database has already diverged significantly from live before recording is to start, so I don't think Mergebot is a solution unless the dev work can be re-applied to a fresh copy of live. Removing products is also a serious problem, they should be removed from sale but left intact if already purchased by customers.

There's a better description of Mergebot here:- https://deliciousbrains.com/database-merging-made-easy/

And if you prefer screencasts, check out this post:- https://deliciousbrains.com/mergebot-in-beta/

Full disclosure: while I don't directly work on Mergebot, I do work for Delicious Brains, the developers of Mergebot.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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