ignatenkovnikita / yii2-migrations-addons
Yii2 Migrations Addons, Traits
Installs: 12 277
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-10-29 05:04:57 UTC
README
Yii2 migrations addons
This traits add column on migrations files
Install
composer require ignatenkovnikita/yii2-migrations-addons:dev-master
List of traits
- AddAuthorUpdater - add columns
author_id
andupdater_id
for behaviorBlameableBehavior
- AddCreatedUpdated - add columns
created_id
andupdated_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'] ]);