Removes old TemplateDto.Design column

This commit is contained in:
Shannon
2018-11-01 16:18:13 +11:00
parent f15d30b1b4
commit 2320b51df2
9 changed files with 27 additions and 17 deletions

View File

@@ -141,6 +141,7 @@ namespace Umbraco.Core.Migrations.Upgrade
Chain<AddLogTableColumns>("{8804D8E8-FE62-4E3A-B8A2-C047C2118C38}");
Chain<DropPreValueTable>("{23275462-446E-44C7-8C2C-3B8C1127B07D}");
Chain<DropDownPropertyEditorsMigration>("{6B251841-3069-4AD5-8AE9-861F9523E8DA}");
Chain<DropTemplateDesignColumn>("{08919C4B-B431-449C-90EC-2B8445B5C6B1}");
//FINAL

View File

@@ -1,5 +1,6 @@
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
{
public class DropTaskTables : MigrationBase
{
public DropTaskTables(IMigrationContext context)
@@ -8,8 +9,10 @@
public override void Migrate()
{
Delete.Table("cmsTaskType");
Delete.Table("cmsTask");
if (TableExists("cmsTaskType"))
Delete.Table("cmsTaskType");
if (TableExists("cmsTask"))
Delete.Table("cmsTask");
}
}
}

View File

@@ -0,0 +1,15 @@
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
{
public class DropTemplateDesignColumn : MigrationBase
{
public DropTemplateDesignColumn(IMigrationContext context)
: base(context)
{ }
public override void Migrate()
{
if(ColumnExists("cmsTemplate", "design"))
Delete.Column("design").FromTable("cmsTemplate").Do();
}
}
}

View File

@@ -22,10 +22,6 @@ namespace Umbraco.Core.Persistence.Dtos
[NullSetting(NullSetting = NullSettings.Null)]
public string Alias { get; set; }
[Column("design")]
[SpecialDbType(SpecialDbTypes.NTEXT)]
public string Design { get; set; }
[ResultColumn]
[Reference(ReferenceType.OneToOne, ColumnName = "NodeId")]
public NodeDto NodeDto { get; set; }

View File

@@ -45,7 +45,6 @@ namespace Umbraco.Core.Persistence.Factories
var dto = new TemplateDto
{
Alias = entity.Alias,
Design = entity.Content ?? string.Empty,
NodeDto = BuildNodeDto(entity, nodeObjectTypeId)
};

View File

@@ -24,7 +24,6 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<Template, NodeDto>(src => src.MasterTemplateId, dto => dto.ParentId);
CacheMap<Template, NodeDto>(src => src.Key, dto => dto.UniqueId);
CacheMap<Template, TemplateDto>(src => src.Alias, dto => dto.Alias);
CacheMap<Template, TemplateDto>(src => src.Content, dto => dto.Design);
}
}
}

View File

@@ -181,7 +181,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
template.Path = nodeDto.Path;
//now do the file work
SaveFile(template, dto);
SaveFile(template);
template.ResetDirtyProperties();
@@ -236,7 +236,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
template.IsMasterTemplate = axisDefs.Any(x => x.ParentId == dto.NodeId);
//now do the file work
SaveFile((Template) entity, dto, originalAlias);
SaveFile((Template) entity, originalAlias);
entity.ResetDirtyProperties();
@@ -245,7 +245,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
template.GetFileContent = file => GetFileContent((Template) file, false);
}
private void SaveFile(Template template, TemplateDto dto, string originalAlias = null)
private void SaveFile(Template template, string originalAlias = null)
{
string content;
@@ -275,10 +275,6 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// once content has been set, "template on disk" are not "on disk" anymore
template.Content = content;
SetVirtualPath(template);
if (dto.Design == content) return;
dto.Design = content;
Database.Update(dto); // though... we don't care about the db value really??!!
}
protected override void PersistDeletedItem(ITemplate entity)

View File

@@ -359,6 +359,7 @@
<Compile Include="Migrations\Upgrade\V_8_0_0\DropDownPropertyEditorsMigration.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DropPreValueTable.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DropTaskTables.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DropTemplateDesignColumn.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\FixLockTablePrimaryKey.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\LanguageColumns.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\PropertyEditorsMigration.cs" />

View File

@@ -35,8 +35,8 @@ namespace Umbraco.Tests.Persistence.Querying
scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} OFF ", SqlSyntax.GetQuotedTableName("umbracoNode"))));
scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON ", SqlSyntax.GetQuotedTableName("cmsTemplate"))));
scope.Database.Insert("cmsTemplate", "pk", false, new TemplateDto { NodeId = 55554, Alias = "testTemplate1", Design = "", PrimaryKey = 22221});
scope.Database.Insert("cmsTemplate", "pk", false, new TemplateDto { NodeId = 55555, Alias = "testTemplate2", Design = "", PrimaryKey = 22222 });
scope.Database.Insert("cmsTemplate", "pk", false, new TemplateDto { NodeId = 55554, Alias = "testTemplate1", PrimaryKey = 22221});
scope.Database.Insert("cmsTemplate", "pk", false, new TemplateDto { NodeId = 55555, Alias = "testTemplate2", PrimaryKey = 22222 });
scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} OFF ", SqlSyntax.GetQuotedTableName("cmsTemplate"))));
scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON ", SqlSyntax.GetQuotedTableName("cmsContentType"))));