38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Managing.Infrastructure.Databases.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddGmxSlippageSetting : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
// Add column with default value
|
|
migrationBuilder.AddColumn<decimal>(
|
|
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;
|
|
");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropColumn(
|
|
name: "GmxSlippage",
|
|
table: "Users");
|
|
}
|
|
}
|
|
}
|