1
0
mirror of synced 2024-11-28 00:20:53 +01:00

Finish initial dan saving and loading

This commit is contained in:
asesidaa 2022-08-29 21:03:49 +08:00
parent e3099153d4
commit 6b3146a94b
4 changed files with 380 additions and 14 deletions

View File

@ -27,7 +27,7 @@ public partial class TaikoDbContext
entity.HasKey(e => new { e.Baid, e.DanId, e.SongNumber }); entity.HasKey(e => new { e.Baid, e.DanId, e.SongNumber });
entity.HasOne(d => d.Parent) entity.HasOne(d => d.Parent)
.WithMany() .WithMany(p => p.DanStageScoreData)
.HasPrincipalKey(p => new {p.Baid, p.DanId}) .HasPrincipalKey(p => new {p.Baid, p.DanId})
.HasForeignKey(d => new {d.Baid, d.DanId}) .HasForeignKey(d => new {d.Baid, d.DanId})
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);

View File

@ -0,0 +1,320 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using TaikoLocalServer.Context;
#nullable disable
namespace TaikoLocalServer.Migrations
{
[DbContext(typeof(TaikoDbContext))]
[Migration("20220829124927_FixNavigation")]
partial class FixNavigation
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.0-preview.7.22376.2");
modelBuilder.Entity("TaikoLocalServer.Entities.Card", b =>
{
b.Property<string>("AccessCode")
.HasColumnType("TEXT");
b.Property<uint>("Baid")
.HasColumnType("INTEGER");
b.HasKey("AccessCode");
b.HasIndex(new[] { "Baid" }, "IX_Card_Baid")
.IsUnique();
b.ToTable("Card", (string)null);
});
modelBuilder.Entity("TaikoLocalServer.Entities.DanScoreDatum", b =>
{
b.Property<uint>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("DanId")
.HasColumnType("INTEGER");
b.Property<uint>("ArrivalSongCount")
.HasColumnType("INTEGER");
b.Property<uint>("ClearState")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(0u);
b.Property<uint>("ComboCountTotal")
.HasColumnType("INTEGER");
b.Property<uint>("SoulGaugeTotal")
.HasColumnType("INTEGER");
b.HasKey("Baid", "DanId");
b.ToTable("DanScoreData");
});
modelBuilder.Entity("TaikoLocalServer.Entities.DanStageScoreDatum", b =>
{
b.Property<uint>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("DanId")
.HasColumnType("INTEGER");
b.Property<uint>("SongNumber")
.HasColumnType("INTEGER");
b.Property<uint>("BadCount")
.HasColumnType("INTEGER");
b.Property<uint>("ComboCount")
.HasColumnType("INTEGER");
b.Property<uint>("DrumrollCount")
.HasColumnType("INTEGER");
b.Property<uint>("GoodCount")
.HasColumnType("INTEGER");
b.Property<uint>("HighScore")
.HasColumnType("INTEGER");
b.Property<uint>("OkCount")
.HasColumnType("INTEGER");
b.Property<uint>("PlayScore")
.HasColumnType("INTEGER");
b.Property<uint>("TotalHitCount")
.HasColumnType("INTEGER");
b.HasKey("Baid", "DanId", "SongNumber");
b.ToTable("DanStageScoreData");
});
modelBuilder.Entity("TaikoLocalServer.Entities.SongBestDatum", b =>
{
b.Property<uint>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<uint>("BestCrown")
.HasColumnType("INTEGER");
b.Property<uint>("BestRate")
.HasColumnType("INTEGER");
b.Property<uint>("BestScore")
.HasColumnType("INTEGER");
b.Property<uint>("BestScoreRank")
.HasColumnType("INTEGER");
b.HasKey("Baid", "SongId", "Difficulty");
b.ToTable("SongBestData");
});
modelBuilder.Entity("TaikoLocalServer.Entities.SongPlayDatum", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<uint>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("ComboCount")
.HasColumnType("INTEGER");
b.Property<uint>("Crown")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<uint>("GoodCount")
.HasColumnType("INTEGER");
b.Property<uint>("HitCount")
.HasColumnType("INTEGER");
b.Property<uint>("MissCount")
.HasColumnType("INTEGER");
b.Property<uint>("OkCount")
.HasColumnType("INTEGER");
b.Property<DateTime>("PlayTime")
.HasColumnType("datetime");
b.Property<uint>("Score")
.HasColumnType("INTEGER");
b.Property<uint>("ScoreRank")
.HasColumnType("INTEGER");
b.Property<uint>("ScoreRate")
.HasColumnType("INTEGER");
b.Property<bool>("Skipped")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("SongNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Baid");
b.ToTable("SongPlayData");
});
modelBuilder.Entity("TaikoLocalServer.Entities.UserDatum", b =>
{
b.Property<uint>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("AchievementDisplayDifficulty")
.HasColumnType("INTEGER");
b.Property<uint>("ColorBody")
.HasColumnType("INTEGER");
b.Property<uint>("ColorFace")
.HasColumnType("INTEGER");
b.Property<uint>("ColorLimb")
.HasColumnType("INTEGER");
b.Property<string>("CostumeData")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("DisplayAchievement")
.HasColumnType("INTEGER");
b.Property<bool>("DisplayDan")
.HasColumnType("INTEGER");
b.Property<string>("FavoriteSongsArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("IsSkipOn")
.HasColumnType("INTEGER");
b.Property<bool>("IsVoiceOn")
.HasColumnType("INTEGER");
b.Property<DateTime>("LastPlayDatetime")
.HasColumnType("datetime");
b.Property<long>("LastPlayMode")
.HasColumnType("INTEGER");
b.Property<string>("MyDonName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("OptionSetting")
.HasColumnType("INTEGER");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("TitlePlateId")
.HasColumnType("INTEGER");
b.HasKey("Baid");
b.ToTable("UserData");
});
modelBuilder.Entity("TaikoLocalServer.Entities.DanScoreDatum", b =>
{
b.HasOne("TaikoLocalServer.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("TaikoLocalServer.Entities.DanStageScoreDatum", b =>
{
b.HasOne("TaikoLocalServer.Entities.DanScoreDatum", "Parent")
.WithMany("DanStageScoreData")
.HasForeignKey("Baid", "DanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Parent");
});
modelBuilder.Entity("TaikoLocalServer.Entities.SongBestDatum", b =>
{
b.HasOne("TaikoLocalServer.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("TaikoLocalServer.Entities.SongPlayDatum", b =>
{
b.HasOne("TaikoLocalServer.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("TaikoLocalServer.Entities.UserDatum", b =>
{
b.HasOne("TaikoLocalServer.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("TaikoLocalServer.Entities.DanScoreDatum", b =>
{
b.Navigation("DanStageScoreData");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,58 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TaikoLocalServer.Migrations
{
/// <inheritdoc />
public partial class FixNavigation : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_DanStageScoreData_DanScoreData_DanScoreDatumBaid_DanScoreDatumDanId",
table: "DanStageScoreData");
migrationBuilder.DropIndex(
name: "IX_DanStageScoreData_DanScoreDatumBaid_DanScoreDatumDanId",
table: "DanStageScoreData");
migrationBuilder.DropColumn(
name: "DanScoreDatumBaid",
table: "DanStageScoreData");
migrationBuilder.DropColumn(
name: "DanScoreDatumDanId",
table: "DanStageScoreData");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<uint>(
name: "DanScoreDatumBaid",
table: "DanStageScoreData",
type: "INTEGER",
nullable: true);
migrationBuilder.AddColumn<uint>(
name: "DanScoreDatumDanId",
table: "DanStageScoreData",
type: "INTEGER",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_DanStageScoreData_DanScoreDatumBaid_DanScoreDatumDanId",
table: "DanStageScoreData",
columns: new[] { "DanScoreDatumBaid", "DanScoreDatumDanId" });
migrationBuilder.AddForeignKey(
name: "FK_DanStageScoreData_DanScoreData_DanScoreDatumBaid_DanScoreDatumDanId",
table: "DanStageScoreData",
columns: new[] { "DanScoreDatumBaid", "DanScoreDatumDanId" },
principalTable: "DanScoreData",
principalColumns: new[] { "Baid", "DanId" });
}
}
}

View File

@ -77,12 +77,6 @@ namespace TaikoLocalServer.Migrations
b.Property<uint>("ComboCount") b.Property<uint>("ComboCount")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<uint?>("DanScoreDatumBaid")
.HasColumnType("INTEGER");
b.Property<uint?>("DanScoreDatumDanId")
.HasColumnType("INTEGER");
b.Property<uint>("DrumrollCount") b.Property<uint>("DrumrollCount")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
@ -103,8 +97,6 @@ namespace TaikoLocalServer.Migrations
b.HasKey("Baid", "DanId", "SongNumber"); b.HasKey("Baid", "DanId", "SongNumber");
b.HasIndex("DanScoreDatumBaid", "DanScoreDatumDanId");
b.ToTable("DanStageScoreData"); b.ToTable("DanStageScoreData");
}); });
@ -271,15 +263,11 @@ namespace TaikoLocalServer.Migrations
modelBuilder.Entity("TaikoLocalServer.Entities.DanStageScoreDatum", b => modelBuilder.Entity("TaikoLocalServer.Entities.DanStageScoreDatum", b =>
{ {
b.HasOne("TaikoLocalServer.Entities.DanScoreDatum", "Parent") b.HasOne("TaikoLocalServer.Entities.DanScoreDatum", "Parent")
.WithMany() .WithMany("DanStageScoreData")
.HasForeignKey("Baid", "DanId") .HasForeignKey("Baid", "DanId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("TaikoLocalServer.Entities.DanScoreDatum", null)
.WithMany("DanStageScoreData")
.HasForeignKey("DanScoreDatumBaid", "DanScoreDatumDanId");
b.Navigation("Parent"); b.Navigation("Parent");
}); });