1
0
mirror of synced 2025-02-06 06:34:29 +01:00

Add unlocks to database

This commit is contained in:
asesidaa 2024-03-29 17:34:59 +08:00
parent bd2cb39b63
commit 8fc7adf35a
10 changed files with 894 additions and 49 deletions

View File

@ -24,6 +24,12 @@ public interface ICardDbContext
public DbSet<OnlineMatchEntry> OnlineMatchEntries { get; set; }
public DbSet<Unlock> Unlocks { get; set; }
public DbSet<Item> Items { get; set; }
public DbSet<Coin> Coins { get; set; }
public Task<int> SaveChangesAsync(CancellationToken cancellationToken);

View File

@ -19,4 +19,8 @@ public partial class CardMain
public string? Created { get; set; } = string.Empty;
public string? Modified { get; set; } = string.Empty;
public List<Item>? Items { get; set; }
public Coin? Coin { get; set; }
public List<Unlock>? Unlocks { get; set; }
}

12
Domain/Entities/Coin.cs Normal file
View File

@ -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; }
}

13
Domain/Entities/Item.cs Normal file
View File

@ -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; }
}

13
Domain/Entities/Unlock.cs Normal file
View File

@ -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; }
}

View File

@ -0,0 +1,11 @@
namespace Domain.Enums;
public enum UnlockType
{
Avatar,
Music,
Navigator,
Title,
Skin,
SoundEffect
}

View File

@ -0,0 +1,584 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<long>("CardId")
.HasColumnType("INTEGER")
.HasColumnName("card_id");
b.Property<string>("Bdata")
.HasColumnType("TEXT")
.HasColumnName("bdata");
b.Property<long>("BdataSize")
.HasColumnType("INTEGER")
.HasColumnName("bdata_size");
b.HasKey("CardId");
b.ToTable("card_bdata", (string)null);
});
modelBuilder.Entity("Domain.Entities.CardDetail", b =>
{
b.Property<long>("CardId")
.HasColumnType("INTEGER")
.HasColumnName("card_id");
b.Property<long>("Pcol1")
.HasColumnType("INTEGER")
.HasColumnName("pcol1");
b.Property<long>("Pcol2")
.HasColumnType("INTEGER")
.HasColumnName("pcol2");
b.Property<long>("Pcol3")
.HasColumnType("INTEGER")
.HasColumnName("pcol3");
b.Property<long>("Fcol1")
.HasColumnType("INTEGER")
.HasColumnName("fcol1");
b.Property<long>("Fcol2")
.HasColumnType("INTEGER")
.HasColumnName("fcol2");
b.Property<long>("Fcol3")
.HasColumnType("INTEGER")
.HasColumnName("fcol3");
b.Property<string>("LastPlayTenpoId")
.HasColumnType("TEXT")
.HasColumnName("last_play_tenpo_id");
b.Property<long?>("LastPlayTime")
.HasColumnType("INTEGER")
.HasColumnName("last_play_time");
b.Property<long>("ScoreBi1")
.HasColumnType("INTEGER")
.HasColumnName("score_bi1");
b.Property<long>("ScoreI1")
.HasColumnType("INTEGER")
.HasColumnName("score_i1");
b.Property<long>("ScoreUi1")
.HasColumnType("INTEGER")
.HasColumnName("score_ui1");
b.Property<long>("ScoreUi2")
.HasColumnType("INTEGER")
.HasColumnName("score_ui2");
b.Property<long>("ScoreUi3")
.HasColumnType("INTEGER")
.HasColumnName("score_ui3");
b.Property<long>("ScoreUi4")
.HasColumnType("INTEGER")
.HasColumnName("score_ui4");
b.Property<long>("ScoreUi5")
.HasColumnType("INTEGER")
.HasColumnName("score_ui5");
b.Property<long>("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<long>("CardId")
.HasColumnType("INTEGER")
.HasColumnName("card_id");
b.Property<string>("AchieveStatus")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("achieve_status");
b.Property<string>("Created")
.HasColumnType("TEXT")
.HasColumnName("created");
b.Property<long>("Fcol1")
.HasColumnType("INTEGER")
.HasColumnName("fcol1");
b.Property<long>("Fcol2")
.HasColumnType("INTEGER")
.HasColumnName("fcol2");
b.Property<long>("Fcol3")
.HasColumnType("INTEGER")
.HasColumnName("fcol3");
b.Property<string>("Modified")
.HasColumnType("TEXT")
.HasColumnName("modified");
b.Property<string>("PlayerName")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("player_name");
b.Property<long>("ScoreI1")
.HasColumnType("INTEGER")
.HasColumnName("score_i1");
b.HasKey("CardId");
b.ToTable("card_main", (string)null);
});
modelBuilder.Entity("Domain.Entities.CardPlayCount", b =>
{
b.Property<long>("CardId")
.HasColumnType("INTEGER")
.HasColumnName("card_id");
b.Property<long>("LastPlayedTime")
.HasColumnType("INTEGER")
.HasColumnName("last_played_time");
b.Property<long>("PlayCount")
.HasColumnType("INTEGER")
.HasColumnName("play_count");
b.HasKey("CardId");
b.ToTable("CardPlayCount", (string)null);
});
modelBuilder.Entity("Domain.Entities.Coin", b =>
{
b.Property<long>("CardId")
.HasColumnType("INTEGER");
b.Property<int>("Count")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreateTime")
.HasColumnType("TEXT");
b.Property<DateTime>("UpdateTime")
.HasColumnType("TEXT");
b.HasKey("CardId");
b.ToTable("Coins");
});
modelBuilder.Entity("Domain.Entities.GlobalScoreRank", b =>
{
b.Property<long>("CardId")
.HasColumnType("INTEGER");
b.Property<string>("Area")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("AreaId")
.HasColumnType("INTEGER");
b.Property<int>("AvatarId")
.HasColumnType("INTEGER");
b.Property<long>("Fcol1")
.HasColumnType("INTEGER");
b.Property<int>("LastPlayTenpoId")
.HasColumnType("INTEGER");
b.Property<string>("PlayerName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Pref")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PrefId")
.HasColumnType("INTEGER");
b.Property<long>("Rank")
.HasColumnType("INTEGER");
b.Property<string>("TenpoName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.Property<long>("TitleId")
.HasColumnType("INTEGER");
b.Property<long>("TotalScore")
.HasColumnType("INTEGER");
b.HasKey("CardId");
b.ToTable("GlobalScoreRank", (string)null);
});
modelBuilder.Entity("Domain.Entities.Item", b =>
{
b.Property<int>("ItemId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("CardId")
.HasColumnType("INTEGER");
b.Property<int>("Count")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreateTime")
.HasColumnType("TEXT");
b.Property<DateTime>("UpdateTime")
.HasColumnType("TEXT");
b.HasKey("ItemId");
b.HasIndex("CardId");
b.ToTable("Items");
});
modelBuilder.Entity("Domain.Entities.MonthlyScoreRank", b =>
{
b.Property<long>("CardId")
.HasColumnType("INTEGER");
b.Property<string>("Area")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("AreaId")
.HasColumnType("INTEGER");
b.Property<int>("AvatarId")
.HasColumnType("INTEGER");
b.Property<long>("Fcol1")
.HasColumnType("INTEGER");
b.Property<int>("LastPlayTenpoId")
.HasColumnType("INTEGER");
b.Property<string>("PlayerName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Pref")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PrefId")
.HasColumnType("INTEGER");
b.Property<long>("Rank")
.HasColumnType("INTEGER");
b.Property<string>("TenpoName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.Property<long>("TitleId")
.HasColumnType("INTEGER");
b.Property<long>("TotalScore")
.HasColumnType("INTEGER");
b.HasKey("CardId");
b.ToTable("MonthlyScoreRank", (string)null);
});
modelBuilder.Entity("Domain.Entities.OnlineMatch", b =>
{
b.Property<long>("MatchId")
.HasColumnType("INTEGER");
b.Property<Guid>("Guid")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<bool>("IsOpen")
.HasColumnType("INTEGER");
b.HasKey("MatchId");
b.ToTable("OnlineMatches");
});
modelBuilder.Entity("Domain.Entities.OnlineMatchEntry", b =>
{
b.Property<long>("MatchId")
.HasColumnType("INTEGER");
b.Property<long>("EntryId")
.HasColumnType("INTEGER");
b.Property<long>("AvatarId")
.HasColumnType("INTEGER");
b.Property<long>("CardId")
.HasColumnType("INTEGER");
b.Property<long>("ClassId")
.HasColumnType("INTEGER");
b.Property<long>("EventId")
.HasColumnType("INTEGER");
b.Property<long>("GroupId")
.HasColumnType("INTEGER");
b.Property<long>("MachineId")
.HasColumnType("INTEGER");
b.Property<long>("MatchRemainingTime")
.HasColumnType("INTEGER");
b.Property<long>("MatchTimeout")
.HasColumnType("INTEGER");
b.Property<long>("MatchWaitTime")
.HasColumnType("INTEGER");
b.Property<long>("MessageId")
.HasColumnType("INTEGER");
b.Property<string>("PlayerName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Pref")
.IsRequired()
.HasColumnType("TEXT");
b.Property<long>("PrefId")
.HasColumnType("INTEGER");
b.Property<DateTime>("StartTime")
.HasColumnType("TEXT");
b.Property<long>("Status")
.HasColumnType("INTEGER");
b.Property<long>("TenpoId")
.HasColumnType("INTEGER");
b.Property<string>("TenpoName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<long>("TitleId")
.HasColumnType("INTEGER");
b.HasKey("MatchId", "EntryId");
b.ToTable("OnlineMatchEntries");
});
modelBuilder.Entity("Domain.Entities.PlayNumRank", b =>
{
b.Property<int>("MusicId")
.HasColumnType("INTEGER");
b.Property<string>("Artist")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PlayCount")
.HasColumnType("INTEGER");
b.Property<int>("PrevRank")
.HasColumnType("INTEGER");
b.Property<int>("PrevRank2")
.HasColumnType("INTEGER");
b.Property<int>("Rank")
.HasColumnType("INTEGER");
b.Property<int>("Rank2")
.HasColumnType("INTEGER");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("MusicId");
b.ToTable("PlayNumRank", (string)null);
});
modelBuilder.Entity("Domain.Entities.ShopScoreRank", b =>
{
b.Property<long>("CardId")
.HasColumnType("INTEGER");
b.Property<string>("Area")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("AreaId")
.HasColumnType("INTEGER");
b.Property<int>("AvatarId")
.HasColumnType("INTEGER");
b.Property<long>("Fcol1")
.HasColumnType("INTEGER");
b.Property<int>("LastPlayTenpoId")
.HasColumnType("INTEGER");
b.Property<string>("PlayerName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Pref")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PrefId")
.HasColumnType("INTEGER");
b.Property<long>("Rank")
.HasColumnType("INTEGER");
b.Property<string>("TenpoName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.Property<long>("TitleId")
.HasColumnType("INTEGER");
b.Property<long>("TotalScore")
.HasColumnType("INTEGER");
b.HasKey("CardId");
b.ToTable("ShopScoreRank", (string)null);
});
modelBuilder.Entity("Domain.Entities.Unlock", b =>
{
b.Property<long>("CardId")
.HasColumnType("INTEGER");
b.Property<int>("UnlockItemId")
.HasColumnType("INTEGER");
b.Property<int>("UnlockType")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreateTime")
.HasColumnType("TEXT");
b.Property<bool>("IsNew")
.HasColumnType("INTEGER");
b.Property<DateTime>("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
}
}
}

View File

@ -0,0 +1,115 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddUnlocks : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<long>(
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<long>(type: "INTEGER", nullable: false),
Count = table.Column<int>(type: "INTEGER", nullable: false),
CreateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdateTime = table.Column<DateTime>(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<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
CardId = table.Column<long>(type: "INTEGER", nullable: false),
Count = table.Column<int>(type: "INTEGER", nullable: false),
CreateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdateTime = table.Column<DateTime>(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<long>(type: "INTEGER", nullable: false),
UnlockItemId = table.Column<int>(type: "INTEGER", nullable: false),
UnlockType = table.Column<int>(type: "INTEGER", nullable: false),
IsNew = table.Column<bool>(type: "INTEGER", nullable: false),
CreateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdateTime = table.Column<DateTime>(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");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Coins");
migrationBuilder.DropTable(
name: "Items");
migrationBuilder.DropTable(
name: "Unlocks");
migrationBuilder.AlterColumn<long>(
name: "MatchId",
table: "OnlineMatches",
type: "INTEGER",
nullable: false,
oldClrType: typeof(long),
oldType: "INTEGER")
.Annotation("Sqlite:Autoincrement", true);
}
}
}

View File

@ -175,6 +175,25 @@ namespace Infrastructure.Migrations
b.ToTable("CardPlayCount", (string)null);
});
modelBuilder.Entity("Domain.Entities.Coin", b =>
{
b.Property<long>("CardId")
.HasColumnType("INTEGER");
b.Property<int>("Count")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreateTime")
.HasColumnType("TEXT");
b.Property<DateTime>("UpdateTime")
.HasColumnType("TEXT");
b.HasKey("CardId");
b.ToTable("Coins");
});
modelBuilder.Entity("Domain.Entities.GlobalScoreRank", b =>
{
b.Property<long>("CardId")
@ -229,6 +248,31 @@ namespace Infrastructure.Migrations
b.ToTable("GlobalScoreRank", (string)null);
});
modelBuilder.Entity("Domain.Entities.Item", b =>
{
b.Property<int>("ItemId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("CardId")
.HasColumnType("INTEGER");
b.Property<int>("Count")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreateTime")
.HasColumnType("TEXT");
b.Property<DateTime>("UpdateTime")
.HasColumnType("TEXT");
b.HasKey("ItemId");
b.HasIndex("CardId");
b.ToTable("Items");
});
modelBuilder.Entity("Domain.Entities.MonthlyScoreRank", b =>
{
b.Property<long>("CardId")
@ -286,7 +330,6 @@ namespace Infrastructure.Migrations
modelBuilder.Entity("Domain.Entities.OnlineMatch", b =>
{
b.Property<long>("MatchId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<Guid>("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<long>("CardId")
.HasColumnType("INTEGER");
b.Property<int>("UnlockItemId")
.HasColumnType("INTEGER");
b.Property<int>("UnlockType")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreateTime")
.HasColumnType("TEXT");
b.Property<bool>("IsNew")
.HasColumnType("INTEGER");
b.Property<DateTime>("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");

View File

@ -37,6 +37,12 @@ public partial class CardDbContext : DbContext, ICardDbContext
public virtual DbSet<OnlineMatchEntry> OnlineMatchEntries { get; set; } = null!;
public virtual DbSet<Unlock> Unlocks { get; set; } = null!;
public virtual DbSet<Item> Items { get; set; } = null!;
public virtual DbSet<Coin> 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<GlobalScoreRank>(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<MonthlyScoreRank>(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<ShopScoreRank>(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<OnlineMatch>(entity =>
@ -223,6 +183,29 @@ public partial class CardDbContext : DbContext, ICardDbContext
entity.HasKey(e => new { e.MatchId, e.EntryId });
});
modelBuilder.Entity<Unlock>(entity =>
{
entity.HasKey(e => new { e.CardId, e.UnlockItemId, e.UnlockType });
entity.HasOne<CardMain>()
.WithMany(e=>e.Unlocks)
.HasForeignKey(e => e.CardId);
});
modelBuilder.Entity<Item>(entity =>
{
entity.HasKey(e => e.ItemId);
entity.HasOne<CardMain>()
.WithMany(e=>e.Items)
.HasForeignKey(e => e.CardId);
});
modelBuilder.Entity<Coin>(entity =>
{
entity.HasKey(e => e.CardId);
entity.HasOne<CardMain>()
.WithOne(e=>e.Coin)
.HasForeignKey<Coin>(e => e.CardId);
});
OnModelCreatingPartial(modelBuilder);
}