Laravel 5.6:从特定文件夹迁移 [英] Laravel 5.6: Migration from a specific folder

查看:129
本文介绍了Laravel 5.6:从特定文件夹迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用php artisan migrate --path="/database/migrations/ef仅使用该路径中的迁移.但是我得到了"Nohting no migrate"并且迁移文件是朝那个方向.

I am trying to use php artisan migrate --path="/database/migrations/ef to use only the migrations in that path. But I got "Nohting no migrate" and the migration files are in that direction.

我试图将其添加到AppServiceProvider的启动方法中,即通过此链接:

I tried to adding this to boot method in AppServiceProvider, that is from this link Laravel running migrations on "app/database/migrations" folder recursively:

$mainPath = database_path('migrations');
$directories = glob($mainPath . '/*' , GLOB_ONLYDIR);
$paths = array_merge([$mainPath], $directories);

$this->loadMigrationsFrom($paths);

但是它也不起作用.

推荐答案

对于Laravel> = 5.0,在子目录中迁移迁移文件的正确命令为:

php artisan migrate --path=/database/migrations/ef
php artisan migrate --path=/database/migrations/relations

这篇关于Laravel 5.6:从特定文件夹迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆