所以我的migrations文件夹看起来像这样,因为我有几十个表,它使事情井然有序:

migrations/
  create_user_table.php
  relations/
  translations/

I'm trying to do a refresh all migrations and seed but it seems like I've run into a slight hiccup where I don't know the artisan command to run migrations recursively (i.e. run migrations in the relations and translations folders as well).

I've tried adding --path="app/database/migrations/*" however it spat out an error. Does anyone know the solution to this?

推荐答案

The only way to do it right now is to manually go through all the migrations. That is, you have to run the migration command on each of your subfolders:

php artisan migrate --path=/app/database/migrations/relations  
php artisan migrate --path=/app/database/migrations/translations

但是,您可以轻松地扩展artisan系统,编写自己的migrate命令,该命令将遍历migrations文件夹下的所有文件夹,为您创建并运行这些命令.

如果您不想通过artisan来实现这一点,也可以简单地编写一个shell脚本

Edit: for Laravel >= 5.0, the correct commands to migrate migration files in sub directories would be:

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

Laravel相关问答推荐

保存很多模型太慢

CKEditor在laravel中的p标记之前和之后添加额外的p标记

如何在 Laravel 中将 Select 选项表单插入数据库

运行Docker时,安装PHP8.1时返回错误

使用 Laravel 计算页面浏览量

Laravel 5 如何配置 Queue 数据库驱动程序以连接到非默认数据库?

Laravel belongsTo 关系 - 试图获取非对象的属性

Laravel 错误ReflectionException-类 App\Http\Kernel 不存在

Laravel - 加载常见的页眉和页脚以查看

刚安装 Lumen 并得到 NotFoundHttpException

合并两个 Eloquent 集合并删除所有重复项.

Laravel:如何在没有数据库的情况下对用户进行身份验证

如何在 laravel blade中进行一次性推送

Laravel 随机排序

如何在 Laravel 4 中使用 SHA1 加密而不是 BCrypt?

WhereHas Laravel 中的关系计数条件是什么

如何在 laravel 4 中删除文件

在 Laravel 中结合 AND/OR Eloquent的查询

Laravel 集合计数结果

count() 参数必须是数组或在 laravel 中实现可数的对象