Skip to content

Commit 6a078a4

Browse files
committed
Fix setting of group
1 parent d82fb2e commit 6a078a4

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

system/Database/MigrationRunner.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,7 @@ public function __construct(MigrationsConfig $config, $db = null)
141141
// Default name space is the app namespace
142142
$this->namespace = APP_NAMESPACE;
143143

144-
// get default database group
145-
$config = config(Database::class);
146-
$this->group = $config->defaultGroup;
147-
unset($config);
144+
$this->group = is_string($db) ? $db : config(Database::class)->defaultGroup;
148145

149146
// If no db connection passed in, use
150147
// default database group.
@@ -841,7 +838,7 @@ protected function migrate($direction, $migration): bool
841838

842839
/** @var Migration $instance */
843840
$instance = new $class(Database::forge($this->db));
844-
$group = $instance->getDBGroup() ?? config(Database::class)->defaultGroup;
841+
$group = $instance->getDBGroup() ?? $this->group;
845842

846843
if (ENVIRONMENT !== 'testing' && $group === 'tests' && $this->groupFilter !== 'tests') {
847844
// @codeCoverageIgnoreStart
@@ -857,8 +854,6 @@ protected function migrate($direction, $migration): bool
857854
return true;
858855
}
859856

860-
$this->setGroup($group);
861-
862857
if (! is_callable([$instance, $direction])) {
863858
$message = sprintf(lang('Migrations.missingMethod'), $direction);
864859

0 commit comments

Comments
 (0)