From 1a205d8727e38573d1cdd1f41e2aa94fbede09cc Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Tue, 4 Mar 2025 17:27:33 +0100 Subject: [PATCH] Handle multiline statements in migrations (#18478) * Handle multiline statements in migrations * Fixed failing unit tests and incorrect obsoletion. * Fixed failing integration tests. * Applied suggestion from code review. --------- Co-authored-by: Sven Geusens --- .../Migrations/MigrationExpressionBase.cs | 5 +++++ .../Migrations/MigrationPlanExecutor.cs | 1 - .../SyntaxProvider/SqlServerSyntaxProviderTests.cs | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Infrastructure/Migrations/MigrationExpressionBase.cs b/src/Umbraco.Infrastructure/Migrations/MigrationExpressionBase.cs index a2029cbef8..117eb8fe7b 100644 --- a/src/Umbraco.Infrastructure/Migrations/MigrationExpressionBase.cs +++ b/src/Umbraco.Infrastructure/Migrations/MigrationExpressionBase.cs @@ -70,6 +70,11 @@ public abstract class MigrationExpressionBase : IMigrationExpression } else { + if (stmtBuilder.Length > 0) + { + stmtBuilder.Append(Environment.NewLine); + } + stmtBuilder.Append(line); } } diff --git a/src/Umbraco.Infrastructure/Migrations/MigrationPlanExecutor.cs b/src/Umbraco.Infrastructure/Migrations/MigrationPlanExecutor.cs index 77677b0bfc..441ff674f2 100644 --- a/src/Umbraco.Infrastructure/Migrations/MigrationPlanExecutor.cs +++ b/src/Umbraco.Infrastructure/Migrations/MigrationPlanExecutor.cs @@ -92,7 +92,6 @@ public class MigrationPlanExecutor : IMigrationPlanExecutor /// Each migration in the plan, may or may not run in a scope depending on the type of plan. /// A plan can complete partially, the changes of each completed migration will be saved. /// - [Obsolete("This will return an ExecutedMigrationPlan in V13")] public ExecutedMigrationPlan ExecutePlan(MigrationPlan plan, string fromState) { plan.Validate(); diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/SyntaxProvider/SqlServerSyntaxProviderTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/SyntaxProvider/SqlServerSyntaxProviderTests.cs index 7e1d1f163f..3d419ff955 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/SyntaxProvider/SqlServerSyntaxProviderTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/SyntaxProvider/SqlServerSyntaxProviderTests.cs @@ -18,7 +18,6 @@ using Umbraco.Cms.Persistence.SqlServer.Services; using Umbraco.Cms.Tests.Common.TestHelpers; using Umbraco.Cms.Tests.Common.Testing; using Umbraco.Cms.Tests.Integration.Testing; -using Umbraco.Extensions; namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.SyntaxProvider;