joshbrw/laravel-module-migrations

添加从其他模块运行迁移的功能。

v2.0.0 2019-03-28 08:47 UTC

This package is auto-updated.

Last update: 2024-08-28 23:27:49 UTC


README

提供了一种特性,可以在 Laravel 模块迁移中使用,以确保另一个模块中的表存在。这解决了任何跨模块表依赖问题。

安装

  1. 通过以下命令将配置发布到 config/module-migrations.php:

    php artisan vendor:publish --provider="Joshbrw\LaravelModuleMigrations\LaravelModuleMigrationsServiceProvider"

  2. 在此配置文件中编写您的表定义。此配置文件应定义可以创建的表,以及包含迁移的模块,以及应该运行以创建此表的迁移。

  3. 在需要创建其他模块中表的所有迁移中,使用 use Joshbrw\LaravelModuleMigrations\Traits\ModuleMigrator

  4. 在任何想要创建表的地方使用 $this->ensureTableExists('tableName');