Большая пачка обновлений

This commit is contained in:
2025-04-21 08:36:46 +04:00
parent be8963a073
commit beb61b7449
39 changed files with 1068 additions and 301 deletions
@@ -13,7 +13,7 @@ using Pf2eModel.Model.Enum;
namespace Pf2eModel.Migrations
{
[DbContext(typeof(Pf2eDbContext))]
[Migration("20250418174520_1")]
[Migration("20250420145024_1")]
partial class _1
{
/// <inheritdoc />
@@ -25,7 +25,6 @@ namespace Pf2eModel.Migrations
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_category", new[] { "unknown", "offensive", "defensive", "interaction", "familiar", "army_tactic", "army_war_action", "kingdom_activity", "kingdom_feat", "kingdom_feature" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_type", new[] { "none", "1_action", "2_actions", "3_actions", "1-3_actions", "1-2_actions" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "alias_type", new[] { "legacy", "english", "legacy_english", "hobby", "other" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "dark-vision" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "free", "str", "dex", "con", "int", "wis", "cha" });
@@ -35,7 +34,7 @@ namespace Pf2eModel.Migrations
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "deity_fonts", new[] { "none", "heal", "harm", "any" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "deity_sanctification", new[] { "holy", "unholy", "any" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_rarity", new[] { "common", "uncommon", "rare", "unique" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "unknown", "trait", "action", "ancestry", "background", "backpack", "campaign_feature", "class", "condition", "deity", "feat", "heritage", "spell", "language" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "unknown", "trait", "action", "ancestry", "archetype", "background", "backpack", "campaign_feature", "class", "condition", "deity", "feat", "heritage", "spell", "language" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "feat_action_type", new[] { "passive", "action", "reaction", "free" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "feat_category", new[] { "ancestryfeature", "classfeature", "calling", "class", "skill", "general", "ancestry", "bonus", "deityboon", "curse", "pfsboon", "campaign_feature" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "size", new[] { "tiny", "small", "medium", "large" });
@@ -435,13 +434,18 @@ namespace Pf2eModel.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Key")
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("key")
.HasColumnName("name")
.HasColumnOrder(2);
b.Property<int>("Type")
.HasColumnType("integer")
.HasColumnName("type")
.HasColumnOrder(3);
b.HasKey("Id")
.HasName("pk_trainings");
@@ -485,11 +489,6 @@ namespace Pf2eModel.Migrations
.HasColumnName("max_actions")
.HasColumnOrder(4);
b.Property<ActionType>("Type")
.HasColumnType("action_type")
.HasColumnName("type")
.HasColumnOrder(2);
b.HasKey("Id")
.HasName("pk_actions");
@@ -616,6 +615,38 @@ namespace Pf2eModel.Migrations
b.ToTable("ancestry_languages", (string)null);
});
modelBuilder.Entity("Pf2eModel.Model.Structure.Archetype", b =>
{
b.Property<int>("Id")
.HasColumnType("integer")
.HasColumnName("id")
.HasColumnOrder(1);
b.Property<int>("DedicationFeatId")
.HasColumnType("integer")
.HasColumnName("dedication_feat_id")
.HasColumnOrder(3);
b.Property<string>("Extra")
.HasColumnType("text")
.HasColumnName("extra")
.HasColumnOrder(4);
b.Property<int>("Level")
.HasColumnType("integer")
.HasColumnName("level")
.HasColumnOrder(2);
b.HasKey("Id")
.HasName("pk_archetype");
b.HasIndex("DedicationFeatId")
.IsUnique()
.HasDatabaseName("ix_archetype_dedication_feat_id");
b.ToTable("archetype", (string)null);
});
modelBuilder.Entity("Pf2eModel.Model.Structure.Background", b =>
{
b.Property<int>("Id")
@@ -632,10 +663,13 @@ namespace Pf2eModel.Migrations
modelBuilder.Entity("Pf2eModel.Model.Structure.BackgroundRelation.BackgroundBoost", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasColumnOrder(1);
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<AttributeValues>("Attribute")
.HasColumnType("attribute_values")
.HasColumnName("attribute")
@@ -725,7 +759,7 @@ namespace Pf2eModel.Migrations
b.Property<int>("AdditionalTrainedSkills")
.HasColumnType("integer")
.HasColumnName("additional_trained_skills")
.HasColumnOrder(6);
.HasColumnOrder(7);
b.Property<int>("Hp")
.HasColumnType("integer")
@@ -742,6 +776,11 @@ namespace Pf2eModel.Migrations
.HasColumnName("spellcasting")
.HasColumnOrder(5);
b.Property<int>("Tradition")
.HasColumnType("integer")
.HasColumnName("tradition")
.HasColumnOrder(6);
b.HasKey("Id")
.HasName("pk_classes");
@@ -840,8 +879,8 @@ namespace Pf2eModel.Migrations
.HasColumnName("name")
.HasColumnOrder(4);
b.Property<int>("Stage")
.HasColumnType("integer")
b.Property<TrainingStage>("Stage")
.HasColumnType("training_stage")
.HasColumnName("stage")
.HasColumnOrder(5);
@@ -1050,7 +1089,12 @@ namespace Pf2eModel.Migrations
b.Property<int?>("Actions")
.HasColumnType("integer")
.HasColumnName("actions")
.HasColumnOrder(4);
.HasColumnOrder(5);
b.Property<int>("ArchetypeId")
.HasColumnType("integer")
.HasColumnName("archetype_id")
.HasColumnOrder(10);
b.Property<ActionCategory>("Category")
.HasColumnType("action_category")
@@ -1060,42 +1104,39 @@ namespace Pf2eModel.Migrations
b.Property<string>("Extra")
.HasColumnType("text")
.HasColumnName("extra")
.HasColumnOrder(10);
.HasColumnOrder(11);
b.Property<bool>("IsFreeAction")
.HasColumnType("boolean")
.HasColumnName("is_free_action")
.HasColumnOrder(8);
b.Property<bool>("IsPassive")
.HasColumnType("boolean")
.HasColumnName("is_passive")
.HasColumnOrder(9);
b.Property<bool>("IsReaction")
.HasColumnType("boolean")
.HasColumnName("is_reaction")
.HasColumnOrder(7);
b.Property<int>("Level")
.HasColumnType("integer")
.HasColumnName("level")
.HasColumnOrder(5);
.HasColumnOrder(4);
b.Property<int?>("LevelTaken")
b.Property<int?>("MaxActions")
.HasColumnType("integer")
.HasColumnName("level_taken")
.HasColumnName("max_actions")
.HasColumnOrder(6);
b.Property<string>("Location")
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("location")
.HasColumnOrder(8);
b.Property<int?>("MaxTakable")
.HasColumnType("integer")
.HasColumnName("max_takable")
.HasColumnOrder(7);
b.Property<bool?>("OnlyLevel1")
.HasColumnType("boolean")
.HasColumnName("only_level1")
.HasColumnOrder(9);
b.Property<ActionType>("Type")
.HasColumnType("action_type")
.HasColumnName("type")
.HasColumnOrder(2);
b.HasKey("Id")
.HasName("pk_feats");
b.HasIndex("ArchetypeId")
.HasDatabaseName("ix_feats_archetype_id");
b.ToTable("feats", (string)null);
});
@@ -1628,6 +1669,27 @@ namespace Pf2eModel.Migrations
b.Navigation("Language");
});
modelBuilder.Entity("Pf2eModel.Model.Structure.Archetype", b =>
{
b.HasOne("Pf2eModel.Model.Structure.Feat", "DedicationFeat")
.WithOne()
.HasForeignKey("Pf2eModel.Model.Structure.Archetype", "DedicationFeatId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_archetype_feats_dedication_feat_id");
b.HasOne("Pf2eModel.Model.Base.Entity", "Entity")
.WithOne()
.HasForeignKey("Pf2eModel.Model.Structure.Archetype", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_archetype_entities_id");
b.Navigation("DedicationFeat");
b.Navigation("Entity");
});
modelBuilder.Entity("Pf2eModel.Model.Structure.Background", b =>
{
b.HasOne("Pf2eModel.Model.Base.Entity", "Entity")
@@ -1841,6 +1903,13 @@ namespace Pf2eModel.Migrations
modelBuilder.Entity("Pf2eModel.Model.Structure.Feat", b =>
{
b.HasOne("Pf2eModel.Model.Structure.Archetype", "Archetype")
.WithMany("Feats")
.HasForeignKey("ArchetypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_feats_archetype_archetype_id");
b.HasOne("Pf2eModel.Model.Base.Entity", "Entity")
.WithOne()
.HasForeignKey("Pf2eModel.Model.Structure.Feat", "Id")
@@ -1848,6 +1917,8 @@ namespace Pf2eModel.Migrations
.IsRequired()
.HasConstraintName("fk_feats_entities_id");
b.Navigation("Archetype");
b.Navigation("Entity");
});
@@ -2000,6 +2071,11 @@ namespace Pf2eModel.Migrations
b.Navigation("Heritages");
});
modelBuilder.Entity("Pf2eModel.Model.Structure.Archetype", b =>
{
b.Navigation("Feats");
});
modelBuilder.Entity("Pf2eModel.Model.Structure.Background", b =>
{
b.Navigation("BackgroundBoosts");
@@ -15,7 +15,6 @@ namespace Pf2eModel.Migrations
{
migrationBuilder.AlterDatabase()
.Annotation("Npgsql:Enum:action_category", "unknown,offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature")
.Annotation("Npgsql:Enum:action_type", "none,1_action,2_actions,3_actions,1-3_actions,1-2_actions")
.Annotation("Npgsql:Enum:alias_type", "legacy,english,legacy_english,hobby,other")
.Annotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,dark-vision")
.Annotation("Npgsql:Enum:attribute_values", "free,str,dex,con,int,wis,cha")
@@ -25,7 +24,7 @@ namespace Pf2eModel.Migrations
.Annotation("Npgsql:Enum:deity_fonts", "none,heal,harm,any")
.Annotation("Npgsql:Enum:deity_sanctification", "holy,unholy,any")
.Annotation("Npgsql:Enum:entity_rarity", "common,uncommon,rare,unique")
.Annotation("Npgsql:Enum:entity_type", "unknown,trait,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell,language")
.Annotation("Npgsql:Enum:entity_type", "unknown,trait,action,ancestry,archetype,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell,language")
.Annotation("Npgsql:Enum:feat_action_type", "passive,action,reaction,free")
.Annotation("Npgsql:Enum:feat_category", "ancestryfeature,classfeature,calling,class,skill,general,ancestry,bonus,deityboon,curse,pfsboon,campaign_feature")
.Annotation("Npgsql:Enum:size", "tiny,small,medium,large")
@@ -120,7 +119,8 @@ namespace Pf2eModel.Migrations
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
key = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false)
name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
type = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
@@ -132,7 +132,6 @@ namespace Pf2eModel.Migrations
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false),
type = table.Column<ActionType>(type: "action_type", nullable: false),
actions = table.Column<int>(type: "integer", nullable: true),
max_actions = table.Column<int>(type: "integer", nullable: true),
is_reaction = table.Column<bool>(type: "boolean", nullable: false),
@@ -197,6 +196,7 @@ namespace Pf2eModel.Migrations
hp = table.Column<int>(type: "integer", nullable: false),
perception = table.Column<int>(type: "integer", nullable: false),
spellcasting = table.Column<bool>(type: "boolean", nullable: false),
tradition = table.Column<int>(type: "integer", nullable: false),
additional_trained_skills = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
@@ -269,32 +269,6 @@ namespace Pf2eModel.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "feats",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false),
type = table.Column<ActionType>(type: "action_type", nullable: false),
category = table.Column<ActionCategory>(type: "action_category", nullable: false),
actions = table.Column<int>(type: "integer", nullable: true),
level = table.Column<int>(type: "integer", nullable: false),
level_taken = table.Column<int>(type: "integer", nullable: true),
max_takable = table.Column<int>(type: "integer", nullable: true),
location = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
only_level1 = table.Column<bool>(type: "boolean", nullable: true),
extra = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_feats", x => x.id);
table.ForeignKey(
name: "fk_feats_entities_id",
column: x => x.id,
principalTable: "entities",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "languages",
columns: table => new
@@ -529,7 +503,8 @@ namespace Pf2eModel.Migrations
name: "background_boosts",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false),
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
background_id = table.Column<int>(type: "integer", nullable: false),
attribute = table.Column<AttributeValues>(type: "attribute_values", nullable: false)
},
@@ -652,7 +627,7 @@ namespace Pf2eModel.Migrations
class_id = table.Column<int>(type: "integer", nullable: false),
training_id = table.Column<int>(type: "integer", nullable: true),
name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
stage = table.Column<int>(type: "integer", nullable: false)
stage = table.Column<TrainingStage>(type: "training_stage", nullable: false)
},
constraints: table =>
{
@@ -754,26 +729,6 @@ namespace Pf2eModel.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "feat_prerequisites",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
feat_id = table.Column<int>(type: "integer", nullable: false),
value = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_feat_prerequisites", x => x.id);
table.ForeignKey(
name: "fk_feat_prerequisites_feats_feat_id",
column: x => x.feat_id,
principalTable: "feats",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ancestry_languages",
columns: table => new
@@ -938,6 +893,78 @@ namespace Pf2eModel.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "archetype",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false),
level = table.Column<int>(type: "integer", nullable: false),
dedication_feat_id = table.Column<int>(type: "integer", nullable: false),
extra = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_archetype", x => x.id);
table.ForeignKey(
name: "fk_archetype_entities_id",
column: x => x.id,
principalTable: "entities",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "feats",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false),
category = table.Column<ActionCategory>(type: "action_category", nullable: false),
level = table.Column<int>(type: "integer", nullable: false),
actions = table.Column<int>(type: "integer", nullable: true),
max_actions = table.Column<int>(type: "integer", nullable: true),
is_reaction = table.Column<bool>(type: "boolean", nullable: false),
is_free_action = table.Column<bool>(type: "boolean", nullable: false),
is_passive = table.Column<bool>(type: "boolean", nullable: false),
archetype_id = table.Column<int>(type: "integer", nullable: false),
extra = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_feats", x => x.id);
table.ForeignKey(
name: "fk_feats_archetype_archetype_id",
column: x => x.archetype_id,
principalTable: "archetype",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_feats_entities_id",
column: x => x.id,
principalTable: "entities",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "feat_prerequisites",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
feat_id = table.Column<int>(type: "integer", nullable: false),
value = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_feat_prerequisites", x => x.id);
table.ForeignKey(
name: "fk_feat_prerequisites_feats_feat_id",
column: x => x.feat_id,
principalTable: "feats",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_ancestry_boosts_ancestry_id",
table: "ancestry_boosts",
@@ -953,6 +980,12 @@ namespace Pf2eModel.Migrations
table: "ancestry_languages",
column: "language_id");
migrationBuilder.CreateIndex(
name: "ix_archetype_dedication_feat_id",
table: "archetype",
column: "dedication_feat_id",
unique: true);
migrationBuilder.CreateIndex(
name: "ix_background_boosts_background_id",
table: "background_boosts",
@@ -1048,6 +1081,11 @@ namespace Pf2eModel.Migrations
table: "feat_prerequisites",
column: "feat_id");
migrationBuilder.CreateIndex(
name: "ix_feats_archetype_id",
table: "feats",
column: "archetype_id");
migrationBuilder.CreateIndex(
name: "ix_heritages_ancestry_id",
table: "heritages",
@@ -1072,11 +1110,31 @@ namespace Pf2eModel.Migrations
name: "ix_spell_defenses_spell_id",
table: "spell_defenses",
column: "spell_id");
migrationBuilder.AddForeignKey(
name: "fk_archetype_feats_dedication_feat_id",
table: "archetype",
column: "dedication_feat_id",
principalTable: "feats",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_archetype_entities_id",
table: "archetype");
migrationBuilder.DropForeignKey(
name: "fk_feats_entities_id",
table: "feats");
migrationBuilder.DropForeignKey(
name: "fk_archetype_feats_dedication_feat_id",
table: "archetype");
migrationBuilder.DropTable(
name: "actions");
@@ -1188,9 +1246,6 @@ namespace Pf2eModel.Migrations
migrationBuilder.DropTable(
name: "traits");
migrationBuilder.DropTable(
name: "feats");
migrationBuilder.DropTable(
name: "ancestries");
@@ -1202,6 +1257,12 @@ namespace Pf2eModel.Migrations
migrationBuilder.DropTable(
name: "entities");
migrationBuilder.DropTable(
name: "feats");
migrationBuilder.DropTable(
name: "archetype");
}
}
}
@@ -22,7 +22,6 @@ namespace Pf2eModel.Migrations
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_category", new[] { "unknown", "offensive", "defensive", "interaction", "familiar", "army_tactic", "army_war_action", "kingdom_activity", "kingdom_feat", "kingdom_feature" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_type", new[] { "none", "1_action", "2_actions", "3_actions", "1-3_actions", "1-2_actions" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "alias_type", new[] { "legacy", "english", "legacy_english", "hobby", "other" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "dark-vision" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "free", "str", "dex", "con", "int", "wis", "cha" });
@@ -32,7 +31,7 @@ namespace Pf2eModel.Migrations
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "deity_fonts", new[] { "none", "heal", "harm", "any" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "deity_sanctification", new[] { "holy", "unholy", "any" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_rarity", new[] { "common", "uncommon", "rare", "unique" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "unknown", "trait", "action", "ancestry", "background", "backpack", "campaign_feature", "class", "condition", "deity", "feat", "heritage", "spell", "language" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "unknown", "trait", "action", "ancestry", "archetype", "background", "backpack", "campaign_feature", "class", "condition", "deity", "feat", "heritage", "spell", "language" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "feat_action_type", new[] { "passive", "action", "reaction", "free" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "feat_category", new[] { "ancestryfeature", "classfeature", "calling", "class", "skill", "general", "ancestry", "bonus", "deityboon", "curse", "pfsboon", "campaign_feature" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "size", new[] { "tiny", "small", "medium", "large" });
@@ -432,13 +431,18 @@ namespace Pf2eModel.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Key")
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("key")
.HasColumnName("name")
.HasColumnOrder(2);
b.Property<int>("Type")
.HasColumnType("integer")
.HasColumnName("type")
.HasColumnOrder(3);
b.HasKey("Id")
.HasName("pk_trainings");
@@ -482,11 +486,6 @@ namespace Pf2eModel.Migrations
.HasColumnName("max_actions")
.HasColumnOrder(4);
b.Property<ActionType>("Type")
.HasColumnType("action_type")
.HasColumnName("type")
.HasColumnOrder(2);
b.HasKey("Id")
.HasName("pk_actions");
@@ -613,6 +612,38 @@ namespace Pf2eModel.Migrations
b.ToTable("ancestry_languages", (string)null);
});
modelBuilder.Entity("Pf2eModel.Model.Structure.Archetype", b =>
{
b.Property<int>("Id")
.HasColumnType("integer")
.HasColumnName("id")
.HasColumnOrder(1);
b.Property<int>("DedicationFeatId")
.HasColumnType("integer")
.HasColumnName("dedication_feat_id")
.HasColumnOrder(3);
b.Property<string>("Extra")
.HasColumnType("text")
.HasColumnName("extra")
.HasColumnOrder(4);
b.Property<int>("Level")
.HasColumnType("integer")
.HasColumnName("level")
.HasColumnOrder(2);
b.HasKey("Id")
.HasName("pk_archetype");
b.HasIndex("DedicationFeatId")
.IsUnique()
.HasDatabaseName("ix_archetype_dedication_feat_id");
b.ToTable("archetype", (string)null);
});
modelBuilder.Entity("Pf2eModel.Model.Structure.Background", b =>
{
b.Property<int>("Id")
@@ -629,10 +660,13 @@ namespace Pf2eModel.Migrations
modelBuilder.Entity("Pf2eModel.Model.Structure.BackgroundRelation.BackgroundBoost", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasColumnOrder(1);
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<AttributeValues>("Attribute")
.HasColumnType("attribute_values")
.HasColumnName("attribute")
@@ -722,7 +756,7 @@ namespace Pf2eModel.Migrations
b.Property<int>("AdditionalTrainedSkills")
.HasColumnType("integer")
.HasColumnName("additional_trained_skills")
.HasColumnOrder(6);
.HasColumnOrder(7);
b.Property<int>("Hp")
.HasColumnType("integer")
@@ -739,6 +773,11 @@ namespace Pf2eModel.Migrations
.HasColumnName("spellcasting")
.HasColumnOrder(5);
b.Property<int>("Tradition")
.HasColumnType("integer")
.HasColumnName("tradition")
.HasColumnOrder(6);
b.HasKey("Id")
.HasName("pk_classes");
@@ -837,8 +876,8 @@ namespace Pf2eModel.Migrations
.HasColumnName("name")
.HasColumnOrder(4);
b.Property<int>("Stage")
.HasColumnType("integer")
b.Property<TrainingStage>("Stage")
.HasColumnType("training_stage")
.HasColumnName("stage")
.HasColumnOrder(5);
@@ -1047,7 +1086,12 @@ namespace Pf2eModel.Migrations
b.Property<int?>("Actions")
.HasColumnType("integer")
.HasColumnName("actions")
.HasColumnOrder(4);
.HasColumnOrder(5);
b.Property<int>("ArchetypeId")
.HasColumnType("integer")
.HasColumnName("archetype_id")
.HasColumnOrder(10);
b.Property<ActionCategory>("Category")
.HasColumnType("action_category")
@@ -1057,42 +1101,39 @@ namespace Pf2eModel.Migrations
b.Property<string>("Extra")
.HasColumnType("text")
.HasColumnName("extra")
.HasColumnOrder(10);
.HasColumnOrder(11);
b.Property<bool>("IsFreeAction")
.HasColumnType("boolean")
.HasColumnName("is_free_action")
.HasColumnOrder(8);
b.Property<bool>("IsPassive")
.HasColumnType("boolean")
.HasColumnName("is_passive")
.HasColumnOrder(9);
b.Property<bool>("IsReaction")
.HasColumnType("boolean")
.HasColumnName("is_reaction")
.HasColumnOrder(7);
b.Property<int>("Level")
.HasColumnType("integer")
.HasColumnName("level")
.HasColumnOrder(5);
.HasColumnOrder(4);
b.Property<int?>("LevelTaken")
b.Property<int?>("MaxActions")
.HasColumnType("integer")
.HasColumnName("level_taken")
.HasColumnName("max_actions")
.HasColumnOrder(6);
b.Property<string>("Location")
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("location")
.HasColumnOrder(8);
b.Property<int?>("MaxTakable")
.HasColumnType("integer")
.HasColumnName("max_takable")
.HasColumnOrder(7);
b.Property<bool?>("OnlyLevel1")
.HasColumnType("boolean")
.HasColumnName("only_level1")
.HasColumnOrder(9);
b.Property<ActionType>("Type")
.HasColumnType("action_type")
.HasColumnName("type")
.HasColumnOrder(2);
b.HasKey("Id")
.HasName("pk_feats");
b.HasIndex("ArchetypeId")
.HasDatabaseName("ix_feats_archetype_id");
b.ToTable("feats", (string)null);
});
@@ -1625,6 +1666,27 @@ namespace Pf2eModel.Migrations
b.Navigation("Language");
});
modelBuilder.Entity("Pf2eModel.Model.Structure.Archetype", b =>
{
b.HasOne("Pf2eModel.Model.Structure.Feat", "DedicationFeat")
.WithOne()
.HasForeignKey("Pf2eModel.Model.Structure.Archetype", "DedicationFeatId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_archetype_feats_dedication_feat_id");
b.HasOne("Pf2eModel.Model.Base.Entity", "Entity")
.WithOne()
.HasForeignKey("Pf2eModel.Model.Structure.Archetype", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_archetype_entities_id");
b.Navigation("DedicationFeat");
b.Navigation("Entity");
});
modelBuilder.Entity("Pf2eModel.Model.Structure.Background", b =>
{
b.HasOne("Pf2eModel.Model.Base.Entity", "Entity")
@@ -1838,6 +1900,13 @@ namespace Pf2eModel.Migrations
modelBuilder.Entity("Pf2eModel.Model.Structure.Feat", b =>
{
b.HasOne("Pf2eModel.Model.Structure.Archetype", "Archetype")
.WithMany("Feats")
.HasForeignKey("ArchetypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_feats_archetype_archetype_id");
b.HasOne("Pf2eModel.Model.Base.Entity", "Entity")
.WithOne()
.HasForeignKey("Pf2eModel.Model.Structure.Feat", "Id")
@@ -1845,6 +1914,8 @@ namespace Pf2eModel.Migrations
.IsRequired()
.HasConstraintName("fk_feats_entities_id");
b.Navigation("Archetype");
b.Navigation("Entity");
});
@@ -1997,6 +2068,11 @@ namespace Pf2eModel.Migrations
b.Navigation("Heritages");
});
modelBuilder.Entity("Pf2eModel.Model.Structure.Archetype", b =>
{
b.Navigation("Feats");
});
modelBuilder.Entity("Pf2eModel.Model.Structure.Background", b =>
{
b.Navigation("BackgroundBoosts");
+6 -2
View File
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Common;
@@ -12,5 +13,8 @@ public partial class Training
[Column(Order = 2)]
[MaxLength(Pf2eDbContext.NameLength)]
public string Key { get; set; } = null!;
public string Name { get; set; } = null!;
[Column(Order = 3)]
public TrainingType Type { get; set; }
}
-24
View File
@@ -1,24 +0,0 @@
using NpgsqlTypes;
namespace Pf2eModel.Model.Enum;
public enum ActionType
{
[PgName("none")]
None,
[PgName("1_action")]
SingleAction,
[PgName("2_actions")]
TwoActions,
[PgName("3_actions")]
ThreeActions,
[PgName("1-3_actions")]
SingleToThreeActions,
[PgName("1-2_actions")]
SingleToTwoActions,
}
+3
View File
@@ -16,6 +16,9 @@ public enum EntityType
[PgName("ancestry")]
Ancestry,
[PgName("archetype")]
Archetype,
[PgName("background")]
Background,
+24
View File
@@ -0,0 +1,24 @@
using NpgsqlTypes;
namespace Pf2eModel.Model.Enum;
public enum SpellTradition
{
[PgName("none")]
None,
[PgName("divine")]
Divine,
[PgName("occult")]
Occult,
[PgName("arcane")]
Arcane,
[PgName("primal")]
Primal,
[PgName("all")]
All,
}
+23
View File
@@ -0,0 +1,23 @@
using NpgsqlTypes;
namespace Pf2eModel.Model.Enum;
public enum TrainingType
{
[PgName("perception")]
Perception,
[PgName("skill")]
Skill,
[PgName("lore")]
Lore,
[PgName("weapon")]
Weapon,
[PgName("armor")]
Armor,
[PgName("save")]
Save,
}
-3
View File
@@ -12,9 +12,6 @@ public partial class Action : IEntity
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public ActionType Type { get; set; }
[Column(Order = 3)]
public int? Actions { get; set; } = null;
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eModel.Model.Structure.AncestryRelation;
@@ -19,5 +20,6 @@ public partial class AncestryBoost
[Column(Order = 4)]
public Enum.AttributeValues Value { get; set; }
[JsonIgnore]
public virtual Ancestry Ancestry { get; set; } = null!;
}
+32
View File
@@ -0,0 +1,32 @@
using Pf2eModel.Model.Base;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pf2eModel.Model.Structure;
public class Archetype : IEntity
{
[Key]
[Column(Order = 1)]
public int Id { get; set; }
public Entity Entity { get; set; } = null!;
[Column(Order = 2)]
public int Level { get; set; }
[Column(Order = 3)]
public int DedicationFeatId { get; set; }
[Column(Order = 4)]
public string? Extra { get; set; }
public Feat DedicationFeat { get; set; } = null!;
public virtual ICollection<Feat> Feats { get; set; } = [];
}
@@ -1,4 +1,5 @@
using Pf2eModel.Model.Enum;
using Newtonsoft.Json;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -7,7 +8,7 @@ namespace Pf2eModel.Model.Structure.BackgroundRelation;
public partial class BackgroundBoost
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
@@ -17,5 +18,6 @@ public partial class BackgroundBoost
[Column(Order = 3)]
public AttributeValues Attribute { get; set; }
[JsonIgnore]
public virtual Background Background { get; set; } = null!;
}
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using Pf2eModel.Model.Base;
using System.ComponentModel.DataAnnotations.Schema;
@@ -16,6 +17,7 @@ public partial class BackgroundItem
[Column(Order = 3)]
public int? Level { get; set; }
[JsonIgnore]
public virtual Background Background { get; set; } = null!;
public virtual Entity Entity { get; set; } = null!;
@@ -1,4 +1,5 @@
using Pf2eModel.Model.Common;
using Newtonsoft.Json;
using Pf2eModel.Model.Common;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -21,6 +22,7 @@ public partial class BackgroundTraining
[Column(Order = 4)]
public TrainingStage Level { get; set; }
[JsonIgnore]
public virtual Background Background { get; set; } = null!;
public virtual Training Training { get; set; } = null!;
+3 -1
View File
@@ -13,7 +13,6 @@ public partial class Class : IEntity
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public Entity Entity { get; set; } = null!;
[Column(Order = 3)]
@@ -26,6 +25,9 @@ public partial class Class : IEntity
public bool Spellcasting { get; set; }
[Column(Order = 6)]
public SpellTradition Tradition { get; set; }
[Column(Order = 7)]
public int AdditionalTrainedSkills { get; set; }
public virtual ICollection<ClassKeyAbility> ClassKeyAbilities { get; set; } = [];
@@ -1,4 +1,5 @@
using Pf2eModel.Model.Enum;
using Newtonsoft.Json;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -17,5 +18,6 @@ public partial class ClassKeyAbility
[Column(Order = 3)]
public AttributeValues Value { get; set; }
[JsonIgnore]
public virtual Class Class { get; set; } = null!;
}
@@ -1,4 +1,5 @@
using Pf2eModel.Model.Base;
using Newtonsoft.Json;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -23,6 +24,7 @@ public partial class ClassProgression
[Column(Order = 5)]
public int? EntityId { get; set; }
[JsonIgnore]
public virtual Class Class { get; set; } = null!;
public virtual Entity? Entity { get; set; }
@@ -1,4 +1,6 @@
using Pf2eModel.Model.Common;
using Newtonsoft.Json;
using Pf2eModel.Model.Common;
using Pf2eModel.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -22,8 +24,9 @@ public partial class ClassTraining
public string? Name { get; set; }
[Column(Order = 5)]
public int Stage { get; set; }
public TrainingStage Stage { get; set; }
[JsonIgnore]
public virtual Class Class { get; set; } = null!;
public virtual Training? Training { get; set; }
+12 -11
View File
@@ -16,33 +16,34 @@ public partial class Feat : IEntity
public Entity Entity { get; set; } = null!;
[Column(Order = 2)]
public ActionType Type { get; set; }
[Column(Order = 3)]
public ActionCategory Category { get; set; }
[Column(Order = 4)]
public int? Actions { get; set; }
[Column(Order = 5)]
public int Level { get; set; }
[Column(Order = 5)]
public int? Actions { get; set; } = null;
[Column(Order = 6)]
public int? LevelTaken { get; set; }
public int? MaxActions { get; set; } = null;
[Column(Order = 7)]
public int? MaxTakable { get; set; }
public bool IsReaction { get; set; } = false;
[Column(Order = 8)]
[MaxLength(255)]
public string? Location { get; set; }
public bool IsFreeAction { get; set; } = false;
[Column(Order = 9)]
public bool? OnlyLevel1 { get; set; }
public bool IsPassive { get; set; } = false;
[Column(Order = 10)]
public int ArchetypeId { get; set; }
[Column(Order = 11)]
public string? Extra { get; set; }
public Archetype Archetype { get; set; } = null!;
public virtual ICollection<FeatPrerequisite> FeatPrerequisites { get; set; } = [];
}
-1
View File
@@ -125,7 +125,6 @@ public partial class Pf2eDbContext : DbContext
.MapEnum<EntityRarity>()
.MapEnum<AliasType>()
.MapEnum<TraitType>()
.MapEnum<ActionType>()
.MapEnum<ActionCategory>()
.MapEnum<Size>()
.MapEnum<AncestryVision>()
+14 -1
View File
@@ -38,7 +38,6 @@ public partial class Pf2eDbContext
.HasPostgresEnum<EntityRarity>()
.HasPostgresEnum<AliasType>()
.HasPostgresEnum<TraitType>()
.HasPostgresEnum<ActionType>()
.HasPostgresEnum<ActionCategory>()
.HasPostgresEnum<Size>()
.HasPostgresEnum<AncestryVision>()
@@ -171,6 +170,20 @@ public partial class Pf2eDbContext
.OnDelete(DeleteBehavior.Cascade);
});
// Archetype
modelBuilder.Entity<Archetype>(entity =>
{
BindEntity(entity);
entity.HasOne(a => a.DedicationFeat).WithOne()
.HasForeignKey<Archetype>(a => a.DedicationFeatId)
.OnDelete(DeleteBehavior.Cascade);
entity.HasMany(a => a.Feats).WithOne(f => f.Archetype)
.HasForeignKey(f => f.ArchetypeId)
.OnDelete(DeleteBehavior.Cascade);
});
// Background
modelBuilder.Entity<Background>(entity =>
{