platx/yii2-migration

Yii2的基础迁移

安装次数: 2,157

依赖者: 0

建议者: 0

安全性: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

类型:yii2-extension

dev-master 2015-11-17 08:17 UTC

This package is not auto-updated.

Last update: 2020-10-02 20:54:33 UTC


README

Yii2的基础迁移

安装

安装此扩展的首选方法是使用 composer

可以运行

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

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

"platx/yii2-migration": "*"

使用方法

扩展安装完成后,只需在迁移中使用它,如下所示

<?php 
class m151013_132543_create_table_group extends \console\db\Migration
{
    protected $_tableName = '{{%HERE_PUT_YOUR_TABLE_NAME}}';
    public function safeUp()
    {
        $this->createTable($this->_tableName, [
            'id' => $this->primaryKey(),
            'name' => $this->string()->notNull(),
            'slug' => $this->string()->notNull()->unique(),
            ...
        ], $this->_tableOptions);
    }
}
?>