leizhishang / migrations
Webman plugin eloquent-ORM migrations
v1.0.0
2025-06-02 10:20 UTC
Requires
- php: >=7.2
- illuminate/console: ^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/database: ^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/filesystem: ^8.0|^9.0|^10.0|^11.0|^12.0
- webman/console: ^1.0 || ^2.0 || dev-master
- workerman/webman-framework: ^1.4.0||^2.1
This package is not auto-updated.
Last update: 2025-06-03 09:43:45 UTC
README
和laravel migration 使用方法类似
- php webman migrate:make create_users_table 生成迁移文件
- php webman migrate:make update_users_table --table=users生成编辑迁移文件,主要参数--table
- php webman migrate:make create_users_table --path=admin 生成迁移文件是指定目录
- php webman migrate:run 执行迁移
- php webman migrate:run --path=admin 执行指定目录的迁移
- php webman migrate:rollback 回滚迁移
- php webman migrate:rollback -s 1 回滚迁移指定次数
- php webman migrate:rollback -m 回滚指定迁移文件,例如2025_01_01_133823_create_test_table
- php webman seed:create UserSeeder 生成数据填充文件
- php webman seed:run 执行数据填充
- php webman migrate:status 查看迁移状态
- php webman migrate:fresh
指定数据库连接
$this->schema()->setConnection(Db::connection('mysql2'))->create('orders', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
dev
composer require pxianyu/migrations:dev-dev
在同一个host,同一个端口下,指定不同的库
执行迁移
php webman migrate:run --database=test
填充数据
- php webman seed:run --database=test