Skip to content

Conversation

@gnkz
Copy link

@gnkz gnkz commented Oct 18, 2015

The problem

The php artisan doctrine:migrations:rollback doesn't work. When executed without arguments it throws InvalidArgumentException: The "version" argument does not exist.. When executed with an argument it throws [RuntimeException]: Too many arguments.

The fix

Updated the $signature property of LaravelDoctrine\Migrations\Console\RollbackCommand from:

protected $signature = 'doctrine:migrations:rollback [version=]
    {--connection= : For a specific connection.}';

To:

protected $signature = 'doctrine:migrations:rollback
    {--migration-version= : For a specific migration version.}
    {--connection= : For a specific connection.}';

Also updated the line 36 from:

$version = $this->argument('version') ?: $configuration->getCurrentVersion();

to:

$version = $this->option('migration-version') ?: $configuration->getCurrentVersion();

With these changes the command accepts no argument and the rollback is executed to the latest version. When the --migration-version option is passed, the rollback is executed to that specific migration version.

@patrickbrouwers
Copy link
Contributor

Thanks for sending in the PR. However I have fixed the problem instead of replacing the solution. No idea why this worked in the past to be honest. Should work again now as stated in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants