问题
I'm having some roadblock on Laravel 4.
Since I can't make artisan:migrate generate migrations from inner folders of app/database/migrations (ex: app/database/migrations/app1)
I have this on my custom command app:migrate
/* default path */
$this->call('migrate');
/* custom path */
$this->call('migrate', array('--path' => 'app/database/migrations/app1'));
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'));
will produce an error saying
[InvalidArgumentException]
The "--path" option does not exist.
can somebody help please.
thanks!
回答1:
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",
]
},
回答2:
You should re-run migrate with "--path" option manually for this case.
来源:https://stackoverflow.com/questions/18425311/laravel-4-migraterollback-with-path-on-artisan-cli