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:
parent
c026cbb415
commit
0a2863ae9a
|
@ -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);
|
||||
|
||||
|
|
11
config/minion/migration.php
Normal file
11
config/minion/migration.php
Normal 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'
|
||||
),
|
||||
);
|
Loading…
Reference in a new issue