Prebuilt deck purchasing and fixes

This commit is contained in:
gamer147
2026-05-26 09:16:21 -04:00
parent fa0901b776
commit b6966ece6e
39 changed files with 7392 additions and 15 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,191 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace SVSim.Database.Migrations
{
/// <inheritdoc />
public partial class AddBuildDeck : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "BuildDeckSeries",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false),
OrderIndex = table.Column<int>(type: "integer", nullable: false),
NameKey = table.Column<string>(type: "text", nullable: false),
IntroKey = table.Column<string>(type: "text", nullable: false),
TitlePath = table.Column<string>(type: "text", nullable: false),
DrumrollPath = table.Column<string>(type: "text", nullable: false),
IsNew = table.Column<bool>(type: "boolean", nullable: false),
IsEnabled = table.Column<bool>(type: "boolean", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BuildDeckSeries", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ViewerBuildDeckProductPurchase",
columns: table => new
{
ViewerId = table.Column<long>(type: "bigint", nullable: false),
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ProductId = table.Column<int>(type: "integer", nullable: false),
PurchaseCount = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ViewerBuildDeckProductPurchase", x => new { x.ViewerId, x.Id });
table.ForeignKey(
name: "FK_ViewerBuildDeckProductPurchase_Viewers_ViewerId",
column: x => x.ViewerId,
principalTable: "Viewers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BuildDeckProducts",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false),
SeriesId = table.Column<int>(type: "integer", nullable: false),
LeaderId = table.Column<int>(type: "integer", nullable: false),
DeckCode = table.Column<string>(type: "text", nullable: false),
ProductNameKey = table.Column<string>(type: "text", nullable: false),
FeaturedCardId = table.Column<long>(type: "bigint", nullable: false),
PurchaseNumMax = table.Column<int>(type: "integer", nullable: false),
IntroPriceCrystal = table.Column<int>(type: "integer", nullable: true),
RegularPriceCrystal = table.Column<int>(type: "integer", nullable: true),
IntroPriceRupy = table.Column<int>(type: "integer", nullable: true),
RegularPriceRupy = table.Column<int>(type: "integer", nullable: true),
IsEnabled = table.Column<bool>(type: "boolean", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BuildDeckProducts", x => x.Id);
table.ForeignKey(
name: "FK_BuildDeckProducts_BuildDeckSeries_SeriesId",
column: x => x.SeriesId,
principalTable: "BuildDeckSeries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BuildDeckSeriesRewardEntry",
columns: table => new
{
BuildDeckSeriesEntryId = table.Column<int>(type: "integer", nullable: false),
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
TierIndex = table.Column<int>(type: "integer", nullable: false),
ItemIndex = table.Column<int>(type: "integer", nullable: false),
RewardType = table.Column<int>(type: "integer", nullable: false),
RewardDetailId = table.Column<long>(type: "bigint", nullable: false),
RewardNumber = table.Column<int>(type: "integer", nullable: false),
MessageId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BuildDeckSeriesRewardEntry", x => new { x.BuildDeckSeriesEntryId, x.Id });
table.ForeignKey(
name: "FK_BuildDeckSeriesRewardEntry_BuildDeckSeries_BuildDeckSeriesE~",
column: x => x.BuildDeckSeriesEntryId,
principalTable: "BuildDeckSeries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BuildDeckProductCardEntry",
columns: table => new
{
BuildDeckProductEntryId = table.Column<int>(type: "integer", nullable: false),
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
CardId = table.Column<long>(type: "bigint", nullable: false),
Number = table.Column<int>(type: "integer", nullable: false),
IsSpot = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BuildDeckProductCardEntry", x => new { x.BuildDeckProductEntryId, x.Id });
table.ForeignKey(
name: "FK_BuildDeckProductCardEntry_BuildDeckProducts_BuildDeckProduc~",
column: x => x.BuildDeckProductEntryId,
principalTable: "BuildDeckProducts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BuildDeckProductRewardEntry",
columns: table => new
{
BuildDeckProductEntryId = table.Column<int>(type: "integer", nullable: false),
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RewardIndex = table.Column<int>(type: "integer", nullable: false),
RewardType = table.Column<int>(type: "integer", nullable: false),
RewardDetailId = table.Column<long>(type: "bigint", nullable: false),
RewardNumber = table.Column<int>(type: "integer", nullable: false),
MessageId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BuildDeckProductRewardEntry", x => new { x.BuildDeckProductEntryId, x.Id });
table.ForeignKey(
name: "FK_BuildDeckProductRewardEntry_BuildDeckProducts_BuildDeckProd~",
column: x => x.BuildDeckProductEntryId,
principalTable: "BuildDeckProducts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_BuildDeckProducts_SeriesId",
table: "BuildDeckProducts",
column: "SeriesId");
migrationBuilder.CreateIndex(
name: "IX_ViewerBuildDeckProductPurchase_ViewerId_ProductId",
table: "ViewerBuildDeckProductPurchase",
columns: new[] { "ViewerId", "ProductId" },
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BuildDeckProductCardEntry");
migrationBuilder.DropTable(
name: "BuildDeckProductRewardEntry");
migrationBuilder.DropTable(
name: "BuildDeckSeriesRewardEntry");
migrationBuilder.DropTable(
name: "ViewerBuildDeckProductPurchase");
migrationBuilder.DropTable(
name: "BuildDeckProducts");
migrationBuilder.DropTable(
name: "BuildDeckSeries");
}
}
}

View File

@@ -540,6 +540,100 @@ namespace SVSim.Database.Migrations
b.ToTable("Battlefields");
});
modelBuilder.Entity("SVSim.Database.Models.BuildDeckProductEntry", b =>
{
b.Property<int>("Id")
.HasColumnType("integer");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone");
b.Property<string>("DeckCode")
.IsRequired()
.HasColumnType("text");
b.Property<long>("FeaturedCardId")
.HasColumnType("bigint");
b.Property<int?>("IntroPriceCrystal")
.HasColumnType("integer");
b.Property<int?>("IntroPriceRupy")
.HasColumnType("integer");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<int>("LeaderId")
.HasColumnType("integer");
b.Property<string>("ProductNameKey")
.IsRequired()
.HasColumnType("text");
b.Property<int>("PurchaseNumMax")
.HasColumnType("integer");
b.Property<int?>("RegularPriceCrystal")
.HasColumnType("integer");
b.Property<int?>("RegularPriceRupy")
.HasColumnType("integer");
b.Property<int>("SeriesId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("SeriesId");
b.ToTable("BuildDeckProducts");
});
modelBuilder.Entity("SVSim.Database.Models.BuildDeckSeriesEntry", b =>
{
b.Property<int>("Id")
.HasColumnType("integer");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone");
b.Property<string>("DrumrollPath")
.IsRequired()
.HasColumnType("text");
b.Property<string>("IntroKey")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<bool>("IsNew")
.HasColumnType("boolean");
b.Property<string>("NameKey")
.IsRequired()
.HasColumnType("text");
b.Property<int>("OrderIndex")
.HasColumnType("integer");
b.Property<string>("TitlePath")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("BuildDeckSeries");
});
modelBuilder.Entity("SVSim.Database.Models.CardCosmeticReward", b =>
{
b.Property<long>("CardId")
@@ -1975,6 +2069,125 @@ namespace SVSim.Database.Migrations
b.Navigation("World");
});
modelBuilder.Entity("SVSim.Database.Models.BuildDeckProductEntry", b =>
{
b.HasOne("SVSim.Database.Models.BuildDeckSeriesEntry", "Series")
.WithMany("Products")
.HasForeignKey("SeriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsMany("SVSim.Database.Models.BuildDeckProductCardEntry", "Cards", b1 =>
{
b1.Property<int>("BuildDeckProductEntryId")
.HasColumnType("integer");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property<int>("Id"));
b1.Property<long>("CardId")
.HasColumnType("bigint");
b1.Property<bool>("IsSpot")
.HasColumnType("boolean");
b1.Property<int>("Number")
.HasColumnType("integer");
b1.HasKey("BuildDeckProductEntryId", "Id");
b1.ToTable("BuildDeckProductCardEntry");
b1.WithOwner()
.HasForeignKey("BuildDeckProductEntryId");
});
b.OwnsMany("SVSim.Database.Models.BuildDeckProductRewardEntry", "Rewards", b1 =>
{
b1.Property<int>("BuildDeckProductEntryId")
.HasColumnType("integer");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property<int>("Id"));
b1.Property<int>("MessageId")
.HasColumnType("integer");
b1.Property<long>("RewardDetailId")
.HasColumnType("bigint");
b1.Property<int>("RewardIndex")
.HasColumnType("integer");
b1.Property<int>("RewardNumber")
.HasColumnType("integer");
b1.Property<int>("RewardType")
.HasColumnType("integer");
b1.HasKey("BuildDeckProductEntryId", "Id");
b1.ToTable("BuildDeckProductRewardEntry");
b1.WithOwner()
.HasForeignKey("BuildDeckProductEntryId");
});
b.Navigation("Cards");
b.Navigation("Rewards");
b.Navigation("Series");
});
modelBuilder.Entity("SVSim.Database.Models.BuildDeckSeriesEntry", b =>
{
b.OwnsMany("SVSim.Database.Models.BuildDeckSeriesRewardEntry", "SeriesRewards", b1 =>
{
b1.Property<int>("BuildDeckSeriesEntryId")
.HasColumnType("integer");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property<int>("Id"));
b1.Property<int>("ItemIndex")
.HasColumnType("integer");
b1.Property<int>("MessageId")
.HasColumnType("integer");
b1.Property<long>("RewardDetailId")
.HasColumnType("bigint");
b1.Property<int>("RewardNumber")
.HasColumnType("integer");
b1.Property<int>("RewardType")
.HasColumnType("integer");
b1.Property<int>("TierIndex")
.HasColumnType("integer");
b1.HasKey("BuildDeckSeriesEntryId", "Id");
b1.ToTable("BuildDeckSeriesRewardEntry");
b1.WithOwner()
.HasForeignKey("BuildDeckSeriesEntryId");
});
b.Navigation("SeriesRewards");
});
modelBuilder.Entity("SVSim.Database.Models.CardCosmeticReward", b =>
{
b.HasOne("SVSim.Database.Models.ShadowverseCardEntry", "Card")
@@ -2322,6 +2535,34 @@ namespace SVSim.Database.Migrations
b1.Navigation("Viewer");
});
b.OwnsMany("SVSim.Database.Models.ViewerBuildDeckProductPurchase", "BuildDeckPurchases", b1 =>
{
b1.Property<long>("ViewerId")
.HasColumnType("bigint");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property<int>("Id"));
b1.Property<int>("ProductId")
.HasColumnType("integer");
b1.Property<int>("PurchaseCount")
.HasColumnType("integer");
b1.HasKey("ViewerId", "Id");
b1.HasIndex("ViewerId", "ProductId")
.IsUnique();
b1.ToTable("ViewerBuildDeckProductPurchase");
b1.WithOwner()
.HasForeignKey("ViewerId");
});
b.OwnsMany("SVSim.Database.Models.ViewerClassData", "Classes", b1 =>
{
b1.Property<long>("ViewerId")
@@ -2523,6 +2764,8 @@ namespace SVSim.Database.Migrations
.HasForeignKey("ViewerId");
});
b.Navigation("BuildDeckPurchases");
b.Navigation("Cards");
b.Navigation("Classes");
@@ -2558,6 +2801,11 @@ namespace SVSim.Database.Migrations
.IsRequired();
});
modelBuilder.Entity("SVSim.Database.Models.BuildDeckSeriesEntry", b =>
{
b.Navigation("Products");
});
modelBuilder.Entity("SVSim.Database.Models.ClassEntry", b =>
{
b.Navigation("LeaderSkins");