Files
SVSimServer/SVSim.Database/Migrations/20260613155613_AddArenaColosseumRun.cs
gamer147 110867358c feat(arena-colosseum): lobby + constructed entry (phase 1)
Closes 5 of arena-colosseum's 16 spec shapes (1/16 → 6/16). Lobby reads
(/top, /get_fee_info, /event_info) render an empty "no event scheduled"
payload by default; /entry + /register_deck activate via admin-flipped
ColosseumSeason + ColosseumRounds config sections.

* Schema: ViewerArenaColosseumRun standalone table (unique on ViewerId)
  with jsonb run-state columns mirroring ViewerArenaTwoPickRun.
* Config sections: ColosseumSeasonConfig (event-level), ColosseumRoundsConfig
  (the 3-round bracket). Empty defaults — IsColosseumPeriod=false.
* Migration AddArenaColosseumRun (DDL only; seed rows come from the section
  ShippedDefaults via EnsureSeedDataAsync).
* DTOs: ColosseumLobbyInfo (round-level, /top + /get_fee_info), ColosseumEventInfo
  (event-level, /event_info), ColosseumOwnStatus (shared status block),
  ColosseumEntryRef, ColosseumFeeList, ColosseumUserDeck, ColosseumBattleResults,
  ColosseumRoundDetail + ColosseumGroupRow. EventInfoResponse uses explicit
  [JsonPropertyName("1"|"2"|"3")] for the string-keyed rounds shape per spec.
* Controller: ArenaColosseumController replaces the 1-action stub with
  the five lifecycle endpoints. /top emits leader_skin_id even when 0
  (project_wire_null_policy override).
* Tests: 11 controller-level tests + 6 config round-trip tests covering
  empty-season payloads, run-seeded /top round-trip, crystal/rupy entry
  debits, now_round_id mismatch rejection, deck_no_list round-trip + reject.
2026-06-13 12:16:22 -04:00

70 lines
3.8 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace SVSim.Database.Migrations
{
/// <inheritdoc />
public partial class AddArenaColosseumRun : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ViewerArenaColosseumRuns",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ViewerId = table.Column<long>(type: "bigint", nullable: false),
EntryId = table.Column<long>(type: "bigint", nullable: false),
SeasonId = table.Column<int>(type: "integer", nullable: false),
RoundId = table.Column<int>(type: "integer", nullable: false),
DeckFormat = table.Column<int>(type: "integer", nullable: false),
LeaderSkinId = table.Column<long>(type: "bigint", nullable: false),
ConsumeItemType = table.Column<int>(type: "integer", nullable: false),
CandidateClassIdsJson = table.Column<string>(type: "jsonb", nullable: false),
SelectTurn = table.Column<int>(type: "integer", nullable: false),
IsSelectCompleted = table.Column<bool>(type: "boolean", nullable: false),
SelectedCardIdsJson = table.Column<string>(type: "jsonb", nullable: false),
PendingPickSetsJson = table.Column<string>(type: "jsonb", nullable: false),
NextCandidateId = table.Column<long>(type: "bigint", nullable: false),
ClassId = table.Column<int>(type: "integer", nullable: false),
ChaosId = table.Column<int>(type: "integer", nullable: false),
ResultListJson = table.Column<string>(type: "jsonb", nullable: false),
WinCount = table.Column<int>(type: "integer", nullable: false),
LossCount = table.Column<int>(type: "integer", nullable: false),
BattleCountThisRound = table.Column<int>(type: "integer", nullable: false),
MaxBattleCountThisRound = table.Column<int>(type: "integer", nullable: false),
BreakthroughNumberThisRound = table.Column<int>(type: "integer", nullable: false),
RestEntryNum = table.Column<int>(type: "integer", nullable: false),
IsRankMatching = table.Column<bool>(type: "boolean", nullable: false),
IsChampion = table.Column<bool>(type: "boolean", nullable: false),
RegisteredDeckNoListJson = table.Column<string>(type: "jsonb", nullable: false),
IsPublished = table.Column<bool>(type: "boolean", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ViewerArenaColosseumRuns", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_ViewerArenaColosseumRuns_ViewerId",
table: "ViewerArenaColosseumRuns",
column: "ViewerId",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ViewerArenaColosseumRuns");
}
}
}