using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using RadicadeServer.DB; #nullable disable namespace RadicadeServer.Migrations { [DbContext(typeof(RecDBContext))] [Migration("20260928000000_AddModerationStartAndNote")] public partial class AddModerationStartAndNote : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.Sql(@" IF COL_LENGTH(N'dbo.Moderation', N'CreatedAt') IS NULL ALTER TABLE [dbo].[Moderation] ADD [CreatedAt] datetime2 NOT NULL CONSTRAINT [DF_Moderation_CreatedAt] DEFAULT GETUTCDATE(); IF COL_LENGTH(N'dbo.Moderation', N'ModeratorNote') IS NULL ALTER TABLE [dbo].[Moderation] ADD [ModeratorNote] nvarchar(max) NULL;"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.Sql(@" IF COL_LENGTH(N'dbo.Moderation', N'ModeratorNote') IS NOT NULL ALTER TABLE [dbo].[Moderation] DROP COLUMN [ModeratorNote]; IF COL_LENGTH(N'dbo.Moderation', N'CreatedAt') IS NOT NULL ALTER TABLE [dbo].[Moderation] DROP COLUMN [CreatedAt];"); } } }