fix: relationships bit messy
All checks were successful
Build, Package and Push Images / preprocess (push) Successful in 2s
Build, Package and Push Images / build (push) Successful in 27s
Build, Package and Push Images / sbom-scan (push) Successful in 38s
Build, Package and Push Images / container-build (push) Successful in 1m20s
Build, Package and Push Images / sonarqube (push) Successful in 1m27s
Build, Package and Push Images / container-sbom-scan (push) Successful in 34s
All checks were successful
Build, Package and Push Images / preprocess (push) Successful in 2s
Build, Package and Push Images / build (push) Successful in 27s
Build, Package and Push Images / sbom-scan (push) Successful in 38s
Build, Package and Push Images / container-build (push) Successful in 1m20s
Build, Package and Push Images / sonarqube (push) Successful in 1m27s
Build, Package and Push Images / container-sbom-scan (push) Successful in 34s
This commit is contained in:
parent
effe9a5a1d
commit
3efe3a5aac
8 changed files with 552 additions and 54 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Server.DB.Documents;
|
||||
|
@ -32,8 +31,4 @@ public class Account
|
|||
public byte PermissionLevel { get; set; }
|
||||
[Column(TypeName = "bytea")] public byte[] Salt { get; set; }
|
||||
public virtual ICollection<Character> Characters { get; set; }
|
||||
|
||||
[DeleteBehavior(DeleteBehavior.Cascade)]
|
||||
[CanBeNull]
|
||||
public virtual GuildMember GuildMember { get; set; }
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Wonderking.Game.Data.Character;
|
||||
using Wonderking.Packets.Outgoing.Data;
|
||||
|
@ -14,6 +13,7 @@ namespace Server.DB.Documents;
|
|||
public class Character
|
||||
{
|
||||
[DeleteBehavior(DeleteBehavior.Cascade)]
|
||||
[Required]
|
||||
public virtual Account Account { get; set; }
|
||||
|
||||
[Key]
|
||||
|
@ -32,7 +32,6 @@ public class Character
|
|||
public byte Level { get; set; }
|
||||
|
||||
[DeleteBehavior(DeleteBehavior.Cascade)]
|
||||
[CanBeNull]
|
||||
public virtual ICollection<InventoryItem> InventoryItems { get; set; }
|
||||
|
||||
public BaseStats BaseStats { get; set; }
|
||||
|
@ -41,7 +40,6 @@ public class Character
|
|||
public int Health { get; set; }
|
||||
public int Mana { get; set; }
|
||||
|
||||
[DeleteBehavior(DeleteBehavior.Restrict)]
|
||||
[CanBeNull]
|
||||
public virtual Guild Guild { get; set; }
|
||||
[DeleteBehavior(DeleteBehavior.Cascade)]
|
||||
public virtual GuildMember GuildMember { get; set; }
|
||||
}
|
||||
|
|
|
@ -12,9 +12,20 @@ public class GuildMember
|
|||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public virtual Guid CharacterId { get; set; }
|
||||
|
||||
[DeleteBehavior(DeleteBehavior.Restrict)]
|
||||
[ForeignKey(nameof(CharacterId))]
|
||||
[Required]
|
||||
public virtual Character Character { get; set; }
|
||||
|
||||
public virtual Guid GuildId { get; set; }
|
||||
|
||||
[DeleteBehavior(DeleteBehavior.Restrict)]
|
||||
[ForeignKey(nameof(GuildId))]
|
||||
[Required]
|
||||
public virtual Guild Guild { get; set; }
|
||||
|
||||
public GuildRank Rank { get; set; }
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace Server.DB.Documents;
|
|||
public class InventoryItem
|
||||
{
|
||||
[DeleteBehavior(DeleteBehavior.Restrict)]
|
||||
[Required]
|
||||
public virtual Character Character { get; set; }
|
||||
|
||||
[Key]
|
||||
|
|
347
Server/DB/Migrations/20231125112400_FixEntityRelationships.Designer.cs
generated
Normal file
347
Server/DB/Migrations/20231125112400_FixEntityRelationships.Designer.cs
generated
Normal file
|
@ -0,0 +1,347 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Server.DB;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Server.DB.Migrations
|
||||
{
|
||||
[DbContext(typeof(WonderkingContext))]
|
||||
[Migration("20231125112400_FixEntityRelationships")]
|
||||
partial class FixEntityRelationships
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.0")
|
||||
.HasAnnotation("Proxies:ChangeTracking", false)
|
||||
.HasAnnotation("Proxies:CheckEquality", false)
|
||||
.HasAnnotation("Proxies:LazyLoading", true)
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Server.DB.Documents.Account", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<byte[]>("Password")
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<byte>("PermissionLevel")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<byte[]>("Salt")
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("Username")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Accounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.DB.Documents.Character", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("AccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("Experience")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<byte>("Gender")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<int>("Health")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<short>("LastXCoordinate")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<short>("LastYCoordinate")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<byte>("Level")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<int>("Mana")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MapId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<byte>("PvPLevel")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Characters");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.DB.Documents.Guild", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("character varying(16)");
|
||||
|
||||
b.Property<string>("Notice")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Guilds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.DB.Documents.GuildMember", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("CharacterId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("GuildId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<byte>("Rank")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CharacterId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("GuildId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("GuildMember");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.DB.Documents.InventoryItem", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<byte>("AddOption")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<byte>("AddOption2")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<byte>("AddOption3")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<Guid>("CharacterId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<byte>("InventoryTab")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<int>("ItemId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<byte>("Level")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<short>("Option")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<short>("Option2")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<short>("Option3")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<byte>("Rarity")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<byte>("Slot")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CharacterId");
|
||||
|
||||
b.ToTable("InventoryItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.DB.Documents.Character", b =>
|
||||
{
|
||||
b.HasOne("Server.DB.Documents.Account", "Account")
|
||||
.WithMany("Characters")
|
||||
.HasForeignKey("AccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsOne("Wonderking.Packets.Outgoing.Data.BaseStats", "BaseStats", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CharacterId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<short>("Dexterity")
|
||||
.HasColumnType("smallint")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "dexterity");
|
||||
|
||||
b1.Property<short>("Intelligence")
|
||||
.HasColumnType("smallint")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "intelligence");
|
||||
|
||||
b1.Property<short>("Luck")
|
||||
.HasColumnType("smallint")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "luck");
|
||||
|
||||
b1.Property<short>("Strength")
|
||||
.HasColumnType("smallint")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "strength");
|
||||
|
||||
b1.Property<short>("Vitality")
|
||||
.HasColumnType("smallint")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "vitality");
|
||||
|
||||
b1.Property<short>("Wisdom")
|
||||
.HasColumnType("smallint")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "wisdom");
|
||||
|
||||
b1.HasKey("CharacterId");
|
||||
|
||||
b1.ToTable("Characters");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CharacterId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Wonderking.Packets.Outgoing.Data.JobData", "JobData", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CharacterId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<byte>("FirstJob")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b1.Property<byte>("FourthJob")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b1.Property<byte>("SecondJob")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b1.Property<byte>("ThirdJob")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b1.HasKey("CharacterId");
|
||||
|
||||
b1.ToTable("Characters");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CharacterId");
|
||||
});
|
||||
|
||||
b.Navigation("Account");
|
||||
|
||||
b.Navigation("BaseStats");
|
||||
|
||||
b.Navigation("JobData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.DB.Documents.GuildMember", b =>
|
||||
{
|
||||
b.HasOne("Server.DB.Documents.Character", "Character")
|
||||
.WithOne("GuildMember")
|
||||
.HasForeignKey("Server.DB.Documents.GuildMember", "CharacterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Server.DB.Documents.Guild", "Guild")
|
||||
.WithMany("GuildMembers")
|
||||
.HasForeignKey("GuildId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Character");
|
||||
|
||||
b.Navigation("Guild");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.DB.Documents.InventoryItem", b =>
|
||||
{
|
||||
b.HasOne("Server.DB.Documents.Character", "Character")
|
||||
.WithMany("InventoryItems")
|
||||
.HasForeignKey("CharacterId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Character");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.DB.Documents.Account", b =>
|
||||
{
|
||||
b.Navigation("Characters");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.DB.Documents.Character", b =>
|
||||
{
|
||||
b.Navigation("GuildMember");
|
||||
|
||||
b.Navigation("InventoryItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.DB.Documents.Guild", b =>
|
||||
{
|
||||
b.Navigation("GuildMembers");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
172
Server/DB/Migrations/20231125112400_FixEntityRelationships.cs
Normal file
172
Server/DB/Migrations/20231125112400_FixEntityRelationships.cs
Normal file
|
@ -0,0 +1,172 @@
|
|||
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Server.DB.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class FixEntityRelationships : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Accounts_GuildMember_GuildMemberId",
|
||||
table: "Accounts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Characters_Guilds_GuildId",
|
||||
table: "Characters");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_GuildMember_CharacterId",
|
||||
table: "GuildMember");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Characters_GuildId",
|
||||
table: "Characters");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Accounts_GuildMemberId",
|
||||
table: "Accounts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "GuildId",
|
||||
table: "Characters");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "GuildMemberId",
|
||||
table: "Accounts");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "CharacterId",
|
||||
table: "InventoryItems",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "GuildId",
|
||||
table: "GuildMember",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "CharacterId",
|
||||
table: "GuildMember",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "AccountId",
|
||||
table: "Characters",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GuildMember_CharacterId",
|
||||
table: "GuildMember",
|
||||
column: "CharacterId",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_GuildMember_CharacterId",
|
||||
table: "GuildMember");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "CharacterId",
|
||||
table: "InventoryItems",
|
||||
type: "uuid",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "GuildId",
|
||||
table: "GuildMember",
|
||||
type: "uuid",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "CharacterId",
|
||||
table: "GuildMember",
|
||||
type: "uuid",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "AccountId",
|
||||
table: "Characters",
|
||||
type: "uuid",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "GuildId",
|
||||
table: "Characters",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "GuildMemberId",
|
||||
table: "Accounts",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GuildMember_CharacterId",
|
||||
table: "GuildMember",
|
||||
column: "CharacterId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Characters_GuildId",
|
||||
table: "Characters",
|
||||
column: "GuildId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Accounts_GuildMemberId",
|
||||
table: "Accounts",
|
||||
column: "GuildMemberId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Accounts_GuildMember_GuildMemberId",
|
||||
table: "Accounts",
|
||||
column: "GuildMemberId",
|
||||
principalTable: "GuildMember",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Characters_Guilds_GuildId",
|
||||
table: "Characters",
|
||||
column: "GuildId",
|
||||
principalTable: "Guilds",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
|
@ -34,9 +34,6 @@ namespace Server.DB.Migrations
|
|||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid?>("GuildMemberId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<byte[]>("Password")
|
||||
.HasColumnType("bytea");
|
||||
|
||||
|
@ -52,8 +49,6 @@ namespace Server.DB.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GuildMemberId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
|
@ -69,7 +64,7 @@ namespace Server.DB.Migrations
|
|||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("AccountId")
|
||||
b.Property<Guid>("AccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("Experience")
|
||||
|
@ -78,9 +73,6 @@ namespace Server.DB.Migrations
|
|||
b.Property<byte>("Gender")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<Guid?>("GuildId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Health")
|
||||
.HasColumnType("integer");
|
||||
|
||||
|
@ -110,8 +102,6 @@ namespace Server.DB.Migrations
|
|||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("GuildId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
|
@ -151,10 +141,10 @@ namespace Server.DB.Migrations
|
|||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("CharacterId")
|
||||
b.Property<Guid>("CharacterId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("GuildId")
|
||||
b.Property<Guid>("GuildId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<byte>("Rank")
|
||||
|
@ -162,7 +152,8 @@ namespace Server.DB.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CharacterId");
|
||||
b.HasIndex("CharacterId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("GuildId");
|
||||
|
||||
|
@ -187,7 +178,7 @@ namespace Server.DB.Migrations
|
|||
b.Property<byte>("AddOption3")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<Guid?>("CharacterId")
|
||||
b.Property<Guid>("CharacterId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Count")
|
||||
|
@ -224,27 +215,13 @@ namespace Server.DB.Migrations
|
|||
b.ToTable("InventoryItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.DB.Documents.Account", b =>
|
||||
{
|
||||
b.HasOne("Server.DB.Documents.GuildMember", "GuildMember")
|
||||
.WithMany()
|
||||
.HasForeignKey("GuildMemberId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("GuildMember");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.DB.Documents.Character", b =>
|
||||
{
|
||||
b.HasOne("Server.DB.Documents.Account", "Account")
|
||||
.WithMany("Characters")
|
||||
.HasForeignKey("AccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Server.DB.Documents.Guild", "Guild")
|
||||
.WithMany()
|
||||
.HasForeignKey("GuildId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsOne("Wonderking.Packets.Outgoing.Data.BaseStats", "BaseStats", b1 =>
|
||||
{
|
||||
|
@ -312,22 +289,22 @@ namespace Server.DB.Migrations
|
|||
|
||||
b.Navigation("BaseStats");
|
||||
|
||||
b.Navigation("Guild");
|
||||
|
||||
b.Navigation("JobData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.DB.Documents.GuildMember", b =>
|
||||
{
|
||||
b.HasOne("Server.DB.Documents.Character", "Character")
|
||||
.WithMany()
|
||||
.HasForeignKey("CharacterId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
.WithOne("GuildMember")
|
||||
.HasForeignKey("Server.DB.Documents.GuildMember", "CharacterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Server.DB.Documents.Guild", "Guild")
|
||||
.WithMany("GuildMembers")
|
||||
.HasForeignKey("GuildId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Character");
|
||||
|
||||
|
@ -339,7 +316,8 @@ namespace Server.DB.Migrations
|
|||
b.HasOne("Server.DB.Documents.Character", "Character")
|
||||
.WithMany("InventoryItems")
|
||||
.HasForeignKey("CharacterId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Character");
|
||||
});
|
||||
|
@ -351,6 +329,8 @@ namespace Server.DB.Migrations
|
|||
|
||||
modelBuilder.Entity("Server.DB.Documents.Character", b =>
|
||||
{
|
||||
b.Navigation("GuildMember");
|
||||
|
||||
b.Navigation("InventoryItems");
|
||||
});
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using MassTransit;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
@ -17,7 +16,6 @@ using OpenTelemetry.Resources;
|
|||
using OpenTelemetry.Trace;
|
||||
using Server.DB;
|
||||
using Server.Services;
|
||||
using Wonderking.Game.Mapping;
|
||||
|
||||
var builder = Host.CreateApplicationBuilder();
|
||||
#if DEBUG
|
||||
|
@ -96,10 +94,6 @@ builder.Services.AddDbContextPool<WonderkingContext>(o =>
|
|||
.EnableSensitiveDataLogging().UseLazyLoadingProxies().UseLoggerFactory(loggerFactory);
|
||||
});
|
||||
|
||||
builder.Services.AddSingleton<CharacterStatsMappingConfiguration>(
|
||||
JsonSerializer.Deserialize<CharacterStatsMappingConfiguration>(
|
||||
File.ReadAllText("config/character-stats.mapping.json")) ?? throw new InvalidOperationException());
|
||||
|
||||
builder.Services.AddSingleton<ILoggerFactory>(loggerFactory);
|
||||
builder.Services.AddSingleton<PacketDistributorService>();
|
||||
builder.Services.AddSingleton<ItemObjectPoolService>();
|
||||
|
|
Loading…
Reference in a new issue