Skip to content

Commit 26283a4

Browse files
committed
Move migration plan to an unique object.
1 parent 7d2f19f commit 26283a4

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

src/Umbraco.Cms.Integrations.Automation.Zapier/Migrations/UmbracoAppStartingHandler.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,7 @@ public void Handle(UmbracoApplicationStartingNotification notification)
3939
{
4040
if (_runtimeState.Level < RuntimeLevel.Run) return;
4141

42-
var migrationPlan = new MigrationPlan(Constants.MigrationPlanName);
43-
44-
migrationPlan.From(string.Empty)
45-
.To<ZapContentConfigTable>(Constants.TargetStateName);
46-
47-
var upgrader = new Upgrader(migrationPlan);
42+
var upgrader = new Upgrader(new ZapierMigrationPlan());
4843
upgrader.Execute(_migrationPlanExecutor, _scopeProvider, _keyValueService);
4944
}
5045
}

src/Umbraco.Cms.Integrations.Automation.Zapier/Migrations/ZapContentConfigComponent.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,7 @@ public ZapContentConfigComponent(IScopeProvider scopeProvider, IMigrationBuilder
3939

4040
public void Initialize()
4141
{
42-
var migrationPlan = new MigrationPlan(Constants.MigrationPlanName);
43-
44-
migrationPlan.From(string.Empty)
45-
.To<ZapContentConfigTable>(Constants.TargetStateName);
46-
47-
var upgrader = new Upgrader(migrationPlan);
42+
var upgrader = new Upgrader(new ZapierMigrationPlan());
4843
upgrader.Execute(_scopeProvider, _migrationBuilder, _keyValueService, _logger);
4944
}
5045

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#if NETCOREAPP
2+
using Umbraco.Cms.Infrastructure.Migrations;
3+
#else
4+
using Umbraco.Core.Migrations;
5+
#endif
6+
7+
namespace Umbraco.Cms.Integrations.Automation.Zapier.Migrations
8+
{
9+
public class ZapierMigrationPlan : MigrationPlan
10+
{
11+
public ZapierMigrationPlan() : base(Constants.MigrationPlanName)
12+
{
13+
From(string.Empty)
14+
.To<ZapContentConfigTable>(Constants.TargetStateName);
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)