platx/yii2-migration

Base migration for Yii2

Installs: 2 157

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type: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

Base migration for Yii2

Installation

The preferred way to install this extension is through composer.

Either run

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

or add

"platx/yii2-migration": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your migrations like this :

<?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);
    }
}
?>