#384 database migrations

This commit is contained in:
Hamid Reza Mohammadi 2023-06-16 16:01:54 +03:30
parent c6f3c48aa8
commit eb7e81317f
5 changed files with 4782 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,92 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace RMuseum.Migrations
{
/// <inheritdoc />
public partial class People : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "PersonId",
table: "PoemGeoDateTags",
type: "int",
nullable: true);
migrationBuilder.CreateTable(
name: "GanjoorRelatedPersons",
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),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
WikiUrl = table.Column<string>(type: "nvarchar(max)", nullable: true),
BirthYearInLHijri = table.Column<int>(type: "int", nullable: false),
DeathYearInLHijri = table.Column<int>(type: "int", nullable: false),
ValidBirthDate = table.Column<bool>(type: "bit", nullable: false),
ValidDeathDate = table.Column<bool>(type: "bit", nullable: false),
BirthLocationId = table.Column<int>(type: "int", nullable: true),
DeathLocationId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_GanjoorRelatedPersons", x => x.Id);
table.ForeignKey(
name: "FK_GanjoorRelatedPersons_GanjoorGeoLocations_BirthLocationId",
column: x => x.BirthLocationId,
principalTable: "GanjoorGeoLocations",
principalColumn: "Id");
table.ForeignKey(
name: "FK_GanjoorRelatedPersons_GanjoorGeoLocations_DeathLocationId",
column: x => x.DeathLocationId,
principalTable: "GanjoorGeoLocations",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_PoemGeoDateTags_PersonId",
table: "PoemGeoDateTags",
column: "PersonId");
migrationBuilder.CreateIndex(
name: "IX_GanjoorRelatedPersons_BirthLocationId",
table: "GanjoorRelatedPersons",
column: "BirthLocationId");
migrationBuilder.CreateIndex(
name: "IX_GanjoorRelatedPersons_DeathLocationId",
table: "GanjoorRelatedPersons",
column: "DeathLocationId");
migrationBuilder.AddForeignKey(
name: "FK_PoemGeoDateTags_GanjoorRelatedPersons_PersonId",
table: "PoemGeoDateTags",
column: "PersonId",
principalTable: "GanjoorRelatedPersons",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PoemGeoDateTags_GanjoorRelatedPersons_PersonId",
table: "PoemGeoDateTags");
migrationBuilder.DropTable(
name: "GanjoorRelatedPersons");
migrationBuilder.DropIndex(
name: "IX_PoemGeoDateTags_PersonId",
table: "PoemGeoDateTags");
migrationBuilder.DropColumn(
name: "PersonId",
table: "PoemGeoDateTags");
}
}
}

View File

@ -1745,6 +1745,50 @@ namespace RMuseum.Migrations
b.ToTable("GanjoorPoetSuggestedSpecLines");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorRelatedPerson", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("BirthLocationId")
.HasColumnType("int");
b.Property<int>("BirthYearInLHijri")
.HasColumnType("int");
b.Property<int?>("DeathLocationId")
.HasColumnType("int");
b.Property<int>("DeathYearInLHijri")
.HasColumnType("int");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<bool>("ValidBirthDate")
.HasColumnType("bit");
b.Property<bool>("ValidDeathDate")
.HasColumnType("bit");
b.Property<string>("WikiUrl")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("BirthLocationId");
b.HasIndex("DeathLocationId");
b.ToTable("GanjoorRelatedPersons");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorSiteBanner", b =>
{
b.Property<int>("Id")
@ -2052,6 +2096,9 @@ namespace RMuseum.Migrations
b.Property<int?>("LunarYear")
.HasColumnType("int");
b.Property<int?>("PersonId")
.HasColumnType("int");
b.Property<int>("PoemId")
.HasColumnType("int");
@ -2062,6 +2109,8 @@ namespace RMuseum.Migrations
b.HasIndex("LocationId");
b.HasIndex("PersonId");
b.HasIndex("PoemId");
b.ToTable("PoemGeoDateTags");
@ -3966,6 +4015,21 @@ namespace RMuseum.Migrations
b.Navigation("SuggestedBy");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorRelatedPerson", b =>
{
b.HasOne("RMuseum.Models.Ganjoor.GanjoorGeoLocation", "BirthLocation")
.WithMany()
.HasForeignKey("BirthLocationId");
b.HasOne("RMuseum.Models.Ganjoor.GanjoorGeoLocation", "DeathLocation")
.WithMany()
.HasForeignKey("DeathLocationId");
b.Navigation("BirthLocation");
b.Navigation("DeathLocation");
});
modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorSiteBanner", b =>
{
b.HasOne("RSecurityBackend.Models.Image.RImage", "RImage")
@ -4069,6 +4133,10 @@ namespace RMuseum.Migrations
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("RMuseum.Models.Ganjoor.GanjoorRelatedPerson", "Person")
.WithMany()
.HasForeignKey("PersonId");
b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem")
.WithMany()
.HasForeignKey("PoemId")
@ -4077,6 +4145,8 @@ namespace RMuseum.Migrations
b.Navigation("Location");
b.Navigation("Person");
b.Navigation("Poem");
});

View File

@ -3296,6 +3296,18 @@
<member name="M:RMuseum.Migrations.CatFields.BuildTargetModel(Microsoft.EntityFrameworkCore.ModelBuilder)">
<inheritdoc />
</member>
<member name="T:RMuseum.Migrations.People">
<inheritdoc />
</member>
<member name="M:RMuseum.Migrations.People.Up(Microsoft.EntityFrameworkCore.Migrations.MigrationBuilder)">
<inheritdoc />
</member>
<member name="M:RMuseum.Migrations.People.Down(Microsoft.EntityFrameworkCore.Migrations.MigrationBuilder)">
<inheritdoc />
</member>
<member name="M:RMuseum.Migrations.People.BuildTargetModel(Microsoft.EntityFrameworkCore.ModelBuilder)">
<inheritdoc />
</member>
<member name="T:RMuseum.Models.Accounting.DonationExpenditure">
<summary>
donation expenditures

View File

@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"DefaultConnection": "(localdb)\\mssqllocaldb;Database=museum;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True"
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=museum;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"RSecurityBackend": {
"ApplicationName": "Ganjoor",