Add missing index on UserLogin table (prevents deadlocks)
This commit is contained in:
@@ -96,6 +96,12 @@ namespace Umbraco.Core.Migrations
|
||||
return tables.Any(x => x.InvariantEquals(tableName));
|
||||
}
|
||||
|
||||
protected bool IndexExists(string indexName)
|
||||
{
|
||||
var indexes = SqlSyntax.GetDefinedIndexes(Context.Database);
|
||||
return indexes.Any(x => x.Item2.InvariantEquals(indexName));
|
||||
}
|
||||
|
||||
protected bool ColumnExists(string tableName, string columnName)
|
||||
{
|
||||
var columns = SqlSyntax.GetColumnsInSchema(Context.Database).Distinct().ToArray();
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace Umbraco.Core.Migrations.Upgrade
|
||||
To<ConvertRelatedLinksToMultiUrlPicker>("{ED28B66A-E248-4D94-8CDB-9BDF574023F0}");
|
||||
To<UpdatePickerIntegerValuesToUdi>("{38C809D5-6C34-426B-9BEA-EFD39162595C}");
|
||||
To<RenameUmbracoDomainsTable>("{6017F044-8E70-4E10-B2A3-336949692ADD}");
|
||||
|
||||
To<AddUserLoginDtoDateIndex>("98339BEF-E4B2-48A8-B9D1-D173DC842BBE");
|
||||
|
||||
//FINAL
|
||||
|
||||
|
||||
@@ -30,11 +30,14 @@ namespace Umbraco.Core.Persistence.Dtos
|
||||
/// Updated every time a user's session is validated
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This allows us to guess if a session is timed out if a user doesn't actively log out
|
||||
/// and also allows us to trim the data in the table
|
||||
/// <para>This allows us to guess if a session is timed out if a user doesn't actively
|
||||
/// log out and also allows us to trim the data in the table.</para>
|
||||
/// <para>The index is IMPORTANT as it prevents deadlocks during deletion of
|
||||
/// old sessions (DELETE ... WHERE lastValidatedUtc < date).</para>
|
||||
/// </remarks>
|
||||
[Column("lastValidatedUtc")]
|
||||
[NullSetting(NullSetting = NullSettings.NotNull)]
|
||||
[Index(IndexTypes.NonClustered, Name = "IX_userLoginDto_lastValidatedUtc")]
|
||||
public DateTime LastValidatedUtc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -367,6 +367,7 @@
|
||||
<Compile Include="Migrations\Upgrade\V_7_9_0\AddUmbracoAuditTable.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_7_9_0\AddUmbracoConsentTable.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_7_9_0\CreateSensitiveDataUserGroup.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_8_0_0\AddUserLoginDtoDateIndex.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_8_0_0\ConvertRelatedLinksToMultiUrlPicker.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_8_0_0\AddContentTypeIsElementColumn.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_8_0_0\AddLogTableColumns.cs" />
|
||||
|
||||
Reference in New Issue
Block a user