mirror of
https://github.com/Oreolek/kohana-migrations.git
synced 2024-05-05 02:28:16 +03:00
Merge branch '3.1/develop' into 3.2/develop
This commit is contained in:
commit
745c40dfc9
|
@ -1,21 +1,24 @@
|
|||
<?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:
|
||||
*
|
||||
* --group=path/to/migration/group
|
||||
* --group=group_name
|
||||
*
|
||||
* This is a required config option, use it specify in which group the
|
||||
* migration should be stored. Due to the nature of the cascading filesystem
|
||||
* minion doesn't automatically know where a migration is stored so make sure
|
||||
* you pass in the full path to your migrations folder, e.g.
|
||||
* migration should be stored. Migrations are stored in a `migrations`
|
||||
* directory followed by the group name specified. By default, the `migrations`
|
||||
* directory is created in `APPPATH` but that can be changed with `--location`
|
||||
*
|
||||
* # The group of the migrations folder is modules/myapp/migrations/myapp/
|
||||
* --group=modules/myapp/migrations/myapp/
|
||||
* --location=modules/auth
|
||||
*
|
||||
* On nix based systems you should be able to tab complete the path
|
||||
* Specified the path of the migration (without the `migrations` directory).
|
||||
* This value is defaulted to `APPPATH`
|
||||
*
|
||||
* # The migration will be created in `modules/myapp/migrations/myapp/`
|
||||
* --group=myapp --location=modules/myapp
|
||||
*
|
||||
* --description="Description of migration here"
|
||||
*
|
||||
|
@ -23,11 +26,9 @@
|
|||
* filename. It is required but can be changed manually later on without
|
||||
* affecting the integrity of the migration.
|
||||
*
|
||||
* The description will be
|
||||
*
|
||||
* @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
|
||||
|
@ -49,7 +50,7 @@ class Minion_Task_Db_Generate extends Minion_Task
|
|||
try
|
||||
{
|
||||
$file = $this->generate($config);
|
||||
Minion_CLI::write('Migration generated: '.$file);
|
||||
Minion_CLI::write('Migration generated: '.$file);
|
||||
}
|
||||
catch(ErrorException $e)
|
||||
{
|
||||
|
@ -57,7 +58,7 @@ class Minion_Task_Db_Generate extends Minion_Task
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function generate($config, $up = null, $down = null)
|
||||
{
|
||||
$defaults = array(
|
||||
|
@ -86,7 +87,7 @@ class Minion_Task_Db_Generate extends Minion_Task
|
|||
$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('description', $description)
|
||||
->set('up', $up)
|
|
@ -1,21 +1,21 @@
|
|||
<?php defined('SYSPATH') or die('No direct script access.');
|
||||
|
||||
/**
|
||||
* The Migrate task compares the current version of the database with the target
|
||||
* version and then executes the necessary commands to bring the database up to
|
||||
* 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
|
||||
* date
|
||||
*
|
||||
* Available config options are:
|
||||
*
|
||||
* --migrate-down
|
||||
* --down
|
||||
*
|
||||
* Migrate the group(s) down
|
||||
*
|
||||
* --migrate-up
|
||||
* --up
|
||||
*
|
||||
* Migrate the group(s) up
|
||||
*
|
||||
* --migrate-to=(timestamp|+up_migrations|down_migrations)
|
||||
* --to=(timestamp|+up_migrations|down_migrations)
|
||||
*
|
||||
* Migrate to a specific timestamp, or up $up_migrations, or down $down_migrations
|
||||
*
|
||||
|
@ -27,24 +27,24 @@
|
|||
*
|
||||
* --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.
|
||||
*
|
||||
* Note, only --migrate-up and --migrate-down can be used with --groups
|
||||
* Note, only --up and --down can be used with --groups
|
||||
*
|
||||
* --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
|
||||
*
|
||||
* --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
|
||||
*
|
||||
* @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
|
||||
|
@ -53,9 +53,9 @@ class Minion_Task_Db_Migrate extends Minion_Task
|
|||
protected $_config = array(
|
||||
'group',
|
||||
'groups',
|
||||
'migrate-up',
|
||||
'migrate-down',
|
||||
'migrate-to',
|
||||
'up',
|
||||
'down',
|
||||
'to',
|
||||
'dry-run',
|
||||
'quiet'
|
||||
);
|
||||
|
@ -70,12 +70,12 @@ class Minion_Task_Db_Migrate extends Minion_Task
|
|||
$k_config = Kohana::$config->load('minion/migration');
|
||||
|
||||
$groups = Arr::get($config, 'group', Arr::get($config, 'groups', NULL));
|
||||
$target = Arr::get($config, 'migrate-to', NULL);
|
||||
$target = Arr::get($config, 'to', NULL);
|
||||
|
||||
$dry_run = array_key_exists('dry-run', $config);
|
||||
$quiet = array_key_exists('quiet', $config);
|
||||
$up = array_key_exists('migrate-up', $config);
|
||||
$down = array_key_exists('migrate-down', $config);
|
||||
$up = array_key_exists('up', $config);
|
||||
$down = array_key_exists('down', $config);
|
||||
|
||||
$groups = $this->_parse_groups($groups);
|
||||
|
||||
|
@ -110,12 +110,12 @@ class Minion_Task_Db_Migrate extends Minion_Task
|
|||
}
|
||||
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('error', $e->getMessage());
|
||||
}
|
||||
|
||||
$view = View::factory('minion/task/db/migrate')
|
||||
$view = View::factory('minion/task/migrations/run')
|
||||
->set('dry_run', $dry_run)
|
||||
->set('quiet', $quiet)
|
||||
->set('dry_run_sql', $manager->get_dry_run_sql())
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* @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
|
||||
|
@ -19,7 +19,7 @@ class Minion_Task_Db_Status extends Minion_Task {
|
|||
$db = Database::instance();
|
||||
$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();
|
||||
|
Loading…
Reference in a new issue