using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Infrastructure; using RadicadeServer.DB; #nullable disable namespace RadicadeServer.Migrations; [DbContext(typeof(RecDBContext))] [Migration("20260920120000_AddPlayerWarnings")] public partial class AddPlayerWarnings : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.Sql(@" IF OBJECT_ID(N'dbo.PlayerWarnings', N'U') IS NULL BEGIN CREATE TABLE [dbo].[PlayerWarnings] ( [Id] bigint IDENTITY(1,1) NOT NULL, [ModeratorPlayerId] bigint NOT NULL, [WarnedPlayerId] bigint NOT NULL, [ReportCategory] int NOT NULL, [DisplayReason] nvarchar(max) NULL, [ModeratorNote] nvarchar(max) NULL, [CreatedAt] datetime2 NOT NULL, [AcknowledgedAt] datetime2 NULL, CONSTRAINT [PK_PlayerWarnings] PRIMARY KEY CLUSTERED ([Id] ASC) ); -- Both lookups on this table are by player: the moderator view lists what was issued -- to a player, and every moderationBlockDetails poll asks whether the caller has one -- pending. CREATE INDEX [IX_PlayerWarnings_WarnedPlayerId] ON [dbo].[PlayerWarnings] ([WarnedPlayerId]); CREATE INDEX [IX_PlayerWarnings_ModeratorPlayerId] ON [dbo].[PlayerWarnings] ([ModeratorPlayerId]); END"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.Sql(@" IF OBJECT_ID(N'dbo.PlayerWarnings', N'U') IS NOT NULL DROP TABLE [dbo].[PlayerWarnings];"); } }