mirror of
https://github.com/Oreolek/kohana-migrations.git
synced 2024-05-04 18:18:16 +03:00
3.3.0 support
This commit is contained in:
parent
3d412dd2aa
commit
526e589f3d
26
classes/minion/task/migrations/new.php → classes/Task/Migration/New.php
Executable file → Normal file
26
classes/minion/task/migrations/new.php → classes/Task/Migration/New.php
Executable file → Normal file
|
@ -34,10 +34,10 @@ class Minion_Task_Migrations_New extends Minion_Task
|
|||
* A set of config options that this task accepts
|
||||
* @var array
|
||||
*/
|
||||
protected $_config = array(
|
||||
'group',
|
||||
'description',
|
||||
'location'
|
||||
protected $_options = array(
|
||||
'group' => NULL,
|
||||
'description' => NULL,
|
||||
'location' => NULL,
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -45,11 +45,11 @@ class Minion_Task_Migrations_New extends Minion_Task
|
|||
*
|
||||
* @param array Configuration
|
||||
*/
|
||||
public function execute(array $config)
|
||||
protected function _execute(array $options)
|
||||
{
|
||||
try
|
||||
{
|
||||
$file = $this->generate($config);
|
||||
$file = $this->generate($options);
|
||||
Minion_CLI::write('Migration generated: '.$file);
|
||||
}
|
||||
catch(ErrorException $e)
|
||||
|
@ -59,7 +59,7 @@ class Minion_Task_Migrations_New extends Minion_Task
|
|||
|
||||
}
|
||||
|
||||
public function generate($config, $up = null, $down = null)
|
||||
public function generate($options, $up = null, $down = null)
|
||||
{
|
||||
$defaults = array(
|
||||
'location' => APPPATH,
|
||||
|
@ -67,19 +67,19 @@ class Minion_Task_Migrations_New extends Minion_Task
|
|||
'group' => NULL,
|
||||
);
|
||||
|
||||
$config = array_merge($defaults, $config);
|
||||
$options = array_merge($defaults, $options);
|
||||
|
||||
// Trim slashes in group
|
||||
$config['group'] = trim($config['group'], '/');
|
||||
$options['group'] = trim($options['group'], '/');
|
||||
|
||||
if ( ! $this->_valid_group($config['group']))
|
||||
if ( ! $this->_valid_group($options['group']))
|
||||
{
|
||||
throw new ErrorException("Please provide a valid --group\nSee help for more info");
|
||||
}
|
||||
|
||||
$group = $config['group'].'/';
|
||||
$description = $config['description'];
|
||||
$location = rtrim(realpath($config['location']), '/').'/migrations/';
|
||||
$group = $options['group'].'/';
|
||||
$description = $options['description'];
|
||||
$location = rtrim(realpath($options['location']), '/').'/migrations/';
|
||||
|
||||
// {year}{month}{day}{hour}{minute}{second}
|
||||
$time = date('YmdHis');
|
|
@ -50,14 +50,14 @@ class Minion_Task_Migrations_Run extends Minion_Task
|
|||
* A set of config options that this task accepts
|
||||
* @var array
|
||||
*/
|
||||
protected $_config = array(
|
||||
'group',
|
||||
'groups',
|
||||
'up',
|
||||
'down',
|
||||
'to',
|
||||
'dry-run',
|
||||
'quiet'
|
||||
protected $_options = array(
|
||||
'group' => NULL,
|
||||
'groups' => NULL,
|
||||
'up' => NULL,
|
||||
'down' => NULL,
|
||||
'to' => NULL,
|
||||
'dry-run' => NULL,
|
||||
'quiet' => NULL,
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -65,17 +65,17 @@ class Minion_Task_Migrations_Run extends Minion_Task
|
|||
*
|
||||
* @param array Configuration to use
|
||||
*/
|
||||
public function execute(array $config)
|
||||
protected function _execute(array $options)
|
||||
{
|
||||
$k_config = Kohana::$config->load('minion/migration');
|
||||
|
||||
$groups = Arr::get($config, 'group', Arr::get($config, 'groups', NULL));
|
||||
$target = Arr::get($config, 'to', NULL);
|
||||
$groups = Arr::get($options, 'group', Arr::get($options, 'groups', NULL));
|
||||
$target = Arr::get($options, 'to', NULL);
|
||||
|
||||
$dry_run = array_key_exists('dry-run', $config);
|
||||
$quiet = array_key_exists('quiet', $config);
|
||||
$up = array_key_exists('up', $config);
|
||||
$down = array_key_exists('down', $config);
|
||||
$dry_run = array_key_exists('dry-run', $options);
|
||||
$quiet = array_key_exists('quiet', $options);
|
||||
$up = array_key_exists('up', $options);
|
||||
$down = array_key_exists('down', $options);
|
||||
|
||||
$groups = $this->_parse_groups($groups);
|
||||
|
|
@ -14,7 +14,7 @@ class Minion_Task_Migrations_Status extends Minion_Task {
|
|||
*
|
||||
* @param array Config for the task
|
||||
*/
|
||||
public function execute(array $config)
|
||||
protected function _execute(array $options)
|
||||
{
|
||||
$db = Database::instance();
|
||||
$model = new Model_Minion_Migration($db);
|
Loading…
Reference in a new issue