Skip to content

Commit

Permalink
fix: use decimal/numeric
Browse files Browse the repository at this point in the history
  • Loading branch information
CumpsD committed Jan 28, 2025
1 parent 0fe4ec8 commit 302aaa3
Show file tree
Hide file tree
Showing 6 changed files with 451 additions and 10 deletions.
10 changes: 5 additions & 5 deletions swappy-bot/EntityFramework/SwapState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ public override void Configure(EntityTypeBuilder<SwapState> builder)

builder.Property(x => x.AssetFrom).IsRequired(false).HasMaxLength(10);
builder.Property(x => x.AssetTo).IsRequired(false).HasMaxLength(10);
builder.Property(x => x.Amount).IsRequired(false);
builder.Property(x => x.Amount).IsRequired(false).HasPrecision(27, 18);
builder.Property(x => x.DestinationAddress).IsRequired(false).HasMaxLength(100);

builder.Property(x => x.QuoteTime).IsRequired(false);
builder.HasIndex(x => x.QuoteTime);

builder.Property(x => x.QuoteDeposit).IsRequired(false);
builder.Property(x => x.QuoteReceive).IsRequired(false);
builder.Property(x => x.QuoteDeposit).IsRequired(false).HasPrecision(27, 18);
builder.Property(x => x.QuoteReceive).IsRequired(false).HasPrecision(27, 18);
builder.Property(x => x.QuoteRate).IsRequired(false).HasMaxLength(200);
builder.Property(x => x.QuotePlatformFee).IsRequired(false);
builder.Property(x => x.QuoteChainflipFee).IsRequired(false);
builder.Property(x => x.QuotePlatformFee).IsRequired(false).HasPrecision(27, 18);
builder.Property(x => x.QuoteChainflipFee).IsRequired(false).HasPrecision(27, 18);

builder.Property(x => x.SwapAccepted).IsRequired(false);
builder.HasIndex(x => x.SwapAccepted);
Expand Down
143 changes: 143 additions & 0 deletions swappy-bot/Migrations/20250128204642_FixPrecisions.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions swappy-bot/Migrations/20250128204642_FixPrecisions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace SwappyBot.Migrations
{
/// <inheritdoc />
public partial class FixPrecisions : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<decimal>(
name: "amount",
table: "swap_state",
type: "numeric(27,18)",
precision: 27,
scale: 18,
nullable: true,
oldClrType: typeof(decimal),
oldType: "numeric",
oldNullable: true);
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<decimal>(
name: "amount",
table: "swap_state",
type: "numeric",
nullable: true,
oldClrType: typeof(decimal),
oldType: "numeric(27,18)",
oldPrecision: 27,
oldScale: 18,
oldNullable: true);
}
}
}
147 changes: 147 additions & 0 deletions swappy-bot/Migrations/20250128204729_FixAllPrecisions.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 302aaa3

Please sign in to comment.