Fix document URL migration (split it in two)

This commit is contained in:
kjac
2024-10-01 14:38:51 +02:00
parent 31347dca74
commit 1cf7d7ad2b
4 changed files with 21 additions and 11 deletions

View File

@@ -170,7 +170,7 @@ public class DocumentUrlService : IDocumentUrlService
using ICoreScope scope = _coreScopeProvider.CreateCoreScope();
scope.ReadLock(Constants.Locks.ContentTree);
IEnumerable<IContent> documents = _documentRepository.GetMany(Array.Empty<Guid>());
IEnumerable<IContent> documents = _documentRepository.GetMany(Array.Empty<int>());
await CreateOrUpdateUrlSegmentsAsync(documents);

View File

@@ -99,6 +99,7 @@ public class UmbracoPlan : MigrationPlan
// To 15.0.0
To<V_15_0_0.AddUserClientId>("{7F4F31D8-DD71-4F0D-93FC-2690A924D84B}");
To<NoopMigration>("{1A8835EF-F8AB-4472-B4D8-D75B7C164022}");
To<V_15_0_0.RebuildDocumentUrls>("{3FE0FA2D-CF4F-4892-BA8D-E97D06E028DC}");
To<V_15_0_0.ConvertBlockListEditorProperties>("{6C04B137-0097-4938-8C6A-276DF1A0ECA8}");
To<V_15_0_0.ConvertBlockGridEditorProperties>("{9D3CE7D4-4884-41D4-98E8-302EB6CB0CF6}");
To<V_15_0_0.ConvertRichTextEditorProperties>("{37875E80-5CDD-42FF-A21A-7D4E3E23E0ED}");

View File

@@ -1,22 +1,15 @@
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Infrastructure.Persistence.Dtos;
using Umbraco.Cms.Infrastructure.Persistence.Dtos;
namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_15_0_0;
[Obsolete("Remove in Umbraco 18.")]
public class AddDocumentUrl : MigrationBase
{
private readonly IDocumentUrlService _documentUrlService;
public AddDocumentUrl(IMigrationContext context, IDocumentUrlService documentUrlService)
public AddDocumentUrl(IMigrationContext context)
: base(context)
{
_documentUrlService = documentUrlService;
}
protected override void Migrate()
{
Create.Table<DocumentUrlDto>().Do();
_documentUrlService.InitAsync(false, CancellationToken.None);
}
=> Create.Table<DocumentUrlDto>().Do();
}

View File

@@ -0,0 +1,16 @@
using Umbraco.Cms.Core.Services;
namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_15_0_0;
[Obsolete("Remove in Umbraco 18.")]
public class RebuildDocumentUrls : MigrationBase
{
private readonly IDocumentUrlService _documentUrlService;
public RebuildDocumentUrls(IMigrationContext context, IDocumentUrlService documentUrlService)
: base(context) =>
_documentUrlService = documentUrlService;
protected override void Migrate()
=> _documentUrlService.InitAsync(false, CancellationToken.None).GetAwaiter().GetResult();
}