#186 PoemCorrections db migration added

This commit is contained in:
Hamid Reza Mohammadi 2021-07-29 20:22:35 +04:30
parent 055d6fc00f
commit 3fecaa8db1
4 changed files with 3044 additions and 1 deletions

View File

@ -22,7 +22,7 @@ namespace RMuseum.DbContext
{
public RMuseumDbContext(DbContextOptions<RMuseumDbContext> options) : base(options)
{
//Database.Migrate();
Database.Migrate();
}
/// <summary>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,107 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace RMuseum.Migrations
{
public partial class PoemCorrections : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "GanjoorPoemCorrections",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PoemId = table.Column<int>(type: "int", nullable: false),
Title = table.Column<string>(type: "nvarchar(max)", nullable: true),
OriginalTitle = table.Column<string>(type: "nvarchar(max)", nullable: true),
Rhythm = table.Column<string>(type: "nvarchar(max)", nullable: true),
OriginalRhythm = table.Column<string>(type: "nvarchar(max)", nullable: true),
Note = table.Column<string>(type: "nvarchar(max)", nullable: true),
Date = table.Column<DateTime>(type: "datetime2", nullable: false),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Reviewed = table.Column<bool>(type: "bit", nullable: false),
ReviewDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ReviewNote = table.Column<string>(type: "nvarchar(max)", nullable: true),
ReviewerUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ApplicationOrder = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GanjoorPoemCorrections", x => x.Id);
table.ForeignKey(
name: "FK_GanjoorPoemCorrections_AspNetUsers_ReviewerUserId",
column: x => x.ReviewerUserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_GanjoorPoemCorrections_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GanjoorPoemCorrections_GanjoorPoems_PoemId",
column: x => x.PoemId,
principalTable: "GanjoorPoems",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "GanjoorVerseVOrderText",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
VORder = table.Column<int>(type: "int", nullable: false),
Text = table.Column<string>(type: "nvarchar(max)", nullable: true),
OriginalText = table.Column<string>(type: "nvarchar(max)", nullable: true),
Result = table.Column<int>(type: "int", nullable: false),
ReviewNote = table.Column<string>(type: "nvarchar(max)", nullable: true),
GanjoorPoemCorrectionId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_GanjoorVerseVOrderText", x => x.Id);
table.ForeignKey(
name: "FK_GanjoorVerseVOrderText_GanjoorPoemCorrections_GanjoorPoemCorrectionId",
column: x => x.GanjoorPoemCorrectionId,
principalTable: "GanjoorPoemCorrections",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_GanjoorPoemCorrections_PoemId",
table: "GanjoorPoemCorrections",
column: "PoemId");
migrationBuilder.CreateIndex(
name: "IX_GanjoorPoemCorrections_ReviewerUserId",
table: "GanjoorPoemCorrections",
column: "ReviewerUserId");
migrationBuilder.CreateIndex(
name: "IX_GanjoorPoemCorrections_UserId",
table: "GanjoorPoemCorrections",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_GanjoorVerseVOrderText_GanjoorPoemCorrectionId",
table: "GanjoorVerseVOrderText",
column: "GanjoorPoemCorrectionId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "GanjoorVerseVOrderText");
migrationBuilder.DropTable(
name: "GanjoorPoemCorrections");
}
}
}

View File

@ -770,6 +770,63 @@ namespace RMuseum.Migrations
b.ToTable("GanjoorPoems");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemCorrection", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ApplicationOrder")
.HasColumnType("int");
b.Property<DateTime>("Date")
.HasColumnType("datetime2");
b.Property<string>("Note")
.HasColumnType("nvarchar(max)");
b.Property<string>("OriginalRhythm")
.HasColumnType("nvarchar(max)");
b.Property<string>("OriginalTitle")
.HasColumnType("nvarchar(max)");
b.Property<int>("PoemId")
.HasColumnType("int");
b.Property<DateTime>("ReviewDate")
.HasColumnType("datetime2");
b.Property<string>("ReviewNote")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Reviewed")
.HasColumnType("bit");
b.Property<Guid?>("ReviewerUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Rhythm")
.HasColumnType("nvarchar(max)");
b.Property<string>("Title")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("PoemId");
b.HasIndex("ReviewerUserId");
b.HasIndex("UserId");
b.ToTable("GanjoorPoemCorrections");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoet", b =>
{
b.Property<int>("Id")
@ -852,6 +909,38 @@ namespace RMuseum.Migrations
b.ToTable("GanjoorVerses");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerseVOrderText", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("GanjoorPoemCorrectionId")
.HasColumnType("int");
b.Property<string>("OriginalText")
.HasColumnType("nvarchar(max)");
b.Property<int>("Result")
.HasColumnType("int");
b.Property<string>("ReviewNote")
.HasColumnType("nvarchar(max)");
b.Property<string>("Text")
.HasColumnType("nvarchar(max)");
b.Property<int>("VORder")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("GanjoorPoemCorrectionId");
b.ToTable("GanjoorVerseVOrderText");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.PoemMusicTrack", b =>
{
b.Property<int>("Id")
@ -2285,6 +2374,31 @@ namespace RMuseum.Migrations
b.Navigation("GanjoorMetre");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemCorrection", b =>
{
b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem")
.WithMany()
.HasForeignKey("PoemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "ReviewerUser")
.WithMany()
.HasForeignKey("ReviewerUserId");
b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Poem");
b.Navigation("ReviewerUser");
b.Navigation("User");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoet", b =>
{
b.HasOne("RSecurityBackend.Models.Image.RImage", "RImage")
@ -2316,6 +2430,13 @@ namespace RMuseum.Migrations
b.Navigation("Poem");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerseVOrderText", b =>
{
b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoemCorrection", null)
.WithMany("VerseOrderText")
.HasForeignKey("GanjoorPoemCorrectionId");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.PoemMusicTrack", b =>
{
b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorTrack", "GanjoorTrack")
@ -2647,6 +2768,11 @@ namespace RMuseum.Migrations
b.Navigation("Tags");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemCorrection", b =>
{
b.Navigation("VerseOrderText");
});
modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorAlbum", b =>
{
b.Navigation("Tracks");