mirror of
https://github.com/Oreolek/kohana-migrations.git
synced 2024-06-26 03:40:54 +03:00
Changing tasks so that allowed config options are stored in member variables
This commit is contained in:
parent
114540af40
commit
2bbd092572
|
@ -6,6 +6,12 @@
|
|||
*/
|
||||
abstract class Minion_Task {
|
||||
|
||||
/**
|
||||
* A set of config options that the task accepts on the command line
|
||||
* @var array
|
||||
*/
|
||||
protected $_config = array();
|
||||
|
||||
/**
|
||||
* Gets the task name for the task
|
||||
*
|
||||
|
@ -28,7 +34,10 @@ abstract class Minion_Task {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function get_config_options();
|
||||
public function get_config_options()
|
||||
{
|
||||
return $this->_config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the task with the specified set of config
|
||||
|
|
|
@ -28,29 +28,31 @@
|
|||
* filesystem) that will be used to source migration files. By default
|
||||
* migrations will be loaded from all available locations
|
||||
*
|
||||
* db:migrate:dry-run
|
||||
*
|
||||
* No value taken, if this is specified then instead of executing the SQL it
|
||||
* will be printed to the console
|
||||
*
|
||||
* @author Matt Button <matthew@sigswitch.com>
|
||||
*/
|
||||
class Minion_Task_Db_Migrate extends Minion_Task
|
||||
{
|
||||
|
||||
/*
|
||||
* The default direction for migrations, TRUE = up, FALSE = down
|
||||
* Th' default direction for migrations, TRUE = up, FALSE = down
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_default_direction = TRUE;
|
||||
|
||||
/**
|
||||
* Get a set of config options that migrations will accept
|
||||
*
|
||||
* @return array
|
||||
* A set of config options that this task accepts
|
||||
* @var array
|
||||
*/
|
||||
public function get_config_options()
|
||||
{
|
||||
return array(
|
||||
'versions',
|
||||
'locations',
|
||||
);
|
||||
}
|
||||
protected $_config = array(
|
||||
'versions',
|
||||
'locations',
|
||||
'dry-run'
|
||||
);
|
||||
|
||||
/**
|
||||
* Migrates the database to the version specified
|
||||
|
@ -73,7 +75,7 @@ class Minion_Task_Db_Migrate extends Minion_Task
|
|||
|
||||
$manager = new Minion_Migration_Manager($db);
|
||||
|
||||
return $manager
|
||||
$results = $manager
|
||||
// Sync the available migrations with those in the db
|
||||
->sync_migration_files()
|
||||
->run_migration($locations, $targets, $this->_default_direction);
|
||||
|
|
Loading…
Reference in a new issue