database migration for sql tuning wizard suggestions
This commit is contained in:
parent
e0883cf0ae
commit
61ac574de8
@ -69,6 +69,41 @@ namespace RMuseum.DbContext
|
||||
|
||||
builder.Entity<GanjoorComment>()
|
||||
.HasIndex(c => c.CommentDate);
|
||||
|
||||
builder.Entity<ImportJob>()
|
||||
.Property(c => c.ProgressPercent)
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
//Index set suggested by SQL Server Tuning Wizard -- begin
|
||||
|
||||
builder.Entity<GanjoorComment>()
|
||||
.HasIndex(c => c.Status);
|
||||
|
||||
builder.Entity<GanjoorPoem>()
|
||||
.HasIndex(c => c.Id);
|
||||
|
||||
builder.Entity<Recitation>()
|
||||
.HasIndex(c => c.GanjoorAudioId);
|
||||
|
||||
builder.Entity<Recitation>()
|
||||
.HasIndex(c => new { c.ReviewStatus, c.GanjoorPostId });
|
||||
|
||||
builder.Entity<RArtifactMasterRecord>()
|
||||
.HasIndex(c => c.LastModified);
|
||||
|
||||
builder.Entity<GanjoorPoet>()
|
||||
.HasIndex(c => new { c.Published, c.Id })
|
||||
.IncludeProperties(c => new { c.Name, c.Nickname, c.RImageId });
|
||||
|
||||
builder.Entity<GanjoorCat>()
|
||||
.HasIndex(c => new { c.ParentId, c.PoetId })
|
||||
.IncludeProperties(c => c.Id);
|
||||
|
||||
builder.Entity<PoemMusicTrack>()
|
||||
.HasIndex(c => new { c.Approved, c.Rejected });
|
||||
|
||||
|
||||
//Index set suggested by SQL Server Tuning Wizard -- end
|
||||
}
|
||||
|
||||
|
||||
|
||||
2517
RMuseum/Migrations/20210517052422_TuningWizardSuggestions.Designer.cs
generated
Normal file
2517
RMuseum/Migrations/20210517052422_TuningWizardSuggestions.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
105
RMuseum/Migrations/20210517052422_TuningWizardSuggestions.cs
Normal file
105
RMuseum/Migrations/20210517052422_TuningWizardSuggestions.cs
Normal file
@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace RMuseum.Migrations
|
||||
{
|
||||
public partial class TuningWizardSuggestions : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_GanjoorCategories_ParentId",
|
||||
table: "GanjoorCategories");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Recitations_GanjoorAudioId",
|
||||
table: "Recitations",
|
||||
column: "GanjoorAudioId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Recitations_ReviewStatus_GanjoorPostId",
|
||||
table: "Recitations",
|
||||
columns: new[] { "ReviewStatus", "GanjoorPostId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GanjoorPoets_Published_Id",
|
||||
table: "GanjoorPoets",
|
||||
columns: new[] { "Published", "Id" })
|
||||
.Annotation("SqlServer:Include", new[] { "Name", "Nickname", "RImageId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GanjoorPoems_Id",
|
||||
table: "GanjoorPoems",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GanjoorPoemMusicTracks_Approved_Rejected",
|
||||
table: "GanjoorPoemMusicTracks",
|
||||
columns: new[] { "Approved", "Rejected" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GanjoorComments_Status",
|
||||
table: "GanjoorComments",
|
||||
column: "Status");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GanjoorCategories_ParentId_PoetId",
|
||||
table: "GanjoorCategories",
|
||||
columns: new[] { "ParentId", "PoetId" })
|
||||
.Annotation("SqlServer:Include", new[] { "Id" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Artifacts_LastModified",
|
||||
table: "Artifacts",
|
||||
column: "LastModified");
|
||||
|
||||
migrationBuilder.Sql("CREATE STATISTICS [_ST_Recitations_GanjoorPostIdReviewStatus] ON [dbo].[Recitations]([GanjoorPostId], [ReviewStatus])");
|
||||
migrationBuilder.Sql("CREATE STATISTICS [_ST_GanjoorCategories_PoetIdParentId] ON [dbo].[GanjoorCategories]([PoetId], [ParentId])");
|
||||
migrationBuilder.Sql("CREATE STATISTICS [_ST_Artifacts_CoverItemIndexStatus] ON [dbo].[Artifacts]([CoverItemIndex], [Status])");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Recitations_GanjoorAudioId",
|
||||
table: "Recitations");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Recitations_ReviewStatus_GanjoorPostId",
|
||||
table: "Recitations");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_GanjoorPoets_Published_Id",
|
||||
table: "GanjoorPoets");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_GanjoorPoems_Id",
|
||||
table: "GanjoorPoems");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_GanjoorPoemMusicTracks_Approved_Rejected",
|
||||
table: "GanjoorPoemMusicTracks");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_GanjoorComments_Status",
|
||||
table: "GanjoorComments");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_GanjoorCategories_ParentId_PoetId",
|
||||
table: "GanjoorCategories");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Artifacts_LastModified",
|
||||
table: "Artifacts");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GanjoorCategories_ParentId",
|
||||
table: "GanjoorCategories",
|
||||
column: "ParentId");
|
||||
|
||||
migrationBuilder.Sql("DROP STATISTICS Recitations._ST_Recitations_GanjoorPostIdReviewStatus");
|
||||
migrationBuilder.Sql("DROP STATISTICS GanjoorCategories._ST_GanjoorCategories_PoetIdParentId");
|
||||
migrationBuilder.Sql("DROP STATISTICS Artifacts._ST_Artifacts_CoverItemIndexStatus");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -16,7 +16,7 @@ namespace RMuseum.Migrations
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("ProductVersion", "5.0.5")
|
||||
.HasAnnotation("ProductVersion", "5.0.6")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
@ -212,6 +212,8 @@ namespace RMuseum.Migrations
|
||||
.IsUnique()
|
||||
.HasFilter("[FriendlyUrl] IS NOT NULL");
|
||||
|
||||
b.HasIndex("LastModified");
|
||||
|
||||
b.ToTable("Artifacts");
|
||||
});
|
||||
|
||||
@ -360,10 +362,11 @@ namespace RMuseum.Migrations
|
||||
|
||||
b.HasIndex("FullUrl");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.HasIndex("PoetId");
|
||||
|
||||
b.HasIndex("ParentId", "PoetId")
|
||||
.HasAnnotation("SqlServer:Include", new[] { "Id" });
|
||||
|
||||
b.ToTable("GanjoorCategories");
|
||||
});
|
||||
|
||||
@ -412,6 +415,8 @@ namespace RMuseum.Migrations
|
||||
|
||||
b.HasIndex("PoemId");
|
||||
|
||||
b.HasIndex("Status");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("GanjoorComments");
|
||||
@ -667,6 +672,8 @@ namespace RMuseum.Migrations
|
||||
|
||||
b.HasIndex("GanjoorMetreId");
|
||||
|
||||
b.HasIndex("Id");
|
||||
|
||||
b.ToTable("GanjoorPoems");
|
||||
});
|
||||
|
||||
@ -694,6 +701,9 @@ namespace RMuseum.Migrations
|
||||
|
||||
b.HasIndex("RImageId");
|
||||
|
||||
b.HasIndex("Published", "Id")
|
||||
.HasAnnotation("SqlServer:Include", new[] { "Name", "Nickname", "RImageId" });
|
||||
|
||||
b.ToTable("GanjoorPoets");
|
||||
});
|
||||
|
||||
@ -825,6 +835,8 @@ namespace RMuseum.Migrations
|
||||
|
||||
b.HasIndex("SuggestedById");
|
||||
|
||||
b.HasIndex("Approved", "Rejected");
|
||||
|
||||
b.ToTable("GanjoorPoemMusicTracks");
|
||||
});
|
||||
|
||||
@ -909,12 +921,16 @@ namespace RMuseum.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GanjoorAudioId");
|
||||
|
||||
b.HasIndex("GanjoorPostId");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.HasIndex("ReviewerId");
|
||||
|
||||
b.HasIndex("ReviewStatus", "GanjoorPostId");
|
||||
|
||||
b.ToTable("Recitations");
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user