Skip to content

Commit

Permalink
Change Amount to WeiAmount at BuilderDTO (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArdenHide authored Dec 13, 2024
1 parent aea413f commit 04d5f35
Show file tree
Hide file tree
Showing 4 changed files with 283 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/DispenserProvider.DataBase/Models/BuilderDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class BuilderDTO
[Column(TypeName = "nvarchar(42)")]
public string ProviderAddress { get; set; } = null!;

[Column(TypeName = "decimal(36,18)")]
public decimal Amount { get; set; }
[Column(TypeName = "nvarchar(78)")]
public string WeiAmount { get; set; } = null!;

[Column(TypeName = "datetime2(0)")]
public DateTime? StartTime { get; set; }
Expand Down

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace DispenserProvider.DataBase.Migrations
{
/// <inheritdoc />
public partial class UpdateAmountToWeiAmount : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Amount",
table: "Builders");

migrationBuilder.AddColumn<string>(
name: "WeiAmount",
table: "Builders",
type: "nvarchar(78)",
nullable: false,
defaultValue: "");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "WeiAmount",
table: "Builders");

migrationBuilder.AddColumn<decimal>(
name: "Amount",
table: "Builders",
type: "decimal(36,18)",
nullable: false,
defaultValue: 0m);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));

b.Property<decimal>("Amount")
.HasColumnType("decimal(36,18)");

b.Property<DateTime?>("FinishTime")
.HasColumnType("datetime2(0)");

Expand All @@ -46,6 +43,10 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<long>("TransactionDetailId")
.HasColumnType("bigint");

b.Property<string>("WeiAmount")
.IsRequired()
.HasColumnType("nvarchar(78)");

b.HasKey("Id");

b.HasIndex("TransactionDetailId");
Expand Down

0 comments on commit 04d5f35

Please sign in to comment.