using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace DiunaBI.Infrastructure.Migrations { /// public partial class FixLayerDefaultValues : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { // Ensure IsDeleted has default constraint (in case previous migration didn't apply it correctly) migrationBuilder.Sql(@" IF NOT EXISTS (SELECT 1 FROM sys.default_constraints WHERE parent_object_id = OBJECT_ID('Layers') AND COL_NAME(parent_object_id, parent_column_id) = 'IsDeleted') BEGIN ALTER TABLE [Layers] ADD CONSTRAINT [DF_Layers_IsDeleted] DEFAULT 0 FOR [IsDeleted]; END "); // Add default constraint for IsCancelled migrationBuilder.AlterColumn( name: "IsCancelled", table: "Layers", type: "bit", nullable: false, defaultValue: false, oldClrType: typeof(bool), oldType: "bit"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "IsCancelled", table: "Layers", type: "bit", nullable: false, oldClrType: typeof(bool), oldType: "bit", oldDefaultValue: false); } } }