Skip to content

Commit

Permalink
Add fix
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalandan committed Nov 15, 2023
1 parent b469118 commit 9810c4d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions system/Database/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ public static function seeder(?string $group = null)
return new Seeder($config, static::connect($group));
}

/**
* Returns instance of Database Factory.
*/
public static function factory(): Database
{
static::ensureFactory();

return static::$factory;
}

/**
* Ensures the database Connection Manager/Factory is loaded and ready to use.
*/
Expand Down
3 changes: 2 additions & 1 deletion system/Database/MigrationRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,8 @@ protected function migrate($direction, $migration): bool
throw new RuntimeException($message);
}

$instance = new $class();
/** @var Migration $instance */
$instance = new $class(Database::factory()->loadForge($this->db));
$group = $instance->getDBGroup() ?? config(Database::class)->defaultGroup;

if (ENVIRONMENT !== 'testing' && $group === 'tests' && $this->groupFilter !== 'tests') {
Expand Down

0 comments on commit 9810c4d

Please sign in to comment.