The most requested feature for WP Migrate DB Pro is the ability to fire a migration from the command line (CLI)
and via a function call. Today I’m super excited to announce that the CLI addon will be available with the release of WP Migrate DB Pro 1.4. With the CLI addon installed, you can initiate a migration using the following function call:
The function currently requires you to use migration profiles. The ‘1’ parameter in the example above will initiate a migration with the migration profile ID of 1.
The IDs of your migration profiles are displayed to the left of the migration profile name on the profile selection page.
The addition of the CLI addon opens up of a tonne of additional potential functionality, including:
- Scheduled migrations via cron
- Automated migrations via deployment scripts
- Command-line migrations via WP-CLI
The command to fire off a migration from the command-line using WP-CLI looks like this:
wp wpmdb migrate 1
To use the “wpmdb” command with WP-CLI simply install our WP-CLI community package using the provided instructions. The command can also be viewed and downloaded directly via our github repo.
The “wpmdb” command is registered within the CLI addon, so as long as you have the CLI addon activated you should be able to use it.
If you’d like early access to CLI migrations, sign up for the beta mailing list.
As always, we love hearing your feedback and suggestions. Please feel free to leave your thoughts in the comment section below.