PHPackages                             zhezhong17/yii2-migration - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. zhezhong17/yii2-migration

ActiveYii2-extension[Database &amp; ORM](/categories/database)

zhezhong17/yii2-migration
=========================

yii2逆向还原mysql表为migrate文件

v1.0.1(6y ago)1713Apache-2.0PHP

Since Aug 10Pushed 6y ago1 watchersCompare

[ Source](https://github.com/zhezhong17/yii2-migration)[ Packagist](https://packagist.org/packages/zhezhong17/yii2-migration)[ RSS](/packages/zhezhong17-yii2-migration/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (2)Used By (0)

参考了e282486518/yii2-console-migration等其他很多包, 但它们都没有达到我的需求

=============================

我们的目标是百分百还原

包括但不限于(表结构 索引 字段长度 字段排序规则 数值精度 视图等)

所以诞生了它

如果你发现生成的结果不能百分百还原，请邮件提醒我。会继续改进的。

=============================

安装 Installation
---------------

[](#安装-installation)

```
composer require zhezhong17/yii2-migration "@dev"

```

OR

```
"zhezhong17/yii2-migration": "*"

```

还需要的工作
------

[](#还需要的工作)

在`console\config\main.php`OR `config\console.php` 中添加 :

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

在命令行中使用方式：

```
php ./yii migrate/reverse all # 逆向生成全部表
php ./yii migrate/reverse table1 #备份一张表
php ./yii migrate/reverse table1,table2,table3... #备份多张表

php ./yii migrate/up #恢复全部表

```

其他问题

```
    1. php ./yii migrate/reverse table1, table2, table3... 这种写法是错误的，逗号后面有空格。参数识别不出来，请注意啊

    2. 为了保持百分百一致，所以生成的是SQL语句, migrations只是执行SQL语句。 不是我们平时写的那种migrations格式。 (不喜欢这个格式请换其他包， 当然后续也可能会改进生成的格式)

    3. 我们的目标是百分百一致

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2469d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bd206f22065a897dea219c63797eabe262ae38bde0fbdd36605c208e39e920a7?d=identicon)[zhezhong](/maintainers/zhezhong)

---

Top Contributors

[![zhezhong17](https://avatars.githubusercontent.com/u/25665106?v=4)](https://github.com/zhezhong17 "zhezhong17 (4 commits)")

---

Tags

consolemigrationyii2

### Embed Badge

![Health badge](/badges/zhezhong17-yii2-migration/health.svg)

```
[![Health](https://phpackages.com/badges/zhezhong17-yii2-migration/health.svg)](https://phpackages.com/packages/zhezhong17-yii2-migration)
```

###  Alternatives

[bizley/migration

Migration generator for Yii 2.

297374.3k11](/packages/bizley-migration)[dmstr/yii2-migrate-command

Console Migration Command with multiple paths/aliases support

31295.5k6](/packages/dmstr-yii2-migrate-command)[e282486518/yii2-console-migration

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

388.1k4](/packages/e282486518-yii2-console-migration)[c006/yii2-migration-utility

Automatically writes the create tables for migrations or create tables in general

63160.6k1](/packages/c006-yii2-migration-utility)[tmukherjee13/yii2-reverse-migration

Generate working migration classes from existing Database

2321.5k](/packages/tmukherjee13-yii2-reverse-migration)[hzhihua/yii2-dump

Generate the schema from an existing database

1828.5k1](/packages/hzhihua-yii2-dump)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
