Skip to content

Incorrect sorting in MigrationManager.cs #237

@VasilievSerg

Description

@VasilievSerg

Hello,
Looks like the GetCurrentMigrations method performs invalid ordering.

public IEnumerable<IMigration> GetCurrentMigrations()
{
  var currentDbVersion = new DbVersion(int.Parse(GrandVersion.MajorVersion), int.Parse(GrandVersion.MinorVersion));

  return GetAllMigrations()
                .Where(x => currentDbVersion.CompareTo(x.Version) >= 0)
                .OrderBy(mg => mg.Version.ToString())
                .OrderBy(mg => mg.Priority)                  // <=
                .ToList();
}

Most likely, there should be the ThenBy invocation instead of OrderBy.
Here is the link.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions