foogile/wp-cli-mig
最新稳定版本:v0.0.2
Composer 安装命令:
composer require foogile/wp-cli-mig
包简介
General migration command for WP-CLI
README 文档
README
General migration command for WP-CLI
Example migration
-
Create migration script
// 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 } }
-
Move into folder migrations and execute migrations using WP-CLI
# 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").
统计信息
- 总下载量: 13.2k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 23
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: WTFPL
- 更新时间: 2014-02-17