From 48e11ab4392bb3233dcfce9ad7af326db1368c7d Mon Sep 17 00:00:00 2001 From: Stephan Date: Wed, 6 Feb 2019 14:53:49 +0100 Subject: [PATCH 1/2] Fix 8.0 migration --- .../V_8_0_0/ContentVariationMigration.cs | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/ContentVariationMigration.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/ContentVariationMigration.cs index 23c835a327..84dd393b0d 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/ContentVariationMigration.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/ContentVariationMigration.cs @@ -3,7 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using NPoco; using Umbraco.Core.Persistence; +using Umbraco.Core.Persistence.DatabaseAnnotations; using Umbraco.Core.Persistence.Dtos; namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 @@ -59,5 +61,58 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 Database.Update(dto); } } + + // we *need* to use this private DTO here, which does *not* have extra properties, which would kill the migration + + [TableName(TableName)] + [PrimaryKey("pk")] + [ExplicitColumns] + private class ContentTypeDto + { + public const string TableName = Constants.DatabaseSchema.Tables.ContentType; + + [Column("pk")] + [PrimaryKeyColumn(IdentitySeed = 535)] + public int PrimaryKey { get; set; } + + [Column("nodeId")] + [ForeignKey(typeof(NodeDto))] + [Index(IndexTypes.UniqueNonClustered, Name = "IX_cmsContentType")] + public int NodeId { get; set; } + + [Column("alias")] + [NullSetting(NullSetting = NullSettings.Null)] + public string Alias { get; set; } + + [Column("icon")] + [Index(IndexTypes.NonClustered)] + [NullSetting(NullSetting = NullSettings.Null)] + public string Icon { get; set; } + + [Column("thumbnail")] + [Constraint(Default = "folder.png")] + public string Thumbnail { get; set; } + + [Column("description")] + [NullSetting(NullSetting = NullSettings.Null)] + [Length(1500)] + public string Description { get; set; } + + [Column("isContainer")] + [Constraint(Default = "0")] + public bool IsContainer { get; set; } + + [Column("allowAtRoot")] + [Constraint(Default = "0")] + public bool AllowAtRoot { get; set; } + + [Column("variations")] + [Constraint(Default = "1" /*ContentVariation.InvariantNeutral*/)] + public byte Variations { get; set; } + + [ResultColumn] + public NodeDto NodeDto { get; set; } + } + } } From 0be5ff64bc626f3f852dc207d86f2ecdcb3e2d6b Mon Sep 17 00:00:00 2001 From: Stephan Date: Wed, 6 Feb 2019 15:05:56 +0100 Subject: [PATCH 2/2] Be friendly --- .../Repositories/Implement/ServerRegistrationRepository.cs | 2 +- .../Services/Implement/LocalizedTextServiceFileSources.cs | 2 +- .../LegacyXmlPublishedCache/PublishedMediaCache.cs | 2 +- .../Persistence/Repositories/ContentTypeRepositoryTest.cs | 2 +- src/Umbraco.Tests/Testing/UmbracoTestBase.cs | 4 ++-- .../Models/Mapping/ContentTypeProfileExtensions.cs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ServerRegistrationRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ServerRegistrationRepository.cs index 2bad7229f2..6b2dfddaeb 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ServerRegistrationRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ServerRegistrationRepository.cs @@ -20,7 +20,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement protected override IRepositoryCachePolicy CreateCachePolicy() { - // TODO: wtf are we doing with cache here? + // TODO: what are we doing with cache here? // why are we using disabled cache helper up there? // // 7.6 says: diff --git a/src/Umbraco.Core/Services/Implement/LocalizedTextServiceFileSources.cs b/src/Umbraco.Core/Services/Implement/LocalizedTextServiceFileSources.cs index a0b952a75a..f620d31fe9 100644 --- a/src/Umbraco.Core/Services/Implement/LocalizedTextServiceFileSources.cs +++ b/src/Umbraco.Core/Services/Implement/LocalizedTextServiceFileSources.cs @@ -61,7 +61,7 @@ namespace Umbraco.Core.Services.Implement var filename = Path.GetFileNameWithoutExtension(localCopy.FullName).Replace("_", "-"); // TODO: Fix this nonsense... would have to wait until v8 to store the language files with their correct - // names instead of storing them as 2 letters but actually having a 4 letter culture. wtf. So now, we + // names instead of storing them as 2 letters but actually having a 4 letter culture. So now, we // need to check if the file is 2 letters, then open it to try to find it's 4 letter culture, then use that // if it's successful. We're going to assume (though it seems assuming in the legacy logic is never a great idea) // that any 4 letter file is named with the actual culture that it is! diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs index c62614ef22..17a18781b4 100644 --- a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs @@ -587,7 +587,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache { int id; if (int.TryParse(itemm.GetAttribute("id", ""), out id) == false) - continue; // wtf? + continue; // uh? var captured = itemm; var cacheValues = GetCacheValues(id, idd => ConvertFromXPathNavigator(captured)); mediaList.Add(CreateFromCacheValues(cacheValues)); diff --git a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs index 2d45c24d0f..03aae74920 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs @@ -311,7 +311,7 @@ namespace Umbraco.Tests.Persistence.Repositories Assert.AreEqual(4, contentType.PropertyTypes.Count()); - // remove all templates - since they are not saved, they would break the (wtf) mapping code + // remove all templates - since they are not saved, they would break the (!) mapping code contentType.AllowedTemplates = new ITemplate[0]; // there is NO mapping from display to contentType, but only from save diff --git a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs index 702a99b510..c404e0404d 100644 --- a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs +++ b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs @@ -157,7 +157,7 @@ namespace Umbraco.Tests.Testing // etc ComposeWeb(); - ComposeWtf(); + ComposeMisc(); // not sure really Compose(Composition); @@ -233,7 +233,7 @@ namespace Umbraco.Tests.Testing } - protected virtual void ComposeWtf() + protected virtual void ComposeMisc() { // what else? var runtimeStateMock = new Mock(); diff --git a/src/Umbraco.Web/Models/Mapping/ContentTypeProfileExtensions.cs b/src/Umbraco.Web/Models/Mapping/ContentTypeProfileExtensions.cs index 0181fc25be..0e324c94b9 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentTypeProfileExtensions.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentTypeProfileExtensions.cs @@ -25,7 +25,7 @@ namespace Umbraco.Web.Models.Mapping where TPropertyTypeBasic : PropertyTypeBasic { return mapping - .ConstructUsing(x => new PropertyGroup(false)) // TODO: we have NO idea of isPublishing here = wtf? + .ConstructUsing(x => new PropertyGroup(false)) // TODO: we have NO idea of isPublishing here = so what? .IgnoreEntityCommonProperties() .ForMember(dest => dest.Id, map => map.Condition(src => src.Id > 0)) .ForMember(dest => dest.Key, map => map.Ignore())