#224 db migration

This commit is contained in:
Hamid Reza Mohammadi 2021-10-21 10:28:37 +03:30
parent 8e2cf5e048
commit 1526b9f885
3 changed files with 3385 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,86 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace RMuseum.Migrations
{
public partial class GanjoorHalfCenturies : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "BirthYearInLHijri",
table: "GanjoorPoets",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "DeathYearInLHijri",
table: "GanjoorPoets",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "GanjoorHalfCenturyId",
table: "GanjoorPoets",
type: "int",
nullable: true);
migrationBuilder.CreateTable(
name: "GanjoorHalfCenturies",
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),
HalfCenturyOrder = table.Column<int>(type: "int", nullable: false),
StartYear = table.Column<int>(type: "int", nullable: false),
EndYear = table.Column<int>(type: "int", nullable: false),
ShowInTimeLine = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GanjoorHalfCenturies", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_GanjoorPoets_GanjoorHalfCenturyId",
table: "GanjoorPoets",
column: "GanjoorHalfCenturyId");
migrationBuilder.AddForeignKey(
name: "FK_GanjoorPoets_GanjoorHalfCenturies_GanjoorHalfCenturyId",
table: "GanjoorPoets",
column: "GanjoorHalfCenturyId",
principalTable: "GanjoorHalfCenturies",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_GanjoorPoets_GanjoorHalfCenturies_GanjoorHalfCenturyId",
table: "GanjoorPoets");
migrationBuilder.DropTable(
name: "GanjoorHalfCenturies");
migrationBuilder.DropIndex(
name: "IX_GanjoorPoets_GanjoorHalfCenturyId",
table: "GanjoorPoets");
migrationBuilder.DropColumn(
name: "BirthYearInLHijri",
table: "GanjoorPoets");
migrationBuilder.DropColumn(
name: "DeathYearInLHijri",
table: "GanjoorPoets");
migrationBuilder.DropColumn(
name: "GanjoorHalfCenturyId",
table: "GanjoorPoets");
}
}
}

View File

@ -559,6 +559,33 @@ namespace RMuseum.Migrations
b.ToTable("GanjoorReportedComments");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorHalfCentury", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("EndYear")
.HasColumnType("int");
b.Property<int>("HalfCenturyOrder")
.HasColumnType("int");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<bool>("ShowInTimeLine")
.HasColumnType("bit");
b.Property<int>("StartYear")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("GanjoorHalfCenturies");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorHealthCheckError", b =>
{
b.Property<int>("Id")
@ -967,9 +994,18 @@ namespace RMuseum.Migrations
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("BirthYearInLHijri")
.HasColumnType("int");
b.Property<int>("DeathYearInLHijri")
.HasColumnType("int");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<int?>("GanjoorHalfCenturyId")
.HasColumnType("int");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
@ -984,6 +1020,8 @@ namespace RMuseum.Migrations
b.HasKey("Id");
b.HasIndex("GanjoorHalfCenturyId");
b.HasIndex("RImageId");
b.HasIndex("Published", "Id")
@ -2735,6 +2773,10 @@ namespace RMuseum.Migrations
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoet", b =>
{
b.HasOne("RMuseum.Models.Ganjoor.GanjoorHalfCentury", null)
.WithMany("Poets")
.HasForeignKey("GanjoorHalfCenturyId");
b.HasOne("RSecurityBackend.Models.Image.RImage", "RImage")
.WithMany()
.HasForeignKey("RImageId");
@ -3158,6 +3200,11 @@ namespace RMuseum.Migrations
b.Navigation("Tags");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorHalfCentury", b =>
{
b.Navigation("Poets");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemCorrection", b =>
{
b.Navigation("VerseOrderText");