You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which operating systems have you tested for this bug?
Linux
Which server did you use?
apache
Database
Mysql
What happened?
When running a new MigrationRunner($config, $db); we are allowed to pass in a $db as the second param. However this $db is never passed to the actual migration files which means that it will fall back to the default one when running latest/up/regress etc. Furthermore, it can't be assumed that $db is a group because it could be a custom config.
Steps to Reproduce
Create a $group and pass it to $forge = \Config\Database::forge($group);
Run a migration file and outtput $this->forge and you'll see it reverts to the default
Expected Output
The migration files should be using the same $db group / config as the Migration runner.
The solution is to:
Amend MigrationRunner $instance = new $class(Database::forge($this->db));
Within your Migration files add a construct which calls the parent.
public function __construct($forge = null){
if ($forge) parent::__construct($forge);
}
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Ukuser36
added
the
bug
Verified issues on the current code behavior or pull requests that will fix them
label
Oct 18, 2023
PHP Version
8.0
CodeIgniter4 Version
4.3.4
CodeIgniter4 Installation Method
Manual (zip or tar.gz)
Which operating systems have you tested for this bug?
Linux
Which server did you use?
apache
Database
Mysql
What happened?
When running a
new MigrationRunner($config, $db);
we are allowed to pass in a $db as the second param. However this $db is never passed to the actual migration files which means that it will fall back to the default one when running latest/up/regress etc. Furthermore, it can't be assumed that $db is a group because it could be a custom config.Steps to Reproduce
$group
and pass it to$forge = \Config\Database::forge($group);
$this->forge
and you'll see it reverts to the defaultExpected Output
The migration files should be using the same $db group / config as the Migration runner.
The solution is to:
$instance = new $class(Database::forge($this->db));
Anything else?
No response
The text was updated successfully, but these errors were encountered: