#217 database migration
This commit is contained in:
parent
73210ddbef
commit
2c8751b92f
3207
RMuseum/Migrations/20211003093459_GanjoorNumberings.Designer.cs
generated
Normal file
3207
RMuseum/Migrations/20211003093459_GanjoorNumberings.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
93
RMuseum/Migrations/20211003093459_GanjoorNumberings.cs
Normal file
93
RMuseum/Migrations/20211003093459_GanjoorNumberings.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace RMuseum.Migrations
|
||||
{
|
||||
public partial class GanjoorNumberings : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GanjoorNumberings",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
StartCatId = table.Column<int>(type: "int", nullable: false),
|
||||
EndCatId = table.Column<int>(type: "int", nullable: true),
|
||||
TotalCouplets = table.Column<int>(type: "int", nullable: false),
|
||||
TotalVerses = table.Column<int>(type: "int", nullable: false),
|
||||
LastCountingDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GanjoorNumberings", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_GanjoorNumberings_GanjoorCategories_EndCatId",
|
||||
column: x => x.EndCatId,
|
||||
principalTable: "GanjoorCategories",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_GanjoorNumberings_GanjoorCategories_StartCatId",
|
||||
column: x => x.StartCatId,
|
||||
principalTable: "GanjoorCategories",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GanjoorVerseNumbers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
NumberingId = table.Column<int>(type: "int", nullable: false),
|
||||
PoemId = table.Column<int>(type: "int", nullable: false),
|
||||
CoupletIndex = table.Column<int>(type: "int", nullable: false),
|
||||
Number = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GanjoorVerseNumbers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_GanjoorVerseNumbers_GanjoorNumberings_NumberingId",
|
||||
column: x => x.NumberingId,
|
||||
principalTable: "GanjoorNumberings",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GanjoorNumberings_EndCatId",
|
||||
table: "GanjoorNumberings",
|
||||
column: "EndCatId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GanjoorNumberings_StartCatId",
|
||||
table: "GanjoorNumberings",
|
||||
column: "StartCatId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GanjoorVerseNumbers_NumberingId_PoemId_CoupletIndex",
|
||||
table: "GanjoorVerseNumbers",
|
||||
columns: new[] { "NumberingId", "PoemId", "CoupletIndex" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GanjoorVerseNumbers_PoemId_CoupletIndex",
|
||||
table: "GanjoorVerseNumbers",
|
||||
columns: new[] { "PoemId", "CoupletIndex" });
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "GanjoorVerseNumbers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "GanjoorNumberings");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -641,6 +641,40 @@ namespace RMuseum.Migrations
|
||||
b.ToTable("GanjoorMetres");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorNumbering", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int?>("EndCatId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("LastCountingDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("StartCatId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TotalCouplets")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TotalVerses")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EndCatId");
|
||||
|
||||
b.HasIndex("StartCatId");
|
||||
|
||||
b.ToTable("GanjoorNumberings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPage", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -1042,6 +1076,35 @@ namespace RMuseum.Migrations
|
||||
b.ToTable("GanjoorVerses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerseNumber", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("CoupletIndex")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Number")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("NumberingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PoemId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PoemId", "CoupletIndex");
|
||||
|
||||
b.HasIndex("NumberingId", "PoemId", "CoupletIndex")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("GanjoorVerseNumbers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerseTranslation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -2520,6 +2583,23 @@ namespace RMuseum.Migrations
|
||||
b.Navigation("ReportedBy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorNumbering", b =>
|
||||
{
|
||||
b.HasOne("RMuseum.Models.Ganjoor.GanjoorCat", "EndCat")
|
||||
.WithMany()
|
||||
.HasForeignKey("EndCatId");
|
||||
|
||||
b.HasOne("RMuseum.Models.Ganjoor.GanjoorCat", "StartCat")
|
||||
.WithMany()
|
||||
.HasForeignKey("StartCatId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("EndCat");
|
||||
|
||||
b.Navigation("StartCat");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPage", b =>
|
||||
{
|
||||
b.HasOne("RMuseum.Models.Ganjoor.GanjoorCat", "Cat")
|
||||
@ -2705,6 +2785,17 @@ namespace RMuseum.Migrations
|
||||
b.Navigation("Poem");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerseNumber", b =>
|
||||
{
|
||||
b.HasOne("RMuseum.Models.Ganjoor.GanjoorNumbering", "Numbering")
|
||||
.WithMany()
|
||||
.HasForeignKey("NumberingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Numbering");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerseTranslation", b =>
|
||||
{
|
||||
b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoemTranslation", null)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user