Files
Radicade/Server/Migrations/20261015120000_AddRoomJoinGiftFromPlayerId.cs
2026-10-16 23:33:13 -07:00

33 lines
1.1 KiB
C#

using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using RadicadeServer.DB;
#nullable disable
namespace RadicadeServer.Migrations
{
/// <summary>
/// Who a room's join box is from. The box already travelled with RecNet's
/// Gift.FromPlayerId, but no room could set it, so every join box arrived with a sender of
/// zero and the client had no name to put on it.
/// </summary>
[DbContext(typeof(RecDBContext))]
[Migration("20261015120000_AddRoomJoinGiftFromPlayerId")]
public partial class AddRoomJoinGiftFromPlayerId : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(@"
IF COL_LENGTH(N'dbo.Rooms', N'JoinGiftFromPlayerId') IS NULL
ALTER TABLE [Rooms] ADD [JoinGiftFromPlayerId] bigint NOT NULL DEFAULT 0;");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(@"
IF COL_LENGTH(N'dbo.Rooms', N'JoinGiftFromPlayerId') IS NOT NULL
ALTER TABLE [Rooms] DROP COLUMN [JoinGiftFromPlayerId];");
}
}
}