using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Managing.Infrastructure.Databases.Migrations
{
///
public partial class AddGmxSlippageSetting : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
// Add column with default value
migrationBuilder.AddColumn(
name: "GmxSlippage",
table: "Users",
type: "numeric(5,2)",
nullable: true,
defaultValue: 0.5m);
// Update existing NULL values to default
migrationBuilder.Sql(@"
UPDATE ""Users""
SET ""GmxSlippage"" = 0.5
WHERE ""GmxSlippage"" IS NULL;
");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "GmxSlippage",
table: "Users");
}
}
}