divan/RMuseum/Migrations/20211004112009_DiwanNumberings.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

98 lines
4.3 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace RMuseum.Migrations
{
public partial class DiwanNumberings : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DiwanNumberings",
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),
StartCatId = table.Column<int>(type: "int", nullable: false),
EndCatId = table.Column<int>(type: "int", nullable: true),
TotalLines = table.Column<int>(type: "int", nullable: false),
TotalVerses = table.Column<int>(type: "int", nullable: false),
TotalCouplets = table.Column<int>(type: "int", nullable: false),
TotalParagraphs = table.Column<int>(type: "int", nullable: false),
LastCountingDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DiwanNumberings", x => x.Id);
table.ForeignKey(
name: "FK_DiwanNumberings_DiwanCategories_EndCatId",
column: x => x.EndCatId,
principalTable: "DiwanCategories",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_DiwanNumberings_DiwanCategories_StartCatId",
column: x => x.StartCatId,
principalTable: "DiwanCategories",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DiwanVerseNumbers",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
NumberingId = table.Column<int>(type: "int", nullable: false),
PoemId = table.Column<int>(type: "int", nullable: false),
CoupletIndex = table.Column<int>(type: "int", nullable: false),
Number = table.Column<int>(type: "int", nullable: false),
IsPoemVerse = table.Column<bool>(type: "bit", nullable: false),
SameTypeNumber = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DiwanVerseNumbers", x => x.Id);
table.ForeignKey(
name: "FK_DiwanVerseNumbers_DiwanNumberings_NumberingId",
column: x => x.NumberingId,
principalTable: "DiwanNumberings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_DiwanNumberings_EndCatId",
table: "DiwanNumberings",
column: "EndCatId");
migrationBuilder.CreateIndex(
name: "IX_DiwanNumberings_StartCatId",
table: "DiwanNumberings",
column: "StartCatId");
migrationBuilder.CreateIndex(
name: "IX_DiwanVerseNumbers_NumberingId_PoemId_CoupletIndex",
table: "DiwanVerseNumbers",
columns: new[] { "NumberingId", "PoemId", "CoupletIndex" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_DiwanVerseNumbers_PoemId_CoupletIndex",
table: "DiwanVerseNumbers",
columns: new[] { "PoemId", "CoupletIndex" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DiwanVerseNumbers");
migrationBuilder.DropTable(
name: "DiwanNumberings");
}
}
}