Mergebot Update: Multisite Support and More


With today’s update, we’re this close to public release of Mergebot. If you’re new around here, Mergebot aims to ease the pain of merging WordPress databases at deploy time and is currently in beta.

Over the last few months, Gilbert and I have been working hard to remove more of the limitations while we are in beta. Gilbert supercharged the app to remove the limit on the number of queries that can be deployed, and I’ve been grinding away to support WordPress multisite. It’s been a challenging time; solving technical problems, uncovering new “features” and fixing them, and relearning lessons about estimating the time it takes to develop new features. Basically never ever, ever, say this:

Yep, that looks pretty straightforward – should take a couple of weeks.

A little while later (cough, a few months)…

Frodo meme it’s done

Multisite Support

When we launched the beta, we only supported single site installs. We soon found a large number of our beta users and potential customers have multisite networks for their various client sites. Therefore, Mergebot, in its current form, didn’t allow them to really try out the product on sites they continually developed on. They don’t get the benefits of Mergebot, and we miss out on valuable feedback.

I’m happy to announce that Mergebot now supports multisite. 🎉

Existing users will need to upgrade the plugin on both sites to version 0.4.0-beta. Mergebot works at the network level, so changes made to any subsite will be recorded, as well as creating new sites on the network. This means that when the Development site’s database needs a refresh, it will need to be the whole multisite database. We’ve baked in even more support for using WP Migrate DB Pro to migrate the database, but other tools should work just fine.

We also support domain mapping in a network using the WordPress MU Domain Mapping plugin (currently version via a new schema.

Two Birds with One Stone

One of the challenges I faced during the development of multisite support was adding the ability to record changes when a new subsite is added to the network. During this operation WordPress creates a new set of tables specifically for that subsite. For example, if the new subsite gets the ID of 3 in the wp_blogs table (subsite and blog seem to be an interchangeable term), then the new tables will have that ID in their prefix, eg. wp_3_posts, wp_3_postmeta and so on.

Mergebot has only ever recorded specific types of SQL queries: INSERT, UPDATE and DELETE queries. However, WordPress uses CREATE TABLE SQL statements to add the tables to the database, so it was high time we added support for all database definition language (DDL) statements.

Mergebot now supports the following query types:


Why am I telling you all of this? Well, it’s a long story but, TL;DR, Mergebot now supports installing and updating WordPress core, plugins, and themes while recording queries!

We previously had advised against doing this because of the issue of operations requiring deploy time data which typically happen on activation. Operations requiring deploy time data is still an issue, which we hope to address in the future. But now we support recording DDL queries, Mergebot can safely record any table creation or alteration that happens during an install or update process.

If you are unsure of what a plugin might do on activation then your best bet is still to activate when not recording in Development, and activate just before deploying your changeset on Production. For other plugins, you can install or update and Mergebot will take care of it. This also means that plugins which perform operations requiring deploy time data outside of any activation or update routine, can be installed or updated safely in a recording. For example, WooCommerce runs operations when you update the product permissions for a downloadable item, but you can now safely install, activate and update WooCommerce while recording changes with Mergebot.

What’s Next for Mergebot?

We are currently wrapping up some other smaller features and bug fixes, and are dangerously close to public release. Whoop! If you want to be the first to hear about when we launch then make sure you sign up here.

We will also be adding schemas to support more plugins, and responding to beta feedback as we get it. Remember, if you are a beta user you can get in touch through the app (click the avatar in the top right and select ‘Email Us’ from the menu) and let us know how it’s going, if you have any issues, or just want to say hi!

Do you have a multisite installation you want to try out with Mergebot? Do you have any questions or any future features you would like us to add? Let us know in the comments below.

About the Author

Iain Poulson

Iain is a WordPress and PHP developer from England. He builds free and premium plugins, as well as occasionally blogging about WordPress. Moonlights as a PhpStorm evangelist.