Merge pull request #11167 from Jeavon/task/migrateIsMaster

Add migration for isMaster column to isSchedulingPublisher in UmbracoServer table
This commit is contained in:
Bjarke Berg
2021-09-22 20:34:55 +02:00
committed by GitHub
5 changed files with 26 additions and 3 deletions

View File

@@ -246,6 +246,9 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade
.To<DictionaryTablesIndexes>("{12DCDE7F-9AB7-4617-804F-AB66BF360980}")
.As("{5AAE6276-80DB-4ACF-B845-199BC6C37538}");
// TO 9.0.0-rc4
To<UmbracoServerColumn>("5E02F241-5253-403D-B5D3-7DB00157E20F");
// TO 9.0.0
}

View File

@@ -0,0 +1,20 @@
using Umbraco.Cms.Infrastructure.Persistence.Dtos;
namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_9_0_0
{
public class UmbracoServerColumn : MigrationBase
{
public UmbracoServerColumn(IMigrationContext context)
: base(context)
{
}
/// <summary>
/// Adds new columns to members table
/// </summary>
protected override void Migrate()
{
ReplaceColumn<ServerRegistrationDto>(Cms.Core.Constants.DatabaseSchema.Tables.Server, "isMaster", "isSchedulingPublisher");
}
}
}

View File

@@ -34,7 +34,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos
[Index(IndexTypes.NonClustered)]
public bool IsActive { get; set; }
[Column("isMaster")]
[Column("isSchedulingPublisher")]
public bool IsSchedulingPublisher { get; set; }
}
}

View File

@@ -121,7 +121,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement
{
var timeoutDate = DateTime.Now.Subtract(staleTimeout);
Database.Update<ServerRegistrationDto>("SET isActive=0, isMaster=0 WHERE lastNotifiedDate < @timeoutDate", new { /*timeoutDate =*/ timeoutDate });
Database.Update<ServerRegistrationDto>("SET isActive=0, isSchedulingPublisher=0 WHERE lastNotifiedDate < @timeoutDate", new { /*timeoutDate =*/ timeoutDate });
ClearCache();
}
}

View File

@@ -175,7 +175,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.NPoco
// Assert
Assert.That(
commands[0].CommandText,
Is.EqualTo("INSERT INTO [umbracoServer] ([umbracoServer].[address], [umbracoServer].[computerName], [umbracoServer].[registeredDate], [umbracoServer].[lastNotifiedDate], [umbracoServer].[isActive], [umbracoServer].[isMaster]) VALUES (@0,@1,@2,@3,@4,@5), (@6,@7,@8,@9,@10,@11)"));
Is.EqualTo("INSERT INTO [umbracoServer] ([umbracoServer].[address], [umbracoServer].[computerName], [umbracoServer].[registeredDate], [umbracoServer].[lastNotifiedDate], [umbracoServer].[isActive], [umbracoServer].[isSchedulingPublisher]) VALUES (@0,@1,@2,@3,@4,@5), (@6,@7,@8,@9,@10,@11)"));
}
[Test]