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

Passing "prev" or "next" to migrate command not working #557

Closed
trickeyone opened this issue Oct 17, 2017 · 3 comments
Closed

Passing "prev" or "next" to migrate command not working #557

trickeyone opened this issue Oct 17, 2017 · 3 comments
Milestone

Comments

@trickeyone
Copy link

When executing migrations:migrate and passing a version parameter of "next" isn't working as expected. If there are migrations that have been executed out of chronological order, the "next" available version is not executed and the "Already at latest version." message is displayed.

i.e.
Migration Versions:
Version1
Version2
Version3
Version4
Version5

  • Previous feature releases have Version1 and Version2.
  • Subsequent release has Version4 and Version5.
  • The release with Version3 isn't released until after Version5.
    When executing migrations:migrate next, Version3 will not be executed and the "Already at latest version." message will be displayed.
    However, executing migrations:migrate will execute the Version3 migration.

This is a disconnect in functionality. Executing with the "next" parameter should execute whichever version is next available, not just after the last-executed version's number. Having migrations out of chronological order was supported in previous versions and it doesn't make sense to disallow executing the migrations singularly with the "next" parameter.

@mikeSimonson
Copy link
Contributor

Well this is maybe more an issue of documentation.

Running migrate next is supposed to only run one migration, the next in order (that's why there is prev too). And in your case there isn't any. Does it work if you run latest ?
Using migration will make sure that all the available migrations have been run. Up to the end if you don't specify a target or up to target that you specified.

@jwage
Copy link
Member

jwage commented May 12, 2018

Currently as it is coded today, the next behavior just grabs the next migration, even if it is one that has been migrated. It seems like this functionality should get the next unexecuted migration?

@jwage jwage added this to the 2.0 milestone May 31, 2018
@jwage jwage modified the milestones: 2.0, 3.0 Jun 6, 2018
@goetas
Copy link
Member

goetas commented Dec 1, 2019

v3.x addresses this.

next is the next not executed migration, and prev is the last executed migration.
Refs at

$newMigrations = $this->migrationPlanCalculator->getNewMigrations();
and
return $executedMigrations->getLast(-1)->getVersion();

@goetas goetas closed this as completed Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants