Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.15.3] Cannot migrate to a specific target with -t #2240

Closed
wallacio opened this issue Nov 13, 2023 · 2 comments · Fixed by #2241
Closed

[0.15.3] Cannot migrate to a specific target with -t #2240

wallacio opened this issue Nov 13, 2023 · 2 comments · Fixed by #2241
Labels

Comments

@wallacio
Copy link
Contributor

Attempting to migrate to a specific target with the -t option, e.g.

php vendor/bin/phinx migrate --target=20210905085019

...throws a TypeError exception:

TypeError: Phinx\Migration\Manager::migrate(): Argument #2 ($version) must be of type ?int, string given, called in /home/vagrant/code/ourclubadmin/vendor/robmorgan/phinx/src/Phinx/Console/Command/Migrate.php on line 124 and defined in /home/vagrant/code/ourclubadmin/vendor/robmorgan/phinx/src/Phinx/Migration/Manager.php:312
Stack trace:
#0 /home/vagrant/code/ourclubadmin/vendor/robmorgan/phinx/src/Phinx/Console/Command/Migrate.php(124): Phinx\Migration\Manager->migrate()
#1 /home/vagrant/code/ourclubadmin/vendor/symfony/console/Command/Command.php(326): Phinx\Console\Command\Migrate->execute()
#2 /home/vagrant/code/ourclubadmin/vendor/symfony/console/Application.php(1063): Symfony\Component\Console\Command\Command->run()
#3 /home/vagrant/code/ourclubadmin/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand()
#4 /home/vagrant/code/ourclubadmin/vendor/robmorgan/phinx/src/Phinx/Console/PhinxApplication.php(69): Symfony\Component\Console\Application->doRun()
#5 /home/vagrant/code/ourclubadmin/vendor/symfony/console/Application.php(174): Phinx\Console\PhinxApplication->doRun()
#6 /home/vagrant/code/ourclubadmin/vendor/robmorgan/phinx/bin/phinx(28): Symfony\Component\Console\Application->run()
#7 /home/vagrant/code/ourclubadmin/vendor/bin/phinx(120): include('...')
#8 {main}

Probably caused by Symfony's getOption returning a string for $version:

$version = $input->getOption('target');

...which is used in a method call to migrate() that's expecting an int.

$this->getManager()->migrate($environment, $version, $fake);

@dereuromark
Copy link
Member

Is that a duplicate of #2231 ?

@dereuromark
Copy link
Member

Sounds like a cast to string is missing? Maybe someone could make a quick PR here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants