nox-it/yii2-nox-migration

此包已被弃用且不再维护。未建议替代包。

Yii2 扩展迁移工具包

2.0.0 2020-05-03 14:50 UTC

README

Yii2 NOX 迁移是一个包含 Yii2 迁移方法的库。

Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads Daily Downloads composer.lock

安装

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

运行以下命令之一

php composer.phar require --prefer-dist nyx-solutions/yii2-nyx-migration "*"

或添加

"nyx-solutions/yii2-nyx-migration": "*"

到您的 composer.json 文件的 require 部分。

使用

use nyx\db\Migration;

class m150409_195340_site extends Migration
{
    /**
     * @inheritdoc
     */
    protected $tableName = 'site';

    /**
     * @inheritdoc
     */
    public function safeUp()
    {
        $columns = [
            'id'                => $this->bigPrimaryKey($this->pkLength),
            'name'              => $this->string(2000)->notNull()
        ];

        $this->createTable($this->getCurrentTableName(), $columns, $this->getTableOptions());
    }
}

许可协议

yii2-nyx-migration 采用 BSD 3-Clause 许可协议发布。有关详细信息,请参阅附带的 LICENSE.md 文件。

Yii2