darkfriend/yii2-data-migrate 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

darkfriend/yii2-data-migrate

Composer 安装命令:

composer require --dev darkfriend/yii2-data-migrate

包简介

RBAC management module for Yii2

README 文档

README

Yii2 Test Data Migrate Extension


Yii2-Data-Migrate provides a test data control.

Latest Stable Version Total Downloads License

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist darkfriend/yii2-data-migrate "*"

or add

"darkfriend/yii2-data-migrate": "*"

to the require section of your composer.json.

Usage

Once the extension is installed, simply modify your application configuration as follows:

return [
    'bootstrap' => ['data'],
    'modules' => [
        'data' => [
            'class' => 'darkfriend\yii2migrate\ConsoleModule',
        ],
    ],
];

After you downloaded and configured Yii2-data-migrate, the last thing you need to do is updating your database schema by applying the migration:

$ php yii data/migrate/up

Migrations are located in the data-migrations directory.

Migrations

You can create the console migrations for creating/updating RBAC items.

Module setup

To be able create the migrations, you need to add the following code to your console application configuration:

// console.php
'modules' => [
    'data' => [
        'class' => 'darkfriend\yii2migrate\ConsoleModule'
    ]
]

Creating Migrations

To create a new migration, run the following command:

$ php yii data/migrate/create <name>

The required name argument gives a brief description about the new migration. For example, if the migration is about creating a new migrate, you may use the name create_migrate_name and run the following command:

$ php yii data/migrate/create create_migrate_name

Applying Migrations

To upgrade a database to its latest structure, you should apply all available new migrations using the following command:

$ php yii data/migrate

Reverting Migrations

To revert (undo) one or multiple migrations that have been applied before, you can run the following command:

$ php yii data/migrate/down     # revert the most recently applied migration
$ php yii data/migrate/down 3   # revert the most 3 recently applied migrations

Redoing Migrations

Redoing migrations means first reverting the specified migrations and then applying again. This can be done as follows:

$ php yii data/migrate/redo     # redo the last applied migration
$ php yii data/migrate/redo 3   # redo the last 3 applied migrations

History Migrations

$ php yii data/migrate/history     # show all applied migration

统计信息

  • 总下载量: 886
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-02-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固