after refactor cleanup
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DiunaBI.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FixLayerDefaultValues : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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<bool>(
|
||||
name: "IsCancelled",
|
||||
table: "Layers",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false,
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "bit");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsCancelled",
|
||||
table: "Layers",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "bit",
|
||||
oldDefaultValue: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user