divan/RMuseum/Migrations/20260928051202_FamilyTreeModels.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

122 lines
5.0 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace RMuseum.Migrations
{
/// <inheritdoc />
public partial class FamilyTreeModels : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "FamilyTreeCaption",
table: "DiwanRelatedPersons",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "SuggestedPersonGraphJson",
table: "DiwanPoemGeoDateTagCorrection",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.CreateTable(
name: "DiwanPersonAffiliations",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Person1Id = table.Column<int>(type: "int", nullable: false),
Person2Id = table.Column<int>(type: "int", nullable: false),
AffiliationType = table.Column<int>(type: "int", nullable: false),
Note = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DiwanPersonAffiliations", x => x.Id);
table.ForeignKey(
name: "FK_DiwanPersonAffiliations_DiwanRelatedPersons_Person1Id",
column: x => x.Person1Id,
principalTable: "DiwanRelatedPersons",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_DiwanPersonAffiliations_DiwanRelatedPersons_Person2Id",
column: x => x.Person2Id,
principalTable: "DiwanRelatedPersons",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "DiwanPersonRelations",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Person1Id = table.Column<int>(type: "int", nullable: false),
Person2Id = table.Column<int>(type: "int", nullable: false),
RelationType = table.Column<int>(type: "int", nullable: false),
DegreeHint = table.Column<int>(type: "int", nullable: true),
Note = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DiwanPersonRelations", x => x.Id);
table.ForeignKey(
name: "FK_DiwanPersonRelations_DiwanRelatedPersons_Person1Id",
column: x => x.Person1Id,
principalTable: "DiwanRelatedPersons",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_DiwanPersonRelations_DiwanRelatedPersons_Person2Id",
column: x => x.Person2Id,
principalTable: "DiwanRelatedPersons",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_DiwanPersonAffiliations_Person1Id",
table: "DiwanPersonAffiliations",
column: "Person1Id");
migrationBuilder.CreateIndex(
name: "IX_DiwanPersonAffiliations_Person2Id",
table: "DiwanPersonAffiliations",
column: "Person2Id");
migrationBuilder.CreateIndex(
name: "IX_DiwanPersonRelations_Person1Id",
table: "DiwanPersonRelations",
column: "Person1Id");
migrationBuilder.CreateIndex(
name: "IX_DiwanPersonRelations_Person2Id",
table: "DiwanPersonRelations",
column: "Person2Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DiwanPersonAffiliations");
migrationBuilder.DropTable(
name: "DiwanPersonRelations");
migrationBuilder.DropColumn(
name: "FamilyTreeCaption",
table: "DiwanRelatedPersons");
migrationBuilder.DropColumn(
name: "SuggestedPersonGraphJson",
table: "DiwanPoemGeoDateTagCorrection");
}
}
}