1
0
Fork 0
mirror of https://github.com/Oreolek/kohana-migrations.git synced 2024-06-16 23:11:06 +03:00

Changed Minion_Migration_Database so that it doesn't try and override Database::instance()

Also, reset_query_stack() now returns an array of queries collected after resetting the stack
This commit is contained in:
Matt Button 2010-12-30 03:21:51 +00:00
parent 765e4eddee
commit 09e3e57368

View file

@ -11,9 +11,19 @@ class Minion_Migration_Database extends Database_MySQL {
* @param array Config for the underlying DB connection * @param array Config for the underlying DB connection
* @return Minion_Migration_Database * @return Minion_Migration_Database
*/ */
public static function instance(array $config) public static function faux_instance($db_group = NULL, array $config = NULL)
{ {
return new Minion_Migration_Database('_minion_faux', $config); if($config === NULL)
{
if($db_group === NULL)
{
$db_group = Database::$default;
}
$config = Kohana::config('database')->$db_group;
}
return new Minion_Migration_Database('__minion_faux', $config);
} }
/** /**
@ -24,6 +34,7 @@ class Minion_Migration_Database extends Database_MySQL {
/** /**
* Gets the stack of queries that have been executed * Gets the stack of queries that have been executed
*
* @return array * @return array
*/ */
public function get_query_stack() public function get_query_stack()
@ -32,14 +43,17 @@ class Minion_Migration_Database extends Database_MySQL {
} }
/** /**
* Resets the query stack to an empty state * Resets the query stack to an empty state and returns the queries
* @return Minion_Migration_Database $this *
* @return array Array of SQL queries that would've been executed
*/ */
public function reset_query_stack() public function reset_query_stack()
{ {
$queries = $this->_queries;
$this->_queries = array(); $this->_queries = array();
return $this; return $queries;
} }
/** /**