Refactor user settings management to remove IsGmxEnabled and DefaultExchange from updatable fields, introducing GmxSlippage instead. Update UserController, UserService, and related DTOs to reflect these changes, ensuring proper handling of user settings. Adjust database schema and migrations to accommodate the new GmxSlippage property, enhancing user customization options for trading configurations.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user