diff --git a/Pf2eDataScrapper/Importers/DatabaseHelper.cs b/Pf2eDataScrapper/Importers/DatabaseHelper.cs new file mode 100644 index 0000000..a8af780 --- /dev/null +++ b/Pf2eDataScrapper/Importers/DatabaseHelper.cs @@ -0,0 +1,33 @@ +using Pf2eDataScrapper.Model; +using Slugify; + +namespace Pf2eDataScrapper.Importers; +public class DatabaseHelper +{ + public Pf2eDbContext Context = new(); + + public SlugHelper Slugger = new(); + + + private int _id = 0; + + public int NextEntityId { get => ++_id; set => _id = value; } + + private DatabaseHelper() + { + NextEntityId = Context.Entities.Any() ? Context.Entities.Max(e => e.Id) : 0; + } + + public string GenerateSlug(string name) + { + return Slugger.GenerateSlug(name); + } + + + + public static readonly DatabaseHelper Instance = new(); + + public static readonly Pf2eDbContext DbContext = Instance.Context; + + +} diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/AonprdImporter.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/AonprdImporter.cs index 425274d..d0f6be7 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/AonprdImporter.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/AonprdImporter.cs @@ -1,11 +1,12 @@ -using Pf2eDataScrapper.Importers.Implementations.Aonprd.SchemaBuilder; +using Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder; +using Pf2eDataScrapper.Importers.Implementations.Aonprd.SchemaBuilder; using Pf2eDataScrapper.Importers.Repositories; namespace Pf2eDataScrapper.Importers.Implementations.Aonprd; internal class AonprdImporter : AbstractImporter { - public override string Name => "Archives of Nethys Pathfinder 2e"; + public override string Name => SourceName; public override string Slug => "aonprd"; @@ -34,6 +35,11 @@ internal class AonprdImporter : AbstractImporter public override void Import() { - throw new NotImplementedException(); + AonprdDataBuilder builder = new(Loader); + + builder.TruncateTables(); + builder.Build(); } + + public const string SourceName = "Archives of Nethys Pathfinder 2e"; } diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/AonprdLoader.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/AonprdLoader.cs index ba0fc32..b66fe0d 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/AonprdLoader.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/AonprdLoader.cs @@ -9,7 +9,7 @@ internal class AonprdLoader(AonprdImporter importer) public AonprdCompendium Compendium = new(); - public int ItemCount => Compendium.Count; + public int ItemCount => Compendium.Count(); public void Prepare() { diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Compendium/AonprdCompendium.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Compendium/AonprdCompendium.cs index 02b2463..24780dd 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Compendium/AonprdCompendium.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Compendium/AonprdCompendium.cs @@ -18,10 +18,14 @@ internal class AonprdCompendium } } - public int Count => Types.Values.Sum(x => x.Count); + public int Count() => Types.Values.Sum(t => t.Count); + public int Count(IEnumerable types) => Types.Values + .Where(t => types.Contains(t.Type)) + .Sum(t => t.Count); public IEnumerable Files(IEnumerable types) => Types.Values .Where(t => types.Contains(t.Type)) .SelectMany(t => t.Files) .Distinct(); + } diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AbstractProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AbstractProcessor.cs new file mode 100644 index 0000000..5337312 --- /dev/null +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AbstractProcessor.cs @@ -0,0 +1,265 @@ +using LinqToDB; +using Newtonsoft.Json.Linq; +using Pf2eDataScrapper.Model; +using Pf2eDataScrapper.Model.Base; +using Pf2eDataScrapper.Model.Base.Source; +using Pf2eDataScrapper.Model.Base.Targets; +using Pf2eDataScrapper.Model.Enum; +using Pf2eDataScrapper.Model.Structure; +using System.Security.Cryptography; +using System.Text; +using System.Text.RegularExpressions; + +namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder; + +internal abstract partial class AbstractProcessor(ProcessorInput input) +{ + protected DatabaseHelper Helper = DatabaseHelper.Instance; + + public readonly Pf2eDbContext Context = DatabaseHelper.DbContext; + + public readonly ProcessorInput Input = input; + + public Entity Entity { get; set; } = new(); + + public abstract EntityType Type { get; } + + public abstract IEntity Object { get; } + + public virtual void Process() + { + if (Input.GetOptional("remaster_id") is not null) + { + string id = Input.GetRequired("id"); + string name = Input.GetRequired("name"); + + ProcessLegacy(id, name); + throw new LegacyItemException(name); + } + + AddEntity(); + AddAlias(); + AddSource(); + AddExternal(); + AddTraits(); + } + + public void Save() + { + Context.SaveChanges(); + } + + protected virtual void AddEntity() + { + Entity.Id = Helper.NextEntityId; + Entity.Type = Type; + Entity.Name = Input.GetRequired("name"); + Entity.Img = ""; // GetRequired("img"); + Entity.Description = Input.GetRequired("markdown"); + Entity.Rarity = Input.EnumOptional("rarity", EntityRarity.Common); + Entity.Slug = Helper.GenerateSlug(Entity.Name); + Entity.IsTranslated = false; + Entity.IsChecked = false; + + Object.Id = Entity.Id; + + Context.Entities.Add(Entity); + } + + protected virtual void AddAlias() + { + EntityAlias alias = new() + { + Type = AliasType.English, + Alias = Entity.Name, + Entity = Entity + }; + + Context.EntityAliases.Add(alias); + + var legacyIdArray = Input.GetOptional("legacy_id"); + + if (legacyIdArray is not null) + { + string legacyId = legacyIdArray[0].ToString(); + + if (LegacyAliases.TryGetValue(legacyId, out var legacyName)) + { + if (legacyName != Entity.Name) + { + EntityAlias legacyAlias = new() + { + Type = AliasType.LegacyEnglish, + Alias = legacyName, + Entity = Entity + }; + + Context.EntityAliases.Add(legacyAlias); + } + + LegacyAliases.Remove(legacyId); + } + else + { + RemasterWithoutLegacy.Add(legacyId, Entity); + } + } + + } + + protected virtual void AddSource() + { + string name = Input.GetRequired("source[0]"); + + Source? source = Context.Sources.FirstOrDefault(s => s.Name == name); + + if (source == null) + { + source = new() + { + Name = name, + Category = Input.EnumRequired("primary_source_category"), + ReleaseDate = DateOnly.Parse(Input.GetRequired("release_date")), + }; + + Context.Sources.Add(source); + } + string sourceMarkdown = Input.GetRequired("source_markdown"); + Match match = SourceSuffixRegex().Match(sourceMarkdown); + + EntitySource entitySource = new() + { + Entity = Entity, + Source = source, + Suffix = ((match?.Captures.Count > 0) ? match?.Captures[0]?.Value : "") ?? "", + IsRemaster = Input.GetOptional("legacy_id") is not null + }; + + Context.EntitySources.Add(entitySource); + } + + protected virtual void AddExternal() + { + if (AonprdTarget is null) + { + AonprdTarget = Context.ExternalTargets.FirstOrDefault(t => t.Name == AonprdImporter.SourceName); + + AonprdTarget ??= new() + { + Name = AonprdImporter.SourceName, + Icon = "http://www.google.com/s2/favicons?domain=2e.aonprd.com", + Prefix = "https://2e.aonprd.com", + }; + } + + EntityExternal external = new() + { + Entity = Entity, + Target = AonprdTarget, + Suffix = Input.GetRequired("url"), + Md5 = Md5(Input.Input.ToString()) + }; + Context.EntityExternals.Add(external); + } + + protected virtual void AddTraits() + { + JToken? traitsJson = Input.Input.SelectToken("trait"); + + if (traitsJson?.Type != JTokenType.Array) + { + throw new Exception("'trait' is expected to be an array"); + } + + var names = traitsJson.ToArray().Select(jToken => jToken.ToString()); + var traitEntities = Context.Traits + .SelectMany(t => t.Entity.Aliases) + .Where(a => names.Contains(a.Alias)) + .Select(a => a.Entity) + .ToList(); + + var traits = Context.Traits + .Where(t => traitEntities.Contains(t.Entity)) + .ToList(); + + foreach (string name in names) + { + if (!traits.Any(t => t.Entity.Aliases.Select(a => a.Alias).Contains(name))) + { + throw new Exception($"Trait '{name}' is not found!!!"); + } + } + + foreach (Trait trait in traits) + { + Entity.Traits.Add(trait); + } + } + + + protected IEnumerable GetTraits(IEnumerable names) + { + List result = Context.Traits.Where(t => names.Contains(t.Entity.Name)).ToList(); + + foreach (string name in names) + { + if (result.Any(t => t.Entity.Name == name)) + { + continue; + } + /* + Trait trait = new() + { + Name = name, + Slug = name, + Type = TraitType.Regular, + Description = "", + }; + Context.Traits.Add(trait); + result.Add(trait); + */ + } + + return result; + } + + protected void ProcessLegacy(string id, string name) + { + if (RemasterWithoutLegacy.TryGetValue(id, out Entity? remastered)) + { + if (remastered.Name != name) + { + EntityAlias alias = new() + { + Type = AliasType.LegacyEnglish, + Alias = name, + Entity = remastered! + }; + Context.EntityAliases.Add(alias); + } + } + else + { + LegacyAliases.Add(id, name); + } + } + + public static string Md5(string input, bool isLowercase = false) + { + using MD5 md5 = MD5.Create(); + byte[] byteHash = md5.ComputeHash(Encoding.UTF8.GetBytes(input)); + string hash = BitConverter.ToString(byteHash).Replace("-", ""); + return (isLowercase) ? hash.ToLower() : hash; + } + + protected static ExternalTarget? AonprdTarget = null; + + protected static Dictionary LegacyAliases = []; + + protected static Dictionary RemasterWithoutLegacy = []; + + [GeneratedRegex(@"^\[.*?\]\(.*?\)\s+(.*)$")] + private static partial Regex SourceSuffixRegex(); + + public class LegacyItemException(string name) : Exception($"Item '{name}' is linked with newer version, skipping.") { } +} diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AonprdDataBuilder.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AonprdDataBuilder.cs new file mode 100644 index 0000000..173c946 --- /dev/null +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AonprdDataBuilder.cs @@ -0,0 +1,84 @@ +using Konsole; +using Newtonsoft.Json.Linq; +using Pf2eDataScrapper.Importers.Implementations.Aonprd.Compendium; +using Pf2eDataScrapper.Importers.Implementations.Pf2eFoundry.Compendium; +using Pf2eDataScrapper.Model.Base; +using System; +using System.ComponentModel; +using System.Reflection; +using static Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder.AbstractProcessor; + +namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder; + +internal class AonprdDataBuilder(AonprdLoader loader) +{ + public Pf2eDatabase Database = Pf2eDatabase.Instance; + + /// + /// Загрузчик данных. + /// + public readonly AonprdLoader Loader = loader; + + /// + /// Коллекция папок компендиума. + /// + public AonprdCompendium Compendium => Loader.Compendium; + + public AonprdProcessorCollection Processors = new(); + + public void TruncateTables() + { + Console.WriteLine("Truncating all old data..."); + + Database.ExecuteCommand("SELECT f_truncate_tables();"); + + Console.WriteLine("Truncation completed!"); + } + + public void Build() + { + Console.WriteLine("Building data..."); + + var window = new Window(0, 0, Console.WindowWidth, Console.WindowHeight).Concurrent(); + + var bars = window.OpenBox("Progress", Console.WindowWidth, 4, new BoxStyle { Body = Colors.WhiteOnBlack }); + + var output = new Window(0, 4, Console.WindowWidth, Console.WindowHeight - 4, window); + + ProgressBar bar1 = new(bars, Loader.ItemCount, 15); + ProgressBar bar2 = new(bars, 1, 15); + int i = 0; + + foreach (var item in Processors.Items) + { + bar1.Refresh(i++, $"{item.Attribute.Name}"); + + bar2.Max = Compendium.Count([item.Attribute.Type]); + int j = 0; + + foreach(var entry in Loader.Entries(item.Attribute.Type)) + { + bar2.Refresh(i++, $"{entry.Id}"); + + var input = new ProcessorInput(entry.Json); + var processor = (AbstractProcessor) item.Constructor.Invoke([input]); + + try + { + processor.Process(); + processor.Save(); + } + catch (LegacyItemException ex) + { + output.WriteLine(ex.Message); + } + } + + bar2.Refresh(j, "Processor complited"); + } + + bar1.Refresh(i, "Done!"); + + window.Clear(); + } +} diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AonprdEnumAttribute.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AonprdEnumAttribute.cs new file mode 100644 index 0000000..afd91e1 --- /dev/null +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AonprdEnumAttribute.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder; + +[AttributeUsage(AttributeTargets.Field)] +internal class AonprdEnumAttribute(string value) : Attribute +{ + public readonly string Value = value; +} diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AonprdProcessorAttribute.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AonprdProcessorAttribute.cs new file mode 100644 index 0000000..d010fa1 --- /dev/null +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AonprdProcessorAttribute.cs @@ -0,0 +1,21 @@ +namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder; + +[AttributeUsage(AttributeTargets.Class)] +public class AonprdProcessorAttribute(string name, string type, string[] dependencies) : Attribute +{ + public readonly string Name = name; + + public readonly string Type = type; + + public readonly IEnumerable Dependencies = dependencies; + + public AonprdProcessorAttribute(string type) : this(type, type, []) + { + } + public AonprdProcessorAttribute(string type, string[] dependencies) : this(type, type, dependencies) + { + } + public AonprdProcessorAttribute(string name, string type) : this(name, type, []) + { + } +} diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AonprdProcessorCollection.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AonprdProcessorCollection.cs new file mode 100644 index 0000000..28979c3 --- /dev/null +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/AonprdProcessorCollection.cs @@ -0,0 +1,88 @@ +using System.Reflection; + +namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder; + +internal class AonprdProcessorCollection +{ + public class ProcessorItem(AonprdProcessorAttribute attribute, ConstructorInfo constructor) + { + public readonly AonprdProcessorAttribute Attribute = attribute; + + public readonly ConstructorInfo Constructor = constructor; + + public int Priority = -1; + } + + public readonly List Items = []; + + public AonprdProcessorCollection() + { + foreach (Type type in Assembly.GetExecutingAssembly().GetTypes()) + { + if (type.GetCustomAttributes(typeof(AonprdProcessorAttribute), true).Length <= 0) + { + continue; + } + + if (!type.IsSubclassOf(typeof(AbstractProcessor))) + { + throw new Exception($"'AonprdProcessor' attribute should only be applied to children of 'AbstractProcessor' class. '{type.FullName}' is not."); + } + + AonprdProcessorAttribute attribute = type.GetCustomAttribute()!; + + ConstructorInfo constructor = type.GetConstructor([typeof(ProcessorInput)])!; + + var collision = Items.FirstOrDefault(i => i.Attribute.Name == attribute.Name); + if (collision is not null) + { + throw new Exception($"Multiply attributes 'AonprdProcessor' have same name '{attribute.Name}'." + + $" They are added to classes: '{type.FullName}' and '{collision.Constructor.DeclaringType!.FullName}'"); + } + + Items.Add(new ProcessorItem(attribute, constructor)); + } + } + + private void SortItems() + { + Dictionary priorities = []; + + while (priorities.Count < Items.Count) + { + foreach (var item in Items) + { + if (item.Priority > 0) + { + continue; + } + + var dependencyPriorities = item.Attribute.Dependencies.Select(d => priorities.TryGetValue(d, out int value) ? value : -1); + + if (dependencyPriorities.Any(p => p == -1)) + { + continue; + } + + item.Priority = dependencyPriorities.Any() ? dependencyPriorities.Max() + 1 : 1; + priorities.Add(item.Attribute.Name, item.Priority); + } + } + + Items.Sort((a, b) => a.Priority - b.Priority); + } + + public IEnumerable Iterate() + { + SortItems(); + + foreach (var item in Items) + { + yield return item; + } + } + + + + +} diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/ProcessorInput.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/ProcessorInput.cs new file mode 100644 index 0000000..cc05660 --- /dev/null +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/ProcessorInput.cs @@ -0,0 +1,65 @@ +using Newtonsoft.Json.Linq; +using NpgsqlTypes; + +namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder; + +internal class ProcessorInput(JObject input) +{ + public readonly JObject Input = input; + + public T GetRequired(string path) + { + JToken token = Input.SelectToken(path) ?? throw new NullReferenceException($"'{path}' is null"); + + return token.ToObject() ?? throw new NullReferenceException($"'{path}' is null"); + } + + public T? GetOptional(string path) + { + JToken? token = Input.SelectToken(path) ?? null; + + return (token is null || token.Type == JTokenType.Null) ? default! : token.ToObject() ?? default; + } + + public T EnumRequired(string path) where T : Enum + { + string value = GetOptional(path) ?? throw new NullReferenceException($"Value in path {path} null or not exists"); + + return Enum(value); + } + + public T EnumOptional(string path, T defaultValue) where T : Enum + { + string? value = GetOptional(path); + + return value is null ? defaultValue : Enum(value); + } + + public static T Enum(string value) where T : Enum + { + foreach (System.Reflection.FieldInfo field in typeof(T).GetFields()) + { + List variants = [field.Name]; + + if (Attribute.GetCustomAttribute(field, typeof(PgNameAttribute)) is PgNameAttribute pgAttribute) + { + variants.Add(pgAttribute.PgName); + } + if (Attribute.GetCustomAttribute(field, typeof(AonprdEnumAttribute)) is AonprdEnumAttribute aonprdAttribute) + { + variants.Add(aonprdAttribute.Value); + } + + if (variants.Contains(value)) + { + return (T) field.GetValue(null)!; + } + } + + throw new InvalidEnumStringException(typeof(T), value); + } + + public class InvalidEnumStringException(Type type, string value) : Exception($"Invalid value '{value}' for enum type {type.FullName}.") + { + } +} diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/Processors/TraitProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/Processors/TraitProcessor.cs new file mode 100644 index 0000000..e852086 --- /dev/null +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/Processors/TraitProcessor.cs @@ -0,0 +1,27 @@ +using Pf2eDataScrapper.Model.Enum; +using Pf2eDataScrapper.Model.Structure; + +namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder.Processors; + +[AonprdProcessor("trait")] +internal class TraitProcessor(ProcessorInput input) : AbstractProcessor(input) +{ + public override EntityType Type => EntityType.Trait; + + public override Trait Object { get; } = new(); + + public override void Process() + { + base.Process(); + + Object.Type = TraitType.Regular; + + Context.Traits.Add(Object); + } + + protected override void AddTraits() + { + // Во втором проходе + } + +} diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/Processors/TraitTraitsProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/Processors/TraitTraitsProcessor.cs new file mode 100644 index 0000000..a17e995 --- /dev/null +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/DataBuilder/Processors/TraitTraitsProcessor.cs @@ -0,0 +1,38 @@ +using Newtonsoft.Json.Linq; +using Pf2eDataScrapper.Model.Enum; +using Pf2eDataScrapper.Model.Structure; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder.Processors; + +[AonprdProcessor("trait_traits", "trait", ["trait"])] +internal class TraitTraitsProcessor(ProcessorInput input) : AbstractProcessor(input) +{ + public override EntityType Type => EntityType.Trait; + + public override Trait Object { get; } = new(); + + public override void Process() + { + string id = Input.GetRequired("id"); + string name = Input.GetRequired("name"); + + if (Input.GetOptional("remaster_id") is not null) + { + throw new LegacyItemException(name); + } + + // base.Process(); + string url = Input.GetRequired("url"); + + var external = Context.EntityExternals.FirstOrDefault(x => x.Suffix == url) ?? throw new Exception("Entity not found?"); + Entity = external.Entity; + + AddTraits(); + } + +} diff --git a/Pf2eDataScrapper/Importers/Implementations/Pf2eFoundry/DataBuilder/AbstractProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Pf2eFoundry/DataBuilder/AbstractProcessor.cs index 060b0c4..c4b42ba 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Pf2eFoundry/DataBuilder/AbstractProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Pf2eFoundry/DataBuilder/AbstractProcessor.cs @@ -1,12 +1,14 @@ using LinqToDB.Common; using Newtonsoft.Json.Linq; using NpgsqlTypes; +using Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder; using Pf2eDataScrapper.Model; using Pf2eDataScrapper.Model.Base; using Pf2eDataScrapper.Model.Base.Source; using Pf2eDataScrapper.Model.Base.Targets; using Pf2eDataScrapper.Model.Common; using Pf2eDataScrapper.Model.Enum; +using Pf2eDataScrapper.Model.Structure; using System.Security.Cryptography; using System.Text; using static LinqToDB.Reflection.Methods.LinqToDB.Insert; @@ -15,9 +17,9 @@ namespace Pf2eDataScrapper.Importers.Implementations.Pf2eFoundry.DataBuilder; internal abstract class AbstractProcessor(JObject input) { - protected DataBuilderHelper Helper = DataBuilderHelper.Instance; + protected DatabaseHelper Helper = DatabaseHelper.Instance; - public readonly Pf2eDbContext Context = DataBuilderHelper.DbContext; + public readonly Pf2eDbContext Context = DatabaseHelper.DbContext; public readonly JObject Input = input; @@ -29,7 +31,7 @@ internal abstract class AbstractProcessor(JObject input) public virtual void Process() { - Entity.Id = Helper.NextId; + Entity.Id = Helper.NextEntityId; Entity.Type = Type; Entity.Name = GetRequired("name"); @@ -115,14 +117,14 @@ internal abstract class AbstractProcessor(JObject input) { string value = GetOptional(path) ?? throw new NullReferenceException($"Value in path {path} null or not exists"); - return DataBuilderHelper.Enum(value); + return ProcessorInput.Enum(value); } public T EnumOptional(string path, T defaultValue) where T : Enum { string? value = GetOptional(path); - return value is null ? defaultValue : DataBuilderHelper.Enum(value); + return value is null ? defaultValue : ProcessorInput.Enum(value); } protected Source GetSource(string name) @@ -136,8 +138,7 @@ internal abstract class AbstractProcessor(JObject input) source = new() { - Name = name, - Url = "" + Name = name }; Context.Sources.Add(source); @@ -168,15 +169,15 @@ internal abstract class AbstractProcessor(JObject input) protected IEnumerable GetTraits(IEnumerable names) { - List result = Context.Traits.Where(t => names.Contains(t.Name)).ToList(); + List result = Context.Traits.Where(t => names.Contains(t.Entity.Name)).ToList(); foreach (string name in names) { - if (result.Any(t => t.Name == name)) + if (result.Any(t => t.Entity.Name == name)) { continue; } - + /* Trait trait = new() { Name = name, @@ -186,6 +187,7 @@ internal abstract class AbstractProcessor(JObject input) }; Context.Traits.Add(trait); result.Add(trait); + */ } return result; diff --git a/Pf2eDataScrapper/Importers/Implementations/Pf2eFoundry/DataBuilder/DataBuilderHelper.cs b/Pf2eDataScrapper/Importers/Implementations/Pf2eFoundry/DataBuilder/DataBuilderHelper.cs deleted file mode 100644 index 9030db1..0000000 --- a/Pf2eDataScrapper/Importers/Implementations/Pf2eFoundry/DataBuilder/DataBuilderHelper.cs +++ /dev/null @@ -1,58 +0,0 @@ -using NpgsqlTypes; -using Pf2eDataScrapper.Model; -using Slugify; - -namespace Pf2eDataScrapper.Importers.Implementations.Pf2eFoundry.DataBuilder; - -internal class DataBuilderHelper -{ - public Pf2eDatabase Database = Pf2eDatabase.Instance; - - public Pf2eDbContext Context = new(); - - public SlugHelper Slugger = new(); - - private DataBuilderHelper() - { - } - - private int _id = 0; - - public int NextId { get => ++_id; } - - public string GenerateSlug(string name) - { - return Slugger.GenerateSlug(name); - } - - - - public static T Enum(string value) where T : Enum - { - foreach (System.Reflection.FieldInfo field in typeof(T).GetFields()) - { - List variants = [field.Name]; - - if (Attribute.GetCustomAttribute(field, typeof(PgNameAttribute)) is PgNameAttribute attribute) - { - variants.Add(attribute.PgName); - } - - if (variants.Contains(value)) - { - return (T) field.GetValue(null)!; - } - } - - throw new InvalidEnumStringException(typeof(T), value); - } - - public class InvalidEnumStringException(Type type, string value) : Exception($"Invalid value '{value}' for enum type {type.FullName}.") - { - } - - - public static readonly DataBuilderHelper Instance = new(); - - public static readonly Pf2eDbContext DbContext = Instance.Context; -} diff --git a/Pf2eDataScrapper/Importers/Implementations/Pf2eFoundry/DataBuilder/Processors/ActionProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Pf2eFoundry/DataBuilder/Processors/ActionProcessor.cs index a43a201..3f069eb 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Pf2eFoundry/DataBuilder/Processors/ActionProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Pf2eFoundry/DataBuilder/Processors/ActionProcessor.cs @@ -14,7 +14,6 @@ internal class ActionProcessor(JObject input) : AbstractProcessor(input) { base.Process(); - Object.Type = EnumRequired("system.actionType.value"); Object.Category = EnumOptional("system.category", ActionCategory.Unknown); Object.Actions = GetOptional("system.actions.value"); diff --git a/Pf2eDataScrapper/Importers/Repositories/GitRepository.cs b/Pf2eDataScrapper/Importers/Repositories/GitRepository.cs index 3f419f9..a7019a4 100644 --- a/Pf2eDataScrapper/Importers/Repositories/GitRepository.cs +++ b/Pf2eDataScrapper/Importers/Repositories/GitRepository.cs @@ -15,7 +15,7 @@ internal class GitRepository(AbstractImporter importer, string url) : AbstractIm /// public override void Update() { - string gitPath = Path.Combine(RepositoryDirPath, importer.Slug); + string gitPath = Path.Combine(RepositoryDirPath, Importer.Slug); if (Directory.Exists(gitPath)) { diff --git a/Pf2eDataScrapper/Migrations/20250416092350_Initial.Designer.cs b/Pf2eDataScrapper/Migrations/20250416092350_Initial.Designer.cs deleted file mode 100644 index e44b1bf..0000000 --- a/Pf2eDataScrapper/Migrations/20250416092350_Initial.Designer.cs +++ /dev/null @@ -1,2044 +0,0 @@ -// -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using Pf2eDataScrapper.Model; -using Pf2eDataScrapper.Model.Enum; - -#nullable disable - -namespace Pf2eDataScrapper.Migrations -{ - [DbContext(typeof(Pf2eDbContext))] - [Migration("20250416092350_Initial")] - partial class Initial - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_category", new[] { "offensive", "defensive", "interaction", "familiar", "army_tactic", "army_war_action", "kingdom_activity", "kingdom_feat", "kingdom_feature" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_type", new[] { "action", "free", "reaction", "passive" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "alias_type", new[] { "old", "english", "old_english", "hobby", "other" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "darkvision" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "any", "str", "dex", "con", "int", "wis", "cha" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "class_progression_type", new[] { "entity", "ancestry_feat", "class_feat", "general_feat", "skill_feat", "skill_increase" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "condition_group", new[] { "senses", "abilities", "death", "attitudes", "detection" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "deity_category", new[] { "deity", "pantheon", "covenant", "philosophy" }); - 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", "action", "ancestry", "background", "backpack", "campaign_feature", "class", "condition", "deity", "feat", "heritage", "spell" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "enum_size", new[] { "med", "tiny" }); - 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[] { "med", "tiny" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_area_type", new[] { "burst", "emanation", "cone", "line", "square", "cube", "cylinder" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_category", new[] { "persistent", "splash" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_kinds", new[] { "damage", "healing", "any" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "training_stage", new[] { "untrained", "trained", "expert", "master", "legendary" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "trait_type", new[] { "regular", "tradition" }); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DeityTraining", b => - { - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id"); - - b.Property("SkillsId") - .HasColumnType("integer") - .HasColumnName("skills_id"); - - b.HasKey("DeityId", "SkillsId") - .HasName("pk_deity_training"); - - b.HasIndex("SkillsId") - .HasDatabaseName("ix_deity_training_skills_id"); - - b.ToTable("deity_training", (string)null); - }); - - modelBuilder.Entity("EntityKeyword", b => - { - b.Property("EntitiesId") - .HasColumnType("integer") - .HasColumnName("entities_id"); - - b.Property("KeywordsId") - .HasColumnType("integer") - .HasColumnName("keywords_id"); - - b.HasKey("EntitiesId", "KeywordsId") - .HasName("pk_entity_keyword"); - - b.HasIndex("KeywordsId") - .HasDatabaseName("ix_entity_keyword_keywords_id"); - - b.ToTable("entity_keyword", (string)null); - }); - - modelBuilder.Entity("EntityTrait", b => - { - b.Property("EntitiesId") - .HasColumnType("integer") - .HasColumnName("entities_id"); - - b.Property("TraitsId") - .HasColumnType("integer") - .HasColumnName("traits_id"); - - b.HasKey("EntitiesId", "TraitsId") - .HasName("pk_entity_trait"); - - b.HasIndex("TraitsId") - .HasDatabaseName("ix_entity_trait_traits_id"); - - b.ToTable("entity_trait", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Entity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Description") - .IsRequired() - .HasColumnType("text") - .HasColumnName("description") - .HasColumnOrder(6) - .HasComment("Текстовое описание объекта"); - - b.Property("Img") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("img") - .HasColumnOrder(5) - .HasComment("Изображение объекта"); - - b.Property("IsChecked") - .HasColumnType("boolean") - .HasColumnName("is_checked") - .HasColumnOrder(9) - .HasComment("Флаг, указывающий, что объект был проверен и не требует автоматической перезаписи"); - - b.Property("IsTranslated") - .HasColumnType("boolean") - .HasColumnName("is_translated") - .HasColumnOrder(8) - .HasComment("Флаг, указывающий, что у объекта существует перевод"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2) - .HasComment("Отображаемое имя"); - - b.Property("Rarity") - .HasColumnType("entity_rarity") - .HasColumnName("rarity") - .HasColumnOrder(7); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("slug") - .HasColumnOrder(4) - .HasComment("Часть имени в URL"); - - b.Property("Type") - .HasColumnType("entity_type") - .HasColumnName("type") - .HasColumnOrder(3) - .HasComment("Тип объекта"); - - b.HasKey("Id") - .HasName("pk_entities"); - - b.ToTable("entities", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.EntityAlias", b => - { - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(1); - - b.Property("Type") - .HasColumnType("alias_type") - .HasColumnName("type") - .HasColumnOrder(2); - - b.Property("Alias") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("alias") - .HasColumnOrder(3); - - b.HasKey("EntityId", "Type") - .HasName("pk_entity_aliases"); - - b.ToTable("entity_aliases", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Keywords.Keyword", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Slug") - .IsRequired() - .HasColumnType("text") - .HasColumnName("slug") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_keywords"); - - b.ToTable("keywords", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Keywords.KeywordAlias", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("KeywordId") - .HasColumnType("integer") - .HasColumnName("keyword_id") - .HasColumnOrder(2); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("value") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_keyword_aliases"); - - b.HasIndex("KeywordId") - .HasDatabaseName("ix_keyword_aliases_keyword_id"); - - b.ToTable("keyword_aliases", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Source.EntitySource", b => - { - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(1); - - b.Property("SourceId") - .HasColumnType("integer") - .HasColumnName("source_id") - .HasColumnOrder(2); - - b.Property("IsRemaster") - .HasColumnType("boolean") - .HasColumnName("is_remaster") - .HasColumnOrder(4) - .HasComment("Флаг, указывающий, что объект является частью ремастера"); - - b.Property("Suffix") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("suffix") - .HasColumnOrder(3) - .HasComment("Номер страницы, эррата и т.д."); - - b.HasKey("EntityId", "SourceId") - .HasName("pk_entity_sources"); - - b.HasIndex("SourceId") - .HasDatabaseName("ix_entity_sources_source_id"); - - b.ToTable("entity_sources", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Source.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("url") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_sources"); - - b.ToTable("sources", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Targets.EntityExternal", b => - { - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(0); - - b.Property("TargetId") - .HasColumnType("integer") - .HasColumnName("target_id") - .HasColumnOrder(1); - - b.Property("Md5") - .IsRequired() - .HasMaxLength(16) - .HasColumnType("character varying(16)") - .HasColumnName("md5") - .HasColumnOrder(3) - .HasComment("Контроль версии объекта"); - - b.Property("Suffix") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("suffix") - .HasColumnOrder(2) - .HasComment("Часть URL до объекта. Для источников Foundry - полный UUID объекта"); - - b.HasKey("EntityId", "TargetId") - .HasName("pk_entity_externals"); - - b.HasIndex("TargetId") - .HasDatabaseName("ix_entity_externals_target_id"); - - b.ToTable("entity_externals", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Targets.ExternalTarget", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Icon") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("icon") - .HasColumnOrder(3); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_external_targets"); - - b.ToTable("external_targets", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Frequency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Max") - .HasColumnType("integer") - .HasColumnName("max") - .HasColumnOrder(2); - - b.Property("Per") - .HasColumnType("integer") - .HasColumnName("per") - .HasColumnOrder(3); - - b.Property("Value") - .HasColumnType("integer") - .HasColumnName("value") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_frequencies"); - - b.ToTable("frequencies", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Language", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.Property("Rarity") - .HasColumnType("entity_rarity") - .HasColumnName("rarity") - .HasColumnOrder(4); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("slug") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_languages"); - - b.ToTable("languages", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Training", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Key") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("key") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_trainings"); - - b.ToTable("trainings", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Trait", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Description") - .IsRequired() - .HasColumnType("text") - .HasColumnName("description") - .HasColumnOrder(5); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("slug") - .HasColumnOrder(4); - - b.Property("Type") - .HasColumnType("trait_type") - .HasColumnName("type") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_traits"); - - b.ToTable("traits", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Action", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Actions") - .HasColumnType("integer") - .HasColumnName("actions") - .HasColumnOrder(4); - - b.Property("Category") - .HasColumnType("action_category") - .HasColumnName("category") - .HasColumnOrder(3); - - b.Property("DeathNote") - .HasColumnType("boolean") - .HasColumnName("death_note") - .HasColumnOrder(5); - - b.Property("Extra") - .HasColumnType("text") - .HasColumnName("extra") - .HasColumnOrder(6); - - b.Property("Type") - .HasColumnType("action_type") - .HasColumnName("type") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_actions"); - - b.ToTable("actions", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Ancestry", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Hp") - .HasColumnType("integer") - .HasColumnName("hp") - .HasColumnOrder(3); - - b.Property("Reach") - .HasColumnType("integer") - .HasColumnName("reach") - .HasColumnOrder(4); - - b.Property("Size") - .HasColumnType("enum_size") - .HasColumnName("size") - .HasColumnOrder(2); - - b.Property("Speed") - .HasColumnType("integer") - .HasColumnName("speed") - .HasColumnOrder(5); - - b.Property("Vision") - .HasColumnType("ancestry_vision") - .HasColumnName("vision") - .HasColumnOrder(6); - - b.HasKey("Id") - .HasName("pk_ancestries"); - - b.ToTable("ancestries", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryBoost", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AncestryId") - .HasColumnType("integer") - .HasColumnName("ancestry_id") - .HasColumnOrder(2); - - b.Property("Boost") - .HasColumnType("boolean") - .HasColumnName("boost") - .HasColumnOrder(3); - - b.Property("Value") - .HasColumnType("attribute_values") - .HasColumnName("value") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_ancestry_boosts"); - - b.HasIndex("AncestryId") - .HasDatabaseName("ix_ancestry_boosts_ancestry_id"); - - b.ToTable("ancestry_boosts", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryItem", b => - { - b.Property("AncestryId") - .HasColumnType("integer") - .HasColumnName("ancestry_id") - .HasColumnOrder(1); - - b.Property("ItemId") - .HasColumnType("integer") - .HasColumnName("item_id") - .HasColumnOrder(2); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(3); - - b.HasKey("AncestryId", "ItemId") - .HasName("pk_ancestry_items"); - - b.HasIndex("ItemId") - .HasDatabaseName("ix_ancestry_items_item_id"); - - b.ToTable("ancestry_items", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryLanguage", b => - { - b.Property("AncestryId") - .HasColumnType("integer") - .HasColumnName("ancestry_id") - .HasColumnOrder(1); - - b.Property("LanguageId") - .HasColumnType("integer") - .HasColumnName("language_id") - .HasColumnOrder(2); - - b.Property("IsAdditional") - .HasColumnType("boolean") - .HasColumnName("is_additional") - .HasColumnOrder(3); - - b.HasKey("AncestryId", "LanguageId") - .HasName("pk_ancestry_languages"); - - b.HasIndex("LanguageId") - .HasDatabaseName("ix_ancestry_languages_language_id"); - - b.ToTable("ancestry_languages", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Background", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.HasKey("Id") - .HasName("pk_backgrounds"); - - b.ToTable("backgrounds", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundBoost", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Attribute") - .HasColumnType("attribute_values") - .HasColumnName("attribute") - .HasColumnOrder(3); - - b.Property("BackgroundId") - .HasColumnType("integer") - .HasColumnName("background_id") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_background_boosts"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_background_boosts_background_id"); - - b.ToTable("background_boosts", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundItem", b => - { - b.Property("BackgroundId") - .HasColumnType("integer") - .HasColumnName("background_id") - .HasColumnOrder(1); - - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(2); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(3); - - b.HasKey("BackgroundId", "EntityId") - .HasName("pk_background_items"); - - b.HasIndex("EntityId") - .HasDatabaseName("ix_background_items_entity_id"); - - b.ToTable("background_items", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundTraining", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("BackgroundId") - .HasColumnType("integer") - .HasColumnName("background_id") - .HasColumnOrder(2); - - b.Property("Level") - .HasColumnType("training_stage") - .HasColumnName("level") - .HasColumnOrder(4); - - b.Property("TrainingId") - .HasColumnType("integer") - .HasColumnName("training_id") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_background_skills"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_background_skills_background_id"); - - b.HasIndex("TrainingId") - .HasDatabaseName("ix_background_skills_training_id"); - - b.ToTable("background_skills", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Class", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("AdditionalTrainedSkills") - .HasColumnType("integer") - .HasColumnName("additional_trained_skills") - .HasColumnOrder(6); - - b.Property("Hp") - .HasColumnType("integer") - .HasColumnName("hp") - .HasColumnOrder(3); - - b.Property("Perception") - .HasColumnType("integer") - .HasColumnName("perception") - .HasColumnOrder(4); - - b.Property("Spellcasting") - .HasColumnType("boolean") - .HasColumnName("spellcasting") - .HasColumnOrder(5); - - b.HasKey("Id") - .HasName("pk_classes"); - - b.ToTable("classes", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassKeyAbility", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClassId") - .HasColumnType("integer") - .HasColumnName("class_id") - .HasColumnOrder(2); - - b.Property("Value") - .HasColumnType("attribute_values") - .HasColumnName("value") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_class_key_abilities"); - - b.HasIndex("ClassId") - .HasDatabaseName("ix_class_key_abilities_class_id"); - - b.ToTable("class_key_abilities", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassProgression", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClassId") - .HasColumnType("integer") - .HasColumnName("class_id") - .HasColumnOrder(2); - - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(5); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(31); - - b.Property("Type") - .HasColumnType("class_progression_type") - .HasColumnName("type") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_class_progressions"); - - b.HasIndex("ClassId") - .HasDatabaseName("ix_class_progressions_class_id"); - - b.HasIndex("EntityId") - .HasDatabaseName("ix_class_progressions_entity_id"); - - b.ToTable("class_progressions", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassTraining", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClassId") - .HasColumnType("integer") - .HasColumnName("class_id") - .HasColumnOrder(2); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(4); - - b.Property("Stage") - .HasColumnType("integer") - .HasColumnName("stage") - .HasColumnOrder(5); - - b.Property("TrainingId") - .HasColumnType("integer") - .HasColumnName("training_id") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_class_trainings"); - - b.HasIndex("ClassId") - .HasDatabaseName("ix_class_trainings_class_id"); - - b.HasIndex("TrainingId") - .HasDatabaseName("ix_class_trainings_training_id"); - - b.ToTable("class_trainings", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Condition", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Extra") - .HasColumnType("text") - .HasColumnName("extra") - .HasColumnOrder(3); - - b.Property("Group") - .HasColumnType("condition_group") - .HasColumnName("group") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_conditions"); - - b.ToTable("conditions", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Deity", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Category") - .HasColumnType("deity_category") - .HasColumnName("category") - .HasColumnOrder(2); - - b.Property("Fonts") - .HasColumnType("deity_fonts") - .HasColumnName("fonts") - .HasColumnOrder(3); - - b.Property("Sanctification") - .HasColumnType("deity_sanctification") - .HasColumnName("sanctification") - .HasColumnOrder(4); - - b.Property("SanctificationMust") - .HasColumnType("boolean") - .HasColumnName("sanctification_must") - .HasColumnOrder(5); - - b.HasKey("Id") - .HasName("pk_deities"); - - b.ToTable("deities", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityAttribute", b => - { - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id") - .HasColumnOrder(1); - - b.Property("Attribute") - .HasColumnType("attribute_values") - .HasColumnName("attribute") - .HasColumnOrder(2); - - b.HasKey("DeityId", "Attribute") - .HasName("pk_deity_attributes"); - - b.ToTable("deity_attributes", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityDomain", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id") - .HasColumnOrder(2); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary") - .HasColumnOrder(3); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("value") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_deity_domains"); - - b.HasIndex("DeityId") - .HasDatabaseName("ix_deity_domains_deity_id"); - - b.ToTable("deity_domains", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeitySpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id") - .HasColumnOrder(2); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(3); - - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_deity_spells"); - - b.HasIndex("DeityId") - .HasDatabaseName("ix_deity_spells_deity_id"); - - b.HasIndex("SpellId") - .HasDatabaseName("ix_deity_spells_spell_id"); - - b.ToTable("deity_spells", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityWeapon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id") - .HasColumnOrder(2); - - b.Property("Weapon") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("weapon") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_deity_weapons"); - - b.HasIndex("DeityId") - .HasDatabaseName("ix_deity_weapons_deity_id"); - - b.ToTable("deity_weapons", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Feat", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Actions") - .HasColumnType("integer") - .HasColumnName("actions") - .HasColumnOrder(4); - - b.Property("Category") - .HasColumnType("action_category") - .HasColumnName("category") - .HasColumnOrder(3); - - b.Property("Extra") - .HasColumnType("text") - .HasColumnName("extra") - .HasColumnOrder(10); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(5); - - b.Property("LevelTaken") - .HasColumnType("integer") - .HasColumnName("level_taken") - .HasColumnOrder(6); - - b.Property("Location") - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("location") - .HasColumnOrder(8); - - b.Property("MaxTakable") - .HasColumnType("integer") - .HasColumnName("max_takable") - .HasColumnOrder(7); - - b.Property("OnlyLevel1") - .HasColumnType("boolean") - .HasColumnName("only_level1") - .HasColumnOrder(9); - - b.Property("Type") - .HasColumnType("action_type") - .HasColumnName("type") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_feats"); - - b.ToTable("feats", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.FeatRelation.FeatPrerequisite", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FeatId") - .HasColumnType("integer") - .HasColumnName("feat_id") - .HasColumnOrder(2); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("value") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_feat_prerequisites"); - - b.HasIndex("FeatId") - .HasDatabaseName("ix_feat_prerequisites_feat_id"); - - b.ToTable("feat_prerequisites", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Heritage", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("AncestryId") - .HasColumnType("integer") - .HasColumnName("ancestry_id") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_heritages"); - - b.HasIndex("AncestryId") - .HasDatabaseName("ix_heritages_ancestry_id"); - - b.ToTable("heritages", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Spell", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("CanHeightening") - .HasColumnType("boolean") - .HasColumnName("can_heightening") - .HasColumnOrder(11); - - b.Property("Cost") - .HasColumnType("integer") - .HasColumnName("cost") - .HasColumnOrder(3); - - b.Property("Counteraction") - .HasColumnType("boolean") - .HasColumnName("counteraction") - .HasColumnOrder(4); - - b.Property("Duration") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("duration") - .HasColumnOrder(6); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(2); - - b.Property("Range") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("range") - .HasColumnOrder(7); - - b.Property("Requirements") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("requirements") - .HasColumnOrder(8); - - b.Property("Sustained") - .HasColumnType("boolean") - .HasColumnName("sustained") - .HasColumnOrder(5); - - b.Property("Target") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("target") - .HasColumnOrder(9); - - b.Property("Time") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("time") - .HasColumnOrder(10); - - b.HasKey("Id") - .HasName("pk_spells"); - - b.ToTable("spells", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellArea", b => - { - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(1); - - b.Property("Details") - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("details") - .HasColumnOrder(2); - - b.Property("Type") - .HasColumnType("spell_area_type") - .HasColumnName("type") - .HasColumnOrder(3); - - b.Property("Value") - .HasColumnType("integer") - .HasColumnName("value") - .HasColumnOrder(4); - - b.HasKey("SpellId") - .HasName("pk_spell_areas"); - - b.ToTable("spell_areas", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellDamage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ApplyMod") - .HasColumnType("boolean") - .HasColumnName("apply_mod") - .HasColumnOrder(4); - - b.Property("Category") - .HasColumnType("spell_damage_category") - .HasColumnName("category") - .HasColumnOrder(5); - - b.Property("Formula") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("formula") - .HasColumnOrder(6); - - b.Property("Key") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("key") - .HasColumnOrder(3); - - b.Property("Kinds") - .HasColumnType("spell_damage_kinds") - .HasColumnName("kinds") - .HasColumnOrder(7); - - b.Property("Materials") - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("materials") - .HasColumnOrder(8); - - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(2); - - b.Property("Type") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("type") - .HasColumnOrder(9); - - b.HasKey("Id") - .HasName("pk_spell_damages"); - - b.HasIndex("SpellId") - .HasDatabaseName("ix_spell_damages_spell_id"); - - b.ToTable("spell_damages", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellDefense", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("IsBasic") - .HasColumnType("boolean") - .HasColumnName("is_basic") - .HasColumnOrder(4); - - b.Property("IsPassive") - .HasColumnType("boolean") - .HasColumnName("is_passive") - .HasColumnOrder(3); - - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(2); - - b.Property("Statistic") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("statistic") - .HasColumnOrder(5); - - b.HasKey("Id") - .HasName("pk_spell_defenses"); - - b.HasIndex("SpellId") - .HasDatabaseName("ix_spell_defenses_spell_id"); - - b.ToTable("spell_defenses", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellRitual", b => - { - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(1); - - b.Property("PrimaryCheck") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("primary_check") - .HasColumnOrder(2); - - b.Property("SecondaryCasters") - .HasColumnType("integer") - .HasColumnName("secondary_casters") - .HasColumnOrder(3); - - b.Property("SecondaryChecks") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("secondary_checks") - .HasColumnOrder(4); - - b.HasKey("SpellId") - .HasName("pk_spell_rituals"); - - b.ToTable("spell_rituals", (string)null); - }); - - modelBuilder.Entity("DeityTraining", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", null) - .WithMany() - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_training_deities_deity_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Training", null) - .WithMany() - .HasForeignKey("SkillsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_training_trainings_skills_id"); - }); - - modelBuilder.Entity("EntityKeyword", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", null) - .WithMany() - .HasForeignKey("EntitiesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_keyword_entities_entities_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Keywords.Keyword", null) - .WithMany() - .HasForeignKey("KeywordsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_keyword_keywords_keywords_id"); - }); - - modelBuilder.Entity("EntityTrait", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", null) - .WithMany() - .HasForeignKey("EntitiesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_trait_entities_entities_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Trait", null) - .WithMany() - .HasForeignKey("TraitsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_trait_traits_traits_id"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.EntityAlias", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany("Aliases") - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_aliases_entities_entity_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Keywords.KeywordAlias", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Keywords.Keyword", "Keyword") - .WithMany("Aliases") - .HasForeignKey("KeywordId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_keyword_aliases_keywords_keyword_id"); - - b.Navigation("Keyword"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Source.EntitySource", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany("Sources") - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_sources_entities_entity_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Source.Source", "Source") - .WithMany("EntitySources") - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_sources_sources_source_id"); - - b.Navigation("Entity"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Targets.EntityExternal", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany("Extrnals") - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_externals_entities_entity_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Targets.ExternalTarget", "Target") - .WithMany("EntityExternals") - .HasForeignKey("TargetId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_externals_external_targets_target_id"); - - b.Navigation("Entity"); - - b.Navigation("Target"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Action", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Action", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_actions_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Ancestry", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Ancestry", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestries_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryBoost", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Ancestry", "Ancestry") - .WithMany("AncestryBoosts") - .HasForeignKey("AncestryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_boosts_ancestries_ancestry_id"); - - b.Navigation("Ancestry"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryItem", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Ancestry", "Ancestry") - .WithMany("AncestryItems") - .HasForeignKey("AncestryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_items_ancestries_ancestry_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_items_entities_item_id"); - - b.Navigation("Ancestry"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryLanguage", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Ancestry", "Ancestry") - .WithMany("AncestryLanguages") - .HasForeignKey("AncestryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_languages_ancestries_ancestry_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Language", "Language") - .WithMany() - .HasForeignKey("LanguageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_languages_languages_language_id"); - - b.Navigation("Ancestry"); - - b.Navigation("Language"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Background", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Background", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_backgrounds_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundBoost", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Background", "Background") - .WithMany("BackgroundBoosts") - .HasForeignKey("BackgroundId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_boosts_backgrounds_background_id"); - - b.Navigation("Background"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundItem", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Background", "Background") - .WithMany("BackgroundItems") - .HasForeignKey("BackgroundId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_items_backgrounds_background_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany() - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_items_entities_entity_id"); - - b.Navigation("Background"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundTraining", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Background", "Background") - .WithMany("BackgroundSkills") - .HasForeignKey("BackgroundId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_skills_backgrounds_background_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Training", "Training") - .WithMany() - .HasForeignKey("TrainingId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_skills_trainings_training_id"); - - b.Navigation("Background"); - - b.Navigation("Training"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Class", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Class", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_classes_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassKeyAbility", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Class", "Class") - .WithMany("ClassKeyAbilities") - .HasForeignKey("ClassId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_class_key_abilities_classes_class_id"); - - b.Navigation("Class"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassProgression", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Class", "Class") - .WithMany("ClassProgressions") - .HasForeignKey("ClassId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_class_progressions_classes_class_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany() - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.SetNull) - .HasConstraintName("fk_class_progressions_entities_entity_id"); - - b.Navigation("Class"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassTraining", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Class", "Class") - .WithMany("ClassTrainings") - .HasForeignKey("ClassId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_class_trainings_classes_class_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Training", "Training") - .WithMany() - .HasForeignKey("TrainingId") - .OnDelete(DeleteBehavior.SetNull) - .HasConstraintName("fk_class_trainings_trainings_training_id"); - - b.Navigation("Class"); - - b.Navigation("Training"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Condition", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Condition", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_conditions_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Deity", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Deity", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deities_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityAttribute", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", "Deity") - .WithMany("DeityAttributes") - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_attributes_deities_deity_id"); - - b.Navigation("Deity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityDomain", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", "Deity") - .WithMany("DeityDomains") - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_domains_deities_deity_id"); - - b.Navigation("Deity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeitySpell", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", "Deity") - .WithMany("DeitySpells") - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_spells_deities_deity_id"); - - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithMany() - .HasForeignKey("SpellId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_spells_spells_spell_id"); - - b.Navigation("Deity"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityWeapon", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", "Deity") - .WithMany("DeityWeapons") - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_weapons_deities_deity_id"); - - b.Navigation("Deity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Feat", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Feat", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_feats_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.FeatRelation.FeatPrerequisite", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Feat", "Feat") - .WithMany("FeatPrerequisites") - .HasForeignKey("FeatId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_feat_prerequisites_feats_feat_id"); - - b.Navigation("Feat"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Heritage", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Ancestry", "Ancestry") - .WithMany("Heritages") - .HasForeignKey("AncestryId") - .OnDelete(DeleteBehavior.Cascade) - .HasConstraintName("fk_heritages_ancestries_ancestry_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Heritage", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_heritages_entities_id"); - - b.Navigation("Ancestry"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Spell", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Spell", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_spells_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellArea", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithOne("SpellArea") - .HasForeignKey("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellArea", "SpellId") - .OnDelete(DeleteBehavior.Cascade) - .HasConstraintName("fk_spell_areas_spells_spell_id"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellDamage", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithMany("SpellDamages") - .HasForeignKey("SpellId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_spell_damages_spells_spell_id"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellDefense", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithMany("SpellDefenses") - .HasForeignKey("SpellId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_spell_defenses_spells_spell_id"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellRitual", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithOne("SpellRitual") - .HasForeignKey("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellRitual", "SpellId") - .OnDelete(DeleteBehavior.Cascade) - .HasConstraintName("fk_spell_rituals_spells_spell_id"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Entity", b => - { - b.Navigation("Aliases"); - - b.Navigation("Extrnals"); - - b.Navigation("Sources"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Keywords.Keyword", b => - { - b.Navigation("Aliases"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Source.Source", b => - { - b.Navigation("EntitySources"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Targets.ExternalTarget", b => - { - b.Navigation("EntityExternals"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Ancestry", b => - { - b.Navigation("AncestryBoosts"); - - b.Navigation("AncestryItems"); - - b.Navigation("AncestryLanguages"); - - b.Navigation("Heritages"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Background", b => - { - b.Navigation("BackgroundBoosts"); - - b.Navigation("BackgroundItems"); - - b.Navigation("BackgroundSkills"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Class", b => - { - b.Navigation("ClassKeyAbilities"); - - b.Navigation("ClassProgressions"); - - b.Navigation("ClassTrainings"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Deity", b => - { - b.Navigation("DeityAttributes"); - - b.Navigation("DeityDomains"); - - b.Navigation("DeitySpells"); - - b.Navigation("DeityWeapons"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Feat", b => - { - b.Navigation("FeatPrerequisites"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Spell", b => - { - b.Navigation("SpellArea"); - - b.Navigation("SpellDamages"); - - b.Navigation("SpellDefenses"); - - b.Navigation("SpellRitual"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Pf2eDataScrapper/Migrations/20250416113548__.Designer.cs b/Pf2eDataScrapper/Migrations/20250416113548__.Designer.cs deleted file mode 100644 index 0741d6b..0000000 --- a/Pf2eDataScrapper/Migrations/20250416113548__.Designer.cs +++ /dev/null @@ -1,2051 +0,0 @@ -// -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using Pf2eDataScrapper.Model; -using Pf2eDataScrapper.Model.Enum; - -#nullable disable - -namespace Pf2eDataScrapper.Migrations -{ - [DbContext(typeof(Pf2eDbContext))] - [Migration("20250416113548__")] - partial class _ - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_category", new[] { "offensive", "defensive", "interaction", "familiar", "army_tactic", "army_war_action", "kingdom_activity", "kingdom_feat", "kingdom_feature" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_type", new[] { "action", "free", "reaction", "passive" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "alias_type", new[] { "old", "english", "old_english", "hobby", "other" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "darkvision" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "any", "str", "dex", "con", "int", "wis", "cha" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "class_progression_type", new[] { "entity", "ancestry_feat", "class_feat", "general_feat", "skill_feat", "skill_increase" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "condition_group", new[] { "unknown", "senses", "abilities", "death", "attitudes", "detection" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "deity_category", new[] { "deity", "pantheon", "covenant", "philosophy" }); - 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", "action", "ancestry", "background", "backpack", "campaign_feature", "class", "condition", "deity", "feat", "heritage", "spell" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "enum_size", new[] { "med", "tiny" }); - 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[] { "med", "tiny" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_area_type", new[] { "burst", "emanation", "cone", "line", "square", "cube", "cylinder" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_category", new[] { "persistent", "splash" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_kinds", new[] { "damage", "healing", "any" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "training_stage", new[] { "untrained", "trained", "expert", "master", "legendary" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "trait_type", new[] { "regular", "tradition" }); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DeityTraining", b => - { - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id"); - - b.Property("SkillsId") - .HasColumnType("integer") - .HasColumnName("skills_id"); - - b.HasKey("DeityId", "SkillsId") - .HasName("pk_deity_training"); - - b.HasIndex("SkillsId") - .HasDatabaseName("ix_deity_training_skills_id"); - - b.ToTable("deity_training", (string)null); - }); - - modelBuilder.Entity("EntityKeyword", b => - { - b.Property("EntitiesId") - .HasColumnType("integer") - .HasColumnName("entities_id"); - - b.Property("KeywordsId") - .HasColumnType("integer") - .HasColumnName("keywords_id"); - - b.HasKey("EntitiesId", "KeywordsId") - .HasName("pk_entity_keyword"); - - b.HasIndex("KeywordsId") - .HasDatabaseName("ix_entity_keyword_keywords_id"); - - b.ToTable("entity_keyword", (string)null); - }); - - modelBuilder.Entity("EntityTrait", b => - { - b.Property("EntitiesId") - .HasColumnType("integer") - .HasColumnName("entities_id"); - - b.Property("TraitsId") - .HasColumnType("integer") - .HasColumnName("traits_id"); - - b.HasKey("EntitiesId", "TraitsId") - .HasName("pk_entity_trait"); - - b.HasIndex("TraitsId") - .HasDatabaseName("ix_entity_trait_traits_id"); - - b.ToTable("entity_trait", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Entity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Description") - .IsRequired() - .HasColumnType("text") - .HasColumnName("description") - .HasColumnOrder(6) - .HasComment("Текстовое описание объекта"); - - b.Property("Img") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("img") - .HasColumnOrder(5) - .HasComment("Изображение объекта"); - - b.Property("IsChecked") - .HasColumnType("boolean") - .HasColumnName("is_checked") - .HasColumnOrder(9) - .HasComment("Флаг, указывающий, что объект был проверен и не требует автоматической перезаписи"); - - b.Property("IsTranslated") - .HasColumnType("boolean") - .HasColumnName("is_translated") - .HasColumnOrder(8) - .HasComment("Флаг, указывающий, что у объекта существует перевод"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2) - .HasComment("Отображаемое имя"); - - b.Property("Rarity") - .HasColumnType("entity_rarity") - .HasColumnName("rarity") - .HasColumnOrder(7); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("slug") - .HasColumnOrder(4) - .HasComment("Часть имени в URL"); - - b.Property("Type") - .HasColumnType("entity_type") - .HasColumnName("type") - .HasColumnOrder(3) - .HasComment("Тип объекта"); - - b.HasKey("Id") - .HasName("pk_entities"); - - b.ToTable("entities", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.EntityAlias", b => - { - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(1); - - b.Property("Type") - .HasColumnType("alias_type") - .HasColumnName("type") - .HasColumnOrder(2); - - b.Property("Alias") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("alias") - .HasColumnOrder(3); - - b.HasKey("EntityId", "Type") - .HasName("pk_entity_aliases"); - - b.ToTable("entity_aliases", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Keywords.Keyword", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Slug") - .IsRequired() - .HasColumnType("text") - .HasColumnName("slug") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_keywords"); - - b.ToTable("keywords", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Keywords.KeywordAlias", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("KeywordId") - .HasColumnType("integer") - .HasColumnName("keyword_id") - .HasColumnOrder(2); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("value") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_keyword_aliases"); - - b.HasIndex("KeywordId") - .HasDatabaseName("ix_keyword_aliases_keyword_id"); - - b.ToTable("keyword_aliases", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Source.EntitySource", b => - { - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(1); - - b.Property("SourceId") - .HasColumnType("integer") - .HasColumnName("source_id") - .HasColumnOrder(2); - - b.Property("IsRemaster") - .HasColumnType("boolean") - .HasColumnName("is_remaster") - .HasColumnOrder(4) - .HasComment("Флаг, указывающий, что объект является частью ремастера"); - - b.Property("Suffix") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("suffix") - .HasColumnOrder(3) - .HasComment("Номер страницы, эррата и т.д."); - - b.HasKey("EntityId", "SourceId") - .HasName("pk_entity_sources"); - - b.HasIndex("SourceId") - .HasDatabaseName("ix_entity_sources_source_id"); - - b.ToTable("entity_sources", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Source.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("url") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_sources"); - - b.ToTable("sources", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Targets.EntityExternal", b => - { - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(0); - - b.Property("TargetId") - .HasColumnType("integer") - .HasColumnName("target_id") - .HasColumnOrder(1); - - b.Property("Md5") - .IsRequired() - .HasMaxLength(16) - .HasColumnType("character varying(16)") - .HasColumnName("md5") - .HasColumnOrder(3) - .HasComment("Контроль версии объекта"); - - b.Property("Suffix") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("suffix") - .HasColumnOrder(2) - .HasComment("Часть URL до объекта. Для источников Foundry - полный UUID объекта"); - - b.HasKey("EntityId", "TargetId") - .HasName("pk_entity_externals"); - - b.HasIndex("TargetId") - .HasDatabaseName("ix_entity_externals_target_id"); - - b.ToTable("entity_externals", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Targets.ExternalTarget", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Icon") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("icon") - .HasColumnOrder(3); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("prefix") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_external_targets"); - - b.ToTable("external_targets", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Frequency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Max") - .HasColumnType("integer") - .HasColumnName("max") - .HasColumnOrder(2); - - b.Property("Per") - .HasColumnType("integer") - .HasColumnName("per") - .HasColumnOrder(3); - - b.Property("Value") - .HasColumnType("integer") - .HasColumnName("value") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_frequencies"); - - b.ToTable("frequencies", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Language", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.Property("Rarity") - .HasColumnType("entity_rarity") - .HasColumnName("rarity") - .HasColumnOrder(4); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("slug") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_languages"); - - b.ToTable("languages", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Training", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Key") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("key") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_trainings"); - - b.ToTable("trainings", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Trait", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Description") - .IsRequired() - .HasColumnType("text") - .HasColumnName("description") - .HasColumnOrder(5); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("slug") - .HasColumnOrder(4); - - b.Property("Type") - .HasColumnType("trait_type") - .HasColumnName("type") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_traits"); - - b.ToTable("traits", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Action", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Actions") - .HasColumnType("integer") - .HasColumnName("actions") - .HasColumnOrder(4); - - b.Property("Category") - .HasColumnType("action_category") - .HasColumnName("category") - .HasColumnOrder(3); - - b.Property("DeathNote") - .HasColumnType("boolean") - .HasColumnName("death_note") - .HasColumnOrder(5); - - b.Property("Extra") - .HasColumnType("text") - .HasColumnName("extra") - .HasColumnOrder(6); - - b.Property("Type") - .HasColumnType("action_type") - .HasColumnName("type") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_actions"); - - b.ToTable("actions", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Ancestry", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Hp") - .HasColumnType("integer") - .HasColumnName("hp") - .HasColumnOrder(3); - - b.Property("Reach") - .HasColumnType("integer") - .HasColumnName("reach") - .HasColumnOrder(4); - - b.Property("Size") - .HasColumnType("enum_size") - .HasColumnName("size") - .HasColumnOrder(2); - - b.Property("Speed") - .HasColumnType("integer") - .HasColumnName("speed") - .HasColumnOrder(5); - - b.Property("Vision") - .HasColumnType("ancestry_vision") - .HasColumnName("vision") - .HasColumnOrder(6); - - b.HasKey("Id") - .HasName("pk_ancestries"); - - b.ToTable("ancestries", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryBoost", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AncestryId") - .HasColumnType("integer") - .HasColumnName("ancestry_id") - .HasColumnOrder(2); - - b.Property("Boost") - .HasColumnType("boolean") - .HasColumnName("boost") - .HasColumnOrder(3); - - b.Property("Value") - .HasColumnType("attribute_values") - .HasColumnName("value") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_ancestry_boosts"); - - b.HasIndex("AncestryId") - .HasDatabaseName("ix_ancestry_boosts_ancestry_id"); - - b.ToTable("ancestry_boosts", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryItem", b => - { - b.Property("AncestryId") - .HasColumnType("integer") - .HasColumnName("ancestry_id") - .HasColumnOrder(1); - - b.Property("ItemId") - .HasColumnType("integer") - .HasColumnName("item_id") - .HasColumnOrder(2); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(3); - - b.HasKey("AncestryId", "ItemId") - .HasName("pk_ancestry_items"); - - b.HasIndex("ItemId") - .HasDatabaseName("ix_ancestry_items_item_id"); - - b.ToTable("ancestry_items", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryLanguage", b => - { - b.Property("AncestryId") - .HasColumnType("integer") - .HasColumnName("ancestry_id") - .HasColumnOrder(1); - - b.Property("LanguageId") - .HasColumnType("integer") - .HasColumnName("language_id") - .HasColumnOrder(2); - - b.Property("IsAdditional") - .HasColumnType("boolean") - .HasColumnName("is_additional") - .HasColumnOrder(3); - - b.HasKey("AncestryId", "LanguageId") - .HasName("pk_ancestry_languages"); - - b.HasIndex("LanguageId") - .HasDatabaseName("ix_ancestry_languages_language_id"); - - b.ToTable("ancestry_languages", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Background", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.HasKey("Id") - .HasName("pk_backgrounds"); - - b.ToTable("backgrounds", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundBoost", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Attribute") - .HasColumnType("attribute_values") - .HasColumnName("attribute") - .HasColumnOrder(3); - - b.Property("BackgroundId") - .HasColumnType("integer") - .HasColumnName("background_id") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_background_boosts"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_background_boosts_background_id"); - - b.ToTable("background_boosts", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundItem", b => - { - b.Property("BackgroundId") - .HasColumnType("integer") - .HasColumnName("background_id") - .HasColumnOrder(1); - - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(2); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(3); - - b.HasKey("BackgroundId", "EntityId") - .HasName("pk_background_items"); - - b.HasIndex("EntityId") - .HasDatabaseName("ix_background_items_entity_id"); - - b.ToTable("background_items", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundTraining", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("BackgroundId") - .HasColumnType("integer") - .HasColumnName("background_id") - .HasColumnOrder(2); - - b.Property("Level") - .HasColumnType("training_stage") - .HasColumnName("level") - .HasColumnOrder(4); - - b.Property("TrainingId") - .HasColumnType("integer") - .HasColumnName("training_id") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_background_skills"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_background_skills_background_id"); - - b.HasIndex("TrainingId") - .HasDatabaseName("ix_background_skills_training_id"); - - b.ToTable("background_skills", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Class", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("AdditionalTrainedSkills") - .HasColumnType("integer") - .HasColumnName("additional_trained_skills") - .HasColumnOrder(6); - - b.Property("Hp") - .HasColumnType("integer") - .HasColumnName("hp") - .HasColumnOrder(3); - - b.Property("Perception") - .HasColumnType("integer") - .HasColumnName("perception") - .HasColumnOrder(4); - - b.Property("Spellcasting") - .HasColumnType("boolean") - .HasColumnName("spellcasting") - .HasColumnOrder(5); - - b.HasKey("Id") - .HasName("pk_classes"); - - b.ToTable("classes", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassKeyAbility", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClassId") - .HasColumnType("integer") - .HasColumnName("class_id") - .HasColumnOrder(2); - - b.Property("Value") - .HasColumnType("attribute_values") - .HasColumnName("value") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_class_key_abilities"); - - b.HasIndex("ClassId") - .HasDatabaseName("ix_class_key_abilities_class_id"); - - b.ToTable("class_key_abilities", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassProgression", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClassId") - .HasColumnType("integer") - .HasColumnName("class_id") - .HasColumnOrder(2); - - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(5); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(31); - - b.Property("Type") - .HasColumnType("class_progression_type") - .HasColumnName("type") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_class_progressions"); - - b.HasIndex("ClassId") - .HasDatabaseName("ix_class_progressions_class_id"); - - b.HasIndex("EntityId") - .HasDatabaseName("ix_class_progressions_entity_id"); - - b.ToTable("class_progressions", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassTraining", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClassId") - .HasColumnType("integer") - .HasColumnName("class_id") - .HasColumnOrder(2); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(4); - - b.Property("Stage") - .HasColumnType("integer") - .HasColumnName("stage") - .HasColumnOrder(5); - - b.Property("TrainingId") - .HasColumnType("integer") - .HasColumnName("training_id") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_class_trainings"); - - b.HasIndex("ClassId") - .HasDatabaseName("ix_class_trainings_class_id"); - - b.HasIndex("TrainingId") - .HasDatabaseName("ix_class_trainings_training_id"); - - b.ToTable("class_trainings", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Condition", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Extra") - .HasColumnType("text") - .HasColumnName("extra") - .HasColumnOrder(3); - - b.Property("Group") - .HasColumnType("condition_group") - .HasColumnName("group") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_conditions"); - - b.ToTable("conditions", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Deity", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Category") - .HasColumnType("deity_category") - .HasColumnName("category") - .HasColumnOrder(2); - - b.Property("Fonts") - .HasColumnType("deity_fonts") - .HasColumnName("fonts") - .HasColumnOrder(3); - - b.Property("Sanctification") - .HasColumnType("deity_sanctification") - .HasColumnName("sanctification") - .HasColumnOrder(4); - - b.Property("SanctificationMust") - .HasColumnType("boolean") - .HasColumnName("sanctification_must") - .HasColumnOrder(5); - - b.HasKey("Id") - .HasName("pk_deities"); - - b.ToTable("deities", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityAttribute", b => - { - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id") - .HasColumnOrder(1); - - b.Property("Attribute") - .HasColumnType("attribute_values") - .HasColumnName("attribute") - .HasColumnOrder(2); - - b.HasKey("DeityId", "Attribute") - .HasName("pk_deity_attributes"); - - b.ToTable("deity_attributes", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityDomain", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id") - .HasColumnOrder(2); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary") - .HasColumnOrder(3); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("value") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_deity_domains"); - - b.HasIndex("DeityId") - .HasDatabaseName("ix_deity_domains_deity_id"); - - b.ToTable("deity_domains", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeitySpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id") - .HasColumnOrder(2); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(3); - - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_deity_spells"); - - b.HasIndex("DeityId") - .HasDatabaseName("ix_deity_spells_deity_id"); - - b.HasIndex("SpellId") - .HasDatabaseName("ix_deity_spells_spell_id"); - - b.ToTable("deity_spells", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityWeapon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id") - .HasColumnOrder(2); - - b.Property("Weapon") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("weapon") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_deity_weapons"); - - b.HasIndex("DeityId") - .HasDatabaseName("ix_deity_weapons_deity_id"); - - b.ToTable("deity_weapons", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Feat", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Actions") - .HasColumnType("integer") - .HasColumnName("actions") - .HasColumnOrder(4); - - b.Property("Category") - .HasColumnType("action_category") - .HasColumnName("category") - .HasColumnOrder(3); - - b.Property("Extra") - .HasColumnType("text") - .HasColumnName("extra") - .HasColumnOrder(10); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(5); - - b.Property("LevelTaken") - .HasColumnType("integer") - .HasColumnName("level_taken") - .HasColumnOrder(6); - - b.Property("Location") - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("location") - .HasColumnOrder(8); - - b.Property("MaxTakable") - .HasColumnType("integer") - .HasColumnName("max_takable") - .HasColumnOrder(7); - - b.Property("OnlyLevel1") - .HasColumnType("boolean") - .HasColumnName("only_level1") - .HasColumnOrder(9); - - b.Property("Type") - .HasColumnType("action_type") - .HasColumnName("type") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_feats"); - - b.ToTable("feats", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.FeatRelation.FeatPrerequisite", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FeatId") - .HasColumnType("integer") - .HasColumnName("feat_id") - .HasColumnOrder(2); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("value") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_feat_prerequisites"); - - b.HasIndex("FeatId") - .HasDatabaseName("ix_feat_prerequisites_feat_id"); - - b.ToTable("feat_prerequisites", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Heritage", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("AncestryId") - .HasColumnType("integer") - .HasColumnName("ancestry_id") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_heritages"); - - b.HasIndex("AncestryId") - .HasDatabaseName("ix_heritages_ancestry_id"); - - b.ToTable("heritages", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Spell", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("CanHeightening") - .HasColumnType("boolean") - .HasColumnName("can_heightening") - .HasColumnOrder(11); - - b.Property("Cost") - .HasColumnType("integer") - .HasColumnName("cost") - .HasColumnOrder(3); - - b.Property("Counteraction") - .HasColumnType("boolean") - .HasColumnName("counteraction") - .HasColumnOrder(4); - - b.Property("Duration") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("duration") - .HasColumnOrder(6); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(2); - - b.Property("Range") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("range") - .HasColumnOrder(7); - - b.Property("Requirements") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("requirements") - .HasColumnOrder(8); - - b.Property("Sustained") - .HasColumnType("boolean") - .HasColumnName("sustained") - .HasColumnOrder(5); - - b.Property("Target") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("target") - .HasColumnOrder(9); - - b.Property("Time") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("time") - .HasColumnOrder(10); - - b.HasKey("Id") - .HasName("pk_spells"); - - b.ToTable("spells", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellArea", b => - { - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(1); - - b.Property("Details") - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("details") - .HasColumnOrder(2); - - b.Property("Type") - .HasColumnType("spell_area_type") - .HasColumnName("type") - .HasColumnOrder(3); - - b.Property("Value") - .HasColumnType("integer") - .HasColumnName("value") - .HasColumnOrder(4); - - b.HasKey("SpellId") - .HasName("pk_spell_areas"); - - b.ToTable("spell_areas", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellDamage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ApplyMod") - .HasColumnType("boolean") - .HasColumnName("apply_mod") - .HasColumnOrder(4); - - b.Property("Category") - .HasColumnType("spell_damage_category") - .HasColumnName("category") - .HasColumnOrder(5); - - b.Property("Formula") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("formula") - .HasColumnOrder(6); - - b.Property("Key") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("key") - .HasColumnOrder(3); - - b.Property("Kinds") - .HasColumnType("spell_damage_kinds") - .HasColumnName("kinds") - .HasColumnOrder(7); - - b.Property("Materials") - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("materials") - .HasColumnOrder(8); - - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(2); - - b.Property("Type") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("type") - .HasColumnOrder(9); - - b.HasKey("Id") - .HasName("pk_spell_damages"); - - b.HasIndex("SpellId") - .HasDatabaseName("ix_spell_damages_spell_id"); - - b.ToTable("spell_damages", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellDefense", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("IsBasic") - .HasColumnType("boolean") - .HasColumnName("is_basic") - .HasColumnOrder(4); - - b.Property("IsPassive") - .HasColumnType("boolean") - .HasColumnName("is_passive") - .HasColumnOrder(3); - - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(2); - - b.Property("Statistic") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("statistic") - .HasColumnOrder(5); - - b.HasKey("Id") - .HasName("pk_spell_defenses"); - - b.HasIndex("SpellId") - .HasDatabaseName("ix_spell_defenses_spell_id"); - - b.ToTable("spell_defenses", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellRitual", b => - { - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(1); - - b.Property("PrimaryCheck") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("primary_check") - .HasColumnOrder(2); - - b.Property("SecondaryCasters") - .HasColumnType("integer") - .HasColumnName("secondary_casters") - .HasColumnOrder(3); - - b.Property("SecondaryChecks") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("secondary_checks") - .HasColumnOrder(4); - - b.HasKey("SpellId") - .HasName("pk_spell_rituals"); - - b.ToTable("spell_rituals", (string)null); - }); - - modelBuilder.Entity("DeityTraining", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", null) - .WithMany() - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_training_deities_deity_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Training", null) - .WithMany() - .HasForeignKey("SkillsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_training_trainings_skills_id"); - }); - - modelBuilder.Entity("EntityKeyword", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", null) - .WithMany() - .HasForeignKey("EntitiesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_keyword_entities_entities_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Keywords.Keyword", null) - .WithMany() - .HasForeignKey("KeywordsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_keyword_keywords_keywords_id"); - }); - - modelBuilder.Entity("EntityTrait", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", null) - .WithMany() - .HasForeignKey("EntitiesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_trait_entities_entities_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Trait", null) - .WithMany() - .HasForeignKey("TraitsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_trait_traits_traits_id"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.EntityAlias", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany("Aliases") - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_aliases_entities_entity_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Keywords.KeywordAlias", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Keywords.Keyword", "Keyword") - .WithMany("Aliases") - .HasForeignKey("KeywordId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_keyword_aliases_keywords_keyword_id"); - - b.Navigation("Keyword"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Source.EntitySource", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany("Sources") - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_sources_entities_entity_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Source.Source", "Source") - .WithMany("EntitySources") - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_sources_sources_source_id"); - - b.Navigation("Entity"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Targets.EntityExternal", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany("Extrnals") - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_externals_entities_entity_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Targets.ExternalTarget", "Target") - .WithMany("EntityExternals") - .HasForeignKey("TargetId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_externals_external_targets_target_id"); - - b.Navigation("Entity"); - - b.Navigation("Target"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Action", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Action", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_actions_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Ancestry", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Ancestry", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestries_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryBoost", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Ancestry", "Ancestry") - .WithMany("AncestryBoosts") - .HasForeignKey("AncestryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_boosts_ancestries_ancestry_id"); - - b.Navigation("Ancestry"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryItem", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Ancestry", "Ancestry") - .WithMany("AncestryItems") - .HasForeignKey("AncestryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_items_ancestries_ancestry_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_items_entities_item_id"); - - b.Navigation("Ancestry"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryLanguage", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Ancestry", "Ancestry") - .WithMany("AncestryLanguages") - .HasForeignKey("AncestryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_languages_ancestries_ancestry_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Language", "Language") - .WithMany() - .HasForeignKey("LanguageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_languages_languages_language_id"); - - b.Navigation("Ancestry"); - - b.Navigation("Language"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Background", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Background", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_backgrounds_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundBoost", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Background", "Background") - .WithMany("BackgroundBoosts") - .HasForeignKey("BackgroundId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_boosts_backgrounds_background_id"); - - b.Navigation("Background"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundItem", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Background", "Background") - .WithMany("BackgroundItems") - .HasForeignKey("BackgroundId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_items_backgrounds_background_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany() - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_items_entities_entity_id"); - - b.Navigation("Background"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundTraining", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Background", "Background") - .WithMany("BackgroundSkills") - .HasForeignKey("BackgroundId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_skills_backgrounds_background_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Training", "Training") - .WithMany() - .HasForeignKey("TrainingId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_skills_trainings_training_id"); - - b.Navigation("Background"); - - b.Navigation("Training"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Class", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Class", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_classes_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassKeyAbility", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Class", "Class") - .WithMany("ClassKeyAbilities") - .HasForeignKey("ClassId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_class_key_abilities_classes_class_id"); - - b.Navigation("Class"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassProgression", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Class", "Class") - .WithMany("ClassProgressions") - .HasForeignKey("ClassId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_class_progressions_classes_class_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany() - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.SetNull) - .HasConstraintName("fk_class_progressions_entities_entity_id"); - - b.Navigation("Class"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassTraining", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Class", "Class") - .WithMany("ClassTrainings") - .HasForeignKey("ClassId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_class_trainings_classes_class_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Training", "Training") - .WithMany() - .HasForeignKey("TrainingId") - .OnDelete(DeleteBehavior.SetNull) - .HasConstraintName("fk_class_trainings_trainings_training_id"); - - b.Navigation("Class"); - - b.Navigation("Training"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Condition", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Condition", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_conditions_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Deity", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Deity", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deities_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityAttribute", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", "Deity") - .WithMany("DeityAttributes") - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_attributes_deities_deity_id"); - - b.Navigation("Deity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityDomain", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", "Deity") - .WithMany("DeityDomains") - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_domains_deities_deity_id"); - - b.Navigation("Deity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeitySpell", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", "Deity") - .WithMany("DeitySpells") - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_spells_deities_deity_id"); - - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithMany() - .HasForeignKey("SpellId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_spells_spells_spell_id"); - - b.Navigation("Deity"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityWeapon", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", "Deity") - .WithMany("DeityWeapons") - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_weapons_deities_deity_id"); - - b.Navigation("Deity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Feat", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Feat", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_feats_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.FeatRelation.FeatPrerequisite", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Feat", "Feat") - .WithMany("FeatPrerequisites") - .HasForeignKey("FeatId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_feat_prerequisites_feats_feat_id"); - - b.Navigation("Feat"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Heritage", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Ancestry", "Ancestry") - .WithMany("Heritages") - .HasForeignKey("AncestryId") - .OnDelete(DeleteBehavior.Cascade) - .HasConstraintName("fk_heritages_ancestries_ancestry_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Heritage", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_heritages_entities_id"); - - b.Navigation("Ancestry"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Spell", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Spell", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_spells_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellArea", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithOne("SpellArea") - .HasForeignKey("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellArea", "SpellId") - .OnDelete(DeleteBehavior.Cascade) - .HasConstraintName("fk_spell_areas_spells_spell_id"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellDamage", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithMany("SpellDamages") - .HasForeignKey("SpellId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_spell_damages_spells_spell_id"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellDefense", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithMany("SpellDefenses") - .HasForeignKey("SpellId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_spell_defenses_spells_spell_id"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellRitual", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithOne("SpellRitual") - .HasForeignKey("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellRitual", "SpellId") - .OnDelete(DeleteBehavior.Cascade) - .HasConstraintName("fk_spell_rituals_spells_spell_id"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Entity", b => - { - b.Navigation("Aliases"); - - b.Navigation("Extrnals"); - - b.Navigation("Sources"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Keywords.Keyword", b => - { - b.Navigation("Aliases"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Source.Source", b => - { - b.Navigation("EntitySources"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Targets.ExternalTarget", b => - { - b.Navigation("EntityExternals"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Ancestry", b => - { - b.Navigation("AncestryBoosts"); - - b.Navigation("AncestryItems"); - - b.Navigation("AncestryLanguages"); - - b.Navigation("Heritages"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Background", b => - { - b.Navigation("BackgroundBoosts"); - - b.Navigation("BackgroundItems"); - - b.Navigation("BackgroundSkills"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Class", b => - { - b.Navigation("ClassKeyAbilities"); - - b.Navigation("ClassProgressions"); - - b.Navigation("ClassTrainings"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Deity", b => - { - b.Navigation("DeityAttributes"); - - b.Navigation("DeityDomains"); - - b.Navigation("DeitySpells"); - - b.Navigation("DeityWeapons"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Feat", b => - { - b.Navigation("FeatPrerequisites"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Spell", b => - { - b.Navigation("SpellArea"); - - b.Navigation("SpellDamages"); - - b.Navigation("SpellDefenses"); - - b.Navigation("SpellRitual"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Pf2eDataScrapper/Migrations/20250416113548__.cs b/Pf2eDataScrapper/Migrations/20250416113548__.cs deleted file mode 100644 index cce0ac6..0000000 --- a/Pf2eDataScrapper/Migrations/20250416113548__.cs +++ /dev/null @@ -1,119 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Pf2eDataScrapper.Migrations -{ - /// - public partial class _ : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterDatabase() - .Annotation("Npgsql:Enum:action_category", "offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature") - .Annotation("Npgsql:Enum:action_type", "action,free,reaction,passive") - .Annotation("Npgsql:Enum:alias_type", "old,english,old_english,hobby,other") - .Annotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,darkvision") - .Annotation("Npgsql:Enum:attribute_values", "any,str,dex,con,int,wis,cha") - .Annotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase") - .Annotation("Npgsql:Enum:condition_group", "unknown,senses,abilities,death,attitudes,detection") - .Annotation("Npgsql:Enum:deity_category", "deity,pantheon,covenant,philosophy") - .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,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell") - .Annotation("Npgsql:Enum:enum_size", "med,tiny") - .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", "med,tiny") - .Annotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder") - .Annotation("Npgsql:Enum:spell_damage_category", "persistent,splash") - .Annotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any") - .Annotation("Npgsql:Enum:training_stage", "untrained,trained,expert,master,legendary") - .Annotation("Npgsql:Enum:trait_type", "regular,tradition") - .OldAnnotation("Npgsql:Enum:action_category", "offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature") - .OldAnnotation("Npgsql:Enum:action_type", "action,free,reaction,passive") - .OldAnnotation("Npgsql:Enum:alias_type", "old,english,old_english,hobby,other") - .OldAnnotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,darkvision") - .OldAnnotation("Npgsql:Enum:attribute_values", "any,str,dex,con,int,wis,cha") - .OldAnnotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase") - .OldAnnotation("Npgsql:Enum:condition_group", "senses,abilities,death,attitudes,detection") - .OldAnnotation("Npgsql:Enum:deity_category", "deity,pantheon,covenant,philosophy") - .OldAnnotation("Npgsql:Enum:deity_fonts", "none,heal,harm,any") - .OldAnnotation("Npgsql:Enum:deity_sanctification", "holy,unholy,any") - .OldAnnotation("Npgsql:Enum:entity_rarity", "common,uncommon,rare,unique") - .OldAnnotation("Npgsql:Enum:entity_type", "unknown,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell") - .OldAnnotation("Npgsql:Enum:enum_size", "med,tiny") - .OldAnnotation("Npgsql:Enum:feat_action_type", "passive,action,reaction,free") - .OldAnnotation("Npgsql:Enum:feat_category", "ancestryfeature,classfeature,calling,class,skill,general,ancestry,bonus,deityboon,curse,pfsboon,campaign_feature") - .OldAnnotation("Npgsql:Enum:size", "med,tiny") - .OldAnnotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder") - .OldAnnotation("Npgsql:Enum:spell_damage_category", "persistent,splash") - .OldAnnotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any") - .OldAnnotation("Npgsql:Enum:training_stage", "untrained,trained,expert,master,legendary") - .OldAnnotation("Npgsql:Enum:trait_type", "regular,tradition"); - - migrationBuilder.AddColumn( - name: "prefix", - table: "external_targets", - type: "character varying(255)", - maxLength: 255, - nullable: false, - defaultValue: "") - .Annotation("Relational:ColumnOrder", 3); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "prefix", - table: "external_targets"); - - migrationBuilder.AlterDatabase() - .Annotation("Npgsql:Enum:action_category", "offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature") - .Annotation("Npgsql:Enum:action_type", "action,free,reaction,passive") - .Annotation("Npgsql:Enum:alias_type", "old,english,old_english,hobby,other") - .Annotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,darkvision") - .Annotation("Npgsql:Enum:attribute_values", "any,str,dex,con,int,wis,cha") - .Annotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase") - .Annotation("Npgsql:Enum:condition_group", "senses,abilities,death,attitudes,detection") - .Annotation("Npgsql:Enum:deity_category", "deity,pantheon,covenant,philosophy") - .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,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell") - .Annotation("Npgsql:Enum:enum_size", "med,tiny") - .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", "med,tiny") - .Annotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder") - .Annotation("Npgsql:Enum:spell_damage_category", "persistent,splash") - .Annotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any") - .Annotation("Npgsql:Enum:training_stage", "untrained,trained,expert,master,legendary") - .Annotation("Npgsql:Enum:trait_type", "regular,tradition") - .OldAnnotation("Npgsql:Enum:action_category", "offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature") - .OldAnnotation("Npgsql:Enum:action_type", "action,free,reaction,passive") - .OldAnnotation("Npgsql:Enum:alias_type", "old,english,old_english,hobby,other") - .OldAnnotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,darkvision") - .OldAnnotation("Npgsql:Enum:attribute_values", "any,str,dex,con,int,wis,cha") - .OldAnnotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase") - .OldAnnotation("Npgsql:Enum:condition_group", "unknown,senses,abilities,death,attitudes,detection") - .OldAnnotation("Npgsql:Enum:deity_category", "deity,pantheon,covenant,philosophy") - .OldAnnotation("Npgsql:Enum:deity_fonts", "none,heal,harm,any") - .OldAnnotation("Npgsql:Enum:deity_sanctification", "holy,unholy,any") - .OldAnnotation("Npgsql:Enum:entity_rarity", "common,uncommon,rare,unique") - .OldAnnotation("Npgsql:Enum:entity_type", "unknown,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell") - .OldAnnotation("Npgsql:Enum:enum_size", "med,tiny") - .OldAnnotation("Npgsql:Enum:feat_action_type", "passive,action,reaction,free") - .OldAnnotation("Npgsql:Enum:feat_category", "ancestryfeature,classfeature,calling,class,skill,general,ancestry,bonus,deityboon,curse,pfsboon,campaign_feature") - .OldAnnotation("Npgsql:Enum:size", "med,tiny") - .OldAnnotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder") - .OldAnnotation("Npgsql:Enum:spell_damage_category", "persistent,splash") - .OldAnnotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any") - .OldAnnotation("Npgsql:Enum:training_stage", "untrained,trained,expert,master,legendary") - .OldAnnotation("Npgsql:Enum:trait_type", "regular,tradition"); - } - } -} diff --git a/Pf2eDataScrapper/Migrations/20250416151720_ActionCategoryUnknown.Designer.cs b/Pf2eDataScrapper/Migrations/20250416151720_ActionCategoryUnknown.Designer.cs deleted file mode 100644 index 2a7f141..0000000 --- a/Pf2eDataScrapper/Migrations/20250416151720_ActionCategoryUnknown.Designer.cs +++ /dev/null @@ -1,2051 +0,0 @@ -// -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using Pf2eDataScrapper.Model; -using Pf2eDataScrapper.Model.Enum; - -#nullable disable - -namespace Pf2eDataScrapper.Migrations -{ - [DbContext(typeof(Pf2eDbContext))] - [Migration("20250416151720_ActionCategoryUnknown")] - partial class ActionCategoryUnknown - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.4") - .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[] { "action", "free", "reaction", "passive" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "alias_type", new[] { "old", "english", "old_english", "hobby", "other" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "darkvision" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "any", "str", "dex", "con", "int", "wis", "cha" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "class_progression_type", new[] { "entity", "ancestry_feat", "class_feat", "general_feat", "skill_feat", "skill_increase" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "condition_group", new[] { "unknown", "senses", "abilities", "death", "attitudes", "detection" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "deity_category", new[] { "deity", "pantheon", "covenant", "philosophy" }); - 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", "action", "ancestry", "background", "backpack", "campaign_feature", "class", "condition", "deity", "feat", "heritage", "spell" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "enum_size", new[] { "med", "tiny" }); - 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[] { "med", "tiny" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_area_type", new[] { "burst", "emanation", "cone", "line", "square", "cube", "cylinder" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_category", new[] { "persistent", "splash" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_kinds", new[] { "damage", "healing", "any" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "training_stage", new[] { "untrained", "trained", "expert", "master", "legendary" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "trait_type", new[] { "regular", "tradition" }); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DeityTraining", b => - { - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id"); - - b.Property("SkillsId") - .HasColumnType("integer") - .HasColumnName("skills_id"); - - b.HasKey("DeityId", "SkillsId") - .HasName("pk_deity_training"); - - b.HasIndex("SkillsId") - .HasDatabaseName("ix_deity_training_skills_id"); - - b.ToTable("deity_training", (string)null); - }); - - modelBuilder.Entity("EntityKeyword", b => - { - b.Property("EntitiesId") - .HasColumnType("integer") - .HasColumnName("entities_id"); - - b.Property("KeywordsId") - .HasColumnType("integer") - .HasColumnName("keywords_id"); - - b.HasKey("EntitiesId", "KeywordsId") - .HasName("pk_entity_keyword"); - - b.HasIndex("KeywordsId") - .HasDatabaseName("ix_entity_keyword_keywords_id"); - - b.ToTable("entity_keyword", (string)null); - }); - - modelBuilder.Entity("EntityTrait", b => - { - b.Property("EntitiesId") - .HasColumnType("integer") - .HasColumnName("entities_id"); - - b.Property("TraitsId") - .HasColumnType("integer") - .HasColumnName("traits_id"); - - b.HasKey("EntitiesId", "TraitsId") - .HasName("pk_entity_trait"); - - b.HasIndex("TraitsId") - .HasDatabaseName("ix_entity_trait_traits_id"); - - b.ToTable("entity_trait", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Entity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Description") - .IsRequired() - .HasColumnType("text") - .HasColumnName("description") - .HasColumnOrder(6) - .HasComment("Текстовое описание объекта"); - - b.Property("Img") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("img") - .HasColumnOrder(5) - .HasComment("Изображение объекта"); - - b.Property("IsChecked") - .HasColumnType("boolean") - .HasColumnName("is_checked") - .HasColumnOrder(9) - .HasComment("Флаг, указывающий, что объект был проверен и не требует автоматической перезаписи"); - - b.Property("IsTranslated") - .HasColumnType("boolean") - .HasColumnName("is_translated") - .HasColumnOrder(8) - .HasComment("Флаг, указывающий, что у объекта существует перевод"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2) - .HasComment("Отображаемое имя"); - - b.Property("Rarity") - .HasColumnType("entity_rarity") - .HasColumnName("rarity") - .HasColumnOrder(7); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("slug") - .HasColumnOrder(4) - .HasComment("Часть имени в URL"); - - b.Property("Type") - .HasColumnType("entity_type") - .HasColumnName("type") - .HasColumnOrder(3) - .HasComment("Тип объекта"); - - b.HasKey("Id") - .HasName("pk_entities"); - - b.ToTable("entities", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.EntityAlias", b => - { - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(1); - - b.Property("Type") - .HasColumnType("alias_type") - .HasColumnName("type") - .HasColumnOrder(2); - - b.Property("Alias") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("alias") - .HasColumnOrder(3); - - b.HasKey("EntityId", "Type") - .HasName("pk_entity_aliases"); - - b.ToTable("entity_aliases", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Keywords.Keyword", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Slug") - .IsRequired() - .HasColumnType("text") - .HasColumnName("slug") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_keywords"); - - b.ToTable("keywords", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Keywords.KeywordAlias", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("KeywordId") - .HasColumnType("integer") - .HasColumnName("keyword_id") - .HasColumnOrder(2); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("value") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_keyword_aliases"); - - b.HasIndex("KeywordId") - .HasDatabaseName("ix_keyword_aliases_keyword_id"); - - b.ToTable("keyword_aliases", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Source.EntitySource", b => - { - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(1); - - b.Property("SourceId") - .HasColumnType("integer") - .HasColumnName("source_id") - .HasColumnOrder(2); - - b.Property("IsRemaster") - .HasColumnType("boolean") - .HasColumnName("is_remaster") - .HasColumnOrder(4) - .HasComment("Флаг, указывающий, что объект является частью ремастера"); - - b.Property("Suffix") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("suffix") - .HasColumnOrder(3) - .HasComment("Номер страницы, эррата и т.д."); - - b.HasKey("EntityId", "SourceId") - .HasName("pk_entity_sources"); - - b.HasIndex("SourceId") - .HasDatabaseName("ix_entity_sources_source_id"); - - b.ToTable("entity_sources", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Source.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("url") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_sources"); - - b.ToTable("sources", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Targets.EntityExternal", b => - { - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(0); - - b.Property("TargetId") - .HasColumnType("integer") - .HasColumnName("target_id") - .HasColumnOrder(1); - - b.Property("Md5") - .IsRequired() - .HasMaxLength(16) - .HasColumnType("character varying(16)") - .HasColumnName("md5") - .HasColumnOrder(3) - .HasComment("Контроль версии объекта"); - - b.Property("Suffix") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("suffix") - .HasColumnOrder(2) - .HasComment("Часть URL до объекта. Для источников Foundry - полный UUID объекта"); - - b.HasKey("EntityId", "TargetId") - .HasName("pk_entity_externals"); - - b.HasIndex("TargetId") - .HasDatabaseName("ix_entity_externals_target_id"); - - b.ToTable("entity_externals", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Targets.ExternalTarget", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Icon") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("icon") - .HasColumnOrder(3); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("prefix") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_external_targets"); - - b.ToTable("external_targets", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Frequency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Max") - .HasColumnType("integer") - .HasColumnName("max") - .HasColumnOrder(2); - - b.Property("Per") - .HasColumnType("integer") - .HasColumnName("per") - .HasColumnOrder(3); - - b.Property("Value") - .HasColumnType("integer") - .HasColumnName("value") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_frequencies"); - - b.ToTable("frequencies", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Language", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.Property("Rarity") - .HasColumnType("entity_rarity") - .HasColumnName("rarity") - .HasColumnOrder(4); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("slug") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_languages"); - - b.ToTable("languages", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Training", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Key") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("key") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_trainings"); - - b.ToTable("trainings", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Trait", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Description") - .IsRequired() - .HasColumnType("text") - .HasColumnName("description") - .HasColumnOrder(5); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("slug") - .HasColumnOrder(4); - - b.Property("Type") - .HasColumnType("trait_type") - .HasColumnName("type") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_traits"); - - b.ToTable("traits", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Action", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Actions") - .HasColumnType("integer") - .HasColumnName("actions") - .HasColumnOrder(4); - - b.Property("Category") - .HasColumnType("action_category") - .HasColumnName("category") - .HasColumnOrder(3); - - b.Property("DeathNote") - .HasColumnType("boolean") - .HasColumnName("death_note") - .HasColumnOrder(5); - - b.Property("Extra") - .HasColumnType("text") - .HasColumnName("extra") - .HasColumnOrder(6); - - b.Property("Type") - .HasColumnType("action_type") - .HasColumnName("type") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_actions"); - - b.ToTable("actions", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Ancestry", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Hp") - .HasColumnType("integer") - .HasColumnName("hp") - .HasColumnOrder(3); - - b.Property("Reach") - .HasColumnType("integer") - .HasColumnName("reach") - .HasColumnOrder(4); - - b.Property("Size") - .HasColumnType("enum_size") - .HasColumnName("size") - .HasColumnOrder(2); - - b.Property("Speed") - .HasColumnType("integer") - .HasColumnName("speed") - .HasColumnOrder(5); - - b.Property("Vision") - .HasColumnType("ancestry_vision") - .HasColumnName("vision") - .HasColumnOrder(6); - - b.HasKey("Id") - .HasName("pk_ancestries"); - - b.ToTable("ancestries", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryBoost", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AncestryId") - .HasColumnType("integer") - .HasColumnName("ancestry_id") - .HasColumnOrder(2); - - b.Property("Boost") - .HasColumnType("boolean") - .HasColumnName("boost") - .HasColumnOrder(3); - - b.Property("Value") - .HasColumnType("attribute_values") - .HasColumnName("value") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_ancestry_boosts"); - - b.HasIndex("AncestryId") - .HasDatabaseName("ix_ancestry_boosts_ancestry_id"); - - b.ToTable("ancestry_boosts", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryItem", b => - { - b.Property("AncestryId") - .HasColumnType("integer") - .HasColumnName("ancestry_id") - .HasColumnOrder(1); - - b.Property("ItemId") - .HasColumnType("integer") - .HasColumnName("item_id") - .HasColumnOrder(2); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(3); - - b.HasKey("AncestryId", "ItemId") - .HasName("pk_ancestry_items"); - - b.HasIndex("ItemId") - .HasDatabaseName("ix_ancestry_items_item_id"); - - b.ToTable("ancestry_items", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryLanguage", b => - { - b.Property("AncestryId") - .HasColumnType("integer") - .HasColumnName("ancestry_id") - .HasColumnOrder(1); - - b.Property("LanguageId") - .HasColumnType("integer") - .HasColumnName("language_id") - .HasColumnOrder(2); - - b.Property("IsAdditional") - .HasColumnType("boolean") - .HasColumnName("is_additional") - .HasColumnOrder(3); - - b.HasKey("AncestryId", "LanguageId") - .HasName("pk_ancestry_languages"); - - b.HasIndex("LanguageId") - .HasDatabaseName("ix_ancestry_languages_language_id"); - - b.ToTable("ancestry_languages", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Background", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.HasKey("Id") - .HasName("pk_backgrounds"); - - b.ToTable("backgrounds", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundBoost", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Attribute") - .HasColumnType("attribute_values") - .HasColumnName("attribute") - .HasColumnOrder(3); - - b.Property("BackgroundId") - .HasColumnType("integer") - .HasColumnName("background_id") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_background_boosts"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_background_boosts_background_id"); - - b.ToTable("background_boosts", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundItem", b => - { - b.Property("BackgroundId") - .HasColumnType("integer") - .HasColumnName("background_id") - .HasColumnOrder(1); - - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(2); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(3); - - b.HasKey("BackgroundId", "EntityId") - .HasName("pk_background_items"); - - b.HasIndex("EntityId") - .HasDatabaseName("ix_background_items_entity_id"); - - b.ToTable("background_items", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundTraining", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("BackgroundId") - .HasColumnType("integer") - .HasColumnName("background_id") - .HasColumnOrder(2); - - b.Property("Level") - .HasColumnType("training_stage") - .HasColumnName("level") - .HasColumnOrder(4); - - b.Property("TrainingId") - .HasColumnType("integer") - .HasColumnName("training_id") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_background_skills"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_background_skills_background_id"); - - b.HasIndex("TrainingId") - .HasDatabaseName("ix_background_skills_training_id"); - - b.ToTable("background_skills", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Class", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("AdditionalTrainedSkills") - .HasColumnType("integer") - .HasColumnName("additional_trained_skills") - .HasColumnOrder(6); - - b.Property("Hp") - .HasColumnType("integer") - .HasColumnName("hp") - .HasColumnOrder(3); - - b.Property("Perception") - .HasColumnType("integer") - .HasColumnName("perception") - .HasColumnOrder(4); - - b.Property("Spellcasting") - .HasColumnType("boolean") - .HasColumnName("spellcasting") - .HasColumnOrder(5); - - b.HasKey("Id") - .HasName("pk_classes"); - - b.ToTable("classes", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassKeyAbility", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClassId") - .HasColumnType("integer") - .HasColumnName("class_id") - .HasColumnOrder(2); - - b.Property("Value") - .HasColumnType("attribute_values") - .HasColumnName("value") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_class_key_abilities"); - - b.HasIndex("ClassId") - .HasDatabaseName("ix_class_key_abilities_class_id"); - - b.ToTable("class_key_abilities", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassProgression", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClassId") - .HasColumnType("integer") - .HasColumnName("class_id") - .HasColumnOrder(2); - - b.Property("EntityId") - .HasColumnType("integer") - .HasColumnName("entity_id") - .HasColumnOrder(5); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(31); - - b.Property("Type") - .HasColumnType("class_progression_type") - .HasColumnName("type") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_class_progressions"); - - b.HasIndex("ClassId") - .HasDatabaseName("ix_class_progressions_class_id"); - - b.HasIndex("EntityId") - .HasDatabaseName("ix_class_progressions_entity_id"); - - b.ToTable("class_progressions", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassTraining", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClassId") - .HasColumnType("integer") - .HasColumnName("class_id") - .HasColumnOrder(2); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(4); - - b.Property("Stage") - .HasColumnType("integer") - .HasColumnName("stage") - .HasColumnOrder(5); - - b.Property("TrainingId") - .HasColumnType("integer") - .HasColumnName("training_id") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_class_trainings"); - - b.HasIndex("ClassId") - .HasDatabaseName("ix_class_trainings_class_id"); - - b.HasIndex("TrainingId") - .HasDatabaseName("ix_class_trainings_training_id"); - - b.ToTable("class_trainings", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Condition", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Extra") - .HasColumnType("text") - .HasColumnName("extra") - .HasColumnOrder(3); - - b.Property("Group") - .HasColumnType("condition_group") - .HasColumnName("group") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_conditions"); - - b.ToTable("conditions", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Deity", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Category") - .HasColumnType("deity_category") - .HasColumnName("category") - .HasColumnOrder(2); - - b.Property("Fonts") - .HasColumnType("deity_fonts") - .HasColumnName("fonts") - .HasColumnOrder(3); - - b.Property("Sanctification") - .HasColumnType("deity_sanctification") - .HasColumnName("sanctification") - .HasColumnOrder(4); - - b.Property("SanctificationMust") - .HasColumnType("boolean") - .HasColumnName("sanctification_must") - .HasColumnOrder(5); - - b.HasKey("Id") - .HasName("pk_deities"); - - b.ToTable("deities", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityAttribute", b => - { - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id") - .HasColumnOrder(1); - - b.Property("Attribute") - .HasColumnType("attribute_values") - .HasColumnName("attribute") - .HasColumnOrder(2); - - b.HasKey("DeityId", "Attribute") - .HasName("pk_deity_attributes"); - - b.ToTable("deity_attributes", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityDomain", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id") - .HasColumnOrder(2); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary") - .HasColumnOrder(3); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("value") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_deity_domains"); - - b.HasIndex("DeityId") - .HasDatabaseName("ix_deity_domains_deity_id"); - - b.ToTable("deity_domains", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeitySpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id") - .HasColumnOrder(2); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(3); - - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(4); - - b.HasKey("Id") - .HasName("pk_deity_spells"); - - b.HasIndex("DeityId") - .HasDatabaseName("ix_deity_spells_deity_id"); - - b.HasIndex("SpellId") - .HasDatabaseName("ix_deity_spells_spell_id"); - - b.ToTable("deity_spells", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityWeapon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("DeityId") - .HasColumnType("integer") - .HasColumnName("deity_id") - .HasColumnOrder(2); - - b.Property("Weapon") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("weapon") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_deity_weapons"); - - b.HasIndex("DeityId") - .HasDatabaseName("ix_deity_weapons_deity_id"); - - b.ToTable("deity_weapons", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Feat", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("Actions") - .HasColumnType("integer") - .HasColumnName("actions") - .HasColumnOrder(4); - - b.Property("Category") - .HasColumnType("action_category") - .HasColumnName("category") - .HasColumnOrder(3); - - b.Property("Extra") - .HasColumnType("text") - .HasColumnName("extra") - .HasColumnOrder(10); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(5); - - b.Property("LevelTaken") - .HasColumnType("integer") - .HasColumnName("level_taken") - .HasColumnOrder(6); - - b.Property("Location") - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("location") - .HasColumnOrder(8); - - b.Property("MaxTakable") - .HasColumnType("integer") - .HasColumnName("max_takable") - .HasColumnOrder(7); - - b.Property("OnlyLevel1") - .HasColumnType("boolean") - .HasColumnName("only_level1") - .HasColumnOrder(9); - - b.Property("Type") - .HasColumnType("action_type") - .HasColumnName("type") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_feats"); - - b.ToTable("feats", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.FeatRelation.FeatPrerequisite", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FeatId") - .HasColumnType("integer") - .HasColumnName("feat_id") - .HasColumnOrder(2); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("value") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_feat_prerequisites"); - - b.HasIndex("FeatId") - .HasDatabaseName("ix_feat_prerequisites_feat_id"); - - b.ToTable("feat_prerequisites", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Heritage", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("AncestryId") - .HasColumnType("integer") - .HasColumnName("ancestry_id") - .HasColumnOrder(2); - - b.HasKey("Id") - .HasName("pk_heritages"); - - b.HasIndex("AncestryId") - .HasDatabaseName("ix_heritages_ancestry_id"); - - b.ToTable("heritages", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Spell", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - b.Property("CanHeightening") - .HasColumnType("boolean") - .HasColumnName("can_heightening") - .HasColumnOrder(11); - - b.Property("Cost") - .HasColumnType("integer") - .HasColumnName("cost") - .HasColumnOrder(3); - - b.Property("Counteraction") - .HasColumnType("boolean") - .HasColumnName("counteraction") - .HasColumnOrder(4); - - b.Property("Duration") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("duration") - .HasColumnOrder(6); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level") - .HasColumnOrder(2); - - b.Property("Range") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("range") - .HasColumnOrder(7); - - b.Property("Requirements") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("requirements") - .HasColumnOrder(8); - - b.Property("Sustained") - .HasColumnType("boolean") - .HasColumnName("sustained") - .HasColumnOrder(5); - - b.Property("Target") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("target") - .HasColumnOrder(9); - - b.Property("Time") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("time") - .HasColumnOrder(10); - - b.HasKey("Id") - .HasName("pk_spells"); - - b.ToTable("spells", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellArea", b => - { - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(1); - - b.Property("Details") - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("details") - .HasColumnOrder(2); - - b.Property("Type") - .HasColumnType("spell_area_type") - .HasColumnName("type") - .HasColumnOrder(3); - - b.Property("Value") - .HasColumnType("integer") - .HasColumnName("value") - .HasColumnOrder(4); - - b.HasKey("SpellId") - .HasName("pk_spell_areas"); - - b.ToTable("spell_areas", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellDamage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ApplyMod") - .HasColumnType("boolean") - .HasColumnName("apply_mod") - .HasColumnOrder(4); - - b.Property("Category") - .HasColumnType("spell_damage_category") - .HasColumnName("category") - .HasColumnOrder(5); - - b.Property("Formula") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("formula") - .HasColumnOrder(6); - - b.Property("Key") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("key") - .HasColumnOrder(3); - - b.Property("Kinds") - .HasColumnType("spell_damage_kinds") - .HasColumnName("kinds") - .HasColumnOrder(7); - - b.Property("Materials") - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("materials") - .HasColumnOrder(8); - - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(2); - - b.Property("Type") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("type") - .HasColumnOrder(9); - - b.HasKey("Id") - .HasName("pk_spell_damages"); - - b.HasIndex("SpellId") - .HasDatabaseName("ix_spell_damages_spell_id"); - - b.ToTable("spell_damages", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellDefense", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("IsBasic") - .HasColumnType("boolean") - .HasColumnName("is_basic") - .HasColumnOrder(4); - - b.Property("IsPassive") - .HasColumnType("boolean") - .HasColumnName("is_passive") - .HasColumnOrder(3); - - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(2); - - b.Property("Statistic") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("statistic") - .HasColumnOrder(5); - - b.HasKey("Id") - .HasName("pk_spell_defenses"); - - b.HasIndex("SpellId") - .HasDatabaseName("ix_spell_defenses_spell_id"); - - b.ToTable("spell_defenses", (string)null); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellRitual", b => - { - b.Property("SpellId") - .HasColumnType("integer") - .HasColumnName("spell_id") - .HasColumnOrder(1); - - b.Property("PrimaryCheck") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("primary_check") - .HasColumnOrder(2); - - b.Property("SecondaryCasters") - .HasColumnType("integer") - .HasColumnName("secondary_casters") - .HasColumnOrder(3); - - b.Property("SecondaryChecks") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("secondary_checks") - .HasColumnOrder(4); - - b.HasKey("SpellId") - .HasName("pk_spell_rituals"); - - b.ToTable("spell_rituals", (string)null); - }); - - modelBuilder.Entity("DeityTraining", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", null) - .WithMany() - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_training_deities_deity_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Training", null) - .WithMany() - .HasForeignKey("SkillsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_training_trainings_skills_id"); - }); - - modelBuilder.Entity("EntityKeyword", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", null) - .WithMany() - .HasForeignKey("EntitiesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_keyword_entities_entities_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Keywords.Keyword", null) - .WithMany() - .HasForeignKey("KeywordsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_keyword_keywords_keywords_id"); - }); - - modelBuilder.Entity("EntityTrait", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", null) - .WithMany() - .HasForeignKey("EntitiesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_trait_entities_entities_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Trait", null) - .WithMany() - .HasForeignKey("TraitsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_trait_traits_traits_id"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.EntityAlias", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany("Aliases") - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_aliases_entities_entity_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Keywords.KeywordAlias", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Keywords.Keyword", "Keyword") - .WithMany("Aliases") - .HasForeignKey("KeywordId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_keyword_aliases_keywords_keyword_id"); - - b.Navigation("Keyword"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Source.EntitySource", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany("Sources") - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_sources_entities_entity_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Source.Source", "Source") - .WithMany("EntitySources") - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_sources_sources_source_id"); - - b.Navigation("Entity"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Targets.EntityExternal", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany("Extrnals") - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_externals_entities_entity_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Targets.ExternalTarget", "Target") - .WithMany("EntityExternals") - .HasForeignKey("TargetId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_entity_externals_external_targets_target_id"); - - b.Navigation("Entity"); - - b.Navigation("Target"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Action", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Action", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_actions_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Ancestry", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Ancestry", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestries_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryBoost", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Ancestry", "Ancestry") - .WithMany("AncestryBoosts") - .HasForeignKey("AncestryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_boosts_ancestries_ancestry_id"); - - b.Navigation("Ancestry"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryItem", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Ancestry", "Ancestry") - .WithMany("AncestryItems") - .HasForeignKey("AncestryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_items_ancestries_ancestry_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_items_entities_item_id"); - - b.Navigation("Ancestry"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.AncestryRelation.AncestryLanguage", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Ancestry", "Ancestry") - .WithMany("AncestryLanguages") - .HasForeignKey("AncestryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_languages_ancestries_ancestry_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Language", "Language") - .WithMany() - .HasForeignKey("LanguageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_ancestry_languages_languages_language_id"); - - b.Navigation("Ancestry"); - - b.Navigation("Language"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Background", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Background", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_backgrounds_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundBoost", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Background", "Background") - .WithMany("BackgroundBoosts") - .HasForeignKey("BackgroundId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_boosts_backgrounds_background_id"); - - b.Navigation("Background"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundItem", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Background", "Background") - .WithMany("BackgroundItems") - .HasForeignKey("BackgroundId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_items_backgrounds_background_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany() - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_items_entities_entity_id"); - - b.Navigation("Background"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.BackgroundRelation.BackgroundTraining", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Background", "Background") - .WithMany("BackgroundSkills") - .HasForeignKey("BackgroundId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_skills_backgrounds_background_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Training", "Training") - .WithMany() - .HasForeignKey("TrainingId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_background_skills_trainings_training_id"); - - b.Navigation("Background"); - - b.Navigation("Training"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Class", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Class", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_classes_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassKeyAbility", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Class", "Class") - .WithMany("ClassKeyAbilities") - .HasForeignKey("ClassId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_class_key_abilities_classes_class_id"); - - b.Navigation("Class"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassProgression", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Class", "Class") - .WithMany("ClassProgressions") - .HasForeignKey("ClassId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_class_progressions_classes_class_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany() - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.SetNull) - .HasConstraintName("fk_class_progressions_entities_entity_id"); - - b.Navigation("Class"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.ClassRelation.ClassTraining", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Class", "Class") - .WithMany("ClassTrainings") - .HasForeignKey("ClassId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_class_trainings_classes_class_id"); - - b.HasOne("Pf2eDataScrapper.Model.Common.Training", "Training") - .WithMany() - .HasForeignKey("TrainingId") - .OnDelete(DeleteBehavior.SetNull) - .HasConstraintName("fk_class_trainings_trainings_training_id"); - - b.Navigation("Class"); - - b.Navigation("Training"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Condition", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Condition", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_conditions_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Deity", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Deity", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deities_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityAttribute", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", "Deity") - .WithMany("DeityAttributes") - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_attributes_deities_deity_id"); - - b.Navigation("Deity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityDomain", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", "Deity") - .WithMany("DeityDomains") - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_domains_deities_deity_id"); - - b.Navigation("Deity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeitySpell", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", "Deity") - .WithMany("DeitySpells") - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_spells_deities_deity_id"); - - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithMany() - .HasForeignKey("SpellId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_spells_spells_spell_id"); - - b.Navigation("Deity"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.DeityRelation.DeityWeapon", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", "Deity") - .WithMany("DeityWeapons") - .HasForeignKey("DeityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_deity_weapons_deities_deity_id"); - - b.Navigation("Deity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Feat", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Feat", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_feats_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.FeatRelation.FeatPrerequisite", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Feat", "Feat") - .WithMany("FeatPrerequisites") - .HasForeignKey("FeatId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_feat_prerequisites_feats_feat_id"); - - b.Navigation("Feat"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Heritage", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Ancestry", "Ancestry") - .WithMany("Heritages") - .HasForeignKey("AncestryId") - .OnDelete(DeleteBehavior.Cascade) - .HasConstraintName("fk_heritages_ancestries_ancestry_id"); - - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Heritage", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_heritages_entities_id"); - - b.Navigation("Ancestry"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Spell", b => - { - b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithOne() - .HasForeignKey("Pf2eDataScrapper.Model.Structure.Spell", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_spells_entities_id"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellArea", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithOne("SpellArea") - .HasForeignKey("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellArea", "SpellId") - .OnDelete(DeleteBehavior.Cascade) - .HasConstraintName("fk_spell_areas_spells_spell_id"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellDamage", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithMany("SpellDamages") - .HasForeignKey("SpellId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_spell_damages_spells_spell_id"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellDefense", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithMany("SpellDefenses") - .HasForeignKey("SpellId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_spell_defenses_spells_spell_id"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellRitual", b => - { - b.HasOne("Pf2eDataScrapper.Model.Structure.Spell", "Spell") - .WithOne("SpellRitual") - .HasForeignKey("Pf2eDataScrapper.Model.Structure.SpellRelation.SpellRitual", "SpellId") - .OnDelete(DeleteBehavior.Cascade) - .HasConstraintName("fk_spell_rituals_spells_spell_id"); - - b.Navigation("Spell"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Entity", b => - { - b.Navigation("Aliases"); - - b.Navigation("Extrnals"); - - b.Navigation("Sources"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Keywords.Keyword", b => - { - b.Navigation("Aliases"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Source.Source", b => - { - b.Navigation("EntitySources"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Targets.ExternalTarget", b => - { - b.Navigation("EntityExternals"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Ancestry", b => - { - b.Navigation("AncestryBoosts"); - - b.Navigation("AncestryItems"); - - b.Navigation("AncestryLanguages"); - - b.Navigation("Heritages"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Background", b => - { - b.Navigation("BackgroundBoosts"); - - b.Navigation("BackgroundItems"); - - b.Navigation("BackgroundSkills"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Class", b => - { - b.Navigation("ClassKeyAbilities"); - - b.Navigation("ClassProgressions"); - - b.Navigation("ClassTrainings"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Deity", b => - { - b.Navigation("DeityAttributes"); - - b.Navigation("DeityDomains"); - - b.Navigation("DeitySpells"); - - b.Navigation("DeityWeapons"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Feat", b => - { - b.Navigation("FeatPrerequisites"); - }); - - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Spell", b => - { - b.Navigation("SpellArea"); - - b.Navigation("SpellDamages"); - - b.Navigation("SpellDefenses"); - - b.Navigation("SpellRitual"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Pf2eDataScrapper/Migrations/20250416151720_ActionCategoryUnknown.cs b/Pf2eDataScrapper/Migrations/20250416151720_ActionCategoryUnknown.cs deleted file mode 100644 index ab7ace7..0000000 --- a/Pf2eDataScrapper/Migrations/20250416151720_ActionCategoryUnknown.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Pf2eDataScrapper.Migrations -{ - /// - public partial class ActionCategoryUnknown : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - 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", "action,free,reaction,passive") - .Annotation("Npgsql:Enum:alias_type", "old,english,old_english,hobby,other") - .Annotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,darkvision") - .Annotation("Npgsql:Enum:attribute_values", "any,str,dex,con,int,wis,cha") - .Annotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase") - .Annotation("Npgsql:Enum:condition_group", "unknown,senses,abilities,death,attitudes,detection") - .Annotation("Npgsql:Enum:deity_category", "deity,pantheon,covenant,philosophy") - .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,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell") - .Annotation("Npgsql:Enum:enum_size", "med,tiny") - .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", "med,tiny") - .Annotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder") - .Annotation("Npgsql:Enum:spell_damage_category", "persistent,splash") - .Annotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any") - .Annotation("Npgsql:Enum:training_stage", "untrained,trained,expert,master,legendary") - .Annotation("Npgsql:Enum:trait_type", "regular,tradition") - .OldAnnotation("Npgsql:Enum:action_category", "offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature") - .OldAnnotation("Npgsql:Enum:action_type", "action,free,reaction,passive") - .OldAnnotation("Npgsql:Enum:alias_type", "old,english,old_english,hobby,other") - .OldAnnotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,darkvision") - .OldAnnotation("Npgsql:Enum:attribute_values", "any,str,dex,con,int,wis,cha") - .OldAnnotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase") - .OldAnnotation("Npgsql:Enum:condition_group", "unknown,senses,abilities,death,attitudes,detection") - .OldAnnotation("Npgsql:Enum:deity_category", "deity,pantheon,covenant,philosophy") - .OldAnnotation("Npgsql:Enum:deity_fonts", "none,heal,harm,any") - .OldAnnotation("Npgsql:Enum:deity_sanctification", "holy,unholy,any") - .OldAnnotation("Npgsql:Enum:entity_rarity", "common,uncommon,rare,unique") - .OldAnnotation("Npgsql:Enum:entity_type", "unknown,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell") - .OldAnnotation("Npgsql:Enum:enum_size", "med,tiny") - .OldAnnotation("Npgsql:Enum:feat_action_type", "passive,action,reaction,free") - .OldAnnotation("Npgsql:Enum:feat_category", "ancestryfeature,classfeature,calling,class,skill,general,ancestry,bonus,deityboon,curse,pfsboon,campaign_feature") - .OldAnnotation("Npgsql:Enum:size", "med,tiny") - .OldAnnotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder") - .OldAnnotation("Npgsql:Enum:spell_damage_category", "persistent,splash") - .OldAnnotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any") - .OldAnnotation("Npgsql:Enum:training_stage", "untrained,trained,expert,master,legendary") - .OldAnnotation("Npgsql:Enum:trait_type", "regular,tradition"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterDatabase() - .Annotation("Npgsql:Enum:action_category", "offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature") - .Annotation("Npgsql:Enum:action_type", "action,free,reaction,passive") - .Annotation("Npgsql:Enum:alias_type", "old,english,old_english,hobby,other") - .Annotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,darkvision") - .Annotation("Npgsql:Enum:attribute_values", "any,str,dex,con,int,wis,cha") - .Annotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase") - .Annotation("Npgsql:Enum:condition_group", "unknown,senses,abilities,death,attitudes,detection") - .Annotation("Npgsql:Enum:deity_category", "deity,pantheon,covenant,philosophy") - .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,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell") - .Annotation("Npgsql:Enum:enum_size", "med,tiny") - .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", "med,tiny") - .Annotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder") - .Annotation("Npgsql:Enum:spell_damage_category", "persistent,splash") - .Annotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any") - .Annotation("Npgsql:Enum:training_stage", "untrained,trained,expert,master,legendary") - .Annotation("Npgsql:Enum:trait_type", "regular,tradition") - .OldAnnotation("Npgsql:Enum:action_category", "unknown,offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature") - .OldAnnotation("Npgsql:Enum:action_type", "action,free,reaction,passive") - .OldAnnotation("Npgsql:Enum:alias_type", "old,english,old_english,hobby,other") - .OldAnnotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,darkvision") - .OldAnnotation("Npgsql:Enum:attribute_values", "any,str,dex,con,int,wis,cha") - .OldAnnotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase") - .OldAnnotation("Npgsql:Enum:condition_group", "unknown,senses,abilities,death,attitudes,detection") - .OldAnnotation("Npgsql:Enum:deity_category", "deity,pantheon,covenant,philosophy") - .OldAnnotation("Npgsql:Enum:deity_fonts", "none,heal,harm,any") - .OldAnnotation("Npgsql:Enum:deity_sanctification", "holy,unholy,any") - .OldAnnotation("Npgsql:Enum:entity_rarity", "common,uncommon,rare,unique") - .OldAnnotation("Npgsql:Enum:entity_type", "unknown,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell") - .OldAnnotation("Npgsql:Enum:enum_size", "med,tiny") - .OldAnnotation("Npgsql:Enum:feat_action_type", "passive,action,reaction,free") - .OldAnnotation("Npgsql:Enum:feat_category", "ancestryfeature,classfeature,calling,class,skill,general,ancestry,bonus,deityboon,curse,pfsboon,campaign_feature") - .OldAnnotation("Npgsql:Enum:size", "med,tiny") - .OldAnnotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder") - .OldAnnotation("Npgsql:Enum:spell_damage_category", "persistent,splash") - .OldAnnotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any") - .OldAnnotation("Npgsql:Enum:training_stage", "untrained,trained,expert,master,legendary") - .OldAnnotation("Npgsql:Enum:trait_type", "regular,tradition"); - } - } -} diff --git a/Pf2eDataScrapper/Migrations/20250416152441_Md5Length.cs b/Pf2eDataScrapper/Migrations/20250416152441_Md5Length.cs deleted file mode 100644 index 19078c9..0000000 --- a/Pf2eDataScrapper/Migrations/20250416152441_Md5Length.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Pf2eDataScrapper.Migrations -{ - /// - public partial class Md5Length : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "md5", - table: "entity_externals", - type: "character varying(32)", - maxLength: 32, - nullable: false, - comment: "Контроль версии объекта", - oldClrType: typeof(string), - oldType: "character varying(16)", - oldMaxLength: 16, - oldComment: "Контроль версии объекта"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "md5", - table: "entity_externals", - type: "character varying(16)", - maxLength: 16, - nullable: false, - comment: "Контроль версии объекта", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldComment: "Контроль версии объекта"); - } - } -} diff --git a/Pf2eDataScrapper/Migrations/20250416202849_Typo.cs b/Pf2eDataScrapper/Migrations/20250416202849_Typo.cs deleted file mode 100644 index b39c8bf..0000000 --- a/Pf2eDataScrapper/Migrations/20250416202849_Typo.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Pf2eDataScrapper.Migrations -{ - /// - public partial class Typo : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Pf2eDataScrapper/Migrations/20250416152441_Md5Length.Designer.cs b/Pf2eDataScrapper/Migrations/20250417082248_V2.Designer.cs similarity index 98% rename from Pf2eDataScrapper/Migrations/20250416152441_Md5Length.Designer.cs rename to Pf2eDataScrapper/Migrations/20250417082248_V2.Designer.cs index f58d556..4904461 100644 --- a/Pf2eDataScrapper/Migrations/20250416152441_Md5Length.Designer.cs +++ b/Pf2eDataScrapper/Migrations/20250417082248_V2.Designer.cs @@ -1,4 +1,5 @@ // +using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; @@ -12,8 +13,8 @@ using Pf2eDataScrapper.Model.Enum; namespace Pf2eDataScrapper.Migrations { [DbContext(typeof(Pf2eDbContext))] - [Migration("20250416152441_Md5Length")] - partial class Md5Length + [Migration("20250417082248_V2")] + partial class V2 { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -25,7 +26,7 @@ namespace Pf2eDataScrapper.Migrations 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[] { "action", "free", "reaction", "passive" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "alias_type", new[] { "old", "english", "old_english", "hobby", "other" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "alias_type", new[] { "legacy", "english", "legacy_english", "hobby", "other" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "darkvision" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "any", "str", "dex", "con", "int", "wis", "cha" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "class_progression_type", new[] { "entity", "ancestry_feat", "class_feat", "general_feat", "skill_feat", "skill_increase" }); @@ -34,11 +35,11 @@ namespace Pf2eDataScrapper.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", "action", "ancestry", "background", "backpack", "campaign_feature", "class", "condition", "deity", "feat", "heritage", "spell" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "enum_size", new[] { "med", "tiny" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "unknown", "trait", "action", "ancestry", "background", "backpack", "campaign_feature", "class", "condition", "deity", "feat", "heritage", "spell" }); 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[] { "med", "tiny" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "source_category", new[] { "rulebook", "adventure-path", "lost-omens" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_area_type", new[] { "burst", "emanation", "cone", "line", "square", "cube", "cylinder" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_category", new[] { "persistent", "splash" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_kinds", new[] { "damage", "healing", "any" }); @@ -296,6 +297,11 @@ namespace Pf2eDataScrapper.Migrations NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Category") + .HasColumnType("source_category") + .HasColumnName("category") + .HasColumnOrder(3); + b.Property("Name") .IsRequired() .HasMaxLength(255) @@ -303,12 +309,10 @@ namespace Pf2eDataScrapper.Migrations .HasColumnName("name") .HasColumnOrder(2); - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("url") - .HasColumnOrder(3); + b.Property("ReleaseDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("release_date") + .HasColumnOrder(4); b.HasKey("Id") .HasName("pk_sources"); @@ -479,47 +483,6 @@ namespace Pf2eDataScrapper.Migrations b.ToTable("trainings", (string)null); }); - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Trait", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Description") - .IsRequired() - .HasColumnType("text") - .HasColumnName("description") - .HasColumnOrder(5); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("slug") - .HasColumnOrder(4); - - b.Property("Type") - .HasColumnType("trait_type") - .HasColumnName("type") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_traits"); - - b.ToTable("traits", (string)null); - }); - modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Action", b => { b.Property("Id") @@ -576,7 +539,7 @@ namespace Pf2eDataScrapper.Migrations .HasColumnOrder(4); b.Property("Size") - .HasColumnType("enum_size") + .HasColumnType("size") .HasColumnName("size") .HasColumnOrder(2); @@ -1458,6 +1421,24 @@ namespace Pf2eDataScrapper.Migrations b.ToTable("spell_rituals", (string)null); }); + modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Trait", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id") + .HasColumnOrder(1); + + b.Property("Type") + .HasColumnType("trait_type") + .HasColumnName("type") + .HasColumnOrder(2); + + b.HasKey("Id") + .HasName("pk_traits"); + + b.ToTable("traits", (string)null); + }); + modelBuilder.Entity("DeityTraining", b => { b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", null) @@ -1501,7 +1482,7 @@ namespace Pf2eDataScrapper.Migrations .IsRequired() .HasConstraintName("fk_entity_trait_entities_entities_id"); - b.HasOne("Pf2eDataScrapper.Model.Common.Trait", null) + b.HasOne("Pf2eDataScrapper.Model.Structure.Trait", null) .WithMany() .HasForeignKey("TraitsId") .OnDelete(DeleteBehavior.Cascade) @@ -1966,6 +1947,18 @@ namespace Pf2eDataScrapper.Migrations b.Navigation("Spell"); }); + modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Trait", b => + { + b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") + .WithOne() + .HasForeignKey("Pf2eDataScrapper.Model.Structure.Trait", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_traits_entities_id"); + + b.Navigation("Entity"); + }); + modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Entity", b => { b.Navigation("Aliases"); diff --git a/Pf2eDataScrapper/Migrations/20250416092350_Initial.cs b/Pf2eDataScrapper/Migrations/20250417082248_V2.cs similarity index 97% rename from Pf2eDataScrapper/Migrations/20250416092350_Initial.cs rename to Pf2eDataScrapper/Migrations/20250417082248_V2.cs index b6f3160..3ed1956 100644 --- a/Pf2eDataScrapper/Migrations/20250416092350_Initial.cs +++ b/Pf2eDataScrapper/Migrations/20250417082248_V2.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using System; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Pf2eDataScrapper.Model.Enum; @@ -7,28 +8,28 @@ using Pf2eDataScrapper.Model.Enum; namespace Pf2eDataScrapper.Migrations { /// - public partial class Initial : Migration + public partial class V2 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterDatabase() - .Annotation("Npgsql:Enum:action_category", "offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature") + .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", "action,free,reaction,passive") - .Annotation("Npgsql:Enum:alias_type", "old,english,old_english,hobby,other") + .Annotation("Npgsql:Enum:alias_type", "legacy,english,legacy_english,hobby,other") .Annotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,darkvision") .Annotation("Npgsql:Enum:attribute_values", "any,str,dex,con,int,wis,cha") .Annotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase") - .Annotation("Npgsql:Enum:condition_group", "senses,abilities,death,attitudes,detection") + .Annotation("Npgsql:Enum:condition_group", "unknown,senses,abilities,death,attitudes,detection") .Annotation("Npgsql:Enum:deity_category", "deity,pantheon,covenant,philosophy") .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,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell") - .Annotation("Npgsql:Enum:enum_size", "med,tiny") + .Annotation("Npgsql:Enum:entity_type", "unknown,trait,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell") .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", "med,tiny") + .Annotation("Npgsql:Enum:source_category", "rulebook,adventure-path,lost-omens") .Annotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder") .Annotation("Npgsql:Enum:spell_damage_category", "persistent,splash") .Annotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any") @@ -62,7 +63,8 @@ namespace Pf2eDataScrapper.Migrations id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), - icon = table.Column(type: "character varying(255)", maxLength: 255, nullable: false) + icon = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), + prefix = table.Column(type: "character varying(255)", maxLength: 255, nullable: false) }, constraints: table => { @@ -119,7 +121,8 @@ namespace Pf2eDataScrapper.Migrations id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), - url = table.Column(type: "character varying(255)", maxLength: 255, nullable: false) + category = table.Column(type: "source_category", nullable: false), + release_date = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { @@ -139,22 +142,6 @@ namespace Pf2eDataScrapper.Migrations table.PrimaryKey("pk_trainings", x => x.id); }); - migrationBuilder.CreateTable( - name: "traits", - columns: table => new - { - id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), - type = table.Column(type: "trait_type", nullable: false), - slug = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), - description = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_traits", x => x.id); - }); - migrationBuilder.CreateTable( name: "actions", columns: table => new @@ -182,7 +169,7 @@ namespace Pf2eDataScrapper.Migrations columns: table => new { id = table.Column(type: "integer", nullable: false), - size = table.Column(type: "enum_size", nullable: false), + size = table.Column(type: "size", nullable: false), hp = table.Column(type: "integer", nullable: false), reach = table.Column(type: "integer", nullable: false), speed = table.Column(type: "integer", nullable: false), @@ -349,6 +336,24 @@ namespace Pf2eDataScrapper.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "traits", + columns: table => new + { + id = table.Column(type: "integer", nullable: false), + type = table.Column(type: "trait_type", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_traits", x => x.id); + table.ForeignKey( + name: "fk_traits_entities_id", + column: x => x.id, + principalTable: "entities", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "entity_externals", columns: table => new @@ -356,7 +361,7 @@ namespace Pf2eDataScrapper.Migrations entity_id = table.Column(type: "integer", nullable: false), target_id = table.Column(type: "integer", nullable: false), suffix = table.Column(type: "character varying(255)", maxLength: 255, nullable: false, comment: "Часть URL до объекта. Для источников Foundry - полный UUID объекта"), - md5 = table.Column(type: "character varying(16)", maxLength: 16, nullable: false, comment: "Контроль версии объекта") + md5 = table.Column(type: "character varying(32)", maxLength: 32, nullable: false, comment: "Контроль версии объекта") }, constraints: table => { @@ -445,30 +450,6 @@ namespace Pf2eDataScrapper.Migrations onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateTable( - name: "entity_trait", - columns: table => new - { - entities_id = table.Column(type: "integer", nullable: false), - traits_id = table.Column(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_entity_trait", x => new { x.entities_id, x.traits_id }); - table.ForeignKey( - name: "fk_entity_trait_entities_entities_id", - column: x => x.entities_id, - principalTable: "entities", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_entity_trait_traits_traits_id", - column: x => x.traits_id, - principalTable: "traits", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - migrationBuilder.CreateTable( name: "ancestry_boosts", columns: table => new @@ -928,6 +909,30 @@ namespace Pf2eDataScrapper.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "entity_trait", + columns: table => new + { + entities_id = table.Column(type: "integer", nullable: false), + traits_id = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_entity_trait", x => new { x.entities_id, x.traits_id }); + table.ForeignKey( + name: "fk_entity_trait_entities_entities_id", + column: x => x.entities_id, + principalTable: "entities", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_entity_trait_traits_traits_id", + column: x => x.traits_id, + principalTable: "traits", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateIndex( name: "ix_ancestry_boosts_ancestry_id", table: "ancestry_boosts", @@ -1058,7 +1063,6 @@ namespace Pf2eDataScrapper.Migrations table: "spell_defenses", column: "spell_id"); - // Procedures migrationBuilder.Sql(""" @@ -1243,12 +1247,6 @@ $func$; migrationBuilder.DropTable( name: "entities"); - - migrationBuilder.Sql("DROP FUNCTION IF EXISTS f_truncate_tables;"); - - migrationBuilder.Sql("DROP FUNCTION IF EXISTS f_drop_tables;"); - - migrationBuilder.Sql("DROP FUNCTION IF EXISTS f_permission_tables;"); } } } diff --git a/Pf2eDataScrapper/Migrations/20250416202849_Typo.Designer.cs b/Pf2eDataScrapper/Migrations/20250417085326_DateOnly.Designer.cs similarity index 97% rename from Pf2eDataScrapper/Migrations/20250416202849_Typo.Designer.cs rename to Pf2eDataScrapper/Migrations/20250417085326_DateOnly.Designer.cs index 28a88bb..d3aa3c0 100644 --- a/Pf2eDataScrapper/Migrations/20250416202849_Typo.Designer.cs +++ b/Pf2eDataScrapper/Migrations/20250417085326_DateOnly.Designer.cs @@ -1,4 +1,5 @@ // +using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; @@ -12,8 +13,8 @@ using Pf2eDataScrapper.Model.Enum; namespace Pf2eDataScrapper.Migrations { [DbContext(typeof(Pf2eDbContext))] - [Migration("20250416202849_Typo")] - partial class Typo + [Migration("20250417085326_DateOnly")] + partial class DateOnly { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -25,7 +26,7 @@ namespace Pf2eDataScrapper.Migrations 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[] { "action", "free", "reaction", "passive" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "alias_type", new[] { "old", "english", "old_english", "hobby", "other" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "alias_type", new[] { "legacy", "english", "legacy_english", "hobby", "other" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "darkvision" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "any", "str", "dex", "con", "int", "wis", "cha" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "class_progression_type", new[] { "entity", "ancestry_feat", "class_feat", "general_feat", "skill_feat", "skill_increase" }); @@ -34,11 +35,11 @@ namespace Pf2eDataScrapper.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", "action", "ancestry", "background", "backpack", "campaign_feature", "class", "condition", "deity", "feat", "heritage", "spell" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "enum_size", new[] { "med", "tiny" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "unknown", "trait", "action", "ancestry", "background", "backpack", "campaign_feature", "class", "condition", "deity", "feat", "heritage", "spell" }); 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[] { "med", "tiny" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "source_category", new[] { "rulebook", "adventure-path", "lost-omens" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_area_type", new[] { "burst", "emanation", "cone", "line", "square", "cube", "cylinder" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_category", new[] { "persistent", "splash" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_kinds", new[] { "damage", "healing", "any" }); @@ -296,6 +297,11 @@ namespace Pf2eDataScrapper.Migrations NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Category") + .HasColumnType("source_category") + .HasColumnName("category") + .HasColumnOrder(3); + b.Property("Name") .IsRequired() .HasMaxLength(255) @@ -303,12 +309,10 @@ namespace Pf2eDataScrapper.Migrations .HasColumnName("name") .HasColumnOrder(2); - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("url") - .HasColumnOrder(3); + b.Property("ReleaseDate") + .HasColumnType("date") + .HasColumnName("release_date") + .HasColumnOrder(4); b.HasKey("Id") .HasName("pk_sources"); @@ -390,47 +394,6 @@ namespace Pf2eDataScrapper.Migrations b.ToTable("external_targets", (string)null); }); - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Trait", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Description") - .IsRequired() - .HasColumnType("text") - .HasColumnName("description") - .HasColumnOrder(5); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("slug") - .HasColumnOrder(4); - - b.Property("Type") - .HasColumnType("trait_type") - .HasColumnName("type") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_traits"); - - b.ToTable("traits", (string)null); - }); - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Frequency", b => { b.Property("Id") @@ -576,7 +539,7 @@ namespace Pf2eDataScrapper.Migrations .HasColumnOrder(4); b.Property("Size") - .HasColumnType("enum_size") + .HasColumnType("size") .HasColumnName("size") .HasColumnOrder(2); @@ -1458,6 +1421,24 @@ namespace Pf2eDataScrapper.Migrations b.ToTable("spell_rituals", (string)null); }); + modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Trait", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id") + .HasColumnOrder(1); + + b.Property("Type") + .HasColumnType("trait_type") + .HasColumnName("type") + .HasColumnOrder(2); + + b.HasKey("Id") + .HasName("pk_traits"); + + b.ToTable("traits", (string)null); + }); + modelBuilder.Entity("DeityTraining", b => { b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", null) @@ -1501,7 +1482,7 @@ namespace Pf2eDataScrapper.Migrations .IsRequired() .HasConstraintName("fk_entity_trait_entities_entities_id"); - b.HasOne("Pf2eDataScrapper.Model.Base.Trait", null) + b.HasOne("Pf2eDataScrapper.Model.Structure.Trait", null) .WithMany() .HasForeignKey("TraitsId") .OnDelete(DeleteBehavior.Cascade) @@ -1557,7 +1538,7 @@ namespace Pf2eDataScrapper.Migrations modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Targets.EntityExternal", b => { b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany("Externals") + .WithMany("Extrnals") .HasForeignKey("EntityId") .OnDelete(DeleteBehavior.Cascade) .IsRequired() @@ -1966,11 +1947,23 @@ namespace Pf2eDataScrapper.Migrations b.Navigation("Spell"); }); + modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Trait", b => + { + b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") + .WithOne() + .HasForeignKey("Pf2eDataScrapper.Model.Structure.Trait", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_traits_entities_id"); + + b.Navigation("Entity"); + }); + modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Entity", b => { b.Navigation("Aliases"); - b.Navigation("Externals"); + b.Navigation("Extrnals"); b.Navigation("Sources"); }); diff --git a/Pf2eDataScrapper/Migrations/20250417085326_DateOnly.cs b/Pf2eDataScrapper/Migrations/20250417085326_DateOnly.cs new file mode 100644 index 0000000..bdd9575 --- /dev/null +++ b/Pf2eDataScrapper/Migrations/20250417085326_DateOnly.cs @@ -0,0 +1,37 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Pf2eDataScrapper.Migrations +{ + /// + public partial class DateOnly : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "release_date", + table: "sources", + type: "date", + nullable: true, + oldClrType: typeof(DateTime), + oldType: "timestamp with time zone", + oldNullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "release_date", + table: "sources", + type: "timestamp with time zone", + nullable: true, + oldClrType: typeof(DateOnly), + oldType: "date", + oldNullable: true); + } + } +} diff --git a/Pf2eDataScrapper/Migrations/Pf2eDbContextModelSnapshot.cs b/Pf2eDataScrapper/Migrations/Pf2eDbContextModelSnapshot.cs index 42c3eb0..32c2661 100644 --- a/Pf2eDataScrapper/Migrations/Pf2eDbContextModelSnapshot.cs +++ b/Pf2eDataScrapper/Migrations/Pf2eDbContextModelSnapshot.cs @@ -1,4 +1,5 @@ // +using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; @@ -22,7 +23,7 @@ namespace Pf2eDataScrapper.Migrations 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[] { "action", "free", "reaction", "passive" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "alias_type", new[] { "old", "english", "old_english", "hobby", "other" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "alias_type", new[] { "legacy", "english", "legacy_english", "hobby", "other" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "darkvision" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "any", "str", "dex", "con", "int", "wis", "cha" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "class_progression_type", new[] { "entity", "ancestry_feat", "class_feat", "general_feat", "skill_feat", "skill_increase" }); @@ -31,11 +32,11 @@ namespace Pf2eDataScrapper.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", "action", "ancestry", "background", "backpack", "campaign_feature", "class", "condition", "deity", "feat", "heritage", "spell" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "enum_size", new[] { "med", "tiny" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "unknown", "trait", "action", "ancestry", "background", "backpack", "campaign_feature", "class", "condition", "deity", "feat", "heritage", "spell" }); 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[] { "med", "tiny" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "source_category", new[] { "rulebook", "adventure-path", "lost-omens" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_area_type", new[] { "burst", "emanation", "cone", "line", "square", "cube", "cylinder" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_category", new[] { "persistent", "splash" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_kinds", new[] { "damage", "healing", "any" }); @@ -293,6 +294,11 @@ namespace Pf2eDataScrapper.Migrations NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Category") + .HasColumnType("source_category") + .HasColumnName("category") + .HasColumnOrder(3); + b.Property("Name") .IsRequired() .HasMaxLength(255) @@ -300,12 +306,10 @@ namespace Pf2eDataScrapper.Migrations .HasColumnName("name") .HasColumnOrder(2); - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("url") - .HasColumnOrder(3); + b.Property("ReleaseDate") + .HasColumnType("date") + .HasColumnName("release_date") + .HasColumnOrder(4); b.HasKey("Id") .HasName("pk_sources"); @@ -387,47 +391,6 @@ namespace Pf2eDataScrapper.Migrations b.ToTable("external_targets", (string)null); }); - modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Trait", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasColumnName("id") - .HasColumnOrder(1); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Description") - .IsRequired() - .HasColumnType("text") - .HasColumnName("description") - .HasColumnOrder(5); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("name") - .HasColumnOrder(2); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("slug") - .HasColumnOrder(4); - - b.Property("Type") - .HasColumnType("trait_type") - .HasColumnName("type") - .HasColumnOrder(3); - - b.HasKey("Id") - .HasName("pk_traits"); - - b.ToTable("traits", (string)null); - }); - modelBuilder.Entity("Pf2eDataScrapper.Model.Common.Frequency", b => { b.Property("Id") @@ -573,7 +536,7 @@ namespace Pf2eDataScrapper.Migrations .HasColumnOrder(4); b.Property("Size") - .HasColumnType("enum_size") + .HasColumnType("size") .HasColumnName("size") .HasColumnOrder(2); @@ -1455,6 +1418,24 @@ namespace Pf2eDataScrapper.Migrations b.ToTable("spell_rituals", (string)null); }); + modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Trait", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id") + .HasColumnOrder(1); + + b.Property("Type") + .HasColumnType("trait_type") + .HasColumnName("type") + .HasColumnOrder(2); + + b.HasKey("Id") + .HasName("pk_traits"); + + b.ToTable("traits", (string)null); + }); + modelBuilder.Entity("DeityTraining", b => { b.HasOne("Pf2eDataScrapper.Model.Structure.Deity", null) @@ -1498,7 +1479,7 @@ namespace Pf2eDataScrapper.Migrations .IsRequired() .HasConstraintName("fk_entity_trait_entities_entities_id"); - b.HasOne("Pf2eDataScrapper.Model.Base.Trait", null) + b.HasOne("Pf2eDataScrapper.Model.Structure.Trait", null) .WithMany() .HasForeignKey("TraitsId") .OnDelete(DeleteBehavior.Cascade) @@ -1554,7 +1535,7 @@ namespace Pf2eDataScrapper.Migrations modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Targets.EntityExternal", b => { b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") - .WithMany("Externals") + .WithMany("Extrnals") .HasForeignKey("EntityId") .OnDelete(DeleteBehavior.Cascade) .IsRequired() @@ -1963,11 +1944,23 @@ namespace Pf2eDataScrapper.Migrations b.Navigation("Spell"); }); + modelBuilder.Entity("Pf2eDataScrapper.Model.Structure.Trait", b => + { + b.HasOne("Pf2eDataScrapper.Model.Base.Entity", "Entity") + .WithOne() + .HasForeignKey("Pf2eDataScrapper.Model.Structure.Trait", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_traits_entities_id"); + + b.Navigation("Entity"); + }); + modelBuilder.Entity("Pf2eDataScrapper.Model.Base.Entity", b => { b.Navigation("Aliases"); - b.Navigation("Externals"); + b.Navigation("Extrnals"); b.Navigation("Sources"); }); diff --git a/Pf2eDataScrapper/Model/Base/Entity.cs b/Pf2eDataScrapper/Model/Base/Entity.cs index e8e04c8..9383e88 100644 --- a/Pf2eDataScrapper/Model/Base/Entity.cs +++ b/Pf2eDataScrapper/Model/Base/Entity.cs @@ -2,7 +2,9 @@ using Pf2eDataScrapper.Model.Base.Keywords; using Pf2eDataScrapper.Model.Base.Source; using Pf2eDataScrapper.Model.Base.Targets; +using Pf2eDataScrapper.Model.Common; using Pf2eDataScrapper.Model.Enum; +using Pf2eDataScrapper.Model.Structure; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; @@ -56,5 +58,5 @@ public class Entity public virtual ICollection Sources { get; set; } = []; - public virtual ICollection Externals { get; set; } = []; + public virtual ICollection Extrnals { get; set; } = []; } diff --git a/Pf2eDataScrapper/Model/Base/Source/Source.cs b/Pf2eDataScrapper/Model/Base/Source/Source.cs index c8c2114..11ac3e5 100644 --- a/Pf2eDataScrapper/Model/Base/Source/Source.cs +++ b/Pf2eDataScrapper/Model/Base/Source/Source.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +using Pf2eDataScrapper.Model.Enum; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Pf2eDataScrapper.Model.Base.Source; @@ -15,8 +16,11 @@ public partial class Source public string Name { get; set; } = null!; [Column(Order = 3)] - [MaxLength(255)] - public string Url { get; set; } = null!; + public SourceCategory Category { get; set; } + + [Column(Order = 4)] + public DateOnly? ReleaseDate { get; set; } + public ICollection EntitySources { get; set; } = []; } diff --git a/Pf2eDataScrapper/Model/Base/Trait.cs b/Pf2eDataScrapper/Model/Base/Trait.cs deleted file mode 100644 index 1f90e80..0000000 --- a/Pf2eDataScrapper/Model/Base/Trait.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Pf2eDataScrapper.Model.Enum; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Pf2eDataScrapper.Model.Base; - -public partial class Trait -{ - [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 TraitType Type { get; set; } - - [Column(Order = 4)] - [MaxLength(Pf2eDbContext.NameLength)] - public string Slug { get; set; } = null!; - - [Column(Order = 5)] - public string Description { get; set; } = null!; - - public virtual ICollection Entities { get; set; } = []; -} diff --git a/Pf2eDataScrapper/Model/Enum/ActionCategory.cs b/Pf2eDataScrapper/Model/Enum/ActionCategory.cs index b4e8951..190e31d 100644 --- a/Pf2eDataScrapper/Model/Enum/ActionCategory.cs +++ b/Pf2eDataScrapper/Model/Enum/ActionCategory.cs @@ -1,4 +1,5 @@ using NpgsqlTypes; +using Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder; namespace Pf2eDataScrapper.Model.Enum; diff --git a/Pf2eDataScrapper/Model/Enum/AliasType.cs b/Pf2eDataScrapper/Model/Enum/AliasType.cs index a30a948..260d2df 100644 --- a/Pf2eDataScrapper/Model/Enum/AliasType.cs +++ b/Pf2eDataScrapper/Model/Enum/AliasType.cs @@ -4,14 +4,14 @@ namespace Pf2eDataScrapper.Model.Enum; public enum AliasType { - [PgName("old")] - Old, + [PgName("legacy")] + Legacy, [PgName("english")] English, - [PgName("old_english")] - OldEnglish, + [PgName("legacy_english")] + LegacyEnglish, [PgName("hobby")] Hobby, diff --git a/Pf2eDataScrapper/Model/Enum/EntityType.cs b/Pf2eDataScrapper/Model/Enum/EntityType.cs index 6eea1e9..3219a3e 100644 --- a/Pf2eDataScrapper/Model/Enum/EntityType.cs +++ b/Pf2eDataScrapper/Model/Enum/EntityType.cs @@ -7,6 +7,9 @@ public enum EntityType [PgName("unknown")] Unknown, + [PgName("trait")] + Trait, + [PgName("action")] Action, diff --git a/Pf2eDataScrapper/Model/Enum/SourceCategory.cs b/Pf2eDataScrapper/Model/Enum/SourceCategory.cs new file mode 100644 index 0000000..35fcbc8 --- /dev/null +++ b/Pf2eDataScrapper/Model/Enum/SourceCategory.cs @@ -0,0 +1,18 @@ +using NpgsqlTypes; +using Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder; + +namespace Pf2eDataScrapper.Model.Enum; +public enum SourceCategory +{ + [PgName("rulebook")] + [AonprdEnum("Rulebooks")] + Rulebooks, + + [PgName("adventure-path")] + [AonprdEnum("Adventure Paths")] + AdventurePaths, + + [PgName("lost-omens")] + [AonprdEnum("Lost Omens")] + LostOmens, +} diff --git a/Pf2eDataScrapper/Model/Pf2eDbContext.cs b/Pf2eDataScrapper/Model/Pf2eDbContext.cs index aeb1328..141c483 100644 --- a/Pf2eDataScrapper/Model/Pf2eDbContext.cs +++ b/Pf2eDataScrapper/Model/Pf2eDbContext.cs @@ -117,26 +117,27 @@ public partial class Pf2eDbContext : DbContext builder => { builder - .MapEnum("entity_type") - .MapEnum("entity_rarity") - .MapEnum("alias_type") - .MapEnum("trait_type") - .MapEnum("action_type") - .MapEnum("action_category") - .MapEnum("enum_size") - .MapEnum("ancestry_vision") - .MapEnum("class_progression_type") - .MapEnum("condition_group") - .MapEnum("deity_category") - .MapEnum("deity_fonts") - .MapEnum("deity_sanctification") - .MapEnum("feat_action_type") - .MapEnum("feat_category") - .MapEnum("spell_area_type") - .MapEnum("spell_damage_category") - .MapEnum("spell_damage_kinds") + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() + .MapEnum() .MapEnum() .MapEnum() + .MapEnum() ; } ); diff --git a/Pf2eDataScrapper/Model/Pf2eDbContextModel.cs b/Pf2eDataScrapper/Model/Pf2eDbContextModel.cs index 4124aa6..721e8c2 100644 --- a/Pf2eDataScrapper/Model/Pf2eDbContextModel.cs +++ b/Pf2eDataScrapper/Model/Pf2eDbContextModel.cs @@ -28,8 +28,6 @@ public partial class Pf2eDbContext DefineBase(modelBuilder); DefineCommon(modelBuilder); DefineStructure(modelBuilder); - - } private void DefineEnums(ModelBuilder modelBuilder) @@ -55,6 +53,7 @@ public partial class Pf2eDbContext .HasPostgresEnum() .HasPostgresEnum() .HasPostgresEnum() + .HasPostgresEnum() ; } @@ -77,7 +76,7 @@ public partial class Pf2eDbContext .OnDelete(DeleteBehavior.Cascade); // EntityExternal - entity.HasMany(e => e.Externals).WithOne(e => e.Entity) + entity.HasMany(e => e.Extrnals).WithOne(e => e.Entity) .HasForeignKey(e => e.EntityId) .OnDelete(DeleteBehavior.Cascade); }); @@ -122,8 +121,6 @@ public partial class Pf2eDbContext modelBuilder.Entity(entity => { }); modelBuilder.Entity(entity => { }); - - modelBuilder.Entity(entity => { }); } private void BindEntity(EntityTypeBuilder entity) where T : class, IEntity @@ -316,10 +313,15 @@ public partial class Pf2eDbContext .HasForeignKey(e => e.SpellId) .OnDelete(DeleteBehavior.Cascade); }); - modelBuilder.Entity(entity => { }); modelBuilder.Entity(entity => { }); modelBuilder.Entity(entity => { }); modelBuilder.Entity(entity => { }); + + // Trait + modelBuilder.Entity(entity => + { + BindEntity(entity); + }); } } diff --git a/Pf2eDataScrapper/Model/Structure/Trait.cs b/Pf2eDataScrapper/Model/Structure/Trait.cs new file mode 100644 index 0000000..1603391 --- /dev/null +++ b/Pf2eDataScrapper/Model/Structure/Trait.cs @@ -0,0 +1,21 @@ +using Pf2eDataScrapper.Model.Base; +using Pf2eDataScrapper.Model.Enum; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Pf2eDataScrapper.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 Entities { get; set; } = []; +} diff --git a/Pf2eDataScrapper/Pf2eDataScrapper.csproj b/Pf2eDataScrapper/Pf2eDataScrapper.csproj index 6a2dae7..60caee2 100644 --- a/Pf2eDataScrapper/Pf2eDataScrapper.csproj +++ b/Pf2eDataScrapper/Pf2eDataScrapper.csproj @@ -11,7 +11,7 @@ - + @@ -33,4 +33,8 @@ + + + + diff --git a/Pf2eDataScrapper/Program.cs b/Pf2eDataScrapper/Program.cs index b3bf3f2..f6b6559 100644 --- a/Pf2eDataScrapper/Program.cs +++ b/Pf2eDataScrapper/Program.cs @@ -1,15 +1,12 @@ using Pf2eDataScrapper; -using Pf2eDataScrapper.Importers.Implementations.Pf2eFoundry; +using Pf2eDataScrapper.Importers.Implementations.Aonprd; EnvSettings.Load(); /* -AonprdImporter importer = new(); -importer.Prepare(); -importer.BuildSchemas(); +Pf2EFoundryImporter importer = new(); */ - -Pf2EFoundryImporter importer = new(); +AonprdImporter importer = new(); importer.Prepare(); importer.Import();