Create temporary index on umbracoPropertyData

This commit is contained in:
Steve Megson
2020-02-03 14:37:31 +00:00
parent 537674a0b3
commit 1677b32274

View File

@@ -19,6 +19,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
public override void Migrate()
{
MigratePropertyData();
CreatePropertyDataIndexes();
MigrateContentAndPropertyTypes();
MigrateContent();
MigrateVersions();
@@ -90,6 +91,15 @@ HAVING COUNT(v2.id) <> 1").Any())
Rename.Table(PreTables.PropertyData).To(Constants.DatabaseSchema.Tables.PropertyData).Do();
}
private void CreatePropertyDataIndexes()
{
// Creates a temporary index on umbracoPropertyData to speed up other migrations which update property values.
// It will be removed in CreateKeysAndIndexes before the normal indexes for the table are created
var tableDefinition = Persistence.DatabaseModelDefinitions.DefinitionFactory.GetTableDefinition(typeof(PropertyDataDto), SqlSyntax);
Execute.Sql(SqlSyntax.FormatPrimaryKey(tableDefinition)).Do();
Execute.Sql($"CREATE UNIQUE NONCLUSTERED INDEX IX_umbracoPropertyData_Temp ON {PreTables.PropertyData} (versionId,propertyTypeId,languageId,segment)").Do();
}
private void MigrateContentAndPropertyTypes()
{
if (!ColumnExists(PreTables.ContentType, "variations"))