Im using the package "robmorgan/phinx": "^0.15"
I've run into an issue with Phinx migration: when I run the command phinx migrate
with the config file, an error occurs.
Command:
vendor\bin\phinx migrate -c "Device/conf.php"
Error message:
TypeError: Phinx\Db\Adapter\PdoAdapter::createPdoConnection(): Argument #2 ($username) must be of type ?string, bool given, called in C:\Applications\wamp\www\migration\src\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\MysqlAdapter.php on line 158 and defined in C:\Applications\wamp\www\migration\src\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\PdoAdapter.php:85
Stack trace:
#0 C:\Applications\wamp\www\migration\src\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\MysqlAdapter.php(158): Phinx\Db\Adapter\PdoAdapter->createPdoConnection('mysql:host=;dbn...', false, false, Array)
#1 C:\Applications\wamp\www\migration\src\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\PdoAdapter.php(169): Phinx\Db\Adapter\MysqlAdapter->connect()
#2 C:\Applications\wamp\www\migration\src\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\PdoAdapter.php(256): Phinx\Db\Adapter\PdoAdapter->getConnection()
#3 C:\Applications\wamp\www\migration\src\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\PdoAdapter.php(277): Phinx\Db\Adapter\PdoAdapter->query('SELECT * FROM `...')
#4 C:\Applications\wamp\www\migration\src\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\PdoAdapter.php(413): Phinx\Db\Adapter\PdoAdapter->fetchAll('SELECT * FROM `...')
#5 C:\Applications\wamp\www\migration\src\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\PdoAdapter.php(385): Phinx\Db\Adapter\PdoAdapter->getVersionLog()
#6 C:\Applications\wamp\www\migration\src\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\AdapterWrapper.php(206): Phinx\Db\Adapter\PdoAdapter->getVersions()
#7 C:\Applications\wamp\www\migration\src\vendor\robmorgan\phinx\src\Phinx\Migration\Manager\Environment.php(254): Phinx\Db\Adapter\AdapterWrapper->getVersions()
#8 C:\Applications\wamp\www\migration\src\vendor\robmorgan\phinx\src\Phinx\Migration\Manager.php(316): Phinx\Migration\Manager\Environment->getVersions()
#9 C:\Applications\wamp\www\migration\src\vendor\robmorgan\phinx\src\Phinx\Console\Command\Migrate.php(124): Phinx\Migration\Manager->migrate('dev', NULL, false)
#10 C:\Applications\wamp\www\migration\src\vendor\symfony\console\Command\Command.php(326): Phinx\Console\Command\Migrate->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 C:\Applications\wamp\www\migration\src\vendor\symfony\console\Application.php(1063): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 C:\Applications\wamp\www\migration\src\vendor\symfony\console\Application.php(320): Symfony\Component\Console\Application->doRunCommand(Object(Phinx\Console\Command\Migrate), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 C:\Applications\wamp\www\migration\src\vendor\robmorgan\phinx\src\Phinx\Console\PhinxApplication.php(69): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 C:\Applications\wamp\www\migration\src\vendor\symfony\console\Application.php(174): Phinx\Console\PhinxApplication->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #15 C:\Applications\wamp\www\migration\src\vendor\robmorgan\phinx\bin\phinx(28): Symfony\Component\Console\Application->run()
#16 C:\Applications\wamp\www\migration\src\vendor\bin\phinx(120): include('C:\\Applications...')
#17 {main}
My conf file content :
$conf = [
"paths" => [
"migrations" => __DIR__,
],
"environments" => [
"default_migration_table" => "phinxlog",
"default_environment" => "dev",
"dev" => [
"adapter" => "mysql",
"host" => getenv('DB_HOST', '127.0.0.1'),
"name" => getenv("DB_DATABASE_CATALOG_DEVICE"),
"user" => getenv('DB_USERNAME', 'forge'),
"pass" => getenv('DB_PASSWORD', ''),
"charset" => "utf8",
"collation" => "utf8_general_ci",
],
],
];