migration testing, manifesto editing

This commit is contained in:
rfi
2024-02-21 19:12:32 +07:00
parent f58abb9534
commit c3bcb16f72
7 changed files with 274 additions and 6 deletions

View File

@@ -48,6 +48,8 @@ namespace BLHX.Server.Common.Database
{
e.Property(b => b.DisplayInfo)
.HasJsonConversion();
e.Property(b => b.Adv)
.HasDefaultValue("");
e.HasMany(b => b.Resources)
.WithOne(e => e.Player)
.HasForeignKey(e => e.PlayerUid)
@@ -92,6 +94,8 @@ namespace BLHX.Server.Common.Database
public uint Uid { get; set; }
public string Token { get; set; }
public string Name { get; set; }
// Aka. manifesto
public string Adv { get; set; } = string.Empty;
public uint Level { get; set; }
// TODO: Exp add setter to recalculate cap and set level
public uint Exp { get; set; }

View File

@@ -0,0 +1,207 @@
// <auto-generated />
using System;
using BLHX.Server.Common.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BLHX.Server.Common.Migrations.Player
{
[DbContext(typeof(PlayerContext))]
[Migration("20240221064120_AddManifesto")]
partial class AddManifesto
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.2")
.HasAnnotation("Proxies:ChangeTracking", false)
.HasAnnotation("Proxies:CheckEquality", false)
.HasAnnotation("Proxies:LazyLoading", true);
modelBuilder.Entity("BLHX.Server.Common.Database.Player", b =>
{
b.Property<uint>("Uid")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Adv")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("DisplayInfo")
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("Exp")
.HasColumnType("INTEGER");
b.Property<uint>("Level")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Token")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Uid");
b.HasIndex("Token")
.IsUnique();
b.ToTable("Players");
});
modelBuilder.Entity("BLHX.Server.Common.Database.PlayerResource", b =>
{
b.Property<uint>("Id")
.HasColumnType("INTEGER");
b.Property<uint>("PlayerUid")
.HasColumnType("INTEGER");
b.Property<uint>("Num")
.HasColumnType("INTEGER");
b.HasKey("Id", "PlayerUid");
b.HasIndex("PlayerUid");
b.ToTable("Resources");
});
modelBuilder.Entity("BLHX.Server.Common.Database.PlayerShip", b =>
{
b.Property<uint>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<uint>("ActivityNpc")
.HasColumnType("INTEGER");
b.Property<uint>("BluePrintFlag")
.HasColumnType("INTEGER");
b.Property<uint>("CommanderId")
.HasColumnType("INTEGER");
b.Property<uint?>("CommonFlag")
.HasColumnType("INTEGER");
b.Property<string>("CoreLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<uint>("Energy")
.HasColumnType("INTEGER");
b.Property<string>("EquipInfoLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("Exp")
.HasColumnType("INTEGER");
b.Property<uint>("Intimacy")
.HasColumnType("INTEGER");
b.Property<bool>("IsLocked")
.HasColumnType("INTEGER");
b.Property<DateTime?>("LastChangeName")
.HasColumnType("TEXT");
b.Property<uint>("Level")
.HasColumnType("INTEGER");
b.Property<string>("MetaRepairLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<uint>("PlayerUid")
.HasColumnType("INTEGER");
b.Property<uint>("Proficiency")
.HasColumnType("INTEGER");
b.Property<uint>("Propose")
.HasColumnType("INTEGER");
b.Property<string>("SkillIdLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("SkinId")
.HasColumnType("INTEGER");
b.Property<string>("State")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("StrengthLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("TemplateId")
.HasColumnType("INTEGER");
b.Property<string>("TransformLists")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("PlayerUid");
b.ToTable("Ships");
});
modelBuilder.Entity("BLHX.Server.Common.Database.PlayerResource", b =>
{
b.HasOne("BLHX.Server.Common.Database.Player", "Player")
.WithMany("Resources")
.HasForeignKey("PlayerUid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("BLHX.Server.Common.Database.PlayerShip", b =>
{
b.HasOne("BLHX.Server.Common.Database.Player", "Player")
.WithMany("Ships")
.HasForeignKey("PlayerUid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("BLHX.Server.Common.Database.Player", b =>
{
b.Navigation("Resources");
b.Navigation("Ships");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BLHX.Server.Common.Migrations.Player
{
/// <inheritdoc />
public partial class AddManifesto : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Adv",
table: "Players",
type: "TEXT",
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Adv",
table: "Players");
}
}
}

View File

@@ -27,6 +27,10 @@ namespace BLHX.Server.Common.Migrations.Player
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Adv")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");