Whenever we’re working with WordPress environments, it’s common for us to clone the production database to our local development database but not necessarily the other way around.
For example, let’s say that we do work in the local development database that contains new posts, perhaps new WooCommerce orders, or other data that you’d like to share with the production site.
At this point, you have two versions of the database that you’d like to merge without losing changes in either environment.
To manage this, we have a few choices:
- You can note all changes made in the local development site and meticulously perform them on the production site.
- You can copy changed rows from the development site and run the queries on the production site. The problem with this is when the new data comes in; users may have the same IDs used in the local development database ultimately creating a conflict.
- With currently available tools, you can move the development database to the live site. But you’d lose the vital changes like comments or orders that happened on the live site during development.
None of them make for an ideal deployment workflow.
WordPress Database Merging
WPMerge changes that by merging changes on the development site to the live site without over-writing the changes made to the live site since cloning.
It will handle creating new IDs, replacing old ones, and also intelligently serialize post IDs.
How It Works
Now you have a production site, and it’s clone, the development site. Install the WPMerge plugin on both prod and dev sites and connect them.
WPMerge is now ready for you to start development. All changes made in the development environment will be recorded.
During development, you can pull in the production database and apply your local changes anytime and continue development. This gives you the complete picture of how your code works on the current production database.
After development is finished, you can push the changes to production. During this process, only the queries that were recorded is pushed to the production database.
As for files, you can download new and changed files as a zip file and upload them via S/FTP. I In a future version, this process will be automated soon – just like the one-click merging of the database, files will also be synced with a single click.
How Can You Use WPMerge?
Even still, you wonder:
Why would I need this plugin?
These are some of the use cases that WPMerge fits in.
- it can be used whenever you are dealing with a site that receives live orders, comments or any data continuously,
- it can also be used if you want to allow your clients to make changes to the live site while you are developing,
- you can also use it for updating plugins, themes, and WordPress core.
- it makes it easy to push theme or page edits to a live site.
- the plugin is solid for making code edits to pages or adding new functionality to existing pages,
- and so on.
Of course, these are just some of the examples.
Regardless, the need to merge the WordPress database from local to production is not an unfelt need, and WPMerge provides solid functionality for making sure you’re able to focus on getting your work done locally all the while pushing merging the updates to production.