From 58814d4ac2ba96e1efaabf25a2a826214e734558 Mon Sep 17 00:00:00 2001 From: Shannon Date: Sat, 15 Mar 2014 20:11:42 +1100 Subject: [PATCH 1/9] updates the migration order --- .../TargetVersionSixTwoZero/AddChangeDocumentTypePermission.cs | 2 +- .../TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs | 2 +- .../TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys.cs | 2 +- .../TargetVersionSixTwoZero/UpdateToNewMemberPropertyAliases.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AddChangeDocumentTypePermission.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AddChangeDocumentTypePermission.cs index 1bd6b45307..a022c4894c 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AddChangeDocumentTypePermission.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AddChangeDocumentTypePermission.cs @@ -4,7 +4,7 @@ using Umbraco.Core.Models.Rdbms; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero { - [Migration("6.2.0", 1, GlobalSettings.UmbracoMigrationName)] + [Migration("6.2.0", 3, GlobalSettings.UmbracoMigrationName)] public class AddChangeDocumentTypePermission : MigrationBase { public override void Up() diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs index 679fe526b0..fcd35a163a 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs @@ -7,7 +7,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero { - [Migration("6.2.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("6.2.0", 1, GlobalSettings.UmbracoMigrationName)] public class AdditionalIndexesAndKeys : SchemaMigration { public override void Up() diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys.cs index 27c0dc91ba..2d1c5fc52c 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero { //see: http://issues.umbraco.org/issue/U4-4430 - [Migration("6.2.0", 3, GlobalSettings.UmbracoMigrationName)] + [Migration("6.2.0", 0, GlobalSettings.UmbracoMigrationName)] public class AssignMissingPrimaryForMySqlKeys : SchemaMigration { public override void Up() diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/UpdateToNewMemberPropertyAliases.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/UpdateToNewMemberPropertyAliases.cs index 66be6bbe30..f64c4e380c 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/UpdateToNewMemberPropertyAliases.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/UpdateToNewMemberPropertyAliases.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Models.Rdbms; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero { - [Migration("6.2.0", 2, GlobalSettings.UmbracoMigrationName)] + [Migration("6.2.0", 4, GlobalSettings.UmbracoMigrationName)] public class UpdateToNewMemberPropertyAliases : MigrationBase { public override void Up() From d7ea8e02d6e8d26bf4dd10ec2224c3945aa32ced Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 17 Mar 2014 09:40:28 +1100 Subject: [PATCH 2/9] fixes unit test --- .../UmbracoServiceMembershipProviderTests.cs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Umbraco.Tests/Membership/UmbracoServiceMembershipProviderTests.cs b/src/Umbraco.Tests/Membership/UmbracoServiceMembershipProviderTests.cs index 99ec6dbef2..8ea9665f41 100644 --- a/src/Umbraco.Tests/Membership/UmbracoServiceMembershipProviderTests.cs +++ b/src/Umbraco.Tests/Membership/UmbracoServiceMembershipProviderTests.cs @@ -15,17 +15,6 @@ namespace Umbraco.Tests.Membership [TestFixture, RequiresSTA] public class UmbracoServiceMembershipProviderTests { - - [Test] - public void Throws_On_Empty_Default_Member_Type_On_Init() - { - var mServiceMock = new Mock(); - var provider = new MembersMembershipProvider(mServiceMock.Object); - mServiceMock.Setup(service => service.GetDefaultMemberType()).Returns(""); - - Assert.Throws(() => provider.Initialize("test", new NameValueCollection())); - } - [Test] public void Sets_Default_Member_Type_From_Service_On_Init() { From af148a4544642413f451266a554080c3a984cbd6 Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 17 Mar 2014 10:48:56 +1100 Subject: [PATCH 3/9] reverts the notion of shema migration - we will run migrations normally as we've been doing, this fixes a couple of unit tests too. --- ...aLossException.cs => DataLossException.cs} | 6 +-- .../Persistence/Migrations/MigrationRunner.cs | 40 ++++--------------- .../Persistence/Migrations/SchemaMigration.cs | 11 ----- .../RemoveUmbracoAppConstraints.cs | 2 +- .../TargetVersionSix/DeleteAppTables.cs | 2 +- .../NewCmsContentType2ContentTypeTable.cs | 2 +- .../RemoveMasterContentTypeColumn.cs | 2 +- .../TargetVersionSix/RenameCmsTabTable.cs | 2 +- .../TargetVersionSix/RenameTabIdColumn.cs | 2 +- ...teCmsContentTypeAllowedContentTypeTable.cs | 2 +- .../UpdateCmsContentTypeTable.cs | 2 +- .../UpdateCmsContentVersionTable.cs | 2 +- .../UpdateCmsPropertyTypeGroupTable.cs | 2 +- .../CreateServerRegistryTable.cs | 2 +- .../AdditionalIndexesAndKeys.cs | 2 +- .../AssignMissingPrimaryForMySqlKeys.cs | 2 +- .../ChangePasswordColumn.cs | 2 +- src/Umbraco.Core/Umbraco.Core.csproj | 7 ++-- src/Umbraco.Tests/Umbraco.Tests.csproj | 1 + 19 files changed, 29 insertions(+), 64 deletions(-) rename src/Umbraco.Core/Persistence/Migrations/{CatastrophicDataLossException.cs => DataLossException.cs} (63%) delete mode 100644 src/Umbraco.Core/Persistence/Migrations/SchemaMigration.cs diff --git a/src/Umbraco.Core/Persistence/Migrations/CatastrophicDataLossException.cs b/src/Umbraco.Core/Persistence/Migrations/DataLossException.cs similarity index 63% rename from src/Umbraco.Core/Persistence/Migrations/CatastrophicDataLossException.cs rename to src/Umbraco.Core/Persistence/Migrations/DataLossException.cs index 9c425a9e82..cb4ea9120a 100644 --- a/src/Umbraco.Core/Persistence/Migrations/CatastrophicDataLossException.cs +++ b/src/Umbraco.Core/Persistence/Migrations/DataLossException.cs @@ -5,15 +5,15 @@ namespace Umbraco.Core.Persistence.Migrations /// /// Used if a migration has executed but the whole process has failed and cannot be rolled back /// - internal class CatastrophicDataLossException : Exception + internal class DataLossException : Exception { - public CatastrophicDataLossException(string msg) + public DataLossException(string msg) : base(msg) { } - public CatastrophicDataLossException(string msg, Exception inner) + public DataLossException(string msg, Exception inner) : base(msg, inner) { diff --git a/src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs b/src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs index bb14bb67f3..9bc9cd8e9c 100644 --- a/src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs +++ b/src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs @@ -48,26 +48,21 @@ namespace Umbraco.Core.Persistence.Migrations var foundMigrations = MigrationResolver.Current.Migrations.ToArray(); - //filter all schema migrations - var schemaMigrations = isUpgrade - ? OrderedUpgradeMigrations(foundMigrations.Where(x => (x is SchemaMigration))).ToList() - : OrderedDowngradeMigrations(foundMigrations.Where(x => (x is SchemaMigration))).ToList(); - //filter all non-schema migrations - var dataMigrations = isUpgrade - ? OrderedUpgradeMigrations(foundMigrations.Where(x => (x is SchemaMigration) == false)).ToList() - : OrderedDowngradeMigrations(foundMigrations.Where(x => (x is SchemaMigration) == false)).ToList(); + var migrations = isUpgrade + ? OrderedUpgradeMigrations(foundMigrations).ToList() + : OrderedDowngradeMigrations(foundMigrations).ToList(); //SD: Why do we want this? - if (Migrating.IsRaisedEventCancelled(new MigrationEventArgs(dataMigrations, _configuredVersion, _targetVersion, true), this)) + if (Migrating.IsRaisedEventCancelled(new MigrationEventArgs(migrations, _configuredVersion, _targetVersion, true), this)) return false; //Loop through migrations to generate sql - var schemaMigrationContext = InitializeMigrations(schemaMigrations, database, databaseProvider, isUpgrade); + var migrationContext = InitializeMigrations(migrations, database, databaseProvider, isUpgrade); try { - ExecuteMigrations(schemaMigrationContext, database); + ExecuteMigrations(migrationContext, database); } catch (Exception ex) { @@ -77,35 +72,16 @@ namespace Umbraco.Core.Persistence.Migrations if (databaseProvider == DatabaseProviders.MySql) { - try - { - var downgrades = OrderedDowngradeMigrations(foundMigrations.Where(x => (x is SchemaMigration))).ToList(); - var downgradeMigrationContext = InitializeMigrations(downgrades, database, databaseProvider, false); - //lets hope that works! - if something cannot be rolled back then a CatastrophicDataLossException should - // be thrown. - ExecuteMigrations(downgradeMigrationContext, database); - } - catch (Exception e) - { - throw new CatastrophicDataLossException( + throw new DataLossException( "An error occurred running a schema migration but the changes could not be rolled back. Error: " + ex.Message + ". In some cases, it may be required that the database be restored to it's original state before running this upgrade process again.", ex); - - } } //continue throwing the exception throw; } - //Ok, we've made it this far, now we can execute our data migrations - - //Loop through migrations to generate sql - var dataMigrationContext = InitializeMigrations(dataMigrations, database, databaseProvider, isUpgrade); - //run them - if this fails the data will be rolled back - ExecuteMigrations(dataMigrationContext, database); - - Migrated.RaiseEvent(new MigrationEventArgs(dataMigrations, dataMigrationContext, _configuredVersion, _targetVersion, false), this); + Migrated.RaiseEvent(new MigrationEventArgs(migrations, migrationContext, _configuredVersion, _targetVersion, false), this); return true; } diff --git a/src/Umbraco.Core/Persistence/Migrations/SchemaMigration.cs b/src/Umbraco.Core/Persistence/Migrations/SchemaMigration.cs deleted file mode 100644 index 6c1e9301ae..0000000000 --- a/src/Umbraco.Core/Persistence/Migrations/SchemaMigration.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Umbraco.Core.Persistence.Migrations -{ - /// - /// A migration class that specifies that it is used for db schema migrations only - these need to execute first and MUST - /// have a downgrade plan. - /// - public abstract class SchemaMigration : MigrationBase - { - - } -} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourNineZero/RemoveUmbracoAppConstraints.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourNineZero/RemoveUmbracoAppConstraints.cs index e7543fd063..efcb5d2415 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourNineZero/RemoveUmbracoAppConstraints.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourNineZero/RemoveUmbracoAppConstraints.cs @@ -4,7 +4,7 @@ using Umbraco.Core.Configuration; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionFourNineZero { [MigrationAttribute("4.9.0", 0, GlobalSettings.UmbracoMigrationName)] - public class RemoveUmbracoAppConstraints : SchemaMigration + public class RemoveUmbracoAppConstraints : MigrationBase { public override void Up() { diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/DeleteAppTables.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/DeleteAppTables.cs index fe0820a025..05edf00062 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/DeleteAppTables.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/DeleteAppTables.cs @@ -16,7 +16,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix public override void Down() { //This cannot be rolled back!! - throw new CatastrophicDataLossException("Cannot rollback migration " + typeof(DeleteAppTables) + " the db tables umbracoAppTree and umbracoApp have been droppped"); + throw new DataLossException("Cannot rollback migration " + typeof(DeleteAppTables) + " the db tables umbracoAppTree and umbracoApp have been droppped"); } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/NewCmsContentType2ContentTypeTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/NewCmsContentType2ContentTypeTable.cs index 29fb8c0f6d..7ff03087c4 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/NewCmsContentType2ContentTypeTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/NewCmsContentType2ContentTypeTable.cs @@ -3,7 +3,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { [Migration("6.0.0", 4, GlobalSettings.UmbracoMigrationName)] - public class NewCmsContentType2ContentTypeTable : SchemaMigration + public class NewCmsContentType2ContentTypeTable : MigrationBase { public override void Up() { diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RemoveMasterContentTypeColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RemoveMasterContentTypeColumn.cs index b11c32e818..680b2001a0 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RemoveMasterContentTypeColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RemoveMasterContentTypeColumn.cs @@ -3,7 +3,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { [Migration("6.0.0", 6, GlobalSettings.UmbracoMigrationName)] - public class RemoveMasterContentTypeColumn : SchemaMigration + public class RemoveMasterContentTypeColumn : MigrationBase { public override void Up() { diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameCmsTabTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameCmsTabTable.cs index daf5400c81..0f8635af09 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameCmsTabTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameCmsTabTable.cs @@ -3,7 +3,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { [Migration("6.0.0", 0, GlobalSettings.UmbracoMigrationName)] - public class RenameCmsTabTable : SchemaMigration + public class RenameCmsTabTable : MigrationBase { public override void Up() { diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameTabIdColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameTabIdColumn.cs index 7ff33092b0..6f3f7edc80 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameTabIdColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameTabIdColumn.cs @@ -4,7 +4,7 @@ using Umbraco.Core.Configuration; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { [Migration("6.0.0", 7, GlobalSettings.UmbracoMigrationName)] - public class RenameTabIdColumn : SchemaMigration + public class RenameTabIdColumn : MigrationBase { public override void Up() { diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeAllowedContentTypeTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeAllowedContentTypeTable.cs index 0d9ddef431..be704466a8 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeAllowedContentTypeTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeAllowedContentTypeTable.cs @@ -3,7 +3,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { [Migration("6.0.0", 3, GlobalSettings.UmbracoMigrationName)] - public class UpdateCmsContentTypeAllowedContentTypeTable : SchemaMigration + public class UpdateCmsContentTypeAllowedContentTypeTable : MigrationBase { public override void Up() { diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeTable.cs index 935b6f62bf..3e6b4cf05c 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeTable.cs @@ -3,7 +3,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { [Migration("6.0.0", 2, GlobalSettings.UmbracoMigrationName)] - public class UpdateCmsContentTypeTable : SchemaMigration + public class UpdateCmsContentTypeTable : MigrationBase { public override void Up() { diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentVersionTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentVersionTable.cs index e84383d753..1dc8998e68 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentVersionTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentVersionTable.cs @@ -3,7 +3,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { [Migration("6.0.0", 8, GlobalSettings.UmbracoMigrationName)] - public class UpdateCmsContentVersionTable : SchemaMigration + public class UpdateCmsContentVersionTable : MigrationBase { public override void Up() { diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsPropertyTypeGroupTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsPropertyTypeGroupTable.cs index ab7f0fa5c1..2bd03f15bc 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsPropertyTypeGroupTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsPropertyTypeGroupTable.cs @@ -4,7 +4,7 @@ using Umbraco.Core.Configuration; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { [Migration("6.0.0", 1, GlobalSettings.UmbracoMigrationName)] - public class UpdateCmsPropertyTypeGroupTable : SchemaMigration + public class UpdateCmsPropertyTypeGroupTable : MigrationBase { public override void Up() { diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixOneZero/CreateServerRegistryTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixOneZero/CreateServerRegistryTable.cs index e54e43761d..5c39f92b21 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixOneZero/CreateServerRegistryTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixOneZero/CreateServerRegistryTable.cs @@ -9,7 +9,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixOneZero { [Migration("6.1.0", 0, GlobalSettings.UmbracoMigrationName)] - public class CreateServerRegistryTable : SchemaMigration + public class CreateServerRegistryTable : MigrationBase { public override void Up() { diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs index fcd35a163a..ecac1db9e7 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs @@ -8,7 +8,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero { [Migration("6.2.0", 1, GlobalSettings.UmbracoMigrationName)] - public class AdditionalIndexesAndKeys : SchemaMigration + public class AdditionalIndexesAndKeys : MigrationBase { public override void Up() { diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys.cs index 2d1c5fc52c..a4fae3ae83 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys.cs @@ -7,7 +7,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero { //see: http://issues.umbraco.org/issue/U4-4430 [Migration("6.2.0", 0, GlobalSettings.UmbracoMigrationName)] - public class AssignMissingPrimaryForMySqlKeys : SchemaMigration + public class AssignMissingPrimaryForMySqlKeys : MigrationBase { public override void Up() { diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/ChangePasswordColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/ChangePasswordColumn.cs index 545e74f1e6..1a5b6cd61e 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/ChangePasswordColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/ChangePasswordColumn.cs @@ -4,7 +4,7 @@ using Umbraco.Core.Configuration; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero { [Migration("6.2.0", 2, GlobalSettings.UmbracoMigrationName)] - public class ChangePasswordColumn : SchemaMigration + public class ChangePasswordColumn : MigrationBase { public override void Up() { diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 929ec806b0..cfd4054ca4 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -221,8 +221,7 @@ - - + @@ -862,8 +861,8 @@ Constants.cs - - Constants.cs + + Constants.cs Constants.cs diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index b19066f0d6..1e943b964c 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -514,6 +514,7 @@ ResXFileCodeGenerator SqlResources.Designer.cs + Designer ResXFileCodeGenerator From c66aca2d411addd84124ff116425ace0bde2a9c8 Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 17 Mar 2014 11:24:01 +1100 Subject: [PATCH 4/9] Adds migration to rename the index umbracoUserLogins_Index to IX_umbracoUserLogins_Index so that it follows standards, fixes unit test --- src/Umbraco.Core/Models/Rdbms/UserLoginDto.cs | 2 +- .../Migrations/Initial/DatabaseSchemaCreation.cs | 6 ++++-- .../AdditionalIndexesAndKeys.cs | 11 +++++++++++ src/Umbraco.Core/StringExtensions.cs | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Core/Models/Rdbms/UserLoginDto.cs b/src/Umbraco.Core/Models/Rdbms/UserLoginDto.cs index 3315d1f7c1..6826377856 100644 --- a/src/Umbraco.Core/Models/Rdbms/UserLoginDto.cs +++ b/src/Umbraco.Core/Models/Rdbms/UserLoginDto.cs @@ -9,7 +9,7 @@ namespace Umbraco.Core.Models.Rdbms internal class UserLoginDto { [Column("contextID")] - [Index(IndexTypes.Clustered, Name = "umbracoUserLogins_Index")] + [Index(IndexTypes.Clustered, Name = "IX_umbracoUserLogins_Index")] public Guid ContextId { get; set; } [Column("userID")] diff --git a/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaCreation.cs b/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaCreation.cs index 0220e146b0..ee10f20730 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaCreation.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaCreation.cs @@ -172,7 +172,8 @@ namespace Umbraco.Core.Persistence.Migrations.Initial x.Item3.InvariantStartsWith("FK_") == false && x.Item3.InvariantStartsWith("PK_") == false && x.Item3.InvariantStartsWith("IX_") == false).Select(x => x.Item3).ToList(); var foreignKeysInSchema = result.TableDefinitions.SelectMany(x => x.ForeignKeys.Select(y => y.Name)).ToList(); - var primaryKeysInSchema = result.TableDefinitions.SelectMany(x => x.Columns.Select(y => y.PrimaryKeyName)).ToList(); + var primaryKeysInSchema = result.TableDefinitions.SelectMany(x => x.Columns.Select(y => y.PrimaryKeyName)) + .Where(x => x.IsNullOrWhiteSpace() == false).ToList(); //Add valid and invalid foreign key differences to the result object foreach (var unknown in unknownConstraintsInDatabase) @@ -284,7 +285,8 @@ namespace Umbraco.Core.Persistence.Migrations.Initial private void ValidateDbIndexes(DatabaseSchemaResult result) { //These are just column indexes NOT constraints or Keys - var colIndexesInDatabase = result.DbIndexDefinitions.Where(x => x.IndexName.InvariantStartsWith("IX_")).Select(x => x.IndexName).ToList(); + //var colIndexesInDatabase = result.DbIndexDefinitions.Where(x => x.IndexName.InvariantStartsWith("IX_")).Select(x => x.IndexName).ToList(); + var colIndexesInDatabase = result.DbIndexDefinitions.Select(x => x.IndexName).ToList(); var indexesInSchema = result.TableDefinitions.SelectMany(x => x.Indexes.Select(y => y.Name)).ToList(); //Add valid and invalid index differences to the result object diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs index ecac1db9e7..cecce85d42 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs @@ -40,6 +40,17 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero { Create.Index("IX_cmsDocument_newest").OnTable("cmsDocument").OnColumn("newest").Ascending().WithOptions().NonClustered(); } + + //we want to drop the umbracoUserLogins_Index index since it is named incorrectly and then re-create it so + // it follows the standard naming convention + if (dbIndexes.Any(x => x.IndexName.InvariantEquals("umbracoUserLogins_Index"))) + { + Delete.Index("umbracoUserLogins_Index").OnTable("umbracoUserLogins"); + } + if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_umbracoUserLogins_Index")) == false) + { + Create.Index("IX_umbracoUserLogins_Index").OnTable("umbracoUserLogins").OnColumn("contextID").Ascending().WithOptions().Clustered(); + } } public override void Down() diff --git a/src/Umbraco.Core/StringExtensions.cs b/src/Umbraco.Core/StringExtensions.cs index d14dbc7c6b..ac5e8b0ec6 100644 --- a/src/Umbraco.Core/StringExtensions.cs +++ b/src/Umbraco.Core/StringExtensions.cs @@ -477,7 +477,7 @@ namespace Umbraco.Core public static bool InvariantContains(this IEnumerable compare, string compareTo) { - return compare.Contains(compareTo, new DelegateEqualityComparer((source, dest) => source.Equals(dest, StringComparison.InvariantCultureIgnoreCase), x => x.GetHashCode())); + return compare.Contains(compareTo, StringComparer.InvariantCultureIgnoreCase); } /// From 4745995f92d5b7cde069d66771fc8f40f4adbd44 Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 17 Mar 2014 11:45:42 +1100 Subject: [PATCH 5/9] Fixes: U4-4373 @Library.NodeById(-1).Id returns "0" instead of "-1"(6.2.0 beta) --- .../CompatibilityHelper.cs | 2 +- .../umbraco/dialogs/protectPage.aspx.cs | 19 +++++++++++-------- .../RazorDynamicNode/RazorLibraryCore.cs | 6 +++--- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/CompatibilityHelper.cs b/src/Umbraco.Web/umbraco.presentation/CompatibilityHelper.cs index a2166e82c0..da14d57a38 100644 --- a/src/Umbraco.Web/umbraco.presentation/CompatibilityHelper.cs +++ b/src/Umbraco.Web/umbraco.presentation/CompatibilityHelper.cs @@ -34,7 +34,7 @@ namespace Umbraco.Web.umbraco.presentation if (doc == null) { - Id = 0; + Id = -1; return; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs index 2af1add9fa..7782ae6654 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs @@ -102,14 +102,17 @@ namespace umbraco.presentation.umbraco.dialogs if (Access.GetProtectionType(documentId) == ProtectionType.Simple) { - MembershipUser m = Access.GetAccessingMembershipUser(documentId); - pane_simple.Visible = true; - pp_pass.Visible = false; - simpleLogin.Visible = false; - SimpleLoginLabel.Visible = true; - SimpleLoginLabel.Text = m.UserName; - pane_advanced.Visible = false; - bt_protect.CommandName = "simple"; + MembershipUser m = Access.GetAccessingMembershipUser(documentId); + if (m != null) + { + pane_simple.Visible = true; + pp_pass.Visible = false; + simpleLogin.Visible = false; + SimpleLoginLabel.Visible = true; + SimpleLoginLabel.Text = m.UserName; + pane_advanced.Visible = false; + bt_protect.CommandName = "simple"; + } } else if (Access.GetProtectionType(documentId) == ProtectionType.Advanced) diff --git a/src/umbraco.MacroEngines/RazorDynamicNode/RazorLibraryCore.cs b/src/umbraco.MacroEngines/RazorDynamicNode/RazorLibraryCore.cs index 6ab1bad3d8..d9d93a458e 100644 --- a/src/umbraco.MacroEngines/RazorDynamicNode/RazorLibraryCore.cs +++ b/src/umbraco.MacroEngines/RazorDynamicNode/RazorLibraryCore.cs @@ -33,13 +33,13 @@ namespace umbraco.MacroEngines.Library public dynamic NodeById(int Id) { var node = new DynamicNode(Id); - if (node != null && node.Id == 0) return new DynamicNull(); + if (node.Id == 0) return new DynamicNull(); return node; } public dynamic NodeById(string Id) { var node = new DynamicNode(Id); - if (node != null && node.Id == 0) return new DynamicNull(); + if (node.Id == 0) return new DynamicNull(); return node; } public dynamic NodeById(DynamicNull Id) @@ -53,7 +53,7 @@ namespace umbraco.MacroEngines.Library return new DynamicNull(); } var node = new DynamicNode(Id); - if (node != null && node.Id == 0) return new DynamicNull(); + if (node.Id == 0) return new DynamicNull(); return node; } public dynamic NodesById(List Ids) From bbeedb6c1bf0d89de5b652ba5e5ab5b118d2d11a Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 17 Mar 2014 12:27:37 +1100 Subject: [PATCH 6/9] Fixes: U4-4373 @Library.NodeById(-1).Id returns "0" instead of "-1"(6.2.0 beta) & U4-4374 @Model.NodeById(-1).DescendantsOrSelf().First().Id results in Excecption (6.2.0 beta) --- .../CompatibilityHelper.cs | 2 +- .../RazorDynamicNode/DynamicBackingItem.cs | 24 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/CompatibilityHelper.cs b/src/Umbraco.Web/umbraco.presentation/CompatibilityHelper.cs index da14d57a38..a2166e82c0 100644 --- a/src/Umbraco.Web/umbraco.presentation/CompatibilityHelper.cs +++ b/src/Umbraco.Web/umbraco.presentation/CompatibilityHelper.cs @@ -34,7 +34,7 @@ namespace Umbraco.Web.umbraco.presentation if (doc == null) { - Id = -1; + Id = 0; return; } diff --git a/src/umbraco.MacroEngines/RazorDynamicNode/DynamicBackingItem.cs b/src/umbraco.MacroEngines/RazorDynamicNode/DynamicBackingItem.cs index c748605264..ded21a3119 100644 --- a/src/umbraco.MacroEngines/RazorDynamicNode/DynamicBackingItem.cs +++ b/src/umbraco.MacroEngines/RazorDynamicNode/DynamicBackingItem.cs @@ -32,6 +32,16 @@ namespace umbraco.MacroEngines } public DynamicBackingItem(int Id) { + if (Id == -1) + { + //this is a special check, previously passing in -1 would return a real node, the root node. Though + // it has no properties (defaults apply), you could access descendants, children, etc... + //This is how this used to work before a large refactor - which I think may have broken other legacy logic too :( + + this.content = new NodeFactory.Node(Id); + return; + } + var n = CompatibilityHelper.ConvertToNode(UmbracoContext.Current.ContentCache.GetById(Id)); this.content = n; @@ -57,7 +67,19 @@ namespace umbraco.MacroEngines } else { - this.content = CompatibilityHelper.ConvertToNode(UmbracoContext.Current.ContentCache.GetById(Id)); + if (Id == -1) + { + //this is a special check, previously passing in -1 would return a real node, the root node. Though + // it has no properties (defaults apply), you could access descendants, children, etc... + //This is how this used to work before a large refactor - which I think may have broken other legacy logic too :( + + this.content = new NodeFactory.Node(Id); + } + else + { + this.content = CompatibilityHelper.ConvertToNode(UmbracoContext.Current.ContentCache.GetById(Id)); + } + this.Type = Type; } } From d1d54d8e84cab0bcb9e79a4ab2b5153307c6fa7a Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 17 Mar 2014 13:12:08 +1100 Subject: [PATCH 7/9] Fixes: U4-4427 Exception with selecting content start node in Multi-node tree picker 6.2.0 --- .../umbraco/dialogs/treePicker.aspx.cs | 10 +++++++--- src/umbraco.controls/TreePicker/SimpleContentPicker.cs | 4 ++-- src/umbraco.editorControls/pagepicker/pagePicker.cs | 6 +++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/treePicker.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/treePicker.aspx.cs index 38518804b4..30f9fbb12d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/treePicker.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/treePicker.aspx.cs @@ -21,10 +21,14 @@ namespace umbraco.dialogs TreeParams = TreeRequestParams.FromQueryStrings().CreateTreeService(); DataBind(); - if(Request.QueryString["selected"] != null && TreeParams.TreeType == "content") { + if(Request.QueryString["selected"] != null && TreeParams.TreeType == "content") + { var currContent = Services.ContentService.GetById(int.Parse(Request.QueryString["selected"])); - if (currContent.ParentId > 0) - DialogTree.SelectedNodePath = currContent.Path; + if (currContent != null) + { + if (currContent.ParentId > 0) + DialogTree.SelectedNodePath = currContent.Path; + } } } diff --git a/src/umbraco.controls/TreePicker/SimpleContentPicker.cs b/src/umbraco.controls/TreePicker/SimpleContentPicker.cs index 21adda53a6..82838b11dc 100644 --- a/src/umbraco.controls/TreePicker/SimpleContentPicker.cs +++ b/src/umbraco.controls/TreePicker/SimpleContentPicker.cs @@ -13,9 +13,9 @@ namespace umbraco.uicontrols.TreePicker { get { - if (HttpContext.Current != null && HttpContext.Current.Request.QueryString["id"] != null) + if ( Context.Request.QueryString["id"] != null) { - return TreeUrlGenerator.GetPickerUrl(Constants.Applications.Content, "content") + "&selected=" + HttpContext.Current.Request.QueryString["id"]; + return TreeUrlGenerator.GetPickerUrl(Constants.Applications.Content, "content") + "&selected=" + Context.Request.QueryString["id"]; } diff --git a/src/umbraco.editorControls/pagepicker/pagePicker.cs b/src/umbraco.editorControls/pagepicker/pagePicker.cs index 932fe4fb40..22074d11fc 100644 --- a/src/umbraco.editorControls/pagepicker/pagePicker.cs +++ b/src/umbraco.editorControls/pagepicker/pagePicker.cs @@ -22,15 +22,15 @@ namespace umbraco.editorControls { public pagePicker() : base() { } - public pagePicker(interfaces.IData data) : base(data) { } + public pagePicker(IData data) : base(data) { } public override string TreePickerUrl { get { - if (HttpContext.Current != null && HttpContext.Current.Request.QueryString["id"] != null) + if (Context.Request.QueryString["id"] != null) { - return TreeUrlGenerator.GetPickerUrl(Umbraco.Core.Constants.Applications.Content, "content") + "&selected=" + HttpContext.Current.Request.QueryString["id"]; + return TreeUrlGenerator.GetPickerUrl(Umbraco.Core.Constants.Applications.Content, "content") + "&selected=" + Context.Request.QueryString["id"]; } return TreeUrlGenerator.GetPickerUrl(Umbraco.Core.Constants.Applications.Content, "content"); From f642a7fd63a8b699d498633b7dad2b004815ca3f Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 17 Mar 2014 13:21:17 +1100 Subject: [PATCH 8/9] Fixes: U4-4368 Cannot insert the value NULL into column 'name' when creating new relation type from API --- src/Umbraco.Core/Models/RelationType.cs | 9 +++++ .../Services/ContentServiceTests.cs | 2 +- .../Services/RelationServiceTests.cs | 34 +++++++++++++++++++ src/Umbraco.Tests/Umbraco.Tests.csproj | 1 + 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/Umbraco.Tests/Services/RelationServiceTests.cs diff --git a/src/Umbraco.Core/Models/RelationType.cs b/src/Umbraco.Core/Models/RelationType.cs index e1f5b4a388..ae20482229 100644 --- a/src/Umbraco.Core/Models/RelationType.cs +++ b/src/Umbraco.Core/Models/RelationType.cs @@ -21,9 +21,18 @@ namespace Umbraco.Core.Models public RelationType(Guid childObjectType, Guid parentObjectType, string @alias) { + Mandate.ParameterNotNullOrEmpty(@alias, "alias"); _childObjectType = childObjectType; _parentObjectType = parentObjectType; _alias = alias; + Name = _alias; + } + + public RelationType(Guid childObjectType, Guid parentObjectType, string @alias, string name) + :this(childObjectType, parentObjectType, @alias) + { + Mandate.ParameterNotNullOrEmpty(name, "name"); + Name = name; } private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo(x => x.Name); diff --git a/src/Umbraco.Tests/Services/ContentServiceTests.cs b/src/Umbraco.Tests/Services/ContentServiceTests.cs index 6434331e30..b5cd6842d0 100644 --- a/src/Umbraco.Tests/Services/ContentServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentServiceTests.cs @@ -14,7 +14,7 @@ using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.Services { - /// + /// /// Tests covering all methods in the ContentService class. /// This is more of an integration test as it involves multiple layers /// as well as configuration. diff --git a/src/Umbraco.Tests/Services/RelationServiceTests.cs b/src/Umbraco.Tests/Services/RelationServiceTests.cs new file mode 100644 index 0000000000..e2b9f57287 --- /dev/null +++ b/src/Umbraco.Tests/Services/RelationServiceTests.cs @@ -0,0 +1,34 @@ +using System; +using NUnit.Framework; +using Umbraco.Core; +using Umbraco.Core.Models; + +namespace Umbraco.Tests.Services +{ + [TestFixture, RequiresSTA] + public class RelationServiceTests : BaseServiceTest + { + [SetUp] + public override void Initialize() + { + base.Initialize(); + } + + [TearDown] + public override void TearDown() + { + base.TearDown(); + } + + [Test] + public void Can_Create_RelationType_Without_Name() + { + var rs = ServiceContext.RelationService; + var rt = new RelationType(new Guid(Constants.ObjectTypes.Document), new Guid(Constants.ObjectTypes.Document), "repeatedEventOccurence"); + + Assert.DoesNotThrow(() => rs.Save(rt)); + + Assert.AreEqual(rt.Name, "repeatedEventOccurence"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 1e943b964c..f654b441a7 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -234,6 +234,7 @@ + From a60e2318ada695388cd71ae8f2100ad4129515ff Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 17 Mar 2014 13:23:26 +1100 Subject: [PATCH 9/9] Fix Null Prevalue Values on Export of DataTypes Exporting a DataType that has a Numeric pre-value that has no value causes an Exception - added null checking to pre value.value --- src/Umbraco.Core/Services/PackagingService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Services/PackagingService.cs b/src/Umbraco.Core/Services/PackagingService.cs index c06cec03fc..b8c854024b 100644 --- a/src/Umbraco.Core/Services/PackagingService.cs +++ b/src/Umbraco.Core/Services/PackagingService.cs @@ -700,7 +700,7 @@ namespace Umbraco.Core.Services { var prevalue = new XElement("PreValue"); prevalue.Add(new XAttribute("Id", pv.Value.Id)); - prevalue.Add(new XAttribute("Value", pv.Value.Value)); + prevalue.Add(new XAttribute("Value", pv.Value.Value == null ? "" : pv.Value.Value)); prevalue.Add(new XAttribute("Alias", pv.Key)); prevalue.Add(new XAttribute("SortOrder", sort)); prevalues.Add(prevalue);