yiisolutions/yii2-migrations-advanced

Advanced migrations for Yii2

dev-master 2017-12-11 17:59 UTC

This package is not auto-updated.

Last update: 2024-11-09 20:50:56 UTC


README

Advanced migrations for Yii2

Installation

Use composer

composer require "yiisolutions/yii2-migrations-advanced: @dev"

or add to composer.json require section:

"yiisolutions/yii2-migrations-advanced": "@dev"

Usage

Add custom migrate command in config/console.php file:

<?php

return [
    // ...
    'controllerMap' => [
        'migrate' => [
            'class' => 'yiisolutions\migrations\commands\MigrateController',
            // your config options here ...
        ],
    ],
    // ...
];

RBAC migrations

Sometimes you need to create a migration for RBAC. Use RbacMigrateController for this:

<?php

return [
    // ...
    'controllerMap' => [
        'rbac-migrate' => [
            'class' => 'yiisolutions\migrations\commands\RbacMigrateController',
        ],    
    ],
    // ...
];

For rbac-migrate/create command available templates:

  • create_[name]_role - create new role migration (options: description, ruleName)
  • drop_[name]_role - drop exist role migration
  • create_[name]_permission - create new permission migration (options: description, ruleName)
  • drop_[name]_permission - drop exist permission migration.