Added indexes for common queries (#8369)

This commit is contained in:
Matteo Piovanelli
2020-05-07 19:39:35 +02:00
committed by GitHub
parent 9d1267a94c
commit 35738c1b58
3 changed files with 32 additions and 0 deletions

View File

@@ -148,5 +148,15 @@ namespace Orchard.Core.Common {
return 7; return 7;
} }
public int UpdateFrom7() {
// The Container_Id is basically a foreign key, used in several queries
SchemaBuilder.AlterTable(nameof(CommonPartRecord), table => {
table.CreateIndex($"IDX_{nameof(CommonPartRecord)}_Container_id",
"Container_id");
});
return 8;
}
} }
} }

View File

@@ -25,6 +25,18 @@ namespace Orchard.Localization {
return 2; return 2;
} }
public int UpdateFrom2() {
// Most searches will be interested in either the content's culture
// or the group of contents that are localizations of one another
SchemaBuilder.AlterTable("LocalizationPartRecord", table => {
table.CreateIndex($"IDX_LocalizationPartRecord_CultureId",
"CultureId");
table.CreateIndex($"IDX_LocalizationPartRecord_MasterContentItemId",
"MasterContentItemId");
});
return 3;
}
} }
[OrchardFeature("Orchard.Localization.Transliteration")] [OrchardFeature("Orchard.Localization.Transliteration")]

View File

@@ -69,5 +69,15 @@ namespace Orchard.Users {
return 6; return 6;
} }
public int UpdateFrom6() {
// users are most commonly searched by NormalizedUserName and or Email
SchemaBuilder.AlterTable("UserPartRecord", table => {
table.CreateIndex($"IDX_UserPartRecord_NameAndEmail",
"NormalizedUserName",
"Email");
});
return 7;
}
} }
} }