command - How can I run outstanding migrations in laravel4? -


this problem.

i have migration 2013_08_25_220444_create_modules_table.php within path :

app/modules/user/migrations/

i have created custom artisan command:

<?php  use illuminate\console\command; use symfony\component\console\input\inputoption; use symfony\component\console\input\inputargument;  class usersmodulecommand extends command {  /**  * console command name.  *  * @var string  */ protected $name = 'users:install';  /**  * console command description.  *  * @var string  */ protected $description = 'instala el modulo de usuarios.';  /**  * create new command instance.  *  * @return void  */ public function __construct() {     parent::__construct(); }  /**  * execute console command.  *  * @return void  */ public function fire() {     echo 'instalando migraciones de usuario...'.php_eol;     $this->call('migrate', array('--path' => app_path() . '/modules/user/migrations'));         echo 'done.'.php_eol; }  /**  * console command arguments.  *  * @return array  */ protected function getarguments() {     return array(         //array('example', inputargument::required, 'an example argument.'),     ); }  /**  * console command options.  *  * @return array  */ protected function getoptions() {     return array(         //array('example', null, inputoption::value_optional, 'an example option.', null),     ); }  } 

in fire() method, call migrate command , pass array of options.

then, in terminal, run command:

php artisan users:install

and output:

instalando migraciones de usuario... nothing migrate. done.

the problem migrations not run.

but if run command in terminal:

php artisan migrate --path=app/modules/user/migrations

everything works ok, runs migration 2013_08_25_220444_create_modules_table.php

note: have registered artisan command in app/start/artisan.php file:

artisan::add(new usersmodulecommand);

what doing wrong ?

sorry english :d

notice how path passed on command line relative app root, 1 passed on command absolute? should calling in command is:

$this->call('migrate', array('--path' => 'app/modules/user/migrations')); 

by way, since might day want rollback these migrations, interesting add app/modules/user/migrations composer.json's classmaps:

composer.json

... "autoload": {     "classmap": [         ...         "app/modules/user/migrations",     ] }, 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -