magein / think-migration
基于magein/migration重新封装的面向对象形式的数据库迁移类
v4.0.0
2025-08-12 01:54 UTC
Requires
- php: ^8.0
- magein/migration: ^4.0
- magein/utils: ^4.0.0
- topthink/framework: ^8.0
README
简介
依赖magein/migration创建适用于thinkphp的扩展包,
magein/migration与think-migration区别在于写法,前者支持链式调用
magein/migration gitee | composer
功能
- 数据库配置文件使用thinkphp的db
- 支持服务类加载
{
"extra": {
"think": {
"services": [
"magein\\think\\migration\\MigrationService"
]
}
}
}
安装
composer require magein/think-migration
使用
可选配置
在config/console.php添加一下配置
[
'command'=>[
'migrate:new'=>MigrateCommand::class,
'mi:new'=>MigrateCommand::class,
'mi:create'=>MigrateCommand::class,
'mi:run'=>MigrateCommand::class,
]
]
运行
# think后面的 1:2 取决于console.php你配置的
php think migate:new --help
php think migate:new user
php think mi:new user
php think mi:create user
php think mi:run user
# 执行
php think migate:new user run
php think migate:new run
# 回滚
php think migate:new user rollback
php think migate:new rollback