diff --git a/modules/minion/classes/migration.php b/modules/minion/classes/migration.php index 1cb5d222..16e4372d 100644 --- a/modules/minion/classes/migration.php +++ b/modules/minion/classes/migration.php @@ -44,8 +44,13 @@ class Migration { * @param Database $db The database connection that should be passed to migrations * @param Model_Migration $model Inject an instance of the minion model into the manager */ - public function __construct(Database $db, Model_Migration $model = NULL) + public function __construct($db = NULL, Model_Migration $model = NULL) { + if($db == NULL) + { + $db = Database::instance(NULL); + } + if ($model === NULL) { $model = new Model_Migration($db); diff --git a/modules/minion/classes/model/migration.php b/modules/minion/classes/model/migration.php index 45e09c7f..b4be0421 100644 --- a/modules/minion/classes/model/migration.php +++ b/modules/minion/classes/model/migration.php @@ -23,8 +23,13 @@ class Model_Migration extends Model * * @param Kohana_Database $db Database connection to use */ - public function __construct(Database $db) + public function __construct($db = NULL) { + if($db == NULL) + { + $db = Database::instance(NULL); + } + $this->_db = $db; $this->_table = Config::get('migration.table', 'migrations'); diff --git a/modules/minion/classes/task/db/migrate.php b/modules/minion/classes/task/db/migrate.php index 0bc31829..6086a60f 100644 --- a/modules/minion/classes/task/db/migrate.php +++ b/modules/minion/classes/task/db/migrate.php @@ -93,12 +93,10 @@ protected function _execute(array $options) } } - $db = Database::instance(); - $model = new Model_Migration($db); - + $model = new Model_Migration(); $model->ensure_table_exists(); - $manager = new Migration($db, $model); + $manager = new Migration(NULL, $model); // Sync the available migrations with those in the db $manager diff --git a/modules/minion/classes/task/db/migrate/status.php b/modules/minion/classes/task/db/migrate/status.php index 1216dae5..154d2630 100644 --- a/modules/minion/classes/task/db/migrate/status.php +++ b/modules/minion/classes/task/db/migrate/status.php @@ -17,7 +17,7 @@ class Task_Db_Migrate_Status extends Minion_Task */ protected function _execute(array $options) { - $model = new Model_Migration(Database::instance()); + $model = new Model_Migration(); $view = new View('minion/db/status'); $view->groups = $model->get_group_statuses();