Больше обработчиков
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+10
-14
@@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Pf2eModel.Model;
|
||||
using Pf2eModel;
|
||||
using Pf2eModel.Model.Enum;
|
||||
|
||||
#nullable disable
|
||||
@@ -13,7 +13,7 @@ using Pf2eModel.Model.Enum;
|
||||
namespace Pf2eModel.Migrations
|
||||
{
|
||||
[DbContext(typeof(Pf2eDbContext))]
|
||||
[Migration("20250418083111_1")]
|
||||
[Migration("20250418160209_1")]
|
||||
partial class _1
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@@ -27,8 +27,8 @@ namespace Pf2eModel.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[] { "none", "1_action", "2_actions", "3_actions", "1-3_actions", "1-2_actions" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "alias_type", new[] { "legacy", "english", "legacy_english", "hobby", "other" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "darkvision" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "any", "str", "dex", "con", "int", "wis", "cha" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "dark-vision" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "free", "str", "dex", "con", "int", "wis", "cha" });
|
||||
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" });
|
||||
@@ -38,7 +38,7 @@ namespace Pf2eModel.Migrations
|
||||
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, "size", new[] { "tiny", "small", "medium", "large" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "source_category", new[] { "rulebook", "adventure-path", "lost-omens", "adventures", "comics", "blog-posts", "society" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_area_type", new[] { "burst", "emanation", "cone", "line", "square", "cube", "cylinder" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_category", new[] { "persistent", "splash" });
|
||||
@@ -543,25 +543,21 @@ namespace Pf2eModel.Migrations
|
||||
.HasColumnName("hp")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<int>("Reach")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("reach")
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<Size>("Size")
|
||||
.HasColumnType("size")
|
||||
b.PrimitiveCollection<Size[]>("Size")
|
||||
.IsRequired()
|
||||
.HasColumnType("size[]")
|
||||
.HasColumnName("size")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<int>("Speed")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("speed")
|
||||
.HasColumnOrder(5);
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<AncestryVision>("Vision")
|
||||
.HasColumnType("ancestry_vision")
|
||||
.HasColumnName("vision")
|
||||
.HasColumnOrder(6);
|
||||
.HasColumnOrder(5);
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_ancestries");
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Pf2eModel.Model;
|
||||
using Pf2eModel;
|
||||
using Pf2eModel.Model.Enum;
|
||||
|
||||
#nullable disable
|
||||
@@ -24,8 +24,8 @@ namespace Pf2eModel.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[] { "none", "1_action", "2_actions", "3_actions", "1-3_actions", "1-2_actions" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "alias_type", new[] { "legacy", "english", "legacy_english", "hobby", "other" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "darkvision" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "any", "str", "dex", "con", "int", "wis", "cha" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "dark-vision" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "free", "str", "dex", "con", "int", "wis", "cha" });
|
||||
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" });
|
||||
@@ -35,7 +35,7 @@ namespace Pf2eModel.Migrations
|
||||
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, "size", new[] { "tiny", "small", "medium", "large" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "source_category", new[] { "rulebook", "adventure-path", "lost-omens", "adventures", "comics", "blog-posts", "society" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_area_type", new[] { "burst", "emanation", "cone", "line", "square", "cube", "cylinder" });
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_category", new[] { "persistent", "splash" });
|
||||
@@ -540,25 +540,21 @@ namespace Pf2eModel.Migrations
|
||||
.HasColumnName("hp")
|
||||
.HasColumnOrder(3);
|
||||
|
||||
b.Property<int>("Reach")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("reach")
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<Size>("Size")
|
||||
.HasColumnType("size")
|
||||
b.PrimitiveCollection<Size[]>("Size")
|
||||
.IsRequired()
|
||||
.HasColumnType("size[]")
|
||||
.HasColumnName("size")
|
||||
.HasColumnOrder(2);
|
||||
|
||||
b.Property<int>("Speed")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("speed")
|
||||
.HasColumnOrder(5);
|
||||
.HasColumnOrder(4);
|
||||
|
||||
b.Property<AncestryVision>("Vision")
|
||||
.HasColumnType("ancestry_vision")
|
||||
.HasColumnName("vision")
|
||||
.HasColumnOrder(6);
|
||||
.HasColumnOrder(5);
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_ancestries");
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Common;
|
||||
|
||||
public partial class Language
|
||||
{
|
||||
[System.ComponentModel.DataAnnotations.Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
[MaxLength(Pf2eDbContext.NameLength)]
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
[Column(Order = 3)]
|
||||
[MaxLength(Pf2eDbContext.NameLength)]
|
||||
public string Slug { get; set; } = null!;
|
||||
|
||||
[Column(Order = 4)]
|
||||
public EntityRarity Rarity { get; set; }
|
||||
}
|
||||
@@ -5,11 +5,11 @@ namespace Pf2eModel.Model.Enum;
|
||||
public enum AncestryVision
|
||||
{
|
||||
[PgName("normal")]
|
||||
normal,
|
||||
Normal,
|
||||
|
||||
[PgName("low-light-vision")]
|
||||
LowLightVision,
|
||||
|
||||
[PgName("darkvision")]
|
||||
darkvision,
|
||||
[PgName("dark-vision")]
|
||||
DarkVision,
|
||||
}
|
||||
@@ -4,8 +4,8 @@ namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum AttributeValues
|
||||
{
|
||||
[PgName("any")]
|
||||
Any,
|
||||
[PgName("free")]
|
||||
Free,
|
||||
|
||||
[PgName("str")]
|
||||
Strength,
|
||||
|
||||
@@ -41,5 +41,8 @@ public enum EntityType
|
||||
Heritage,
|
||||
|
||||
[PgName("spell")]
|
||||
Spell
|
||||
Spell,
|
||||
|
||||
[PgName("language")]
|
||||
Language
|
||||
}
|
||||
@@ -4,9 +4,15 @@ namespace Pf2eModel.Model.Enum;
|
||||
|
||||
public enum Size
|
||||
{
|
||||
[PgName("med")]
|
||||
med,
|
||||
|
||||
[PgName("tiny")]
|
||||
tiny,
|
||||
Tiny,
|
||||
|
||||
[PgName("small")]
|
||||
Small,
|
||||
|
||||
[PgName("medium")]
|
||||
Medium,
|
||||
|
||||
[PgName("large")]
|
||||
Large,
|
||||
}
|
||||
@@ -16,19 +16,16 @@ public partial class Ancestry : IEntity
|
||||
public Entity Entity { get; set; } = null!;
|
||||
|
||||
[Column(Order = 2)]
|
||||
public Size Size { get; set; } = Size.med;
|
||||
public Size[] Size { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public int Hp { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public int Reach { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
public int Speed { get; set; }
|
||||
|
||||
[Column(Order = 6)]
|
||||
public AncestryVision Vision { get; set; } = AncestryVision.normal;
|
||||
[Column(Order = 5)]
|
||||
public AncestryVision Vision { get; set; } = AncestryVision.Normal;
|
||||
|
||||
public virtual ICollection<AncestryBoost> AncestryBoosts { get; set; } = [];
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Pf2eModel.Model.Common;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure.AncestryRelation;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.Model.Structure;
|
||||
|
||||
[EntityOfType(EntityType.Language)]
|
||||
public partial class Language: IEntity
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column(Order = 1)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public Entity Entity { get; set; } = null!;
|
||||
|
||||
}
|
||||
@@ -15,7 +15,7 @@ using Pf2eModel.Model.Structure.DeityRelation;
|
||||
using Pf2eModel.Model.Structure.FeatRelation;
|
||||
using Pf2eModel.Model.Structure.SpellRelation;
|
||||
|
||||
namespace Pf2eModel.Model;
|
||||
namespace Pf2eModel;
|
||||
|
||||
public partial class Pf2eDbContext : DbContext
|
||||
{
|
||||
@@ -30,7 +30,7 @@ public partial class Pf2eDbContext : DbContext
|
||||
|
||||
#region DbSets
|
||||
|
||||
public virtual DbSet<Structure.Action> Actions { get; set; }
|
||||
public virtual DbSet<Model.Structure.Action> Actions { get; set; }
|
||||
|
||||
public virtual DbSet<Ancestry> Ancestries { get; set; }
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Pf2eModel.Model;
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Base.Keywords;
|
||||
using Pf2eModel.Model.Base.Source;
|
||||
@@ -14,7 +15,7 @@ using Pf2eModel.Model.Structure.DeityRelation;
|
||||
using Pf2eModel.Model.Structure.FeatRelation;
|
||||
using Pf2eModel.Model.Structure.SpellRelation;
|
||||
|
||||
namespace Pf2eModel.Model;
|
||||
namespace Pf2eModel;
|
||||
|
||||
public partial class Pf2eDbContext
|
||||
{
|
||||
@@ -28,7 +29,6 @@ public partial class Pf2eDbContext
|
||||
DefineBase(modelBuilder);
|
||||
DefineCommon(modelBuilder);
|
||||
DefineStructure(modelBuilder);
|
||||
DefineFunctions(modelBuilder);
|
||||
}
|
||||
|
||||
private void DefineEnums(ModelBuilder modelBuilder)
|
||||
@@ -135,7 +135,7 @@ public partial class Pf2eDbContext
|
||||
private void DefineStructure(ModelBuilder modelBuilder)
|
||||
{
|
||||
// Action
|
||||
modelBuilder.Entity<Structure.Action>(entity =>
|
||||
modelBuilder.Entity<Model.Structure.Action>(entity =>
|
||||
{
|
||||
BindEntity(entity);
|
||||
});
|
||||
@@ -325,86 +325,4 @@ public partial class Pf2eDbContext
|
||||
BindEntity(entity);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void DefineFunctions(ModelBuilder modelBuilder)
|
||||
{
|
||||
// modelBuilder.HasDbFunction(typeof(Pf2eDbContext).GetMethod(nameof(FTruncateTables), Array.Empty<Type>()))
|
||||
/*
|
||||
modelBuilder.HasPostgresExtension($"""
|
||||
CREATE OR REPLACE FUNCTION f_truncate_tables()
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql AS
|
||||
$func$
|
||||
BEGIN
|
||||
EXECUTE (
|
||||
SELECT 'TRUNCATE TABLE '
|
||||
|| string_agg(format('%I.%I', schemaname, tablename), ', ')
|
||||
|| ' CASCADE;'
|
||||
FROM pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
AND tablename != '__EFMigrationsHistory'
|
||||
);
|
||||
END
|
||||
$func$;
|
||||
""")
|
||||
;
|
||||
|
||||
/*
|
||||
Database.ExecuteSql($"""
|
||||
CREATE OR REPLACE FUNCTION f_truncate_tables()
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql AS
|
||||
$func$
|
||||
BEGIN
|
||||
EXECUTE (
|
||||
SELECT 'TRUNCATE TABLE '
|
||||
|| string_agg(format('%I.%I', schemaname, tablename), ', ')
|
||||
|| ' CASCADE;'
|
||||
FROM pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
AND tablename != '__EFMigrationsHistory'
|
||||
);
|
||||
END
|
||||
$func$;
|
||||
""");
|
||||
|
||||
Database.ExecuteSql($"""
|
||||
CREATE OR REPLACE FUNCTION f_drop_tables()
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql AS
|
||||
$func$
|
||||
BEGIN
|
||||
EXECUTE (
|
||||
SELECT 'DROP TABLE '
|
||||
|| string_agg(format('%I.%I', schemaname, tablename), ', ')
|
||||
|| ' CASCADE;'
|
||||
FROM pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
);
|
||||
END
|
||||
$func$;
|
||||
""");
|
||||
|
||||
Database.ExecuteSql($"""
|
||||
CREATE OR REPLACE FUNCTION f_permission_tables(_username text)
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql AS
|
||||
$func$
|
||||
DECLARE
|
||||
_tbl text;
|
||||
_sch text;
|
||||
BEGIN
|
||||
FOR _sch, _tbl IN
|
||||
SELECT schemaname, tablename
|
||||
FROM pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
LOOP
|
||||
EXECUTE format('ALTER TABLE %I.%I OWNER TO %I', _sch, _tbl, _username);
|
||||
END LOOP;
|
||||
END
|
||||
$func$;
|
||||
""");
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,4 +27,22 @@
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="RebuildDatabase.bat">
|
||||
<Generator></Generator>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="RebuildDatabase.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>RebuildDatabase.bat</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
@echo off
|
||||
|
||||
del /s .\Migrations\Pf2eDbContextModelSnapshot.cs
|
||||
del /s .\Migrations\*_1.cs
|
||||
del /s .\Migrations\*_1.Designer.cs
|
||||
|
||||
dotnet ef database drop -f
|
||||
dotnet ef migrations add 1
|
||||
dotnet ef database update
|
||||
Reference in New Issue
Block a user