using System; using Umbraco.Cms.Core.Composing; using Umbraco.Cms.Core.Migrations; using Umbraco.Extensions; namespace Umbraco.Cms.Core.Packaging { /// /// Base class for package migration plans /// public abstract class PackageMigrationPlan : MigrationPlan, IDiscoverable { /// /// Creates a package migration plan /// /// The name of the package. If the package has a package.manifest these must match. protected PackageMigrationPlan(string packageName) : this(packageName, packageName) { } /// /// Create a plan for a Package Name /// /// The package name that the plan is for. If the package has a package.manifest these must match. /// /// The plan name for the package. This should be the same name as the /// package name if there is only one plan in the package. /// protected PackageMigrationPlan(string packageName, string planName) : base(planName) { // A call to From must be done first From(string.Empty); DefinePlan(); PackageName = packageName; } /// /// Inform the plan executor to ignore all saved package state and /// run the migration from initial state to it's end state. /// public override bool IgnoreCurrentState => true; /// /// Returns the Package Name for this plan /// public string PackageName { get; } protected abstract void DefinePlan(); } }