magein/think-migration

基于magein/migration重新封装的面向对象形式的数据库迁移类

v4.0.0 2025-08-12 01:54 UTC

This package is auto-updated.

Last update: 2025-08-12 01:59:57 UTC


README

简介

依赖magein/migration创建适用于thinkphp的扩展包,

magein/migration与think-migration区别在于写法,前者支持链式调用

magein/migration gitee | composer

thinkphp官方文档

think-migration

功能

  1. 数据库配置文件使用thinkphp的db
  2. 支持服务类加载
{
  "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