mirror of
https://github.com/Oreolek/kohana-migrations.git
synced 2024-05-18 17:08:18 +03:00
renaming the migration tasks for cleaner separation (refs #11)
This commit is contained in:
parent
212b525b6b
commit
b97efcf806
|
@ -1,7 +1,7 @@
|
||||||
<?php defined('SYSPATH') or die('No direct script access.');
|
<?php defined('SYSPATH') or die('No direct script access.');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The generate task provides an easy way to create migration files
|
* The new task provides an easy way to create migration files
|
||||||
*
|
*
|
||||||
* Available config options are:
|
* Available config options are:
|
||||||
*
|
*
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
*
|
*
|
||||||
* @author Matt Button <matthew@sigswitch.com>
|
* @author Matt Button <matthew@sigswitch.com>
|
||||||
*/
|
*/
|
||||||
class Minion_Task_Db_Generate extends Minion_Task
|
class Minion_Task_Migrations_New extends Minion_Task
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* A set of config options that this task accepts
|
* A set of config options that this task accepts
|
||||||
|
@ -49,7 +49,7 @@ class Minion_Task_Db_Generate extends Minion_Task
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$file = $this->generate($config);
|
$file = $this->generate($config);
|
||||||
Minion_CLI::write('Migration generated: '.$file);
|
Minion_CLI::write('Migration generated: '.$file);
|
||||||
}
|
}
|
||||||
catch(ErrorException $e)
|
catch(ErrorException $e)
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ class Minion_Task_Db_Generate extends Minion_Task
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generate($config, $up = null, $down = null)
|
public function generate($config, $up = null, $down = null)
|
||||||
{
|
{
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
|
@ -86,7 +86,7 @@ class Minion_Task_Db_Generate extends Minion_Task
|
||||||
$file = $this->_generate_filename($location, $group, $time, $description);
|
$file = $this->_generate_filename($location, $group, $time, $description);
|
||||||
|
|
||||||
|
|
||||||
$data = Kohana::FILE_SECURITY.View::factory('minion/task/db/generate/template')
|
$data = Kohana::FILE_SECURITY.View::factory('minion/task/migrations/new/template')
|
||||||
->set('class', $class)
|
->set('class', $class)
|
||||||
->set('description', $description)
|
->set('description', $description)
|
||||||
->set('up', $up)
|
->set('up', $up)
|
|
@ -1,8 +1,8 @@
|
||||||
<?php defined('SYSPATH') or die('No direct script access.');
|
<?php defined('SYSPATH') or die('No direct script access.');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Migrate task compares the current version of the database with the target
|
* The Run task compares the current version of the database with the target
|
||||||
* version and then executes the necessary commands to bring the database up to
|
* version and then executes the necessary commands to bring the database up to
|
||||||
* date
|
* date
|
||||||
*
|
*
|
||||||
* Available config options are:
|
* Available config options are:
|
||||||
|
@ -27,24 +27,24 @@
|
||||||
*
|
*
|
||||||
* --groups=group[,group2[,group3...]]
|
* --groups=group[,group2[,group3...]]
|
||||||
*
|
*
|
||||||
* A list of groups that will be used to source migration files. By default
|
* A list of groups that will be used to source migration files. By default
|
||||||
* migrations will be loaded from all available groups.
|
* migrations will be loaded from all available groups.
|
||||||
*
|
*
|
||||||
* Note, only --migrate-up and --migrate-down can be used with --groups
|
* Note, only --migrate-up and --migrate-down can be used with --groups
|
||||||
*
|
*
|
||||||
* --dry-run
|
* --dry-run
|
||||||
*
|
*
|
||||||
* No value taken, if this is specified then instead of executing the SQL it
|
* No value taken, if this is specified then instead of executing the SQL it
|
||||||
* will be printed to the console
|
* will be printed to the console
|
||||||
*
|
*
|
||||||
* --quiet
|
* --quiet
|
||||||
*
|
*
|
||||||
* Suppress all unnecessary output. If --dry-run is enabled then only dry run
|
* Suppress all unnecessary output. If --dry-run is enabled then only dry run
|
||||||
* SQL will be output
|
* SQL will be output
|
||||||
*
|
*
|
||||||
* @author Matt Button <matthew@sigswitch.com>
|
* @author Matt Button <matthew@sigswitch.com>
|
||||||
*/
|
*/
|
||||||
class Minion_Task_Db_Migrate extends Minion_Task
|
class Minion_Task_Migrations_Run extends Minion_Task
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* A set of config options that this task accepts
|
* A set of config options that this task accepts
|
||||||
|
@ -110,12 +110,12 @@ class Minion_Task_Db_Migrate extends Minion_Task
|
||||||
}
|
}
|
||||||
catch(Minion_Migration_Exception $e)
|
catch(Minion_Migration_Exception $e)
|
||||||
{
|
{
|
||||||
return View::factory('minion/task/db/migrate/exception')
|
return View::factory('minion/task/migrations/run/exception')
|
||||||
->set('migration', $e->get_migration())
|
->set('migration', $e->get_migration())
|
||||||
->set('error', $e->getMessage());
|
->set('error', $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$view = View::factory('minion/task/db/migrate')
|
$view = View::factory('minion/task/migrations/run')
|
||||||
->set('dry_run', $dry_run)
|
->set('dry_run', $dry_run)
|
||||||
->set('quiet', $quiet)
|
->set('quiet', $quiet)
|
||||||
->set('dry_run_sql', $manager->get_dry_run_sql())
|
->set('dry_run_sql', $manager->get_dry_run_sql())
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* @author Matt Button <matthew@sigswitch.com>
|
* @author Matt Button <matthew@sigswitch.com>
|
||||||
*/
|
*/
|
||||||
class Minion_Task_Db_Status extends Minion_Task {
|
class Minion_Task_Migrations_Status extends Minion_Task {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the task
|
* Execute the task
|
||||||
|
@ -19,7 +19,7 @@ class Minion_Task_Db_Status extends Minion_Task {
|
||||||
$db = Database::instance();
|
$db = Database::instance();
|
||||||
$model = new Model_Minion_Migration($db);
|
$model = new Model_Minion_Migration($db);
|
||||||
|
|
||||||
$view = new View('minion/task/db/status');
|
$view = new View('minion/task/migrations/status');
|
||||||
|
|
||||||
$view->groups = $model->get_group_statuses();
|
$view->groups = $model->get_group_statuses();
|
||||||
|
|
Loading…
Reference in a new issue