#221 model changes and database migration

This commit is contained in:
Hamid Reza Mohammadi 2021-10-09 19:15:59 +03:30
parent 61801ac207
commit a4a8ee32b2
6 changed files with 3277 additions and 0 deletions

View File

@ -134,6 +134,12 @@ namespace RMuseum.DbContext
builder.Entity<GanjoorVerseNumber>()
.HasIndex(n => new { n.PoemId, n.CoupletIndex });
builder.Entity<GanjoorVerse>()
.HasIndex(v => v.PoemId);//the next statement causes a drop index in the migration which this line prevents it
builder.Entity<GanjoorVerse>()
.HasIndex(v => new { v.PoemId, v.CoupletIndex });
//Index set suggested by SQL Server Tuning Wizard -- end

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace RMuseum.Migrations
{
public partial class GanjoorVerseCoupletIndex : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "CoupletIndex",
table: "GanjoorVerses",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_GanjoorVerses_PoemId_CoupletIndex",
table: "GanjoorVerses",
columns: new[] { "PoemId", "CoupletIndex" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_GanjoorVerses_PoemId_CoupletIndex",
table: "GanjoorVerses");
migrationBuilder.DropColumn(
name: "CoupletIndex",
table: "GanjoorVerses");
}
}
}

View File

@ -1063,6 +1063,9 @@ namespace RMuseum.Migrations
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("CoupletIndex")
.HasColumnType("int");
b.Property<int>("PoemId")
.HasColumnType("int");
@ -1079,6 +1082,8 @@ namespace RMuseum.Migrations
b.HasIndex("PoemId");
b.HasIndex("PoemId", "CoupletIndex");
b.ToTable("GanjoorVerses");
});

View File

@ -34,5 +34,10 @@
/// text
/// </summary>
public string Text { get; set; }
/// <summary>
/// couplet index
/// </summary>
public int? CoupletIndex { get; set; }
}
}

View File

@ -5549,6 +5549,11 @@
text
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.GanjoorVerse.CoupletIndex">
<summary>
couplet index
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.GanjoorVerseNumber.Id">
<summary>
id