Content-Length: 270878 | pFad | http://github.com/umbraco/Umbraco-CMS/pull/19509

21 Fix check for pending package migration to use the package not the plan name by AndyButland · Pull Request #19509 · umbraco/Umbraco-CMS · GitHub
Skip to content

Fix check for pending package migration to use the package not the plan name #19509

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AndyButland
Copy link
Contributor

Prerequisites

  • I have added steps to test this contribution in the description below

Resolves #19503

Description

When running attending package migrations from the backoffice, there's a check for the requested package to ensure we have a plan for it. However, as the linked issue describes, we are comparing the package with the plan name, and they can be different. This fixes by comparing to the package name.

Testing

  • Configure Umbraco:Cms:Unattended:PackageMigrationsUnattended to be false.
  • Create an example migration plan for a package with a different plan and package name
  • Run the pending package migrations from the Packages > Installed dashboard.
  • Before this PR you should see an error that no package migrations were found, after this PR you should find it succeeds and see the expected state value in the umbracoKeyValue table.

Example package migration and plan:

using Umbraco.Cms.Core.Packaging;

public class MigrationPlan() : PackageMigrationPlan("Example migration", "Example migration plan")
{
    protected override void DefinePlan()
    {
        To<MigrationExample>(MigrationExample.MigrationIdentifier);
    }
}
using Umbraco.Cms.Infrastructure.Migrations;

public class MigrationExample(IMigrationContext context, ILogger<MigrationExample> logger) : MigrationBase(context)
{
    public static Guid MigrationIdentifier = new("ed57c617-20c2-4e2a-9433-4f7bdcbf39b6");

    protected override void Migrate()
    {
        logger.LogInformation("Running migration step 1");
    }
}

@Copilot Copilot AI review requested due to automatic review settings June 9, 2025 05:26
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the package migration check by comparing the package name instead of the migration plan name.

  • Updated the code to check package names in _packageMigrationPlans.Values.
  • Improved the inline comment to clarify the intended behavior.
Comments suppressed due to low confidence (1)

src/Umbraco.Infrastructure/Install/PackageMigrationRunner.cs:82

  • [nitpick] Consider renaming the lambda parameter 'x' to 'plan' for enhanced clarity.
.Any(x => x.PackageName.InvariantEquals(packageName)) is false

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.

Package migration won't run
1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/umbraco/Umbraco-CMS/pull/19509

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy