1
0
Fork 0
mirror of https://github.com/Oreolek/kohana-migrations.git synced 2024-06-16 15:01:08 +03:00

Filling out the environment config option in db:migrate

This commit is contained in:
Matt Button 2010-12-29 01:10:11 +00:00
parent c026cbb415
commit 0a2863ae9a
2 changed files with 19 additions and 2 deletions

View file

@ -7,6 +7,11 @@
*
* Available config options are:
*
* --environment=environment
*
* Specify the "environment" that you're currently in. You can change the
* environment => db config group mapping in the minion/migration config file.
*
* --versions=[location:]version
*
* Used to specify the version to migrate the database to. The location prefix
@ -49,6 +54,7 @@ class Minion_Task_Db_Migrate extends Minion_Task
* @var array
*/
protected $_config = array(
'environment',
'versions',
'locations',
'dry-run'
@ -61,7 +67,7 @@ class Minion_Task_Db_Migrate extends Minion_Task
*/
public function execute(array $config)
{
$k_config = Kohana::config('minion/task/migrations');
$k_config = Kohana::config('minion/migration');
// Grab user input, using sensible defaults
$environment = Arr::get($config, 'environment', 'development');
@ -71,7 +77,7 @@ class Minion_Task_Db_Migrate extends Minion_Task
$targets = $this->_parse_target_versions($versions);
$locations = $this->_parse_locations($specified_locations);
$db = Database::instance($k_config['db_connection'][$environment]);
$db = Database::instance($k_config['db_connections'][$environment]);
$manager = new Minion_Migration_Manager($db);

View file

@ -0,0 +1,11 @@
<?php
return array(
// Allows you to map an environment to a specific database config group
'db_connections' => array(
'development' => 'default',
'unittest' => 'unittest'
),
);