xiaochengfu/yii2-migrate

yii2 database migration

Installs: 19

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 1

Open Issues: 0

Type:yii2-extension

v1.1.2 2017-04-21 04:37 UTC

This package is auto-updated.

Last update: 2024-04-14 17:56:25 UTC


README

yii2 database migration ,it is easy!

Installation

The preferred way to install this extension is through composer.

Either run

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

or add

"xiaochengfu/yii2-migrate": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

网页端使用:

1.在 backend/config/main.php 添加如下配置

'modules' => [
        'migration' => [
            'class' => 'xiaochengfu\migrate\Module',
        ]
    ],

2.在你的后台访问 http://yourdomain/migration

演示地址: http://yii.phpsy.cn/migration

命令行使用方法:

1.在console/config/main.php 添加如下配置

'controllerMap' => [
        'migrate' => [
                    'class' => 'xiaochengfu\migrate\console\MigrateController',
                    'useTablePrefix' => true,
                    'migrationPath' => '@console/migrations',
                ],
    ],

2.将迁移文件转存,及备份 php yii migrate/dump

3.还原指定文件

php yii migrate/to m170420_151515_migration.php