承接 hjp1011/yii2-console-migration 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

hjp1011/yii2-console-migration

Composer 安装命令:

composer require hjp1011/yii2-console-migration

包简介

yii2命令行中使用migration备份和还原数据库

README 文档

README

Yii2 uses Migration to back up and restore the database, adding other extended usage methods.

Notice:

If you are using PHP7.2, then yII must use v2.0.15.1 or higher, because the yii2 core class Object conflicts with the PHP7.2 reserved class Object.

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

use yii\base\Object // PHP7.1 and previous versions
use yii\base\BaseObject // PHP7.2

Installation

The preferred way to install this extension is through [composer] (http://getcomposer.org/download/).

Run

composer require hjp1011/yii2-console-migration "*"

Or add

"hjp1011/yii2-console-migration": "*"

To the corresponding location of the 'composer. Json' file.

usage

Backup table in command line:

inconsole\config\main.php add :

'controllerMap' => [
    'migrate' => [
        'class' => 'yiiframe\migration\ConsoleController',
    ],
],

Use on the command line:

php ./yii migrate/backup all #Backup all tables
php ./yii migrate/backup table1,table2,table3... #Backup multiple tables
php ./yii migrate/backup table1 #Back up a table

php ./yii migrate/up #Restore all tables

Back up tables in the background:

Add the following code to a background controller, such as PublicController:

public function actions()
{
    return [
        'backup' => [
            'class' => 'yiiframe\migration\WebAction',
            'returnFormat' => 'json',
            'migrationPath' => '@console/migrations'
        ]
    ];
}

Send an Ajax request to/admin/public/backup?tables=yii2_ad,yii2_admin

Other usage:

For friends who want to do more extensions, you can inherit directly yiiframe\migration\components\MigrateCreate

Or use the following code:

$migrate = Yii::createObject([
        'class' => 'yiiframe\migration\components\MigrateCreate',
        'migrationPath' => $this->migrationPath
]);
$migrate->create($table);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2021-12-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固