divan/RMuseum/Migrations/20230616122943_People.cs
Anas Rashid e8f2306422 Rename Ganjoor -> Diwan throughout the code
Projects (GanjooRazor -> DiwanRazor, GanjoorService.sln -> DiwanService.sln), files,
folders, classes, namespaces, settings, API routes (/api/diwan) and DB tables (Diwan*).
External addresses (ganjoor.net, github.com/ganjoor) unchanged. Migrations renamed
consistently (no pending model changes); requires a fresh database.
Upstream RUNNING_LOCALLY/SEMANTIC_SEARCH docs archived unmodified under docs/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 23:49:01 +02:00

93 lines
3.7 KiB
C#

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: "DiwanRelatedPersons",
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_DiwanRelatedPersons", x => x.Id);
table.ForeignKey(
name: "FK_DiwanRelatedPersons_DiwanGeoLocations_BirthLocationId",
column: x => x.BirthLocationId,
principalTable: "DiwanGeoLocations",
principalColumn: "Id");
table.ForeignKey(
name: "FK_DiwanRelatedPersons_DiwanGeoLocations_DeathLocationId",
column: x => x.DeathLocationId,
principalTable: "DiwanGeoLocations",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_PoemGeoDateTags_PersonId",
table: "PoemGeoDateTags",
column: "PersonId");
migrationBuilder.CreateIndex(
name: "IX_DiwanRelatedPersons_BirthLocationId",
table: "DiwanRelatedPersons",
column: "BirthLocationId");
migrationBuilder.CreateIndex(
name: "IX_DiwanRelatedPersons_DeathLocationId",
table: "DiwanRelatedPersons",
column: "DeathLocationId");
migrationBuilder.AddForeignKey(
name: "FK_PoemGeoDateTags_DiwanRelatedPersons_PersonId",
table: "PoemGeoDateTags",
column: "PersonId",
principalTable: "DiwanRelatedPersons",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PoemGeoDateTags_DiwanRelatedPersons_PersonId",
table: "PoemGeoDateTags");
migrationBuilder.DropTable(
name: "DiwanRelatedPersons");
migrationBuilder.DropIndex(
name: "IX_PoemGeoDateTags_PersonId",
table: "PoemGeoDateTags");
migrationBuilder.DropColumn(
name: "PersonId",
table: "PoemGeoDateTags");
}
}
}