diff --git a/Application/Interfaces/ICardDbContext.cs b/Application/Interfaces/ICardDbContext.cs index 46bb223..73d0297 100644 --- a/Application/Interfaces/ICardDbContext.cs +++ b/Application/Interfaces/ICardDbContext.cs @@ -23,6 +23,12 @@ public interface ICardDbContext public DbSet OnlineMatches { get; set; } public DbSet OnlineMatchEntries { get; set; } + + public DbSet Unlocks { get; set; } + + public DbSet Items { get; set; } + + public DbSet Coins { get; set; } public Task SaveChangesAsync(CancellationToken cancellationToken); diff --git a/Domain/Entities/CardMain.cs b/Domain/Entities/CardMain.cs index f3f092f..2e80df7 100644 --- a/Domain/Entities/CardMain.cs +++ b/Domain/Entities/CardMain.cs @@ -19,4 +19,8 @@ public partial class CardMain public string? Created { get; set; } = string.Empty; public string? Modified { get; set; } = string.Empty; + + public List? Items { get; set; } + public Coin? Coin { get; set; } + public List? Unlocks { get; set; } } diff --git a/Domain/Entities/Coin.cs b/Domain/Entities/Coin.cs new file mode 100644 index 0000000..eeccf2e --- /dev/null +++ b/Domain/Entities/Coin.cs @@ -0,0 +1,12 @@ +namespace Domain.Entities; + +public class Coin +{ + public long CardId { get; set; } + + public int Count { get; set; } + + public DateTime CreateTime { get; set; } + + public DateTime UpdateTime { get; set; } +} \ No newline at end of file diff --git a/Domain/Entities/Item.cs b/Domain/Entities/Item.cs new file mode 100644 index 0000000..f5fbfcb --- /dev/null +++ b/Domain/Entities/Item.cs @@ -0,0 +1,13 @@ +namespace Domain.Entities; + +public class Item +{ + public long CardId { get; set; } + + public int ItemId { get; set; } + + public int Count { get; set; } + + public DateTime CreateTime { get; set; } + public DateTime UpdateTime { get; set; } +} \ No newline at end of file diff --git a/Domain/Entities/Unlock.cs b/Domain/Entities/Unlock.cs new file mode 100644 index 0000000..cf66475 --- /dev/null +++ b/Domain/Entities/Unlock.cs @@ -0,0 +1,13 @@ +using Domain.Enums; + +namespace Domain.Entities; + +public class Unlock +{ + public long CardId { get; set; } + public int UnlockItemId { get; set; } + public UnlockType UnlockType { get; set; } + public bool IsNew { get; set; } + public DateTime CreateTime { get; set; } + public DateTime UpdateTime { get; set; } +} \ No newline at end of file diff --git a/Domain/Enums/UnlockType.cs b/Domain/Enums/UnlockType.cs new file mode 100644 index 0000000..fcb7dac --- /dev/null +++ b/Domain/Enums/UnlockType.cs @@ -0,0 +1,11 @@ +namespace Domain.Enums; + +public enum UnlockType +{ + Avatar, + Music, + Navigator, + Title, + Skin, + SoundEffect +} \ No newline at end of file diff --git a/Infrastructure/Migrations/20240329093329_AddUnlocks.Designer.cs b/Infrastructure/Migrations/20240329093329_AddUnlocks.Designer.cs new file mode 100644 index 0000000..a46bd03 --- /dev/null +++ b/Infrastructure/Migrations/20240329093329_AddUnlocks.Designer.cs @@ -0,0 +1,584 @@ +// +using System; +using Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Infrastructure.Migrations +{ + [DbContext(typeof(CardDbContext))] + [Migration("20240329093329_AddUnlocks")] + partial class AddUnlocks + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); + + modelBuilder.Entity("Domain.Entities.CardBdatum", b => + { + b.Property("CardId") + .HasColumnType("INTEGER") + .HasColumnName("card_id"); + + b.Property("Bdata") + .HasColumnType("TEXT") + .HasColumnName("bdata"); + + b.Property("BdataSize") + .HasColumnType("INTEGER") + .HasColumnName("bdata_size"); + + b.HasKey("CardId"); + + b.ToTable("card_bdata", (string)null); + }); + + modelBuilder.Entity("Domain.Entities.CardDetail", b => + { + b.Property("CardId") + .HasColumnType("INTEGER") + .HasColumnName("card_id"); + + b.Property("Pcol1") + .HasColumnType("INTEGER") + .HasColumnName("pcol1"); + + b.Property("Pcol2") + .HasColumnType("INTEGER") + .HasColumnName("pcol2"); + + b.Property("Pcol3") + .HasColumnType("INTEGER") + .HasColumnName("pcol3"); + + b.Property("Fcol1") + .HasColumnType("INTEGER") + .HasColumnName("fcol1"); + + b.Property("Fcol2") + .HasColumnType("INTEGER") + .HasColumnName("fcol2"); + + b.Property("Fcol3") + .HasColumnType("INTEGER") + .HasColumnName("fcol3"); + + b.Property("LastPlayTenpoId") + .HasColumnType("TEXT") + .HasColumnName("last_play_tenpo_id"); + + b.Property("LastPlayTime") + .HasColumnType("INTEGER") + .HasColumnName("last_play_time"); + + b.Property("ScoreBi1") + .HasColumnType("INTEGER") + .HasColumnName("score_bi1"); + + b.Property("ScoreI1") + .HasColumnType("INTEGER") + .HasColumnName("score_i1"); + + b.Property("ScoreUi1") + .HasColumnType("INTEGER") + .HasColumnName("score_ui1"); + + b.Property("ScoreUi2") + .HasColumnType("INTEGER") + .HasColumnName("score_ui2"); + + b.Property("ScoreUi3") + .HasColumnType("INTEGER") + .HasColumnName("score_ui3"); + + b.Property("ScoreUi4") + .HasColumnType("INTEGER") + .HasColumnName("score_ui4"); + + b.Property("ScoreUi5") + .HasColumnType("INTEGER") + .HasColumnName("score_ui5"); + + b.Property("ScoreUi6") + .HasColumnType("INTEGER") + .HasColumnName("score_ui6"); + + b.HasKey("CardId", "Pcol1", "Pcol2", "Pcol3"); + + b.ToTable("card_detail", (string)null); + }); + + modelBuilder.Entity("Domain.Entities.CardMain", b => + { + b.Property("CardId") + .HasColumnType("INTEGER") + .HasColumnName("card_id"); + + b.Property("AchieveStatus") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("achieve_status"); + + b.Property("Created") + .HasColumnType("TEXT") + .HasColumnName("created"); + + b.Property("Fcol1") + .HasColumnType("INTEGER") + .HasColumnName("fcol1"); + + b.Property("Fcol2") + .HasColumnType("INTEGER") + .HasColumnName("fcol2"); + + b.Property("Fcol3") + .HasColumnType("INTEGER") + .HasColumnName("fcol3"); + + b.Property("Modified") + .HasColumnType("TEXT") + .HasColumnName("modified"); + + b.Property("PlayerName") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("player_name"); + + b.Property("ScoreI1") + .HasColumnType("INTEGER") + .HasColumnName("score_i1"); + + b.HasKey("CardId"); + + b.ToTable("card_main", (string)null); + }); + + modelBuilder.Entity("Domain.Entities.CardPlayCount", b => + { + b.Property("CardId") + .HasColumnType("INTEGER") + .HasColumnName("card_id"); + + b.Property("LastPlayedTime") + .HasColumnType("INTEGER") + .HasColumnName("last_played_time"); + + b.Property("PlayCount") + .HasColumnType("INTEGER") + .HasColumnName("play_count"); + + b.HasKey("CardId"); + + b.ToTable("CardPlayCount", (string)null); + }); + + modelBuilder.Entity("Domain.Entities.Coin", b => + { + b.Property("CardId") + .HasColumnType("INTEGER"); + + b.Property("Count") + .HasColumnType("INTEGER"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.HasKey("CardId"); + + b.ToTable("Coins"); + }); + + modelBuilder.Entity("Domain.Entities.GlobalScoreRank", b => + { + b.Property("CardId") + .HasColumnType("INTEGER"); + + b.Property("Area") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("AreaId") + .HasColumnType("INTEGER"); + + b.Property("AvatarId") + .HasColumnType("INTEGER"); + + b.Property("Fcol1") + .HasColumnType("INTEGER"); + + b.Property("LastPlayTenpoId") + .HasColumnType("INTEGER"); + + b.Property("PlayerName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Pref") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PrefId") + .HasColumnType("INTEGER"); + + b.Property("Rank") + .HasColumnType("INTEGER"); + + b.Property("TenpoName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TitleId") + .HasColumnType("INTEGER"); + + b.Property("TotalScore") + .HasColumnType("INTEGER"); + + b.HasKey("CardId"); + + b.ToTable("GlobalScoreRank", (string)null); + }); + + modelBuilder.Entity("Domain.Entities.Item", b => + { + b.Property("ItemId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CardId") + .HasColumnType("INTEGER"); + + b.Property("Count") + .HasColumnType("INTEGER"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.HasKey("ItemId"); + + b.HasIndex("CardId"); + + b.ToTable("Items"); + }); + + modelBuilder.Entity("Domain.Entities.MonthlyScoreRank", b => + { + b.Property("CardId") + .HasColumnType("INTEGER"); + + b.Property("Area") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("AreaId") + .HasColumnType("INTEGER"); + + b.Property("AvatarId") + .HasColumnType("INTEGER"); + + b.Property("Fcol1") + .HasColumnType("INTEGER"); + + b.Property("LastPlayTenpoId") + .HasColumnType("INTEGER"); + + b.Property("PlayerName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Pref") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PrefId") + .HasColumnType("INTEGER"); + + b.Property("Rank") + .HasColumnType("INTEGER"); + + b.Property("TenpoName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TitleId") + .HasColumnType("INTEGER"); + + b.Property("TotalScore") + .HasColumnType("INTEGER"); + + b.HasKey("CardId"); + + b.ToTable("MonthlyScoreRank", (string)null); + }); + + modelBuilder.Entity("Domain.Entities.OnlineMatch", b => + { + b.Property("MatchId") + .HasColumnType("INTEGER"); + + b.Property("Guid") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("IsOpen") + .HasColumnType("INTEGER"); + + b.HasKey("MatchId"); + + b.ToTable("OnlineMatches"); + }); + + modelBuilder.Entity("Domain.Entities.OnlineMatchEntry", b => + { + b.Property("MatchId") + .HasColumnType("INTEGER"); + + b.Property("EntryId") + .HasColumnType("INTEGER"); + + b.Property("AvatarId") + .HasColumnType("INTEGER"); + + b.Property("CardId") + .HasColumnType("INTEGER"); + + b.Property("ClassId") + .HasColumnType("INTEGER"); + + b.Property("EventId") + .HasColumnType("INTEGER"); + + b.Property("GroupId") + .HasColumnType("INTEGER"); + + b.Property("MachineId") + .HasColumnType("INTEGER"); + + b.Property("MatchRemainingTime") + .HasColumnType("INTEGER"); + + b.Property("MatchTimeout") + .HasColumnType("INTEGER"); + + b.Property("MatchWaitTime") + .HasColumnType("INTEGER"); + + b.Property("MessageId") + .HasColumnType("INTEGER"); + + b.Property("PlayerName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Pref") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PrefId") + .HasColumnType("INTEGER"); + + b.Property("StartTime") + .HasColumnType("TEXT"); + + b.Property("Status") + .HasColumnType("INTEGER"); + + b.Property("TenpoId") + .HasColumnType("INTEGER"); + + b.Property("TenpoName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TitleId") + .HasColumnType("INTEGER"); + + b.HasKey("MatchId", "EntryId"); + + b.ToTable("OnlineMatchEntries"); + }); + + modelBuilder.Entity("Domain.Entities.PlayNumRank", b => + { + b.Property("MusicId") + .HasColumnType("INTEGER"); + + b.Property("Artist") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PlayCount") + .HasColumnType("INTEGER"); + + b.Property("PrevRank") + .HasColumnType("INTEGER"); + + b.Property("PrevRank2") + .HasColumnType("INTEGER"); + + b.Property("Rank") + .HasColumnType("INTEGER"); + + b.Property("Rank2") + .HasColumnType("INTEGER"); + + b.Property("Title") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("MusicId"); + + b.ToTable("PlayNumRank", (string)null); + }); + + modelBuilder.Entity("Domain.Entities.ShopScoreRank", b => + { + b.Property("CardId") + .HasColumnType("INTEGER"); + + b.Property("Area") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("AreaId") + .HasColumnType("INTEGER"); + + b.Property("AvatarId") + .HasColumnType("INTEGER"); + + b.Property("Fcol1") + .HasColumnType("INTEGER"); + + b.Property("LastPlayTenpoId") + .HasColumnType("INTEGER"); + + b.Property("PlayerName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Pref") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PrefId") + .HasColumnType("INTEGER"); + + b.Property("Rank") + .HasColumnType("INTEGER"); + + b.Property("TenpoName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TitleId") + .HasColumnType("INTEGER"); + + b.Property("TotalScore") + .HasColumnType("INTEGER"); + + b.HasKey("CardId"); + + b.ToTable("ShopScoreRank", (string)null); + }); + + modelBuilder.Entity("Domain.Entities.Unlock", b => + { + b.Property("CardId") + .HasColumnType("INTEGER"); + + b.Property("UnlockItemId") + .HasColumnType("INTEGER"); + + b.Property("UnlockType") + .HasColumnType("INTEGER"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("IsNew") + .HasColumnType("INTEGER"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.HasKey("CardId", "UnlockItemId", "UnlockType"); + + b.ToTable("Unlocks"); + }); + + modelBuilder.Entity("Domain.Entities.Coin", b => + { + b.HasOne("Domain.Entities.CardMain", null) + .WithOne("Coin") + .HasForeignKey("Domain.Entities.Coin", "CardId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Domain.Entities.Item", b => + { + b.HasOne("Domain.Entities.CardMain", null) + .WithMany("Items") + .HasForeignKey("CardId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Domain.Entities.OnlineMatchEntry", b => + { + b.HasOne("Domain.Entities.OnlineMatch", null) + .WithMany("Entries") + .HasForeignKey("MatchId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Domain.Entities.Unlock", b => + { + b.HasOne("Domain.Entities.CardMain", null) + .WithMany("Unlocks") + .HasForeignKey("CardId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Domain.Entities.CardMain", b => + { + b.Navigation("Coin"); + + b.Navigation("Items"); + + b.Navigation("Unlocks"); + }); + + modelBuilder.Entity("Domain.Entities.OnlineMatch", b => + { + b.Navigation("Entries"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Infrastructure/Migrations/20240329093329_AddUnlocks.cs b/Infrastructure/Migrations/20240329093329_AddUnlocks.cs new file mode 100644 index 0000000..ec4336b --- /dev/null +++ b/Infrastructure/Migrations/20240329093329_AddUnlocks.cs @@ -0,0 +1,115 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Infrastructure.Migrations +{ + /// + public partial class AddUnlocks : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "MatchId", + table: "OnlineMatches", + type: "INTEGER", + nullable: false, + oldClrType: typeof(long), + oldType: "INTEGER") + .OldAnnotation("Sqlite:Autoincrement", true); + + migrationBuilder.CreateTable( + name: "Coins", + columns: table => new + { + CardId = table.Column(type: "INTEGER", nullable: false), + Count = table.Column(type: "INTEGER", nullable: false), + CreateTime = table.Column(type: "TEXT", nullable: false), + UpdateTime = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Coins", x => x.CardId); + table.ForeignKey( + name: "FK_Coins_card_main_CardId", + column: x => x.CardId, + principalTable: "card_main", + principalColumn: "card_id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Items", + columns: table => new + { + ItemId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CardId = table.Column(type: "INTEGER", nullable: false), + Count = table.Column(type: "INTEGER", nullable: false), + CreateTime = table.Column(type: "TEXT", nullable: false), + UpdateTime = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Items", x => x.ItemId); + table.ForeignKey( + name: "FK_Items_card_main_CardId", + column: x => x.CardId, + principalTable: "card_main", + principalColumn: "card_id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Unlocks", + columns: table => new + { + CardId = table.Column(type: "INTEGER", nullable: false), + UnlockItemId = table.Column(type: "INTEGER", nullable: false), + UnlockType = table.Column(type: "INTEGER", nullable: false), + IsNew = table.Column(type: "INTEGER", nullable: false), + CreateTime = table.Column(type: "TEXT", nullable: false), + UpdateTime = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Unlocks", x => new { x.CardId, x.UnlockItemId, x.UnlockType }); + table.ForeignKey( + name: "FK_Unlocks_card_main_CardId", + column: x => x.CardId, + principalTable: "card_main", + principalColumn: "card_id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Items_CardId", + table: "Items", + column: "CardId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Coins"); + + migrationBuilder.DropTable( + name: "Items"); + + migrationBuilder.DropTable( + name: "Unlocks"); + + migrationBuilder.AlterColumn( + name: "MatchId", + table: "OnlineMatches", + type: "INTEGER", + nullable: false, + oldClrType: typeof(long), + oldType: "INTEGER") + .Annotation("Sqlite:Autoincrement", true); + } + } +} diff --git a/Infrastructure/Migrations/CardDbContextModelSnapshot.cs b/Infrastructure/Migrations/CardDbContextModelSnapshot.cs index 8d059ef..54b79b0 100644 --- a/Infrastructure/Migrations/CardDbContextModelSnapshot.cs +++ b/Infrastructure/Migrations/CardDbContextModelSnapshot.cs @@ -175,6 +175,25 @@ namespace Infrastructure.Migrations b.ToTable("CardPlayCount", (string)null); }); + modelBuilder.Entity("Domain.Entities.Coin", b => + { + b.Property("CardId") + .HasColumnType("INTEGER"); + + b.Property("Count") + .HasColumnType("INTEGER"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.HasKey("CardId"); + + b.ToTable("Coins"); + }); + modelBuilder.Entity("Domain.Entities.GlobalScoreRank", b => { b.Property("CardId") @@ -229,6 +248,31 @@ namespace Infrastructure.Migrations b.ToTable("GlobalScoreRank", (string)null); }); + modelBuilder.Entity("Domain.Entities.Item", b => + { + b.Property("ItemId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CardId") + .HasColumnType("INTEGER"); + + b.Property("Count") + .HasColumnType("INTEGER"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.HasKey("ItemId"); + + b.HasIndex("CardId"); + + b.ToTable("Items"); + }); + modelBuilder.Entity("Domain.Entities.MonthlyScoreRank", b => { b.Property("CardId") @@ -286,7 +330,6 @@ namespace Infrastructure.Migrations modelBuilder.Entity("Domain.Entities.OnlineMatch", b => { b.Property("MatchId") - .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); b.Property("Guid") @@ -298,7 +341,7 @@ namespace Infrastructure.Migrations b.HasKey("MatchId"); - b.ToTable("OnlineMatches", (string)null); + b.ToTable("OnlineMatches"); }); modelBuilder.Entity("Domain.Entities.OnlineMatchEntry", b => @@ -368,7 +411,7 @@ namespace Infrastructure.Migrations b.HasKey("MatchId", "EntryId"); - b.ToTable("OnlineMatchEntries", (string)null); + b.ToTable("OnlineMatchEntries"); }); modelBuilder.Entity("Domain.Entities.PlayNumRank", b => @@ -458,6 +501,49 @@ namespace Infrastructure.Migrations b.ToTable("ShopScoreRank", (string)null); }); + modelBuilder.Entity("Domain.Entities.Unlock", b => + { + b.Property("CardId") + .HasColumnType("INTEGER"); + + b.Property("UnlockItemId") + .HasColumnType("INTEGER"); + + b.Property("UnlockType") + .HasColumnType("INTEGER"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("IsNew") + .HasColumnType("INTEGER"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.HasKey("CardId", "UnlockItemId", "UnlockType"); + + b.ToTable("Unlocks"); + }); + + modelBuilder.Entity("Domain.Entities.Coin", b => + { + b.HasOne("Domain.Entities.CardMain", null) + .WithOne("Coin") + .HasForeignKey("Domain.Entities.Coin", "CardId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Domain.Entities.Item", b => + { + b.HasOne("Domain.Entities.CardMain", null) + .WithMany("Items") + .HasForeignKey("CardId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Domain.Entities.OnlineMatchEntry", b => { b.HasOne("Domain.Entities.OnlineMatch", null) @@ -467,6 +553,24 @@ namespace Infrastructure.Migrations .IsRequired(); }); + modelBuilder.Entity("Domain.Entities.Unlock", b => + { + b.HasOne("Domain.Entities.CardMain", null) + .WithMany("Unlocks") + .HasForeignKey("CardId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Domain.Entities.CardMain", b => + { + b.Navigation("Coin"); + + b.Navigation("Items"); + + b.Navigation("Unlocks"); + }); + modelBuilder.Entity("Domain.Entities.OnlineMatch", b => { b.Navigation("Entries"); diff --git a/Infrastructure/Persistence/CardDbContext.cs b/Infrastructure/Persistence/CardDbContext.cs index 31042b6..4a1495c 100644 --- a/Infrastructure/Persistence/CardDbContext.cs +++ b/Infrastructure/Persistence/CardDbContext.cs @@ -36,6 +36,12 @@ public partial class CardDbContext : DbContext, ICardDbContext public virtual DbSet OnlineMatches { get; set; } = null!; public virtual DbSet OnlineMatchEntries { get; set; } = null!; + + public virtual DbSet Unlocks { get; set; } = null!; + + public virtual DbSet Items { get; set; } = null!; + + public virtual DbSet Coins { get; set; } = null!; protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) @@ -131,13 +137,6 @@ public partial class CardDbContext : DbContext, ICardDbContext entity.ToTable("PlayNumRank"); entity.Property(e => e.MusicId).ValueGeneratedNever(); - entity.Property(e => e.PlayCount); - entity.Property(e => e.Artist); - entity.Property(e => e.Title); - entity.Property(e => e.Rank); - entity.Property(e => e.Rank2); - entity.Property(e => e.PrevRank); - entity.Property(e => e.PrevRank2); }); modelBuilder.Entity(entity => @@ -147,19 +146,6 @@ public partial class CardDbContext : DbContext, ICardDbContext entity.ToTable("GlobalScoreRank"); entity.Property(e => e.CardId).ValueGeneratedNever(); - entity.Property(e => e.Fcol1); - entity.Property(e => e.AvatarId); - entity.Property(e => e.Title); - entity.Property(e => e.TitleId); - entity.Property(e => e.Rank); - entity.Property(e => e.AreaId); - entity.Property(e => e.Area); - entity.Property(e => e.LastPlayTenpoId); - entity.Property(e => e.TenpoName); - entity.Property(e => e.PrefId); - entity.Property(e => e.Pref); - entity.Property(e => e.TotalScore); - entity.Property(e => e.PlayerName); }); modelBuilder.Entity(entity => @@ -169,19 +155,6 @@ public partial class CardDbContext : DbContext, ICardDbContext entity.ToTable("MonthlyScoreRank"); entity.Property(e => e.CardId).ValueGeneratedNever(); - entity.Property(e => e.Fcol1); - entity.Property(e => e.AvatarId); - entity.Property(e => e.Title); - entity.Property(e => e.TitleId); - entity.Property(e => e.Rank); - entity.Property(e => e.AreaId); - entity.Property(e => e.Area); - entity.Property(e => e.LastPlayTenpoId); - entity.Property(e => e.TenpoName); - entity.Property(e => e.PrefId); - entity.Property(e => e.Pref); - entity.Property(e => e.TotalScore); - entity.Property(e => e.PlayerName); }); modelBuilder.Entity(entity => @@ -191,19 +164,6 @@ public partial class CardDbContext : DbContext, ICardDbContext entity.ToTable("ShopScoreRank"); entity.Property(e => e.CardId).ValueGeneratedNever(); - entity.Property(e => e.Fcol1); - entity.Property(e => e.AvatarId); - entity.Property(e => e.Title); - entity.Property(e => e.TitleId); - entity.Property(e => e.Rank); - entity.Property(e => e.AreaId); - entity.Property(e => e.Area); - entity.Property(e => e.LastPlayTenpoId); - entity.Property(e => e.TenpoName); - entity.Property(e => e.PrefId); - entity.Property(e => e.Pref); - entity.Property(e => e.TotalScore); - entity.Property(e => e.PlayerName); }); modelBuilder.Entity(entity => @@ -222,7 +182,30 @@ public partial class CardDbContext : DbContext, ICardDbContext { entity.HasKey(e => new { e.MatchId, e.EntryId }); }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.CardId, e.UnlockItemId, e.UnlockType }); + entity.HasOne() + .WithMany(e=>e.Unlocks) + .HasForeignKey(e => e.CardId); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.ItemId); + entity.HasOne() + .WithMany(e=>e.Items) + .HasForeignKey(e => e.CardId); + }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CardId); + entity.HasOne() + .WithOne(e=>e.Coin) + .HasForeignKey(e => e.CardId); + }); OnModelCreatingPartial(modelBuilder); }