Вынесение модели в отдельный проект
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Pf2eModel.Model;
|
||||
using Pf2eModel.Model.Enum;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Pf2eModel.Migrations
|
||||
{
|
||||
[DbContext(typeof(Pf2eDbContext))]
|
||||
[Migration("20250418062358_Function")]
|
||||
partial class Function
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Pf2eModel.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Function : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql("""
|
||||
CREATE OR REPLACE FUNCTION f_truncate_tables()
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql AS
|
||||
$func$
|
||||
BEGIN
|
||||
EXECUTE
|
||||
(SELECT 'TRUNCATE TABLE '
|
||||
|| string_agg(format('%I.%I', schemaname, tablename), ', ')
|
||||
|| ' CASCADE;'
|
||||
FROM pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
AND tablename != '__EFMigrationsHistory'
|
||||
);
|
||||
END
|
||||
$func$;
|
||||
""");
|
||||
migrationBuilder.Sql("""
|
||||
CREATE OR REPLACE FUNCTION f_drop_tables()
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql AS
|
||||
$func$
|
||||
BEGIN
|
||||
EXECUTE
|
||||
(SELECT 'DROP TABLE '
|
||||
|| string_agg(format('%I.%I', schemaname, tablename), ', ')
|
||||
|| ' CASCADE;'
|
||||
FROM pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
);
|
||||
END
|
||||
$func$;
|
||||
""");
|
||||
migrationBuilder.Sql("""
|
||||
CREATE OR REPLACE FUNCTION f_permission_tables(_username text)
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql AS
|
||||
$func$
|
||||
DECLARE
|
||||
_tbl text;
|
||||
_sch text;
|
||||
BEGIN
|
||||
FOR _sch, _tbl IN
|
||||
SELECT schemaname, tablename
|
||||
FROM pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
LOOP
|
||||
EXECUTE format('ALTER TABLE %I.%I OWNER TO %I', _sch, _tbl, _username);
|
||||
END LOOP;
|
||||
END
|
||||
$func$;
|
||||
""");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql("DROP FUNCTION f_truncate_tables;");
|
||||
migrationBuilder.Sql("DROP FUNCTION f_drop_tables;");
|
||||
migrationBuilder.Sql("DROP FUNCTION f_permission_tables;");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Pf2eModel.Model.Base.Keywords;
|
||||
using Pf2eModel.Model.Base.Source;
|
||||
using Pf2eModel.Model.Base.Targets;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using Pf2eModel.Model.Structure;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Base;
|
||||
|
||||
public class Entity
|
||||
{
|
||||
[System.ComponentModel.DataAnnotations.Key]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
[MaxLength(Pf2eDbContext.NameLength)]
|
||||
[Comment("Отображаемое имя")]
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
[Column(Order = 3)]
|
||||
[Comment("Тип объекта")]
|
||||
public EntityType Type { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
[MaxLength(Pf2eDbContext.NameLength)]
|
||||
[Comment("Часть имени в URL")]
|
||||
public string Slug { get; set; } = null!;
|
||||
|
||||
[Column(Order = 5)]
|
||||
[StringLength(255)]
|
||||
[Comment("Изображение объекта")]
|
||||
public string Img { get; set; } = null!;
|
||||
|
||||
[Column(Order = 6)]
|
||||
[Comment("Текстовое описание объекта")]
|
||||
public string Description { get; set; } = null!;
|
||||
|
||||
[Column(Order = 7)]
|
||||
public EntityRarity Rarity { get; set; } = EntityRarity.Common;
|
||||
|
||||
[Column(Order = 8)]
|
||||
[Comment("Флаг, указывающий, что у объекта существует перевод")]
|
||||
public bool? IsTranslated { get; set; } = false;
|
||||
|
||||
[Column(Order = 9)]
|
||||
[Comment("Флаг, указывающий, что объект был проверен и не требует автоматической перезаписи")]
|
||||
public bool? IsChecked { get; set; } = false;
|
||||
|
||||
public virtual ICollection<Trait> Traits { get; set; } = [];
|
||||
|
||||
public virtual ICollection<Keyword> Keywords { get; set; } = [];
|
||||
|
||||
public virtual ICollection<EntityAlias> Aliases { get; set; } = [];
|
||||
|
||||
public virtual ICollection<EntitySource> Sources { get; set; } = [];
|
||||
|
||||
public virtual ICollection<EntityExternal> Externals { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Base;
|
||||
|
||||
[PrimaryKey(nameof(EntityId), nameof(Type))]
|
||||
public partial class EntityAlias
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public int EntityId { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public AliasType Type { get; set; } = AliasType.Other;
|
||||
|
||||
[Column(Order = 3)]
|
||||
[MaxLength(Pf2eDbContext.NameLength)]
|
||||
public string Alias { get; set; } = null!;
|
||||
|
||||
public virtual Entity Entity { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Base.Keywords;
|
||||
|
||||
public partial class Keyword
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public string Slug { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Entity> Entities { get; set; } = [];
|
||||
|
||||
public virtual ICollection<KeywordAlias> Aliases { get; set; } = [];
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Base.Keywords;
|
||||
|
||||
public partial class KeywordAlias
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int KeywordId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
[MaxLength(Pf2eDbContext.NameLength)]
|
||||
public string Value { get; set; } = null!;
|
||||
|
||||
public virtual Keyword Keyword { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Base.Source;
|
||||
|
||||
[PrimaryKey(nameof(EntityId), nameof(SourceId))]
|
||||
public partial class EntitySource
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public int EntityId { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int SourceId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
[MaxLength(255)]
|
||||
[Comment("Номер страницы, эррата и т.д.")]
|
||||
public string Suffix { get; set; } = null!;
|
||||
|
||||
[Column(Order = 4)]
|
||||
[Comment("Флаг, указывающий, что объект является частью ремастера")]
|
||||
public bool IsRemaster { get; set; }
|
||||
|
||||
public virtual Entity Entity { get; set; } = null!;
|
||||
|
||||
public virtual Source Source { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Base.Source;
|
||||
|
||||
public partial class Source
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
[MaxLength(Pf2eDbContext.NameLength)]
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
[Column(Order = 3)]
|
||||
public SourceCategory Category { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public DateOnly? ReleaseDate { get; set; }
|
||||
|
||||
|
||||
public ICollection<EntitySource> EntitySources { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Base.Targets;
|
||||
|
||||
[PrimaryKey(nameof(EntityId), nameof(TargetId))]
|
||||
public partial class EntityExternal
|
||||
{
|
||||
[Column(Order = 0)]
|
||||
public int EntityId { get; set; }
|
||||
|
||||
[Column(Order = 1)]
|
||||
public int TargetId { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
[MaxLength(255)]
|
||||
[Comment("Часть URL до объекта. Для источников Foundry - полный UUID объекта")]
|
||||
public string Suffix { get; set; } = "";
|
||||
|
||||
[Column(Order = 3)]
|
||||
[MaxLength(32)]
|
||||
[Comment("Контроль версии объекта")]
|
||||
public string Md5 { get; set; } = null!;
|
||||
|
||||
public virtual Entity Entity { get; set; } = null!;
|
||||
|
||||
public virtual ExternalTarget Target { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Base.Targets;
|
||||
|
||||
public partial class ExternalTarget
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
[StringLength(Pf2eDbContext.NameLength)]
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
[Column(Order = 3)]
|
||||
[StringLength(255)]
|
||||
public string Icon { get; set; } = null!;
|
||||
|
||||
[Column(Order = 3)]
|
||||
[StringLength(Pf2eDbContext.NameLength)]
|
||||
public string Prefix { get; set; } = null!;
|
||||
|
||||
[Column(Order = 4)]
|
||||
public virtual ICollection<EntityExternal> EntityExternals { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Common;
|
||||
|
||||
public partial class Frequency
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int Max { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public int Per { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public int? Value { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Common;
|
||||
|
||||
public partial class Language
|
||||
{
|
||||
[System.ComponentModel.DataAnnotations.Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
[MaxLength(Pf2eDbContext.NameLength)]
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
[Column(Order = 3)]
|
||||
[MaxLength(Pf2eDbContext.NameLength)]
|
||||
public string Slug { get; set; } = null!;
|
||||
|
||||
[Column(Order = 4)]
|
||||
public EntityRarity Rarity { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Common;
|
||||
|
||||
public partial class Training
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
[MaxLength(Pf2eDbContext.NameLength)]
|
||||
public string Key { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum ActionCategory
|
||||
{
|
||||
Unknown,
|
||||
|
||||
[PgName("offensive")]
|
||||
Offensive,
|
||||
|
||||
[PgName("defensive")]
|
||||
Defensive,
|
||||
|
||||
[PgName("interaction")]
|
||||
Interaction,
|
||||
|
||||
[PgName("familiar")]
|
||||
Familiar,
|
||||
|
||||
[PgName("army_tactic")]
|
||||
ArmyTactic,
|
||||
|
||||
[PgName("army_war_action")]
|
||||
ArmyWarAction,
|
||||
|
||||
[PgName("kingdom_activity")]
|
||||
KingdomActivity,
|
||||
|
||||
[PgName("kingdom_feat")]
|
||||
KingdomFeat,
|
||||
|
||||
[PgName("kingdom_feature")]
|
||||
KingdomFeature,
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
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,
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum AliasType
|
||||
{
|
||||
[PgName("legacy")]
|
||||
Legacy,
|
||||
|
||||
[PgName("english")]
|
||||
English,
|
||||
|
||||
[PgName("legacy_english")]
|
||||
LegacyEnglish,
|
||||
|
||||
[PgName("hobby")]
|
||||
Hobby,
|
||||
|
||||
[PgName("other")]
|
||||
Other,
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum AncestryVision
|
||||
{
|
||||
[PgName("normal")]
|
||||
normal,
|
||||
|
||||
[PgName("low-light-vision")]
|
||||
LowLightVision,
|
||||
|
||||
[PgName("darkvision")]
|
||||
darkvision,
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum AttributeValues
|
||||
{
|
||||
[PgName("any")]
|
||||
Any,
|
||||
|
||||
[PgName("str")]
|
||||
Strength,
|
||||
|
||||
[PgName("dex")]
|
||||
Dexterity,
|
||||
|
||||
[PgName("con")]
|
||||
Constitution,
|
||||
|
||||
[PgName("int")]
|
||||
Intelligence,
|
||||
|
||||
[PgName("wis")]
|
||||
Wisdom,
|
||||
|
||||
[PgName("cha")]
|
||||
Charisma
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum ClassProgressionType
|
||||
{
|
||||
[PgName("entity")]
|
||||
Entity,
|
||||
|
||||
[PgName("ancestry_feat")]
|
||||
AncestryFeat,
|
||||
|
||||
[PgName("class_feat")]
|
||||
ClassFeat,
|
||||
|
||||
[PgName("general_feat")]
|
||||
GeneralFeat,
|
||||
|
||||
[PgName("skill_feat")]
|
||||
SkillFeat,
|
||||
|
||||
[PgName("skill_increase")]
|
||||
SkillIncrease,
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
|
||||
public enum ConditionGroup
|
||||
{
|
||||
[PgName("unknown")]
|
||||
Unknown,
|
||||
|
||||
[PgName("senses")]
|
||||
Senses,
|
||||
|
||||
[PgName("abilities")]
|
||||
Abilities,
|
||||
|
||||
[PgName("death")]
|
||||
Death,
|
||||
|
||||
[PgName("attitudes")]
|
||||
Attitudes,
|
||||
|
||||
[PgName("detection")]
|
||||
Detection
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum DeityCategory
|
||||
{
|
||||
[PgName("deity")]
|
||||
Deity,
|
||||
|
||||
[PgName("pantheon")]
|
||||
Pantheon,
|
||||
|
||||
[PgName("covenant")]
|
||||
Covenant,
|
||||
|
||||
[PgName("philosophy")]
|
||||
Philosophy,
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum DeityFonts
|
||||
{
|
||||
[PgName("none")]
|
||||
None,
|
||||
|
||||
[PgName("heal")]
|
||||
Heal,
|
||||
|
||||
[PgName("harm")]
|
||||
Harm,
|
||||
|
||||
[PgName("any")]
|
||||
Any,
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum DeitySanctification
|
||||
{
|
||||
[PgName("holy")]
|
||||
Holy,
|
||||
|
||||
[PgName("unholy")]
|
||||
Unholy,
|
||||
|
||||
[PgName("any")]
|
||||
Any,
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum EntityRarity
|
||||
{
|
||||
[PgName("common")]
|
||||
Common,
|
||||
|
||||
[PgName("uncommon")]
|
||||
Uncommon,
|
||||
|
||||
[PgName("rare")]
|
||||
Rare,
|
||||
|
||||
[PgName("unique")]
|
||||
Unique
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum EntityType
|
||||
{
|
||||
[PgName("unknown")]
|
||||
Unknown,
|
||||
|
||||
[PgName("trait")]
|
||||
Trait,
|
||||
|
||||
[PgName("action")]
|
||||
Action,
|
||||
|
||||
[PgName("ancestry")]
|
||||
Ancestry,
|
||||
|
||||
[PgName("background")]
|
||||
Background,
|
||||
|
||||
[PgName("backpack")]
|
||||
Backpack,
|
||||
|
||||
[PgName("campaign_feature")]
|
||||
CampaignFeature,
|
||||
|
||||
[PgName("class")]
|
||||
Class,
|
||||
|
||||
[PgName("condition")]
|
||||
Condition,
|
||||
|
||||
[PgName("deity")]
|
||||
Deity,
|
||||
|
||||
[PgName("feat")]
|
||||
Feat,
|
||||
|
||||
[PgName("heritage")]
|
||||
Heritage,
|
||||
|
||||
[PgName("spell")]
|
||||
Spell
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum FeatActionType
|
||||
{
|
||||
[PgName("passive")]
|
||||
Passive,
|
||||
|
||||
[PgName("action")]
|
||||
Action,
|
||||
|
||||
[PgName("reaction")]
|
||||
Reaction,
|
||||
|
||||
[PgName("free")]
|
||||
Free,
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum FeatCategory
|
||||
{
|
||||
[PgName("ancestryfeature")]
|
||||
Ancestryfeature,
|
||||
|
||||
[PgName("classfeature")]
|
||||
Classfeature,
|
||||
|
||||
[PgName("calling")]
|
||||
Calling,
|
||||
|
||||
[PgName("class")]
|
||||
Class,
|
||||
|
||||
[PgName("skill")]
|
||||
Skill,
|
||||
|
||||
[PgName("general")]
|
||||
General,
|
||||
|
||||
[PgName("ancestry")]
|
||||
Ancestry,
|
||||
|
||||
[PgName("bonus")]
|
||||
Bonus,
|
||||
|
||||
[PgName("deityboon")]
|
||||
Deityboon,
|
||||
|
||||
[PgName("curse")]
|
||||
Curse,
|
||||
|
||||
[PgName("pfsboon")]
|
||||
Pfsboon,
|
||||
|
||||
[PgName("campaign_feature")]
|
||||
CampaignFeature,
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum Size
|
||||
{
|
||||
[PgName("med")]
|
||||
med,
|
||||
|
||||
[PgName("tiny")]
|
||||
tiny,
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
public enum SourceCategory
|
||||
{
|
||||
[PgName("rulebook")]
|
||||
Rulebooks,
|
||||
|
||||
[PgName("adventure-path")]
|
||||
AdventurePaths,
|
||||
|
||||
[PgName("lost-omens")]
|
||||
LostOmens,
|
||||
|
||||
[PgName("adventures")]
|
||||
Adventures,
|
||||
|
||||
[PgName("comics")]
|
||||
Comics,
|
||||
|
||||
[PgName("blog-posts")]
|
||||
BlogPosts,
|
||||
|
||||
[PgName("society")]
|
||||
Society,
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum SpellAreaType
|
||||
{
|
||||
[PgName("burst")]
|
||||
Burst,
|
||||
|
||||
[PgName("emanation")]
|
||||
Emanation,
|
||||
|
||||
[PgName("cone")]
|
||||
Cone,
|
||||
|
||||
[PgName("line")]
|
||||
Line,
|
||||
|
||||
[PgName("square")]
|
||||
Square,
|
||||
|
||||
[PgName("cube")]
|
||||
Cube,
|
||||
|
||||
[PgName("cylinder")]
|
||||
Cylinder,
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum SpellDamageCategory
|
||||
{
|
||||
[PgName("persistent")]
|
||||
Persistent,
|
||||
|
||||
[PgName("splash")]
|
||||
Splash,
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum SpellDamageKinds
|
||||
{
|
||||
[PgName("damage")]
|
||||
Damage,
|
||||
|
||||
[PgName("healing")]
|
||||
Healing,
|
||||
|
||||
[PgName("any")]
|
||||
Any,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
public enum TrainingStage
|
||||
{
|
||||
Untrained = 0,
|
||||
|
||||
Trained = 1,
|
||||
|
||||
Expert = 2,
|
||||
|
||||
Master = 3,
|
||||
|
||||
Legendary = 4,
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using NpgsqlTypes;
|
||||
|
||||
namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum TraitType
|
||||
{
|
||||
[PgName("regular")]
|
||||
Regular,
|
||||
|
||||
[PgName("tradition")]
|
||||
Tradition
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using Pf2eModel.Model.Base;
|
||||
|
||||
namespace Pf2eModel.Model;
|
||||
|
||||
public interface IEntity
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public Entity Entity { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
using dotenv.net;
|
||||
using dotenv.net.Utilities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Base.Keywords;
|
||||
using Pf2eModel.Model.Base.Source;
|
||||
using Pf2eModel.Model.Base.Targets;
|
||||
using Pf2eModel.Model.Common;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using Pf2eModel.Model.Structure;
|
||||
using Pf2eModel.Model.Structure.AncestryRelation;
|
||||
using Pf2eModel.Model.Structure.BackgroundRelation;
|
||||
using Pf2eModel.Model.Structure.ClassRelation;
|
||||
using Pf2eModel.Model.Structure.DeityRelation;
|
||||
using Pf2eModel.Model.Structure.FeatRelation;
|
||||
using Pf2eModel.Model.Structure.SpellRelation;
|
||||
|
||||
namespace Pf2eModel.Model;
|
||||
|
||||
public partial class Pf2eDbContext : DbContext
|
||||
{
|
||||
public Pf2eDbContext()
|
||||
{
|
||||
}
|
||||
|
||||
public Pf2eDbContext(DbContextOptions<Pf2eDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
#region DbSets
|
||||
|
||||
public virtual DbSet<Structure.Action> Actions { get; set; }
|
||||
|
||||
public virtual DbSet<Ancestry> Ancestries { get; set; }
|
||||
|
||||
public virtual DbSet<AncestryBoost> AncestryBoosts { get; set; }
|
||||
|
||||
public virtual DbSet<AncestryItem> AncestryItems { get; set; }
|
||||
|
||||
public virtual DbSet<AncestryLanguage> AncestryLanguages { get; set; }
|
||||
|
||||
public virtual DbSet<Background> Backgrounds { get; set; }
|
||||
|
||||
public virtual DbSet<BackgroundBoost> BackgroundBoosts { get; set; }
|
||||
|
||||
public virtual DbSet<BackgroundItem> BackgroundItems { get; set; }
|
||||
|
||||
public virtual DbSet<BackgroundTraining> BackgroundSkills { get; set; }
|
||||
|
||||
public virtual DbSet<Class> Classes { get; set; }
|
||||
|
||||
public virtual DbSet<ClassKeyAbility> ClassKeyAbilities { get; set; }
|
||||
|
||||
public virtual DbSet<ClassProgression> ClassProgressions { get; set; }
|
||||
|
||||
public virtual DbSet<ClassTraining> ClassTrainings { get; set; }
|
||||
|
||||
public virtual DbSet<Condition> Conditions { get; set; }
|
||||
|
||||
public virtual DbSet<Deity> Deities { get; set; }
|
||||
|
||||
public virtual DbSet<DeityAttribute> DeityAttributes { get; set; }
|
||||
|
||||
public virtual DbSet<DeityDomain> DeityDomains { get; set; }
|
||||
|
||||
public virtual DbSet<DeitySpell> DeitySpells { get; set; }
|
||||
|
||||
public virtual DbSet<DeityWeapon> DeityWeapons { get; set; }
|
||||
|
||||
public virtual DbSet<Entity> Entities { get; set; }
|
||||
|
||||
public virtual DbSet<EntityAlias> EntityAliases { get; set; }
|
||||
|
||||
public virtual DbSet<EntityExternal> EntityExternals { get; set; }
|
||||
|
||||
public virtual DbSet<EntitySource> EntitySources { get; set; }
|
||||
|
||||
public virtual DbSet<ExternalTarget> ExternalTargets { get; set; }
|
||||
|
||||
public virtual DbSet<Feat> Feats { get; set; }
|
||||
|
||||
public virtual DbSet<FeatPrerequisite> FeatPrerequisites { get; set; }
|
||||
|
||||
public virtual DbSet<Frequency> Frequencies { get; set; }
|
||||
|
||||
public virtual DbSet<Heritage> Heritages { get; set; }
|
||||
|
||||
public virtual DbSet<Keyword> Keywords { get; set; }
|
||||
|
||||
public virtual DbSet<KeywordAlias> KeywordAliases { get; set; }
|
||||
|
||||
public virtual DbSet<Language> Languages { get; set; }
|
||||
|
||||
public virtual DbSet<Source> Sources { get; set; }
|
||||
|
||||
public virtual DbSet<Spell> Spells { get; set; }
|
||||
|
||||
public virtual DbSet<SpellArea> SpellAreas { get; set; }
|
||||
|
||||
public virtual DbSet<SpellDamage> SpellDamages { get; set; }
|
||||
|
||||
public virtual DbSet<SpellDefense> SpellDefenses { get; set; }
|
||||
|
||||
public virtual DbSet<SpellRitual> SpellRituals { get; set; }
|
||||
|
||||
public virtual DbSet<Training> Trainings { get; set; }
|
||||
|
||||
public virtual DbSet<Trait> Traits { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
DotEnv.Load();
|
||||
|
||||
// optionsBuilder.LogTo(Console.WriteLine);
|
||||
optionsBuilder.UseSnakeCaseNamingConvention();
|
||||
optionsBuilder.UseNpgsql(EnvReader.GetStringValue("DATABASE_CONNECTION"),
|
||||
builder =>
|
||||
{
|
||||
builder
|
||||
.MapEnum<EntityType>()
|
||||
.MapEnum<EntityRarity>()
|
||||
.MapEnum<AliasType>()
|
||||
.MapEnum<TraitType>()
|
||||
.MapEnum<ActionType>()
|
||||
.MapEnum<ActionCategory>()
|
||||
.MapEnum<Size>()
|
||||
.MapEnum<AncestryVision>()
|
||||
.MapEnum<ClassProgressionType>()
|
||||
.MapEnum<ConditionGroup>()
|
||||
.MapEnum<DeityCategory>()
|
||||
.MapEnum<DeityFonts>()
|
||||
.MapEnum<DeitySanctification>()
|
||||
.MapEnum<FeatActionType>()
|
||||
.MapEnum<FeatCategory>()
|
||||
.MapEnum<SpellAreaType>()
|
||||
.MapEnum<SpellDamageCategory>()
|
||||
.MapEnum<SpellDamageKinds>()
|
||||
.MapEnum<AttributeValues>()
|
||||
.MapEnum<TrainingStage>()
|
||||
.MapEnum<SourceCategory>()
|
||||
;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,412 @@
|
||||
using LinqToDB.Common;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Base.Keywords;
|
||||
using Pf2eModel.Model.Base.Source;
|
||||
using Pf2eModel.Model.Base.Targets;
|
||||
using Pf2eModel.Model.Common;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using Pf2eModel.Model.Structure;
|
||||
using Pf2eModel.Model.Structure.AncestryRelation;
|
||||
using Pf2eModel.Model.Structure.BackgroundRelation;
|
||||
using Pf2eModel.Model.Structure.ClassRelation;
|
||||
using Pf2eModel.Model.Structure.DeityRelation;
|
||||
using Pf2eModel.Model.Structure.FeatRelation;
|
||||
using Pf2eModel.Model.Structure.SpellRelation;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Pf2eModel.Model;
|
||||
|
||||
public partial class Pf2eDbContext
|
||||
{
|
||||
public const int NameLength = 255;
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.UseIdentityByDefaultColumns();
|
||||
|
||||
DefineEnums(modelBuilder);
|
||||
DefineBase(modelBuilder);
|
||||
DefineCommon(modelBuilder);
|
||||
DefineStructure(modelBuilder);
|
||||
DefineFunctions(modelBuilder);
|
||||
}
|
||||
|
||||
private void DefineEnums(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder
|
||||
.HasPostgresEnum<EntityType>()
|
||||
.HasPostgresEnum<EntityRarity>()
|
||||
.HasPostgresEnum<AliasType>()
|
||||
.HasPostgresEnum<TraitType>()
|
||||
.HasPostgresEnum<ActionType>()
|
||||
.HasPostgresEnum<ActionCategory>()
|
||||
.HasPostgresEnum<Size>()
|
||||
.HasPostgresEnum<AncestryVision>()
|
||||
.HasPostgresEnum<ClassProgressionType>()
|
||||
.HasPostgresEnum<ConditionGroup>()
|
||||
.HasPostgresEnum<DeityCategory>()
|
||||
.HasPostgresEnum<DeityFonts>()
|
||||
.HasPostgresEnum<DeitySanctification>()
|
||||
.HasPostgresEnum<FeatActionType>()
|
||||
.HasPostgresEnum<FeatCategory>()
|
||||
.HasPostgresEnum<SpellAreaType>()
|
||||
.HasPostgresEnum<SpellDamageCategory>()
|
||||
.HasPostgresEnum<SpellDamageKinds>()
|
||||
.HasPostgresEnum<AttributeValues>()
|
||||
.HasPostgresEnum<TrainingStage>()
|
||||
.HasPostgresEnum<SourceCategory>()
|
||||
;
|
||||
}
|
||||
|
||||
private void DefineBase(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Entity>(entity =>
|
||||
{
|
||||
entity.HasMany(e => e.Traits).WithMany(t => t.Entities);
|
||||
|
||||
entity.HasMany(e => e.Keywords).WithMany(t => t.Entities);
|
||||
|
||||
// EntityAlias
|
||||
entity.HasMany(e => e.Aliases).WithOne(e => e.Entity)
|
||||
.HasForeignKey(e => e.EntityId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
// EntitySource
|
||||
entity.HasMany(e => e.Sources).WithOne(e => e.Entity)
|
||||
.HasForeignKey(e => e.EntityId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
// EntityExternal
|
||||
entity.HasMany(e => e.Externals).WithOne(e => e.Entity)
|
||||
.HasForeignKey(e => e.EntityId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
modelBuilder.Entity<EntityAlias>(entity => { });
|
||||
|
||||
// Source
|
||||
modelBuilder.Entity<Source>(entity =>
|
||||
{
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
|
||||
entity.HasMany(s => s.EntitySources).WithOne(e => e.Source)
|
||||
.HasForeignKey(e => e.SourceId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
// + EntitySource
|
||||
});
|
||||
modelBuilder.Entity<EntitySource>(entity => { });
|
||||
|
||||
// External
|
||||
modelBuilder.Entity<ExternalTarget>(entity =>
|
||||
{
|
||||
entity.HasMany(t => t.EntityExternals).WithOne(e => e.Target)
|
||||
.HasForeignKey(e => e.TargetId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
modelBuilder.Entity<EntityExternal>(entity => { });
|
||||
|
||||
// Keywords
|
||||
modelBuilder.Entity<Keyword>(entity =>
|
||||
{
|
||||
entity.HasMany(e => e.Aliases).WithOne(e => e.Keyword)
|
||||
.HasForeignKey(e => e.KeywordId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
modelBuilder.Entity<KeywordAlias>(entity => { });
|
||||
}
|
||||
|
||||
private void DefineCommon(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Frequency>(entity => { });
|
||||
|
||||
modelBuilder.Entity<Language>(entity => { });
|
||||
|
||||
modelBuilder.Entity<Training>(entity => { });
|
||||
}
|
||||
|
||||
private void BindEntity<T>(EntityTypeBuilder<T> entity) where T : class, IEntity
|
||||
{
|
||||
entity.HasOne(entity => entity.Entity)
|
||||
.WithOne()
|
||||
.HasForeignKey<T>(entity => entity.Id)
|
||||
.IsRequired();
|
||||
}
|
||||
|
||||
private void DefineStructure(ModelBuilder modelBuilder)
|
||||
{
|
||||
// Action
|
||||
modelBuilder.Entity<Structure.Action>(entity =>
|
||||
{
|
||||
BindEntity(entity);
|
||||
});
|
||||
|
||||
// Ancestry
|
||||
modelBuilder.Entity<Ancestry>(entity =>
|
||||
{
|
||||
BindEntity(entity);
|
||||
|
||||
entity.HasMany(e => e.AncestryBoosts).WithOne(e => e.Ancestry)
|
||||
.HasForeignKey(e => e.AncestryId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasMany(e => e.AncestryItems).WithOne(e => e.Ancestry)
|
||||
.HasForeignKey(e => e.AncestryId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasMany(e => e.AncestryLanguages).WithOne(e => e.Ancestry)
|
||||
.HasForeignKey(e => e.AncestryId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
modelBuilder.Entity<AncestryBoost>(entity => { });
|
||||
modelBuilder.Entity<AncestryItem>(entity =>
|
||||
{
|
||||
entity.HasOne(d => d.Item).WithMany()
|
||||
.HasForeignKey(d => d.ItemId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
modelBuilder.Entity<AncestryLanguage>(entity =>
|
||||
{
|
||||
entity.HasOne(d => d.Language).WithMany()
|
||||
.HasForeignKey(d => d.LanguageId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
// Background
|
||||
modelBuilder.Entity<Background>(entity =>
|
||||
{
|
||||
BindEntity(entity);
|
||||
});
|
||||
modelBuilder.Entity<BackgroundBoost>(entity =>
|
||||
{
|
||||
entity.HasOne(d => d.Background).WithMany(p => p.BackgroundBoosts)
|
||||
.HasForeignKey(d => d.BackgroundId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
modelBuilder.Entity<BackgroundItem>(entity =>
|
||||
{
|
||||
entity.HasOne(d => d.Background).WithMany(p => p.BackgroundItems)
|
||||
.HasForeignKey(d => d.BackgroundId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasOne(d => d.Entity).WithMany()
|
||||
.HasForeignKey(d => d.EntityId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
modelBuilder.Entity<BackgroundTraining>(entity =>
|
||||
{
|
||||
entity.HasOne(d => d.Background).WithMany(p => p.BackgroundSkills)
|
||||
.HasForeignKey(d => d.BackgroundId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
// Class
|
||||
modelBuilder.Entity<Class>(entity =>
|
||||
{
|
||||
BindEntity(entity);
|
||||
});
|
||||
modelBuilder.Entity<ClassKeyAbility>(entity =>
|
||||
{
|
||||
entity.HasOne(d => d.Class).WithMany(p => p.ClassKeyAbilities)
|
||||
.HasForeignKey(d => d.ClassId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
modelBuilder.Entity<ClassProgression>(entity =>
|
||||
{
|
||||
entity.HasOne(d => d.Class).WithMany(p => p.ClassProgressions)
|
||||
.HasForeignKey(d => d.ClassId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasOne(d => d.Entity).WithMany()
|
||||
.HasForeignKey(d => d.EntityId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
modelBuilder.Entity<ClassTraining>(entity =>
|
||||
{
|
||||
entity.HasOne(d => d.Class).WithMany(p => p.ClassTrainings)
|
||||
.HasForeignKey(d => d.ClassId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasOne(d => d.Training).WithMany()
|
||||
.HasForeignKey(d => d.TrainingId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
// Condition
|
||||
modelBuilder.Entity<Condition>(entity =>
|
||||
{
|
||||
BindEntity(entity);
|
||||
});
|
||||
|
||||
// Deity
|
||||
modelBuilder.Entity<Deity>(entity =>
|
||||
{
|
||||
BindEntity(entity);
|
||||
|
||||
entity.HasMany(e => e.DeityAttributes).WithOne(e => e.Deity)
|
||||
.HasForeignKey(e => e.DeityId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasMany(e => e.DeityDomains).WithOne(e => e.Deity)
|
||||
.HasForeignKey(e => e.DeityId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasMany(e => e.DeitySpells).WithOne(e => e.Deity)
|
||||
.HasForeignKey(e => e.DeityId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasMany(e => e.DeityWeapons).WithOne(e => e.Deity)
|
||||
.HasForeignKey(e => e.DeityId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasMany(e => e.Skills).WithMany();
|
||||
});
|
||||
modelBuilder.Entity<DeityAttribute>(entity => { });
|
||||
modelBuilder.Entity<DeityDomain>(entity => { });
|
||||
modelBuilder.Entity<DeitySpell>(entity =>
|
||||
{
|
||||
entity.HasOne(d => d.Spell).WithMany()
|
||||
.HasForeignKey(d => d.SpellId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
modelBuilder.Entity<DeityWeapon>(entity => { });
|
||||
|
||||
// Feat
|
||||
modelBuilder.Entity<Feat>(entity =>
|
||||
{
|
||||
BindEntity(entity);
|
||||
|
||||
entity.HasMany(e => e.FeatPrerequisites).WithOne(e => e.Feat)
|
||||
.HasForeignKey(e => e.FeatId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
modelBuilder.Entity<FeatPrerequisite>(entity => { });
|
||||
|
||||
// Heritage
|
||||
modelBuilder.Entity<Heritage>(entity =>
|
||||
{
|
||||
BindEntity(entity);
|
||||
|
||||
entity.HasOne(d => d.Ancestry).WithMany(p => p.Heritages)
|
||||
.HasForeignKey(d => d.AncestryId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
// Spell
|
||||
modelBuilder.Entity<Spell>(entity =>
|
||||
{
|
||||
BindEntity(entity);
|
||||
|
||||
entity.HasOne(e => e.SpellArea).WithOne(e => e.Spell)
|
||||
.HasForeignKey<SpellArea>(e => e.SpellId)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired(false);
|
||||
|
||||
entity.HasOne(e => e.SpellRitual).WithOne(e => e.Spell)
|
||||
.HasForeignKey<SpellRitual>(e => e.SpellId)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired(false);
|
||||
|
||||
entity.HasMany(e => e.SpellDamages).WithOne(e => e.Spell)
|
||||
.HasForeignKey(e => e.SpellId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasMany(e => e.SpellDefenses).WithOne(e => e.Spell)
|
||||
.HasForeignKey(e => e.SpellId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
modelBuilder.Entity<SpellArea>(entity => { });
|
||||
modelBuilder.Entity<SpellDamage>(entity => { });
|
||||
modelBuilder.Entity<SpellDefense>(entity => { });
|
||||
modelBuilder.Entity<SpellRitual>(entity => { });
|
||||
|
||||
// Trait
|
||||
modelBuilder.Entity<Trait>(entity =>
|
||||
{
|
||||
BindEntity(entity);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void DefineFunctions(ModelBuilder modelBuilder)
|
||||
{
|
||||
// modelBuilder.HasDbFunction(typeof(Pf2eDbContext).GetMethod(nameof(FTruncateTables), Array.Empty<Type>()))
|
||||
/*
|
||||
modelBuilder.HasPostgresExtension($"""
|
||||
CREATE OR REPLACE FUNCTION f_truncate_tables()
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql AS
|
||||
$func$
|
||||
BEGIN
|
||||
EXECUTE (
|
||||
SELECT 'TRUNCATE TABLE '
|
||||
|| string_agg(format('%I.%I', schemaname, tablename), ', ')
|
||||
|| ' CASCADE;'
|
||||
FROM pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
AND tablename != '__EFMigrationsHistory'
|
||||
);
|
||||
END
|
||||
$func$;
|
||||
""")
|
||||
;
|
||||
|
||||
/*
|
||||
Database.ExecuteSql($"""
|
||||
CREATE OR REPLACE FUNCTION f_truncate_tables()
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql AS
|
||||
$func$
|
||||
BEGIN
|
||||
EXECUTE (
|
||||
SELECT 'TRUNCATE TABLE '
|
||||
|| string_agg(format('%I.%I', schemaname, tablename), ', ')
|
||||
|| ' CASCADE;'
|
||||
FROM pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
AND tablename != '__EFMigrationsHistory'
|
||||
);
|
||||
END
|
||||
$func$;
|
||||
""");
|
||||
|
||||
Database.ExecuteSql($"""
|
||||
CREATE OR REPLACE FUNCTION f_drop_tables()
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql AS
|
||||
$func$
|
||||
BEGIN
|
||||
EXECUTE (
|
||||
SELECT 'DROP TABLE '
|
||||
|| string_agg(format('%I.%I', schemaname, tablename), ', ')
|
||||
|| ' CASCADE;'
|
||||
FROM pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
);
|
||||
END
|
||||
$func$;
|
||||
""");
|
||||
|
||||
Database.ExecuteSql($"""
|
||||
CREATE OR REPLACE FUNCTION f_permission_tables(_username text)
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql AS
|
||||
$func$
|
||||
DECLARE
|
||||
_tbl text;
|
||||
_sch text;
|
||||
BEGIN
|
||||
FOR _sch, _tbl IN
|
||||
SELECT schemaname, tablename
|
||||
FROM pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
LOOP
|
||||
EXECUTE format('ALTER TABLE %I.%I OWNER TO %I', _sch, _tbl, _username);
|
||||
END LOOP;
|
||||
END
|
||||
$func$;
|
||||
""");
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure;
|
||||
|
||||
public partial class Action : IEntity
|
||||
{
|
||||
[System.ComponentModel.DataAnnotations.Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[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;
|
||||
|
||||
[Column(Order = 4)]
|
||||
public int? MaxActions { get; set; } = null;
|
||||
|
||||
[Column(Order = 5)]
|
||||
public bool IsReaction { get; set; } = false;
|
||||
|
||||
[Column(Order = 6)]
|
||||
public bool IsFreeAction { get; set; } = false;
|
||||
|
||||
[Column(Order = 6)]
|
||||
public bool IsPassive { get; set; } = false;
|
||||
|
||||
[Column(Order = 6)]
|
||||
public string? Extra { get; set; }
|
||||
|
||||
|
||||
public Entity Entity { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using Pf2eModel.Model.Structure.AncestryRelation;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure;
|
||||
|
||||
public partial class Ancestry : IEntity
|
||||
{
|
||||
[System.ComponentModel.DataAnnotations.Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public Entity Entity { get; set; } = null!;
|
||||
|
||||
[Column(Order = 2)]
|
||||
public Size Size { get; set; } = Size.med;
|
||||
|
||||
[Column(Order = 3)]
|
||||
public int Hp { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public int Reach { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
public int Speed { get; set; }
|
||||
|
||||
[Column(Order = 6)]
|
||||
public AncestryVision Vision { get; set; } = AncestryVision.normal;
|
||||
|
||||
public virtual ICollection<AncestryBoost> AncestryBoosts { get; set; } = [];
|
||||
|
||||
public virtual ICollection<AncestryItem> AncestryItems { get; set; } = [];
|
||||
|
||||
public virtual ICollection<AncestryLanguage> AncestryLanguages { get; set; } = [];
|
||||
|
||||
public virtual ICollection<Heritage> Heritages { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.AncestryRelation;
|
||||
|
||||
public partial class AncestryBoost
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int AncestryId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public bool Boost { get; set; } = true;
|
||||
|
||||
[Column(Order = 4)]
|
||||
public Enum.AttributeValues Value { get; set; }
|
||||
|
||||
public virtual Ancestry Ancestry { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Pf2eModel.Model.Base;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.AncestryRelation;
|
||||
|
||||
[PrimaryKey(nameof(AncestryId), nameof(ItemId))]
|
||||
public partial class AncestryItem
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public int AncestryId { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int ItemId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public int Level { get; set; }
|
||||
|
||||
public virtual Ancestry Ancestry { get; set; } = null!;
|
||||
|
||||
public virtual Entity Item { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Pf2eModel.Model.Common;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.AncestryRelation;
|
||||
|
||||
[PrimaryKey(nameof(AncestryId), nameof(LanguageId))]
|
||||
public partial class AncestryLanguage
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public int AncestryId { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int LanguageId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public bool IsAdditional { get; set; }
|
||||
|
||||
public virtual Ancestry Ancestry { get; set; } = null!;
|
||||
|
||||
public virtual Language Language { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Structure.BackgroundRelation;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure;
|
||||
|
||||
public partial class Background : IEntity
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public Entity Entity { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<BackgroundBoost> BackgroundBoosts { get; set; } = [];
|
||||
|
||||
public virtual ICollection<BackgroundItem> BackgroundItems { get; set; } = [];
|
||||
|
||||
public virtual ICollection<BackgroundTraining> BackgroundSkills { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.BackgroundRelation;
|
||||
|
||||
public partial class BackgroundBoost
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int BackgroundId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public AttributeValues Attribute { get; set; }
|
||||
|
||||
public virtual Background Background { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Pf2eModel.Model.Base;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.BackgroundRelation;
|
||||
|
||||
[PrimaryKey(nameof(BackgroundId), nameof(EntityId))]
|
||||
public partial class BackgroundItem
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public int BackgroundId { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int EntityId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public int? Level { get; set; }
|
||||
|
||||
public virtual Background Background { get; set; } = null!;
|
||||
|
||||
public virtual Entity Entity { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using Pf2eModel.Model.Common;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.BackgroundRelation;
|
||||
|
||||
public partial class BackgroundTraining
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int BackgroundId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public int TrainingId { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public TrainingStage Level { get; set; }
|
||||
|
||||
public virtual Background Background { get; set; } = null!;
|
||||
|
||||
public virtual Training Training { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Structure.ClassRelation;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure;
|
||||
|
||||
public partial class Class : IEntity
|
||||
{
|
||||
[Key]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public Entity Entity { get; set; } = null!;
|
||||
|
||||
[Column(Order = 3)]
|
||||
public int Hp { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public int Perception { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
public bool Spellcasting { get; set; }
|
||||
|
||||
[Column(Order = 6)]
|
||||
public int AdditionalTrainedSkills { get; set; }
|
||||
|
||||
public virtual ICollection<ClassKeyAbility> ClassKeyAbilities { get; set; } = [];
|
||||
|
||||
public virtual ICollection<ClassProgression> ClassProgressions { get; set; } = [];
|
||||
|
||||
public virtual ICollection<ClassTraining> ClassTrainings { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.ClassRelation;
|
||||
|
||||
public partial class ClassKeyAbility
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int ClassId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public AttributeValues Value { get; set; }
|
||||
|
||||
public virtual Class Class { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.ClassRelation;
|
||||
public partial class ClassProgression
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int ClassId { get; set; }
|
||||
|
||||
[Column(Order = 31)]
|
||||
public int Level { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public ClassProgressionType Type { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
public int? EntityId { get; set; }
|
||||
|
||||
public virtual Class Class { get; set; } = null!;
|
||||
|
||||
public virtual Entity? Entity { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Pf2eModel.Model.Common;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.ClassRelation;
|
||||
|
||||
public partial class ClassTraining
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int ClassId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public int? TrainingId { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
[MaxLength(Pf2eDbContext.NameLength)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
public int Stage { get; set; }
|
||||
|
||||
public virtual Class Class { get; set; } = null!;
|
||||
|
||||
public virtual Training? Training { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure;
|
||||
|
||||
public partial class Condition : IEntity
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public Entity Entity { get; set; } = null!;
|
||||
|
||||
[Column(Order = 2)]
|
||||
public ConditionGroup? Group { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public string? Extra { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Common;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using Pf2eModel.Model.Structure.DeityRelation;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure;
|
||||
|
||||
public partial class Deity : IEntity
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public Entity Entity { get; set; } = null!;
|
||||
|
||||
[Column(Order = 2)]
|
||||
public DeityCategory Category { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public DeityFonts Fonts { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public DeitySanctification Sanctification { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
public bool SanctificationMust { get; set; }
|
||||
|
||||
public virtual ICollection<DeityAttribute> DeityAttributes { get; set; } = new List<DeityAttribute>();
|
||||
|
||||
public virtual ICollection<DeityDomain> DeityDomains { get; set; } = new List<DeityDomain>();
|
||||
|
||||
public virtual ICollection<DeitySpell> DeitySpells { get; set; } = new List<DeitySpell>();
|
||||
|
||||
public virtual ICollection<DeityWeapon> DeityWeapons { get; set; } = new List<DeityWeapon>();
|
||||
|
||||
public virtual ICollection<Training> Skills { get; set; } = new List<Training>();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.DeityRelation;
|
||||
|
||||
[PrimaryKey(nameof(DeityId), nameof(Attribute))]
|
||||
public partial class DeityAttribute
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public int DeityId { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public AttributeValues Attribute { get; set; }
|
||||
|
||||
public virtual Deity Deity { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.DeityRelation;
|
||||
|
||||
public partial class DeityDomain
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int DeityId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public bool IsPrimary { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
[MaxLength(Pf2eDbContext.NameLength)]
|
||||
public string Value { get; set; } = null!;
|
||||
|
||||
public virtual Deity Deity { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.DeityRelation;
|
||||
|
||||
public partial class DeitySpell
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int DeityId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public int Level { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public int SpellId { get; set; }
|
||||
|
||||
public virtual Deity Deity { get; set; } = null!;
|
||||
|
||||
public virtual Spell Spell { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.DeityRelation;
|
||||
|
||||
public partial class DeityWeapon
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int DeityId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
[MaxLength(Pf2eDbContext.NameLength)]
|
||||
public string Weapon { get; set; } = null!;
|
||||
|
||||
public virtual Deity Deity { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using Pf2eModel.Model.Structure.FeatRelation;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure;
|
||||
|
||||
public partial class Feat : IEntity
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
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 = 6)]
|
||||
public int? LevelTaken { get; set; }
|
||||
|
||||
[Column(Order = 7)]
|
||||
public int? MaxTakable { get; set; }
|
||||
|
||||
[Column(Order = 8)]
|
||||
[MaxLength(255)]
|
||||
public string? Location { get; set; }
|
||||
|
||||
[Column(Order = 9)]
|
||||
public bool? OnlyLevel1 { get; set; }
|
||||
|
||||
[Column(Order = 10)]
|
||||
public string? Extra { get; set; }
|
||||
|
||||
public virtual ICollection<FeatPrerequisite> FeatPrerequisites { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.FeatRelation;
|
||||
|
||||
public partial class FeatPrerequisite
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int FeatId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
[MaxLength(255)]
|
||||
public string Value { get; set; } = null!;
|
||||
|
||||
public virtual Feat Feat { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Pf2eModel.Model.Base;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure;
|
||||
|
||||
public partial class Heritage : IEntity
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public Entity Entity { get; set; } = null!;
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int? AncestryId { get; set; }
|
||||
|
||||
public virtual Ancestry? Ancestry { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Structure.SpellRelation;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure;
|
||||
|
||||
public partial class Spell : IEntity
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[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 Cost { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public bool Counteraction { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
public bool Sustained { get; set; }
|
||||
|
||||
[Column(Order = 6)]
|
||||
[MaxLength(255)]
|
||||
public string Duration { get; set; } = null!;
|
||||
|
||||
[Column(Order = 7)]
|
||||
[MaxLength(255)]
|
||||
public string Range { get; set; } = null!;
|
||||
|
||||
[Column(Order = 8)]
|
||||
[MaxLength(255)]
|
||||
public string Requirements { get; set; } = null!;
|
||||
|
||||
[Column(Order = 9)]
|
||||
[MaxLength(255)]
|
||||
public string Target { get; set; } = null!;
|
||||
|
||||
[Column(Order = 10)]
|
||||
[MaxLength(255)]
|
||||
public string Time { get; set; } = null!;
|
||||
|
||||
[Column(Order = 11)]
|
||||
public bool CanHeightening { get; set; }
|
||||
|
||||
public virtual SpellArea? SpellArea { get; set; }
|
||||
|
||||
public virtual SpellRitual? SpellRitual { get; set; }
|
||||
|
||||
public virtual ICollection<SpellDamage> SpellDamages { get; set; } = new List<SpellDamage>();
|
||||
|
||||
public virtual ICollection<SpellDefense> SpellDefenses { get; set; } = new List<SpellDefense>();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.SpellRelation;
|
||||
|
||||
public partial class SpellArea
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Column(Order = 1)]
|
||||
public int SpellId { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
[MaxLength(255)]
|
||||
public string? Details { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public SpellAreaType Type { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public int Value { get; set; }
|
||||
|
||||
public virtual Spell Spell { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.SpellRelation;
|
||||
|
||||
public partial class SpellDamage
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int SpellId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
[MaxLength(255)]
|
||||
public string Key { get; set; } = null!;
|
||||
|
||||
[Column(Order = 4)]
|
||||
public bool? ApplyMod { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
public SpellDamageCategory? Category { get; set; }
|
||||
|
||||
[Column(Order = 6)]
|
||||
[MaxLength(255)]
|
||||
public string Formula { get; set; } = null!;
|
||||
|
||||
[Column(Order = 7)]
|
||||
public SpellDamageKinds Kinds { get; set; }
|
||||
|
||||
[Column(Order = 8)]
|
||||
[MaxLength(255)]
|
||||
public string? Materials { get; set; }
|
||||
|
||||
[Column(Order = 9)]
|
||||
[MaxLength(255)]
|
||||
public string Type { get; set; } = null!;
|
||||
|
||||
public virtual Spell Spell { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.SpellRelation;
|
||||
|
||||
public partial class SpellDefense
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public int SpellId { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public bool IsPassive { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public bool? IsBasic { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
[MaxLength(255)]
|
||||
public string Statistic { get; set; } = null!;
|
||||
|
||||
public virtual Spell Spell { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.SpellRelation;
|
||||
|
||||
public partial class SpellRitual
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Column(Order = 1)]
|
||||
public int SpellId { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
[MaxLength(255)]
|
||||
public string PrimaryCheck { get; set; } = null!;
|
||||
|
||||
[Column(Order = 3)]
|
||||
public int SecondaryCasters { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
[MaxLength(255)]
|
||||
public string SecondaryChecks { get; set; } = null!;
|
||||
|
||||
public virtual Spell Spell { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure;
|
||||
|
||||
public partial class Trait : IEntity
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public Entity Entity { get; set; } = null!;
|
||||
|
||||
[Column(Order = 2)]
|
||||
public TraitType Type { get; set; }
|
||||
|
||||
public virtual ICollection<Entity> Entities { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\Pf2eDataScrapper\.env" Link=".env">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="dotenv.net" Version="3.2.1" />
|
||||
<PackageReference Include="EFCore.NamingConventions" Version="9.0.0" />
|
||||
<PackageReference Include="linq2db" Version="5.4.1" />
|
||||
<PackageReference Include="linq2db.EntityFrameworkCore" Version="9.0.0" />
|
||||
<PackageReference Include="Npgsql" Version="9.0.3" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user