Laravel 4在Artisan CLI上使用--path进行rollback:rollback [英] Laravel 4 migrate:rollback with --path on artisan CLI

查看:81
本文介绍了Laravel 4在Artisan CLI上使用--path进行rollback:rollback的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Laravel 4上遇到了障碍.

I'm having some roadblock on Laravel 4.

因为我无法使artisan:migrateapp/database/migrations (例如:app/database/migrations/app1)的内部文件夹生成迁移

我的自定义命令app:migrate

/* default path */
$this->call('migrate'); 

/* custom path */
$this->call('migrate', array('--path' => 'app/database/migrations/app1')); 

但是我还想要一个app:refresh命令,该命令将从自定义路径然后从默认路径回滚所有迁移.然后重新迁移并植入所有种子,就像migrate:refresh --seed所做的一样

but i also want an app:refresh command which will rollback all the migrations from the custom path then from the default path.. then re migrate and seed everything just like what migrate:refresh --seed does

我该如何扭转呢?打电话:

how do i reverse this? calling:

$this->call('migrate:rollback', array('--path' => 'app/database/migrations/app1'));

将产生一个错误提示

[InvalidArgumentException]
The "--path" option does not exist.

请有人帮忙.

谢谢!

推荐答案

您要做的就是确保可以自动加载迁移类.最简单的方法是将路径保存到要保存到composer.jsonautoload.classmap:

All you have to do is make sure your migration classes can be autoloaded. The easiest way to do so is to add the path to the folder you're keeping them to composer.json's autoload.classmap:

...
"autoload": {
    "classmap": [
        ...
        "app/database/migrations/app1",
    ]
},

这篇关于Laravel 4在Artisan CLI上使用--path进行rollback:rollback的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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