I am installing the migrate scripts for the first time on my application. What I wish to do is use the configuration under /config/test/database.php to run my migrate installation scripts.
My entry on paths.php is the following
$environments = array(
'test' => array('http://test.*'),
'local' => array('http://localhost.*')
);
My entry on /application/config/test/database.php
return array(
'connections' => array(
'mysql' => array('driver' => 'mysql',
'host' => 'localhost',
'database' => 'new_db',
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
'prefix' => '')
),
);
and /application/config/database.php
return array(
'connections' => array(
'mysql' => array('driver' => 'mysql',
'host' => 'localhost',
'database' => 'default_db',
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
'prefix' => '')
),
);
Every time I run php artisan migrate:install --env=test
it always installs on the DB defined on /application/config/database.php and not using the configuration from /application/config/test/database.php.
Appreciate if someone could help me fix this issue.
I figured it out myself. Am not sure if this is something that has been documented in Laravel for multiple environment. An additional parameter was required on the environment definition on the paths.php
$environments = array(
'test' => array('http://test.*','MY_COMPUTER_NAME'),
'local' => array('http://localhost.*')
);
Now, running php artisan migrate:install --env=test
correctly executes the migration scripts on the DB configuration defined on /application/config/test/database.php.
Hope this helps others