PHPackages                             ajiho/think-phinx - 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. ajiho/think-phinx

ActiveComposer-plugin[Database &amp; ORM](/categories/database)

ajiho/think-phinx
=================

Phinx integration for thinkphp6

v1.0.0(2y ago)097MITPHPPHP &gt;=7.2

Since May 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ajiho/think-phinx)[ Packagist](https://packagist.org/packages/ajiho/think-phinx)[ Docs](https://github.com/ajiho/think-phinx)[ RSS](/packages/ajiho-think-phinx/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

think-phinx
===========

[](#think-phinx)

基于[phinx](https://book.cakephp.org/phinx)封装的一个thinkphp6数据库迁移工具

设计灵感来自于[wdaglb/thinkphp-migration](https://github.com/wdaglb/thinkphp-migration)并在此基础上进行了大量优化

think-phinxphinx1.0.0~0.13.0特性
==

[](#特性)

- 和tp官方的迁移工具保持相同的命令,无学习成本
- 相对于tp官方的迁移工具,think-phinx支持多数据库(环境,-e选项)迁移
- 相对于tp官方的迁移工具,phinx是直接通过composer更新而不是固定死版本,bug修复还有特性支持交给phinx官方去做，think-phinx只做了一个桥梁的作用
- 相对于tp官方的迁移工具,迁移文件模板默认提供和laravel迁移工具一样的`up`和`down`方法
- 集成`faker`假数据模拟工具,且是还在维护的[fakerphp/faker](https://packagist.org/packages/fakerphp/faker),而不是已经被弃用的[fzaninotto/faker](https://packagist.org/packages/fzaninotto/faker)
- 原汁原味的phinx,[phinx的官方文档](https://phinx.org/)内容完全可用
- 相对于`wdaglb/thinkphp-migration`命令的选项不需要两个`--`
- 相对于`wdaglb/thinkphp-migration`会自动创建文件迁移和填充路径,无需手动创建
- 相对于`wdaglb/thinkphp-migration`支持thinkphp6.x
- 相对于`wdaglb/thinkphp-migration`是直接在控制台输出phinx原本的命令信息
- 和phinx官方的命令选项保持一致,比如命令选项简写
- 迁移和填充模板默认有提供示例代码,帮助您快速启航

安装
==

[](#安装)

```
composer require ajiho/think-phinx
```

安装过程中会询问你是否确认安装该插件？ `y`

安装完毕后运行`php think`会得到如下信息

```
 migrate
  migrate:breakpoint  Run the phinx [Breakpoint] command
  migrate:create      Run the phinx [Create] command
  migrate:rollback    Run the phinx [Rollback] command
  migrate:run         Run the phinx [Migrate] command
  migrate:status      Run the phinx [Status] command
 seed
  seed:create         Run the phinx [Seed Create] command
  seed:run            Run the phinx [Seed Run] command

```

配置文件
====

[](#配置文件)

安装完毕后会自动生成配置文件`/config/phinx.php`

```
