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
Requires
- php: >=5.4.0
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2025-04-14 20:17:53 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