#106 site banner db migration

This commit is contained in:
Hamid Reza Mohammadi 2021-04-22 16:10:12 +04:30
parent a3d82ad01f
commit 1f90b8044e
3 changed files with 2398 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace RMuseum.Migrations
{
public partial class SiteBanner : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "GanjoorSiteBanners",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RImageId = table.Column<Guid>(nullable: false),
AlternateText = table.Column<string>(nullable: true),
TargetUrl = table.Column<string>(nullable: true),
Active = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GanjoorSiteBanners", x => x.Id);
table.ForeignKey(
name: "FK_GanjoorSiteBanners_GeneralImages_RImageId",
column: x => x.RImageId,
principalTable: "GeneralImages",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_GanjoorSiteBanners_RImageId",
table: "GanjoorSiteBanners",
column: "RImageId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "GanjoorSiteBanners");
}
}
}

View File

@ -671,6 +671,32 @@ namespace RMuseum.Migrations
b.ToTable("GanjoorPoets");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorSiteBanner", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<bool>("Active")
.HasColumnType("bit");
b.Property<string>("AlternateText")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("RImageId")
.HasColumnType("uniqueidentifier");
b.Property<string>("TargetUrl")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("RImageId");
b.ToTable("GanjoorSiteBanners");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerse", b =>
{
b.Property<int>("Id")
@ -2038,6 +2064,15 @@ namespace RMuseum.Migrations
.HasForeignKey("RImageId");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorSiteBanner", b =>
{
b.HasOne("RSecurityBackend.Models.Image.RImage", "RImage")
.WithMany()
.HasForeignKey("RImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerse", b =>
{
b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem")