Skip to content

Allow --page --bypass-dependency-check to use previously migrated media when migrating content #532

@bluemodus-dbromeland

Description

@bluemodus-dbromeland

Brief bug description

When you run a page migration without including --media-libraries, like this: "migrate --pages --bypass-dependency-check", the media does not migrate to a page field. Even if the media was already migrated in a previous run

Output logs

(Migration.Tool.Extensions.DefaultMigrations.AssetMigration) [ERR] Trying to migrate asset field value "XxxxxxxxImage", but command media-libraries was not invoked (787d3d89)

Expected behavior

I would expect that the logs a warning or info noting the dependency requirement, however, given the user has selected to '--bypass-dependency-check' it really shouldn't be an error and not migrate media. This will save hours of time, expecially when migrated large media libraries > 6GB.

Suggested code updated on AssetMigration.cs

if (!invokedCommands.Commands.Any(x => x is MigrateMediaLibrariesCommand))
{
//Log warning instead of an error
logger.LogWarning($"Trying to migrate asset field value {{FieldName}}, but command {MigrateMediaLibrariesCommand.Moniker} was not invoked", fieldName);
//Don't return here and migrate media that is assumed to be migrated in a previous run.
//return new(false, null);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions