deesoft/yii2-console

Yii2 控制台命令

安装次数: 15,390

依赖项: 5

建议者: 0

安全: 0

星标: 5

关注者: 3

分支: 2

公开问题: 3

类型:yii2-extension

1.1 2016-02-22 03:00 UTC

This package is not auto-updated.

Last update: 2024-09-14 17:58:50 UTC


README

Yii2 控制台命令。包含功能更丰富和易用的迁移控制器。

Latest Stable Version Latest Unstable Version License

安装

通过 composer 安装此扩展是首选方式。

运行以下命令之一

php composer.phar require deesoft/yii2-console "~1.0"

或者

"deesoft/yii2-console": "~1.0"

将以下内容添加到您的 composer.json 文件的 require 部分。

用法

扩展安装后,只需按如下修改您的配置

// params.php or params-local.php

return [
    ...
    'dee.migration.path' => [
        '@yii/rbac/migrations',
        // list your migration path here
    ]
];

您还可以通过 bootstrap 动态添加新的路径到您的扩展。

    ...
    public function bootstrap($app)
    {
        $app->params['dee.migration.path'][] = '@your/ext/migrations';
    }

特性

与官方迁移命令兼容

部分上移、下移和重做

与原始迁移不同,它只能按迁移序列执行 updownredo。我们可以独立执行迁移而不依赖于其序列。例如,您的迁移历史如下

	(2016-02-09 02:29:14) m160201_050050_create_table_accounting
	(2016-02-09 02:29:14) m160201_050040_create_table_inventory
	(2016-02-09 02:29:13) m160201_050030_create_table_sales
	(2016-02-09 02:29:13) m160201_050020_create_table_purchase
	(2016-02-09 02:29:13) m160201_050010_create_table_master
	(2016-02-09 02:29:11) m140527_084418_auto_number
	(2016-02-09 02:29:11) m140506_102106_rbac_init
	(2016-02-01 04:02:51) m130524_201442_init

我们可以仅对 m160201_050020_create_table_purchase 执行 downredo。使用 migrate/partialmigrate/partial 来执行。

./yii migrate/down m160201_050020
./yii migrate/redo 140527_084418

从操作中排除特定版本

./yii migrate -e=160201_050030,140527_084418
./yii migrate/down all -e=m140506_102106_rbac_init