ignatenkovnikita/yii2-migrations-addons

Yii2 Migrations Addons, Traits

v1.0 2017-07-28 13:25 UTC

This package is auto-updated.

Last update: 2024-11-29 05:20:55 UTC


README

Yii2 migrations addons

Latest Stable Version Total Downloads Latest Unstable Version License

This traits add column on migrations files

Install

composer require ignatenkovnikita/yii2-migrations-addons:dev-master

List of traits

  • AddAuthorUpdater - add columns author_id and updater_id for behavior BlameableBehavior
  • AddCreatedUpdated - add columns created_id and updated_at for behavior TimestampBehavior
  • ForeignKeyTrait - add FK

Usage

AddAuthorUpdater

use \ignatenkovnikita\migrationsaddons\AddAuthorUpdater;

$this->addAllUser($tableName);

AddCreatedUpdated

use \ignatenkovnikita\migrationsaddons\AddCreatedUpdated;

$this->addAllTime($tableName);

ForeignKeyTrait

use \ignatenkovnikita\migrationsaddons\ForeignKeyTrait;

$this->addForeignKeys($tableName,[
    ['user_id', 'table_name', 'id']
]);