joshbrw / laravel-module-migrations
添加从其他模块运行迁移的功能。
v2.0.0
2019-03-28 08:47 UTC
Requires
- php: >=7.2
- illuminate/database: 5.8.*
- illuminate/support: 5.8.*
- nwidart/laravel-modules: 5.*
README
提供了一种特性,可以在 Laravel 模块迁移中使用,以确保另一个模块中的表存在。这解决了任何跨模块表依赖问题。
安装
-
通过以下命令将配置发布到
config/module-migrations.php
:php artisan vendor:publish --provider="Joshbrw\LaravelModuleMigrations\LaravelModuleMigrationsServiceProvider"
-
在此配置文件中编写您的表定义。此配置文件应定义可以创建的表,以及包含迁移的模块,以及应该运行以创建此表的迁移。
-
在需要创建其他模块中表的所有迁移中,使用
use Joshbrw\LaravelModuleMigrations\Traits\ModuleMigrator
。 -
在任何想要创建表的地方使用
$this->ensureTableExists('tableName');
。