Files
sor/Server/src/SOR.Database/Migrations/Game/20260401222603_AddCustomLobbyHexSides.cs
T
97e7698000 Wire HexSides through custom lobby; fix boardTemplateIdOverride empty-string crash
Server:
- CustomRulesOverride: add HexSides (int?) field
- CustomLobby entity: add HexSidesOverride (int?) column
- GameUpdateLobbyRulesHandler: save HexSidesOverride, include HexSides in
  effective rules preview
- GameLobbyReadyHandler: set rules.HexSides from lobby.HexSidesOverride on
  game start
- GameSavePresetHandler: capture BoardShape + HexSides in saved presets
- Migration 20260401222603_AddCustomLobbyHexSides: adds HexSidesOverride to
  custom_lobbies; applied to pg-forge-01 via dotnet ef database update

Client:
- rules_editor_dialog: send null (not "") for boardTemplateIdOverride when no
  template selected — empty string crashed Guid? deserialisation on the server

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-04-01 18:28:08 -04:00

111 lines
3.4 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SOR.Database.Migrations.Game
{
/// <inheritdoc />
public partial class AddCustomLobbyHexSides : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "HexSides",
schema: "game",
table: "game_rule_sets",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer",
oldDefaultValue: 0);
migrationBuilder.AlterColumn<string>(
name: "GridType",
schema: "game",
table: "game_rule_sets",
type: "text",
nullable: false,
oldClrType: typeof(string),
oldType: "text",
oldDefaultValue: "Square");
migrationBuilder.AddColumn<int>(
name: "HexSidesOverride",
schema: "game",
table: "custom_lobbies",
type: "integer",
nullable: true);
migrationBuilder.AlterColumn<int>(
name: "HexSides",
schema: "game",
table: "board_templates",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer",
oldDefaultValue: 0);
migrationBuilder.AlterColumn<string>(
name: "GridType",
schema: "game",
table: "board_templates",
type: "text",
nullable: false,
oldClrType: typeof(string),
oldType: "text",
oldDefaultValue: "Square");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "HexSidesOverride",
schema: "game",
table: "custom_lobbies");
migrationBuilder.AlterColumn<int>(
name: "HexSides",
schema: "game",
table: "game_rule_sets",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer");
migrationBuilder.AlterColumn<string>(
name: "GridType",
schema: "game",
table: "game_rule_sets",
type: "text",
nullable: false,
defaultValue: "Square",
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<int>(
name: "HexSides",
schema: "game",
table: "board_templates",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer");
migrationBuilder.AlterColumn<string>(
name: "GridType",
schema: "game",
table: "board_templates",
type: "text",
nullable: false,
defaultValue: "Square",
oldClrType: typeof(string),
oldType: "text");
}
}
}