Переосмысление аттрибутов переберающих процессоров и устаревшых элементов

This commit is contained in:
2025-05-14 15:44:32 +04:00
parent e6f53fc074
commit 995029ce8d
36 changed files with 1036 additions and 68 deletions
@@ -13,7 +13,7 @@ using Pf2eModel.Model.Enum;
namespace Pf2eModel.Migrations
{
[DbContext(typeof(Pf2eDbContext))]
[Migration("20250514084949_1")]
[Migration("20250514102154_1")]
partial class _1
{
/// <inheritdoc />
@@ -86,6 +86,25 @@ namespace Pf2eModel.Migrations
b.ToTable("entity_keyword", (string)null);
});
modelBuilder.Entity("EntityLegacyEntity", b =>
{
b.Property<int>("LegacyEntitiesId")
.HasColumnType("integer")
.HasColumnName("legacy_entities_id");
b.Property<int>("RemasterEntitiesId")
.HasColumnType("integer")
.HasColumnName("remaster_entities_id");
b.HasKey("LegacyEntitiesId", "RemasterEntitiesId")
.HasName("pk_entity_legacy_entity");
b.HasIndex("RemasterEntitiesId")
.HasDatabaseName("ix_entity_legacy_entity_remaster_entities_id");
b.ToTable("entity_legacy_entity", (string)null);
});
modelBuilder.Entity("EntityTrait", b =>
{
b.Property<int>("EntitiesId")
@@ -240,6 +259,123 @@ namespace Pf2eModel.Migrations
b.ToTable("keyword_aliases", (string)null);
});
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasColumnOrder(1);
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("jsonb")
.HasColumnName("name")
.HasColumnOrder(2)
.HasComment("Отображаемое имя");
b.HasKey("Id")
.HasName("pk_legacy_entities");
b.ToTable("legacy_entities", (string)null);
});
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntityExternal", b =>
{
b.Property<int>("LegacyEntityId")
.HasColumnType("integer")
.HasColumnName("legacy_entity_id")
.HasColumnOrder(1)
.HasComment("Идентификатор сущности");
b.Property<int>("TargetId")
.HasColumnType("integer")
.HasColumnName("target_id")
.HasColumnOrder(2)
.HasComment("Идентификатор цели");
b.Property<string>("ExternalId")
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("external_id")
.HasColumnOrder(3);
b.Property<string>("Md5")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasColumnName("md5")
.HasColumnOrder(5)
.HasComment("Контрольная сумма объекта");
b.Property<string>("Suffix")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("suffix")
.HasColumnOrder(4)
.HasComment("Часть URL до объекта. Для источников Foundry - полный UUID объекта");
b.HasKey("LegacyEntityId", "TargetId")
.HasName("pk_legacy_entity_externals");
b.HasIndex("TargetId")
.HasDatabaseName("ix_legacy_entity_externals_target_id");
b.ToTable("legacy_entity_externals", (string)null);
});
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntitySource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasColumnOrder(0)
.HasComment("Идентификатор");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<bool>("IsRemaster")
.HasColumnType("boolean")
.HasColumnName("is_remaster")
.HasColumnOrder(4)
.HasComment("Флаг, указывающий, что объект является частью ремастера");
b.Property<int>("LegacyEntityId")
.HasColumnType("integer")
.HasColumnName("legacy_entity_id")
.HasColumnOrder(1)
.HasComment("Идентификатор устаревшей сущности");
b.Property<int>("SourceId")
.HasColumnType("integer")
.HasColumnName("source_id")
.HasColumnOrder(2)
.HasComment("Идентификатор источника");
b.Property<string>("Suffix")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("suffix")
.HasColumnOrder(3)
.HasComment("Номер страницы, эррата и т.д.");
b.HasKey("Id")
.HasName("pk_legacy_entity_sources");
b.HasIndex("LegacyEntityId")
.HasDatabaseName("ix_legacy_entity_sources_legacy_entity_id");
b.HasIndex("SourceId")
.HasDatabaseName("ix_legacy_entity_sources_source_id");
b.ToTable("legacy_entity_sources", (string)null);
});
modelBuilder.Entity("Pf2eModel.Model.Base.Source.EntitySource", b =>
{
b.Property<int>("Id")
@@ -340,6 +476,12 @@ namespace Pf2eModel.Migrations
.HasColumnOrder(2)
.HasComment("Идентификатор цели");
b.Property<string>("ExternalId")
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("external_id")
.HasColumnOrder(3);
b.Property<string>("Md5")
.IsRequired()
.HasMaxLength(32)
@@ -1842,6 +1984,23 @@ namespace Pf2eModel.Migrations
.HasConstraintName("fk_entity_keyword_keywords_keywords_id");
});
modelBuilder.Entity("EntityLegacyEntity", b =>
{
b.HasOne("Pf2eModel.Model.Base.Legacy.LegacyEntity", null)
.WithMany()
.HasForeignKey("LegacyEntitiesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_entity_legacy_entity_legacy_entities_legacy_entities_id");
b.HasOne("Pf2eModel.Model.Base.Entity", null)
.WithMany()
.HasForeignKey("RemasterEntitiesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_entity_legacy_entity_entities_remaster_entities_id");
});
modelBuilder.Entity("EntityTrait", b =>
{
b.HasOne("Pf2eModel.Model.Base.Entity", null)
@@ -1871,6 +2030,48 @@ namespace Pf2eModel.Migrations
b.Navigation("Keyword");
});
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntityExternal", b =>
{
b.HasOne("Pf2eModel.Model.Base.Legacy.LegacyEntity", "LegacyEntity")
.WithMany("Externals")
.HasForeignKey("LegacyEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_legacy_entity_externals_legacy_entities_legacy_entity_id");
b.HasOne("Pf2eModel.Model.Base.Targets.ExternalTarget", "Target")
.WithMany("LegacyEntityExternals")
.HasForeignKey("TargetId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_legacy_entity_externals_external_targets_target_id");
b.Navigation("LegacyEntity");
b.Navigation("Target");
});
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntitySource", b =>
{
b.HasOne("Pf2eModel.Model.Base.Legacy.LegacyEntity", "LegacyEntity")
.WithMany("Sources")
.HasForeignKey("LegacyEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_legacy_entity_sources_legacy_entities_legacy_entity_id");
b.HasOne("Pf2eModel.Model.Base.Source.Source", "Source")
.WithMany("LegacyEntitySources")
.HasForeignKey("SourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_legacy_entity_sources_sources_source_id");
b.Navigation("LegacyEntity");
b.Navigation("Source");
});
modelBuilder.Entity("Pf2eModel.Model.Base.Source.EntitySource", b =>
{
b.HasOne("Pf2eModel.Model.Base.Entity", "Entity")
@@ -2509,14 +2710,25 @@ namespace Pf2eModel.Migrations
b.Navigation("Aliases");
});
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntity", b =>
{
b.Navigation("Externals");
b.Navigation("Sources");
});
modelBuilder.Entity("Pf2eModel.Model.Base.Source.Source", b =>
{
b.Navigation("EntitySources");
b.Navigation("LegacyEntitySources");
});
modelBuilder.Entity("Pf2eModel.Model.Base.Targets.ExternalTarget", b =>
{
b.Navigation("EntityExternals");
b.Navigation("LegacyEntityExternals");
});
modelBuilder.Entity("Pf2eModel.Model.Structure.Ancestry", b =>
@@ -101,6 +101,19 @@ namespace Pf2eModel.Migrations
table.PrimaryKey("pk_keywords", x => x.id);
});
migrationBuilder.CreateTable(
name: "legacy_entities",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(type: "jsonb", nullable: false, comment: "Отображаемое имя")
},
constraints: table =>
{
table.PrimaryKey("pk_legacy_entities", x => x.id);
});
migrationBuilder.CreateTable(
name: "sources",
columns: table => new
@@ -399,6 +412,7 @@ namespace Pf2eModel.Migrations
{
entity_id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор сущности"),
target_id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор цели"),
external_id = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
suffix = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, comment: "Часть URL до объекта. Для источников Foundry - полный UUID объекта"),
md5 = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "Контрольная сумма объекта")
},
@@ -463,6 +477,57 @@ namespace Pf2eModel.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "entity_legacy_entity",
columns: table => new
{
legacy_entities_id = table.Column<int>(type: "integer", nullable: false),
remaster_entities_id = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_entity_legacy_entity", x => new { x.legacy_entities_id, x.remaster_entities_id });
table.ForeignKey(
name: "fk_entity_legacy_entity_entities_remaster_entities_id",
column: x => x.remaster_entities_id,
principalTable: "entities",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_entity_legacy_entity_legacy_entities_legacy_entities_id",
column: x => x.legacy_entities_id,
principalTable: "legacy_entities",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "legacy_entity_externals",
columns: table => new
{
legacy_entity_id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор сущности"),
target_id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор цели"),
external_id = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
suffix = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, comment: "Часть URL до объекта. Для источников Foundry - полный UUID объекта"),
md5 = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "Контрольная сумма объекта")
},
constraints: table =>
{
table.PrimaryKey("pk_legacy_entity_externals", x => new { x.legacy_entity_id, x.target_id });
table.ForeignKey(
name: "fk_legacy_entity_externals_external_targets_target_id",
column: x => x.target_id,
principalTable: "external_targets",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_legacy_entity_externals_legacy_entities_legacy_entity_id",
column: x => x.legacy_entity_id,
principalTable: "legacy_entities",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "entity_sources",
columns: table => new
@@ -491,6 +556,34 @@ namespace Pf2eModel.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "legacy_entity_sources",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
legacy_entity_id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор устаревшей сущности"),
source_id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор источника"),
suffix = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, comment: "Номер страницы, эррата и т.д."),
is_remaster = table.Column<bool>(type: "boolean", nullable: false, comment: "Флаг, указывающий, что объект является частью ремастера")
},
constraints: table =>
{
table.PrimaryKey("pk_legacy_entity_sources", x => x.id);
table.ForeignKey(
name: "fk_legacy_entity_sources_legacy_entities_legacy_entity_id",
column: x => x.legacy_entity_id,
principalTable: "legacy_entities",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_legacy_entity_sources_sources_source_id",
column: x => x.source_id,
principalTable: "sources",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ancestry_boosts",
columns: table => new
@@ -1260,6 +1353,11 @@ namespace Pf2eModel.Migrations
table: "entity_keyword",
column: "keywords_id");
migrationBuilder.CreateIndex(
name: "ix_entity_legacy_entity_remaster_entities_id",
table: "entity_legacy_entity",
column: "remaster_entities_id");
migrationBuilder.CreateIndex(
name: "ix_entity_sources_entity_id",
table: "entity_sources",
@@ -1295,6 +1393,21 @@ namespace Pf2eModel.Migrations
table: "languages",
column: "entity_id");
migrationBuilder.CreateIndex(
name: "ix_legacy_entity_externals_target_id",
table: "legacy_entity_externals",
column: "target_id");
migrationBuilder.CreateIndex(
name: "ix_legacy_entity_sources_legacy_entity_id",
table: "legacy_entity_sources",
column: "legacy_entity_id");
migrationBuilder.CreateIndex(
name: "ix_legacy_entity_sources_source_id",
table: "legacy_entity_sources",
column: "source_id");
migrationBuilder.CreateIndex(
name: "ix_ritual_checks_ritual_id",
table: "ritual_checks",
@@ -1411,6 +1524,9 @@ namespace Pf2eModel.Migrations
migrationBuilder.DropTable(
name: "entity_keyword");
migrationBuilder.DropTable(
name: "entity_legacy_entity");
migrationBuilder.DropTable(
name: "entity_sources");
@@ -1429,6 +1545,12 @@ namespace Pf2eModel.Migrations
migrationBuilder.DropTable(
name: "keyword_aliases");
migrationBuilder.DropTable(
name: "legacy_entity_externals");
migrationBuilder.DropTable(
name: "legacy_entity_sources");
migrationBuilder.DropTable(
name: "ritual_areas");
@@ -1465,12 +1587,6 @@ namespace Pf2eModel.Migrations
migrationBuilder.DropTable(
name: "deities");
migrationBuilder.DropTable(
name: "external_targets");
migrationBuilder.DropTable(
name: "sources");
migrationBuilder.DropTable(
name: "traits");
@@ -1480,6 +1596,15 @@ namespace Pf2eModel.Migrations
migrationBuilder.DropTable(
name: "keywords");
migrationBuilder.DropTable(
name: "external_targets");
migrationBuilder.DropTable(
name: "legacy_entities");
migrationBuilder.DropTable(
name: "sources");
migrationBuilder.DropTable(
name: "rituals");
@@ -83,6 +83,25 @@ namespace Pf2eModel.Migrations
b.ToTable("entity_keyword", (string)null);
});
modelBuilder.Entity("EntityLegacyEntity", b =>
{
b.Property<int>("LegacyEntitiesId")
.HasColumnType("integer")
.HasColumnName("legacy_entities_id");
b.Property<int>("RemasterEntitiesId")
.HasColumnType("integer")
.HasColumnName("remaster_entities_id");
b.HasKey("LegacyEntitiesId", "RemasterEntitiesId")
.HasName("pk_entity_legacy_entity");
b.HasIndex("RemasterEntitiesId")
.HasDatabaseName("ix_entity_legacy_entity_remaster_entities_id");
b.ToTable("entity_legacy_entity", (string)null);
});
modelBuilder.Entity("EntityTrait", b =>
{
b.Property<int>("EntitiesId")
@@ -237,6 +256,123 @@ namespace Pf2eModel.Migrations
b.ToTable("keyword_aliases", (string)null);
});
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasColumnOrder(1);
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("jsonb")
.HasColumnName("name")
.HasColumnOrder(2)
.HasComment("Отображаемое имя");
b.HasKey("Id")
.HasName("pk_legacy_entities");
b.ToTable("legacy_entities", (string)null);
});
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntityExternal", b =>
{
b.Property<int>("LegacyEntityId")
.HasColumnType("integer")
.HasColumnName("legacy_entity_id")
.HasColumnOrder(1)
.HasComment("Идентификатор сущности");
b.Property<int>("TargetId")
.HasColumnType("integer")
.HasColumnName("target_id")
.HasColumnOrder(2)
.HasComment("Идентификатор цели");
b.Property<string>("ExternalId")
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("external_id")
.HasColumnOrder(3);
b.Property<string>("Md5")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasColumnName("md5")
.HasColumnOrder(5)
.HasComment("Контрольная сумма объекта");
b.Property<string>("Suffix")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("suffix")
.HasColumnOrder(4)
.HasComment("Часть URL до объекта. Для источников Foundry - полный UUID объекта");
b.HasKey("LegacyEntityId", "TargetId")
.HasName("pk_legacy_entity_externals");
b.HasIndex("TargetId")
.HasDatabaseName("ix_legacy_entity_externals_target_id");
b.ToTable("legacy_entity_externals", (string)null);
});
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntitySource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasColumnOrder(0)
.HasComment("Идентификатор");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<bool>("IsRemaster")
.HasColumnType("boolean")
.HasColumnName("is_remaster")
.HasColumnOrder(4)
.HasComment("Флаг, указывающий, что объект является частью ремастера");
b.Property<int>("LegacyEntityId")
.HasColumnType("integer")
.HasColumnName("legacy_entity_id")
.HasColumnOrder(1)
.HasComment("Идентификатор устаревшей сущности");
b.Property<int>("SourceId")
.HasColumnType("integer")
.HasColumnName("source_id")
.HasColumnOrder(2)
.HasComment("Идентификатор источника");
b.Property<string>("Suffix")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("suffix")
.HasColumnOrder(3)
.HasComment("Номер страницы, эррата и т.д.");
b.HasKey("Id")
.HasName("pk_legacy_entity_sources");
b.HasIndex("LegacyEntityId")
.HasDatabaseName("ix_legacy_entity_sources_legacy_entity_id");
b.HasIndex("SourceId")
.HasDatabaseName("ix_legacy_entity_sources_source_id");
b.ToTable("legacy_entity_sources", (string)null);
});
modelBuilder.Entity("Pf2eModel.Model.Base.Source.EntitySource", b =>
{
b.Property<int>("Id")
@@ -337,6 +473,12 @@ namespace Pf2eModel.Migrations
.HasColumnOrder(2)
.HasComment("Идентификатор цели");
b.Property<string>("ExternalId")
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("external_id")
.HasColumnOrder(3);
b.Property<string>("Md5")
.IsRequired()
.HasMaxLength(32)
@@ -1839,6 +1981,23 @@ namespace Pf2eModel.Migrations
.HasConstraintName("fk_entity_keyword_keywords_keywords_id");
});
modelBuilder.Entity("EntityLegacyEntity", b =>
{
b.HasOne("Pf2eModel.Model.Base.Legacy.LegacyEntity", null)
.WithMany()
.HasForeignKey("LegacyEntitiesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_entity_legacy_entity_legacy_entities_legacy_entities_id");
b.HasOne("Pf2eModel.Model.Base.Entity", null)
.WithMany()
.HasForeignKey("RemasterEntitiesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_entity_legacy_entity_entities_remaster_entities_id");
});
modelBuilder.Entity("EntityTrait", b =>
{
b.HasOne("Pf2eModel.Model.Base.Entity", null)
@@ -1868,6 +2027,48 @@ namespace Pf2eModel.Migrations
b.Navigation("Keyword");
});
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntityExternal", b =>
{
b.HasOne("Pf2eModel.Model.Base.Legacy.LegacyEntity", "LegacyEntity")
.WithMany("Externals")
.HasForeignKey("LegacyEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_legacy_entity_externals_legacy_entities_legacy_entity_id");
b.HasOne("Pf2eModel.Model.Base.Targets.ExternalTarget", "Target")
.WithMany("LegacyEntityExternals")
.HasForeignKey("TargetId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_legacy_entity_externals_external_targets_target_id");
b.Navigation("LegacyEntity");
b.Navigation("Target");
});
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntitySource", b =>
{
b.HasOne("Pf2eModel.Model.Base.Legacy.LegacyEntity", "LegacyEntity")
.WithMany("Sources")
.HasForeignKey("LegacyEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_legacy_entity_sources_legacy_entities_legacy_entity_id");
b.HasOne("Pf2eModel.Model.Base.Source.Source", "Source")
.WithMany("LegacyEntitySources")
.HasForeignKey("SourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_legacy_entity_sources_sources_source_id");
b.Navigation("LegacyEntity");
b.Navigation("Source");
});
modelBuilder.Entity("Pf2eModel.Model.Base.Source.EntitySource", b =>
{
b.HasOne("Pf2eModel.Model.Base.Entity", "Entity")
@@ -2506,14 +2707,25 @@ namespace Pf2eModel.Migrations
b.Navigation("Aliases");
});
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntity", b =>
{
b.Navigation("Externals");
b.Navigation("Sources");
});
modelBuilder.Entity("Pf2eModel.Model.Base.Source.Source", b =>
{
b.Navigation("EntitySources");
b.Navigation("LegacyEntitySources");
});
modelBuilder.Entity("Pf2eModel.Model.Base.Targets.ExternalTarget", b =>
{
b.Navigation("EntityExternals");
b.Navigation("LegacyEntityExternals");
});
modelBuilder.Entity("Pf2eModel.Model.Structure.Ancestry", b =>
+6
View File
@@ -2,6 +2,7 @@
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Pf2eModel.Model.Base.Keywords;
using Pf2eModel.Model.Base.Legacy;
using Pf2eModel.Model.Base.Source;
using Pf2eModel.Model.Base.Targets;
using Pf2eModel.Model.Common.I18n;
@@ -99,4 +100,9 @@ public class Entity
/// Коллекция внешних ссылок, связанных с сущностью.
/// </summary>
public ICollection<EntityExternal> Externals { get; set; } = [];
/// <summary>
/// Коллекция устаревших сущностей.
/// </summary>
public IEnumerable<LegacyEntity> LegacyEntities { get; set; } = [];
}
@@ -0,0 +1,42 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Pf2eModel.Model.Common.I18n;
namespace Pf2eModel.Model.Base.Legacy;
/// <summary>
/// Информация об устаревшей сущности
/// </summary>
public class LegacyEntity
{
/// <summary>
/// Идентификатор сущности.
/// </summary>
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
/// <summary>
/// Отображаемое имя сущности.
/// </summary>
[Column(Order = 2)]
[Comment("Отображаемое имя")]
public LocaleString Name { get; set; } = [];
/// <summary>
/// Коллекция обновлённых сущностей.
/// </summary>
public ICollection<Entity> RemasterEntities { get; set; } = [];
/// <summary>
/// Коллекция источников, связанных с сущностью.
/// </summary>
public ICollection<LegacyEntitySource> Sources { get; set; } = [];
/// <summary>
/// Коллекция внешних ссылок, связанных с сущностью.
/// </summary>
public ICollection<LegacyEntityExternal> Externals { get; set; } = [];
}
@@ -0,0 +1,58 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Pf2eModel.Model.Base.Targets;
namespace Pf2eModel.Model.Base.Legacy;
/// <summary>
/// Внешняя ссылка сущности.
/// </summary>
[PrimaryKey(nameof(LegacyEntityId), nameof(TargetId))]
public class LegacyEntityExternal
{
/// <summary>
/// Идентификатор сущности.
/// </summary>
[Column(Order = 1)]
[Comment("Идентификатор сущности")]
public int LegacyEntityId { get; set; }
/// <summary>
/// Идентификатор цели.
/// </summary>
[Column(Order = 2)]
[Comment("Идентификатор цели")]
public int TargetId { get; set; }
[Column(Order = 3)]
[MaxLength(255)]
public string? ExternalId { get; set; } = null;
/// <summary>
/// Конечная часть URL внешней ссылки.
/// Для источников Foundry - полный UUID объекта.
/// </summary>
[Column(Order = 4)]
[MaxLength(255)]
[Comment("Часть URL до объекта. Для источников Foundry - полный UUID объекта")]
public string Suffix { get; set; } = "";
/// <summary>
/// Контрольная сумма объекта.
/// </summary>
[Column(Order = 5)]
[MaxLength(32)]
[Comment("Контрольная сумма объекта")]
public string Md5 { get; set; } = null!;
/// <summary>
/// Сущность, которая ссылается на внешнюю ссылку.
/// </summary>
public LegacyEntity LegacyEntity { get; set; } = null!;
/// <summary>
/// Цель внешней ссылки.
/// </summary>
public ExternalTarget Target { get; set; } = null!;
}
@@ -0,0 +1,59 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Pf2eModel.Model.Base.Legacy;
/// <summary>
/// Связь между сущностью и источником.
/// </summary>
public class LegacyEntitySource
{
/// <summary>
/// Идентификатор связи.
/// </summary>
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 0)]
[Comment("Идентификатор")]
public int Id { get; set; }
/// <summary>
/// Идентификатор устаревшей сущности.
/// </summary>
[Column(Order = 1)]
[Comment("Идентификатор устаревшей сущности")]
public int LegacyEntityId { get; set; }
/// <summary>
/// Идентификатор источника.
/// </summary>
[Column(Order = 2)]
[Comment("Идентификатор источника")]
public int SourceId { get; set; }
/// <summary>
/// Дополнительная информация о источнике, например, номер страницы, номер тома и т.д.
/// </summary>
[Column(Order = 3)]
[MaxLength(255)]
[Comment("Номер страницы, эррата и т.д.")]
public string Suffix { get; set; } = null!;
/// <summary>
/// Флаг, указывающий, что объект является частью ремастера.
/// </summary>
[Column(Order = 4)]
[Comment("Флаг, указывающий, что объект является частью ремастера")]
public bool IsRemaster { get; set; }
/// <summary>
/// Сущность, к которой относится источник.
/// </summary>
public LegacyEntity LegacyEntity { get; set; } = null!;
/// <summary>
/// Источник, к которому относится сущность.
/// </summary>
public Source.Source Source { get; set; } = null!;
}
+6
View File
@@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Pf2eModel.Model.Base.Legacy;
using Pf2eModel.Model.Enum;
namespace Pf2eModel.Model.Base.Source;
@@ -45,4 +46,9 @@ public class Source
/// Связанные сущности.
/// </summary>
public ICollection<EntitySource> EntitySources { get; set; } = [];
/// <summary>
/// Связанные сущности.
/// </summary>
public ICollection<LegacyEntitySource> LegacyEntitySources { get; set; } = [];
}
@@ -24,11 +24,9 @@ public class EntityExternal
[Comment("Идентификатор цели")]
public int TargetId { get; set; }
/*
[Column(Order = 3)]
[MaxLength(255)]
public string ExternalId { get; set; } = "";
*/
public string? ExternalId { get; set; } = null;
/// <summary>
/// Конечная часть URL внешней ссылки.
@@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Pf2eModel.Model.Base.Legacy;
namespace Pf2eModel.Model.Base.Targets;
@@ -46,4 +47,9 @@ public class ExternalTarget
/// Коллекция сущностей, которые ссылаются на эту цель.
/// </summary>
public ICollection<EntityExternal> EntityExternals { get; set; } = [];
/// <summary>
/// Коллекция устаревших сущностей, которые ссылаются на эту цель.
/// </summary>
public ICollection<LegacyEntityExternal> LegacyEntityExternals { get; set; } = [];
}
+7
View File
@@ -3,6 +3,7 @@ using dotenv.net.Utilities;
using Microsoft.EntityFrameworkCore;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Base.Keywords;
using Pf2eModel.Model.Base.Legacy;
using Pf2eModel.Model.Base.Source;
using Pf2eModel.Model.Base.Targets;
using Pf2eModel.Model.Common;
@@ -97,6 +98,12 @@ public partial class Pf2eDbContext : DbContext
public virtual DbSet<Language> Languages { get; set; }
public virtual DbSet<LegacyEntity> LegacyEntities { get; set; }
public virtual DbSet<LegacyEntityExternal> LegacyEntityExternals { get; set; }
public virtual DbSet<LegacyEntitySource> LegacyEntitySources { get; set; }
public virtual DbSet<Ritual> Rituals { get; set; }
public virtual DbSet<RitualArea> RitualAreas { get; set; }
+35
View File
@@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Pf2eModel.Model;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Base.Keywords;
using Pf2eModel.Model.Base.Legacy;
using Pf2eModel.Model.Base.Source;
using Pf2eModel.Model.Base.Targets;
using Pf2eModel.Model.Common;
@@ -144,6 +145,28 @@ public partial class Pf2eDbContext
.OnDelete(DeleteBehavior.Cascade);
});
// LegacyEntity
modelBuilder.Entity<LegacyEntity>(entity =>
{
BindLocaleString(entity, l => l.Name);
entity.HasMany(l => l.RemasterEntities).WithMany(e => e.LegacyEntities);
// LegacyEntitySource
entity
.HasMany(e => e.Sources)
.WithOne(e => e.LegacyEntity)
.HasForeignKey(e => e.LegacyEntityId)
.OnDelete(DeleteBehavior.Cascade);
// LegacyEntityExternal
entity
.HasMany(e => e.Externals)
.WithOne(e => e.LegacyEntity)
.HasForeignKey(e => e.LegacyEntityId)
.OnDelete(DeleteBehavior.Cascade);
});
// Source
modelBuilder.Entity<Source>(entity =>
{
@@ -155,6 +178,12 @@ public partial class Pf2eDbContext
.HasForeignKey(e => e.SourceId)
.OnDelete(DeleteBehavior.Cascade);
entity
.HasMany(s => s.LegacyEntitySources)
.WithOne(e => e.Source)
.HasForeignKey(e => e.SourceId)
.OnDelete(DeleteBehavior.Cascade);
// + EntitySource
});
modelBuilder.Entity<EntitySource>(entity => { });
@@ -167,6 +196,12 @@ public partial class Pf2eDbContext
.WithOne(e => e.Target)
.HasForeignKey(e => e.TargetId)
.OnDelete(DeleteBehavior.Cascade);
entity
.HasMany(t => t.LegacyEntityExternals)
.WithOne(e => e.Target)
.HasForeignKey(e => e.TargetId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<EntityExternal>(entity => { });