diff --git a/src/Umbraco.Deploy.Contrib/Extensions/ArtifactMigratorCollectionBuilderExtensions.cs b/src/Umbraco.Deploy.Contrib/Extensions/ArtifactMigratorCollectionBuilderExtensions.cs
index c4f500b..e9d7f41 100644
--- a/src/Umbraco.Deploy.Contrib/Extensions/ArtifactMigratorCollectionBuilderExtensions.cs
+++ b/src/Umbraco.Deploy.Contrib/Extensions/ArtifactMigratorCollectionBuilderExtensions.cs
@@ -6,42 +6,45 @@ namespace Umbraco.Extensions;
public static class ArtifactMigratorCollectionBuilderExtensions
{
///
- /// Adds the legacy artifact migrators to allow importing from Umbraco 7.
+ /// Adds/inserts the legacy artifact migrators to allow importing from Umbraco 7.
///
/// The artifact migrator collection builder.
///
/// The artifact migrator collection builder.
///
+ ///
+ /// The legacy migrators are inserted at the beginning of the collection to ensure they run before any other migrators, including default Deploy migrators.
+ ///
public static ArtifactMigratorCollectionBuilder AddLegacyMigrators(this ArtifactMigratorCollectionBuilder artifactMigratorCollectionBuilder)
- => artifactMigratorCollectionBuilder
+ => artifactMigratorCollectionBuilder.Insert(
// Pre-values to configuration
- .Append()
+ typeof(PreValuesDataTypeArtifactJsonMigrator),
// Release/expire dates to schedule
- .Append()
+ typeof(DocumentArtifactJsonMigrator),
// Allowed at root and child content types to permissions
- .Append()
+ typeof(ContentTypeArtifactJsonMigrator),
// Data types
- .Append()
- .Append()
- .Append()
- .Append()
- .Append()
- .Append() // Ensure this is appended before other dropdown migrators to avoid duplicate migration
- .Append()
- .Append()
- .Append()
- .Append()
- .Append()
- .Append()
- .Append()
- .Append()
- .Append()
- .Append()
- .Append()
- .Append()
- .Append()
- .Append()
- .Append()
+ typeof(CheckBoxListDataTypeArtifactMigrator),
+ typeof(ColorPickerAliasDataTypeArtifactMigrator),
+ typeof(ContentPicker2DataTypeArtifactMigrator),
+ typeof(ContentPickerAliasDataTypeArtifactMigrator),
+ typeof(DateDataTypeArtifactMigrator),
+ typeof(DropDownFlexibleDataTypeArtifactMigrator), // Ensure this is appended before other dropdown migrators to avoid duplicate migration
+ typeof(DropDownDataTypeArtifactMigrator),
+ typeof(DropdownlistMultiplePublishKeysDataTypeArtifactMigrator),
+ typeof(DropdownlistPublishingKeysDataTypeArtifactMigrator),
+ typeof(DropDownMultipleDataTypeArtifactMigrator),
+ typeof(MediaPicker2DataTypeArtifactMigrator),
+ typeof(MemberPicker2DataTypeArtifactMigrator),
+ typeof(MultiNodeTreePicker2DataTypeArtifactMigrator),
+ typeof(MultipleMediaPickerDataTypeArtifactMigrator),
+ typeof(NoEditDataTypeArtifactMigrator),
+ typeof(RadioButtonListDataTypeArtifactMigrator),
+ typeof(RelatedLinks2DataTypeArtifactMigrator),
+ typeof(RelatedLinksDataTypeArtifactMigrator),
+ typeof(TextboxDataTypeArtifactMigrator),
+ typeof(TextboxMultipleDataTypeArtifactMigrator),
+ typeof(TinyMCEv3DataTypeArtifactMigrator),
// Add prefixes to pre-value property editor aliases, triggering property type migrators
- .Append();
+ typeof(PrevalueArtifactMigrator));
}
diff --git a/src/Umbraco.Deploy.Contrib/Extensions/ArtifactTypeResolverCollectionBuilderExtensions.cs b/src/Umbraco.Deploy.Contrib/Extensions/ArtifactTypeResolverCollectionBuilderExtensions.cs
index 9e598ab..d89295c 100644
--- a/src/Umbraco.Deploy.Contrib/Extensions/ArtifactTypeResolverCollectionBuilderExtensions.cs
+++ b/src/Umbraco.Deploy.Contrib/Extensions/ArtifactTypeResolverCollectionBuilderExtensions.cs
@@ -6,12 +6,15 @@ namespace Umbraco.Extensions;
public static class ArtifactTypeResolverCollectionBuilderExtensions
{
///
- /// Adds the legacy artifact type resolver to allow importing from Umbraco 7.
+ /// Adds/inserts the legacy artifact type resolver to allow importing from Umbraco 7.
///
/// The artifact type resolver collection builder.
///
/// The artifact type resolver collection builder.
///
+ ///
+ /// The legacy artifact type resolver is inserted at the beginning of the collection to ensure it runs before any other resolvers.
+ ///
public static ArtifactTypeResolverCollectionBuilder AddLegacyTypeResolver(this ArtifactTypeResolverCollectionBuilder artifactTypeResolverCollectionBuilder)
- => artifactTypeResolverCollectionBuilder.Append();
+ => artifactTypeResolverCollectionBuilder.Insert();
}
diff --git a/src/Umbraco.Deploy.Contrib/Extensions/OrderedCollectionBuilderExtensions.cs b/src/Umbraco.Deploy.Contrib/Extensions/OrderedCollectionBuilderExtensions.cs
new file mode 100644
index 0000000..efba3b6
--- /dev/null
+++ b/src/Umbraco.Deploy.Contrib/Extensions/OrderedCollectionBuilderExtensions.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using Umbraco.Cms.Core.Composing;
+using Umbraco.Deploy.Core.Migrators;
+
+namespace Umbraco.Extensions;
+
+internal static class OrderedCollectionBuilderExtensions
+{
+ public static ArtifactMigratorCollectionBuilder Insert(this ArtifactMigratorCollectionBuilder builder, params IEnumerable types)
+ => Insert(builder, 0, types);
+
+ public static ArtifactMigratorCollectionBuilder Insert(this ArtifactMigratorCollectionBuilder builder, int index, params IEnumerable types)
+ => Insert(builder, index, types);
+
+ public static PropertyTypeMigratorCollectionBuilder Insert(this PropertyTypeMigratorCollectionBuilder builder, params IEnumerable types)
+ => Insert(builder, 0, types);
+
+ public static PropertyTypeMigratorCollectionBuilder Insert(this PropertyTypeMigratorCollectionBuilder builder, int index, params IEnumerable types)
+ => Insert(builder, index, types);
+
+ private static TBuilder Insert(TBuilder builder, int index, params IEnumerable types)
+ where TBuilder : OrderedCollectionBuilderBase
+ where TCollection : class, IBuilderCollection
+ {
+ foreach (var type in types)
+ {
+ builder.Insert(index, type);
+
+ // Insert next type after the current one
+ index++;
+ }
+
+ return builder;
+ }
+}
diff --git a/src/Umbraco.Deploy.Contrib/Extensions/PropertyTypeMigratorCollectionBuilderExtensions.cs b/src/Umbraco.Deploy.Contrib/Extensions/PropertyTypeMigratorCollectionBuilderExtensions.cs
index ded077e..636d2a7 100644
--- a/src/Umbraco.Deploy.Contrib/Extensions/PropertyTypeMigratorCollectionBuilderExtensions.cs
+++ b/src/Umbraco.Deploy.Contrib/Extensions/PropertyTypeMigratorCollectionBuilderExtensions.cs
@@ -6,19 +6,22 @@ namespace Umbraco.Extensions;
public static class PropertyTypeMigratorCollectionBuilderExtensions
{
///
- /// Adds the legacy property type migrators to allow importing from Umbraco 7.
+ /// Adds/inserts the legacy property type migrators to allow importing from Umbraco 7.
///
///
/// The property type migrator collection builder.
///
+ ///
+ /// The legacy migrators are inserted at the beginning of the collection to ensure they run before any other migrators, including default Deploy migrators.
+ ///
public static PropertyTypeMigratorCollectionBuilder AddLegacyMigrators(this PropertyTypeMigratorCollectionBuilder propertyTypeMigratorCollectionBuilder)
- => propertyTypeMigratorCollectionBuilder
+ => propertyTypeMigratorCollectionBuilder.Insert(
// Pre-values to a single value or JSON array
- .Append()
- .Append()
- .Append()
- .Append()
- .Append()
- .Append()
- .Append();
+ typeof(CheckBoxListPropertyTypeMigrator),
+ typeof(DropDownPropertyTypeMigrator),
+ typeof(DropDownListFlexiblePropertyTypeMigrator),
+ typeof(DropdownlistMultiplePublishKeysPropertyTypeMigrator),
+ typeof(DropdownlistPublishingKeysPropertyTypeMigrator),
+ typeof(DropDownMultiplePropertyTypeMigrator),
+ typeof(RadioButtonListPropertyTypeMigrator));
}