2017 © Pedro Peláez
 

wp-cli-package wp-cli-mig

General migration command for WP-CLI

image

foogile/wp-cli-mig

General migration command for WP-CLI

  • Thursday, October 20, 2016
  • by stianlik
  • Repository
  • 3 Watchers
  • 21 Stars
  • 4,809 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 4 Versions
  • 7 % Grown

The README.md

wp-cli-mig

General migration command for WP-CLI, (*1)

Example migration

  1. Create migration script, (*2)

    // filename: migrations/1_FirstMigration.php
    namespace WpCliMigrate;
    
    use Foogile\WpCli\Migrate\MigrationInterface;
    
    class FirstMigration implements MigrationInterface
    {
    
        public function up()
        {
            // Do some work using WordPress API
        }
    
        public function down()
        {
            // Undo some work using WordPress API
        }
    
    }
    
  2. Move into folder migrations and execute migrations using WP-CLI, (*3)

        # Migrate to version 1
        wp --require=/path/to/command.php mig to 1
    
        # Migrate to version 2
        wp --require=/path/to/command.php mig to 2
    
        # Revert all migrations
        wp --require=/path/to/command.php mig to 0
    
        # Status
        wp --require=/path/to/command.php mig status
    

For migrations that should stop execution, throw exceptions from up/down-methods. I.e. a non-reversable migration will typically refuse a down()-operation: throw new \Exception("Cannot rollback migration")., (*4)

The Versions

20/10 2016

dev-master

9999999-dev https://github.com/stianlik/wp-cli-mig/

General migration command for WP-CLI

  Sources   Download

WTFPL

The Requires

  • php >=5.3.0

 

by Stian Liknes

31/03 2014

v0.0.2

0.0.2.0

General migration command for WP-CLI

  Sources   Download

WTFPL

The Requires

  • php >=5.3.0

 

by Stian Liknes

18/02 2014

v0.0.1

0.0.1.0

General migration command for WP-CLI

  Sources   Download

WTFPL

The Requires

  • php >=5.3.0

 

by Stian Liknes

17/02 2014

v0.0.0

0.0.0.0

General migration command for WP-CLI

  Sources   Download

WTFPL

The Requires

  • php >=5.3.0

 

by Stian Liknes