Merge remote-tracking branch 'origin/v12/dev' into v13/dev

# Conflicts:
#	src/Umbraco.Infrastructure/Install/PackageMigrationRunner.cs
#	src/Umbraco.Infrastructure/Migrations/IMigrationContext.cs
#	src/Umbraco.Infrastructure/Migrations/IMigrationPlanExecutor.cs
#	src/Umbraco.Infrastructure/Migrations/Install/DatabaseBuilder.cs
#	src/Umbraco.Infrastructure/Migrations/MigrationContext.cs
#	src/Umbraco.Infrastructure/Migrations/MigrationPlan.cs
#	src/Umbraco.Infrastructure/Migrations/MigrationPlanExecutor.cs
#	src/Umbraco.Infrastructure/Migrations/PostMigrations/ClearCsrfCookies.cs
#	src/Umbraco.Infrastructure/Migrations/PostMigrations/DeleteLogViewerQueryFile.cs
#	src/Umbraco.Infrastructure/Migrations/PostMigrations/RebuildPublishedSnapshot.cs
#	src/Umbraco.Infrastructure/Migrations/Upgrade/Upgrader.cs
#	src/Umbraco.Web.BackOffice/Controllers/MacroRenderingController.cs
#	tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/MigrationPlanTests.cs
#	tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/PostMigrationTests.cs
This commit is contained in:
Bjarke Berg
2023-01-19 10:43:07 +01:00
66 changed files with 4098 additions and 1901 deletions

View File

@@ -1013,6 +1013,21 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement
return SimilarNodeName.GetUniqueName(names, id, nodeName);
}
protected virtual bool SortorderExists(int parentId, int sortOrder)
{
SqlTemplate? template = SqlContext.Templates.Get(Constants.SqlTemplates.VersionableRepository.SortOrderExists, tsql => tsql
.Select("sortOrder")
.From<NodeDto>()
.Where<NodeDto>(x => x.NodeObjectType == SqlTemplate.Arg<Guid>("nodeObjectType") &&
x.ParentId == SqlTemplate.Arg<int>("parentId") &&
x.SortOrder == SqlTemplate.Arg<int>("sortOrder")));
Sql<ISqlContext> sql = template.Sql(NodeObjectTypeId, parentId, sortOrder);
var result = Database.ExecuteScalar<int?>(sql);
return result != null;
}
protected virtual int GetNewChildSortOrder(int parentId, int first)
{
SqlTemplate? template = SqlContext.Templates.Get(Constants.SqlTemplates.VersionableRepository.GetSortOrder, tsql => tsql