Currently i use a dump script and commit the database to the git repo.
--skip-extended-insert --skip-comments --skip-dump-date means that a diff can give me a fair idea of what has changed, but it all falls down if I try to merge.

The WP_SITEURL, WP_HOME and all the other places wordpress stores full URLs need updating when importing to another host (testing,staging,production)

Is anyone using a better method?

Main issues:

  • WordPress stores full URLs all through the database (non-portable)
  • Lots of other, non-relevant records change
    • auto_increment values (i just strip these out, but have run into ID issues)
    • timestamps (can also strip out, potentially)
    • transient* records … no idea what to do with them

A process that created timestamped migrations, with only the things added or removed, would be ideal… but i’m not sure if it’s even possible?

2

Here are two possible solutions, both of these are actually generic MySQL version control tools but can be adapted to your workflow:

dbv.php

This tool creates “migrations”, which are basically SQL scripts, from the changes detected on the database. These scripts are stored in a local directory and thus can be commited to your current VCS (git, for example).

It’s used through a PHP web interface.

DBVC

Fundamentally similar to the previous tool, this is based on a command line interface. It’s configured through a json file. The main difference is that it doesn’t auto-generate the migration files.

There’s a pending issue to integrate this with the previous similar, so that’s something to look for.

WordPress Plugins

Some plugins that could aid in the creation of a repeatable workflow:

  • VersionPress (still in early development at this date)
  • WP Migrate DB (there is a pro version)
  • WP Synch DB (a fork of the previous project with some of the pro features included)

Leave a Reply

Your email address will not be published. Required fields are marked *