diff --git a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs
index eddb8c5b2c..066e70483a 100644
--- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs
+++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs
@@ -34,7 +34,6 @@ namespace Umbraco.Cms.Core.DependencyInjection
builder.CacheRefreshers().Add(() => builder.TypeLoader.GetCacheRefreshers());
builder.DataEditors().Add(() => builder.TypeLoader.GetDataEditors());
builder.Actions().Add(() => builder.TypeLoader.GetActions());
- builder.PackageMigrationPlans().Add(() => builder.TypeLoader.GetPackageMigrationPlans());
// register known content apps
builder.ContentApps()
@@ -120,13 +119,6 @@ namespace Umbraco.Cms.Core.DependencyInjection
builder.BackOfficeAssets();
}
- ///
- /// Gets the package migration plans collection builder.
- ///
- /// The builder.
- public static PackageMigrationPlanCollectionBuilder PackageMigrationPlans(this IUmbracoBuilder builder)
- => builder.WithCollectionBuilder();
-
///
/// Gets the actions collection builder.
///
diff --git a/src/Umbraco.Core/Extensions/TypeLoaderExtensions.cs b/src/Umbraco.Core/Extensions/TypeLoaderExtensions.cs
index 6ac5432806..8928d221c5 100644
--- a/src/Umbraco.Core/Extensions/TypeLoaderExtensions.cs
+++ b/src/Umbraco.Core/Extensions/TypeLoaderExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Umbraco.
+// Copyright (c) Umbraco.
// See LICENSE for more details.
using System;
@@ -23,13 +23,6 @@ namespace Umbraco.Extensions
///
public static IEnumerable GetCacheRefreshers(this TypeLoader mgr) => mgr.GetTypes();
- ///
- /// Gets all types implementing
- ///
- ///
- ///
- public static IEnumerable GetPackageMigrationPlans(this TypeLoader mgr) => mgr.GetTypes();
-
///
/// Gets all types implementing
///
diff --git a/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Collections.cs b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Collections.cs
index 34a14d7deb..c63094821c 100644
--- a/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Collections.cs
+++ b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.Collections.cs
@@ -1,8 +1,9 @@
using Umbraco.Cms.Core.DependencyInjection;
+using Umbraco.Cms.Core.Packaging;
using Umbraco.Cms.Infrastructure.Persistence;
using Umbraco.Cms.Infrastructure.Persistence.Mappers;
-namespace Umbraco.Cms.Infrastructure.DependencyInjection
+namespace Umbraco.Extensions
{
///
/// Provides extension methods to the class.
@@ -18,5 +19,14 @@ namespace Umbraco.Cms.Infrastructure.DependencyInjection
public static NPocoMapperCollectionBuilder NPocoMappers(this IUmbracoBuilder builder)
=> builder.WithCollectionBuilder();
+
+
+ ///
+ /// Gets the package migration plans collection builder.
+ ///
+ /// The builder.
+ public static PackageMigrationPlanCollectionBuilder PackageMigrationPlans(this IUmbracoBuilder builder)
+ => builder.WithCollectionBuilder();
+
}
}
diff --git a/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs
index de7ad4bcae..5b7e4a336c 100644
--- a/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs
+++ b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs
@@ -70,6 +70,7 @@ namespace Umbraco.Cms.Infrastructure.DependencyInjection
builder.Services.AddUnique(factory => factory.GetRequiredService().CreateDatabase());
builder.Services.AddUnique(factory => factory.GetRequiredService().SqlContext);
builder.NPocoMappers().Add();
+ builder.PackageMigrationPlans().Add(() => builder.TypeLoader.GetPackageMigrationPlans());
builder.Services.AddUnique();
builder.Services.AddUnique();
diff --git a/src/Umbraco.Infrastructure/Extensions/InfrastuctureTypeLoaderExtensions.cs b/src/Umbraco.Infrastructure/Extensions/InfrastuctureTypeLoaderExtensions.cs
new file mode 100644
index 0000000000..b420f77253
--- /dev/null
+++ b/src/Umbraco.Infrastructure/Extensions/InfrastuctureTypeLoaderExtensions.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using Umbraco.Cms.Core.Composing;
+using Umbraco.Cms.Core.Packaging;
+
+namespace Umbraco.Extensions
+{
+ public static class InfrastuctureTypeLoaderExtensions
+ {
+ ///
+ /// Gets all types implementing
+ ///
+ ///
+ ///
+ public static IEnumerable GetPackageMigrationPlans(this TypeLoader mgr) => mgr.GetTypes();
+
+ }
+}
diff --git a/src/Umbraco.Core/Migrations/IMigrationPlanExecutor.cs b/src/Umbraco.Infrastructure/Migrations/IMigrationPlanExecutor.cs
similarity index 77%
rename from src/Umbraco.Core/Migrations/IMigrationPlanExecutor.cs
rename to src/Umbraco.Infrastructure/Migrations/IMigrationPlanExecutor.cs
index 0ba8bc1ecd..4610e02d60 100644
--- a/src/Umbraco.Core/Migrations/IMigrationPlanExecutor.cs
+++ b/src/Umbraco.Infrastructure/Migrations/IMigrationPlanExecutor.cs
@@ -1,3 +1,5 @@
+using Umbraco.Cms.Infrastructure.Migrations;
+
namespace Umbraco.Cms.Core.Migrations
{
public interface IMigrationPlanExecutor
diff --git a/src/Umbraco.Core/Migrations/MergeBuilder.cs b/src/Umbraco.Infrastructure/Migrations/MergeBuilder.cs
similarity index 97%
rename from src/Umbraco.Core/Migrations/MergeBuilder.cs
rename to src/Umbraco.Infrastructure/Migrations/MergeBuilder.cs
index 8aecd6e044..6f340fa008 100644
--- a/src/Umbraco.Core/Migrations/MergeBuilder.cs
+++ b/src/Umbraco.Infrastructure/Migrations/MergeBuilder.cs
@@ -1,7 +1,7 @@
-using System;
+using System;
using System.Collections.Generic;
-namespace Umbraco.Cms.Core.Migrations
+namespace Umbraco.Cms.Infrastructure.Migrations
{
///
/// Represents a migration plan builder for merges.
diff --git a/src/Umbraco.Infrastructure/Migrations/MigrationContext.cs b/src/Umbraco.Infrastructure/Migrations/MigrationContext.cs
index f70fcf991a..89235292d2 100644
--- a/src/Umbraco.Infrastructure/Migrations/MigrationContext.cs
+++ b/src/Umbraco.Infrastructure/Migrations/MigrationContext.cs
@@ -1,6 +1,7 @@
-using System;
+using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
+using Umbraco.Cms.Core.Migrations;
using Umbraco.Cms.Infrastructure.Persistence;
namespace Umbraco.Cms.Infrastructure.Migrations
diff --git a/src/Umbraco.Core/Migrations/MigrationPlan.cs b/src/Umbraco.Infrastructure/Migrations/MigrationPlan.cs
similarity index 99%
rename from src/Umbraco.Core/Migrations/MigrationPlan.cs
rename to src/Umbraco.Infrastructure/Migrations/MigrationPlan.cs
index 92ab90553a..9d0f110a74 100644
--- a/src/Umbraco.Core/Migrations/MigrationPlan.cs
+++ b/src/Umbraco.Infrastructure/Migrations/MigrationPlan.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
@@ -6,7 +6,7 @@ using Umbraco.Cms.Core.Scoping;
using Umbraco.Extensions;
using Type = System.Type;
-namespace Umbraco.Cms.Core.Migrations
+namespace Umbraco.Cms.Infrastructure.Migrations
{
///
@@ -114,7 +114,7 @@ namespace Umbraco.Cms.Core.Migrations
=> To(targetState, typeof(TMigration));
public MigrationPlan To(Guid targetState)
- where TMigration : IMigration
+ where TMigration : MigrationBase
=> To(targetState, typeof(TMigration));
///
diff --git a/src/Umbraco.Infrastructure/Migrations/MigrationPlanExecutor.cs b/src/Umbraco.Infrastructure/Migrations/MigrationPlanExecutor.cs
index e0c0ba51fd..51fc613c21 100644
--- a/src/Umbraco.Infrastructure/Migrations/MigrationPlanExecutor.cs
+++ b/src/Umbraco.Infrastructure/Migrations/MigrationPlanExecutor.cs
@@ -58,7 +58,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations
_logger.LogInformation("Execute {MigrationType}", transition.MigrationType.Name);
var migration = _migrationBuilder.Build(transition.MigrationType, context);
- migration.Migrate();
+ migration.Run();
var nextState = transition.TargetState;
origState = nextState;
@@ -84,7 +84,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations
{
_logger.LogInformation($"PostMigration: {postMigrationType.FullName}.");
var postMigration = _migrationBuilder.Build(postMigrationType, context);
- postMigration.Migrate();
+ postMigration.Run();
}
}
diff --git a/src/Umbraco.Infrastructure/Packaging/AutomaticPackageMigrationPlan.cs b/src/Umbraco.Infrastructure/Packaging/AutomaticPackageMigrationPlan.cs
index 25a6bd6e9a..304e650bb6 100644
--- a/src/Umbraco.Infrastructure/Packaging/AutomaticPackageMigrationPlan.cs
+++ b/src/Umbraco.Infrastructure/Packaging/AutomaticPackageMigrationPlan.cs
@@ -25,7 +25,7 @@ namespace Umbraco.Cms.Infrastructure.Packaging
protected sealed override void DefinePlan()
{
- // calculate the final state based on the hash value of the embedded resource
+ // calculate the final state based on the hash value of the embedded resource
var finalId = PackageDataManifest.ToString(SaveOptions.DisableFormatting).ToGuid();
To(finalId);
}
@@ -55,7 +55,7 @@ namespace Umbraco.Cms.Infrastructure.Packaging
{
}
- public override void Migrate()
+ protected override void Migrate()
{
var plan = (AutomaticPackageMigrationPlan)Context.Plan;
XDocument xml = plan.PackageDataManifest;
diff --git a/src/Umbraco.Core/Packaging/PackageMigrationPlan.cs b/src/Umbraco.Infrastructure/Packaging/PackageMigrationPlan.cs
similarity index 96%
rename from src/Umbraco.Core/Packaging/PackageMigrationPlan.cs
rename to src/Umbraco.Infrastructure/Packaging/PackageMigrationPlan.cs
index f4284c2944..d25c65cfb8 100644
--- a/src/Umbraco.Core/Packaging/PackageMigrationPlan.cs
+++ b/src/Umbraco.Infrastructure/Packaging/PackageMigrationPlan.cs
@@ -1,7 +1,6 @@
using System;
using Umbraco.Cms.Core.Composing;
-using Umbraco.Cms.Core.Migrations;
-using Umbraco.Extensions;
+using Umbraco.Cms.Infrastructure.Migrations;
namespace Umbraco.Cms.Core.Packaging
{
diff --git a/src/Umbraco.Core/Packaging/PackageMigrationPlanCollection.cs b/src/Umbraco.Infrastructure/Packaging/PackageMigrationPlanCollection.cs
similarity index 100%
rename from src/Umbraco.Core/Packaging/PackageMigrationPlanCollection.cs
rename to src/Umbraco.Infrastructure/Packaging/PackageMigrationPlanCollection.cs
diff --git a/src/Umbraco.Core/Packaging/PackageMigrationPlanCollectionBuilder.cs b/src/Umbraco.Infrastructure/Packaging/PackageMigrationPlanCollectionBuilder.cs
similarity index 100%
rename from src/Umbraco.Core/Packaging/PackageMigrationPlanCollectionBuilder.cs
rename to src/Umbraco.Infrastructure/Packaging/PackageMigrationPlanCollectionBuilder.cs
diff --git a/src/Umbraco.Core/Packaging/PendingPackageMigrations.cs b/src/Umbraco.Infrastructure/Packaging/PendingPackageMigrations.cs
similarity index 100%
rename from src/Umbraco.Core/Packaging/PendingPackageMigrations.cs
rename to src/Umbraco.Infrastructure/Packaging/PendingPackageMigrations.cs
diff --git a/src/Umbraco.Tests.Integration/Umbraco.Core/RuntimeStateTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Core/RuntimeStateTests.cs
index 60d36cb87b..0e3a3b43a1 100644
--- a/src/Umbraco.Tests.Integration/Umbraco.Core/RuntimeStateTests.cs
+++ b/src/Umbraco.Tests.Integration/Umbraco.Core/RuntimeStateTests.cs
@@ -12,6 +12,7 @@ using Umbraco.Cms.Infrastructure.Migrations;
using Umbraco.Cms.Infrastructure.Packaging;
using Umbraco.Cms.Tests.Common.Testing;
using Umbraco.Cms.Tests.Integration.Testing;
+using Umbraco.Extensions;
namespace Umbraco.Cms.Tests.Integration.Umbraco.Core
{
@@ -93,7 +94,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core
{
}
- public override void Migrate()
+ protected override void Migrate()
{
ImportPackage.FromEmbeddedResource().Do();
}
diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/PostMigrationTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/PostMigrationTests.cs
index 7ad2c4119a..2b6ff721eb 100644
--- a/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/PostMigrationTests.cs
+++ b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/PostMigrationTests.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Umbraco.
+// Copyright (c) Umbraco.
// See LICENSE for more details.
using System;
@@ -9,6 +9,7 @@ using Moq;
using NPoco;
using NUnit.Framework;
using Umbraco.Cms.Core.Configuration.Models;
+using Umbraco.Cms.Core.Migrations;
using Umbraco.Cms.Core.Scoping;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Infrastructure.Migrations;