using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Backend.Migrations { /// public partial class AddSeasonWorkflowRulesJson : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "WorkflowRulesJson", table: "Seasons", type: "text", nullable: false, defaultValue: "[]"); migrationBuilder.Sql( """ UPDATE "Seasons" SET "WorkflowRulesJson" = COALESCE(NULLIF((SELECT "WorkflowRulesJson" FROM "SiteSettings" WHERE "Id" = 1), ''), '[]') WHERE COALESCE("WorkflowRulesJson", '') = ''; """); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "WorkflowRulesJson", table: "Seasons"); } } }