diff --git a/src/DispenserProvider.DataBase/Models/BuilderDTO.cs b/src/DispenserProvider.DataBase/Models/BuilderDTO.cs index 60bba87..7e8bd55 100644 --- a/src/DispenserProvider.DataBase/Models/BuilderDTO.cs +++ b/src/DispenserProvider.DataBase/Models/BuilderDTO.cs @@ -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; } diff --git a/src/DispenserProvider.Migrations/Migrations/20241213123343_Update-Amount-To-WeiAmount.Designer.cs b/src/DispenserProvider.Migrations/Migrations/20241213123343_Update-Amount-To-WeiAmount.Designer.cs new file mode 100644 index 0000000..f32b6b0 --- /dev/null +++ b/src/DispenserProvider.Migrations/Migrations/20241213123343_Update-Amount-To-WeiAmount.Designer.cs @@ -0,0 +1,237 @@ +// +using System; +using DispenserProvider.DataBase; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace DispenserProvider.DataBase.Migrations +{ + [DbContext(typeof(DispenserContext))] + [Migration("20241213123343_Update-Amount-To-WeiAmount")] + partial class UpdateAmountToWeiAmount + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("DispenserProvider.DataBase.Models.BuilderDTO", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("FinishTime") + .HasColumnType("datetime2(0)"); + + b.Property("ProviderAddress") + .IsRequired() + .HasColumnType("nvarchar(42)"); + + b.Property("StartTime") + .HasColumnType("datetime2(0)"); + + b.Property("TransactionDetailId") + .HasColumnType("bigint"); + + b.Property("WeiAmount") + .IsRequired() + .HasColumnType("nvarchar(78)"); + + b.HasKey("Id"); + + b.HasIndex("TransactionDetailId"); + + b.ToTable("Builders"); + }); + + modelBuilder.Entity("DispenserProvider.DataBase.Models.DispenserDTO", b => + { + b.Property("Id") + .HasColumnType("nvarchar(64)"); + + b.Property("CreationLogSignature") + .IsRequired() + .HasColumnType("nvarchar(132)"); + + b.Property("DeletionLogSignature") + .HasColumnType("nvarchar(132)"); + + b.Property("RefundDetailId") + .HasColumnType("bigint"); + + b.Property("RefundFinishTime") + .HasColumnType("datetime2(0)"); + + b.Property("Signature") + .HasColumnType("nvarchar(132)"); + + b.Property("UserAddress") + .IsRequired() + .HasColumnType("nvarchar(42)"); + + b.Property("WithdrawalDetailId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("CreationLogSignature"); + + b.HasIndex("DeletionLogSignature"); + + b.HasIndex("RefundDetailId") + .IsUnique() + .HasFilter("[RefundDetailId] IS NOT NULL"); + + b.HasIndex("Signature") + .IsUnique() + .HasFilter("[Signature] IS NOT NULL"); + + b.HasIndex("WithdrawalDetailId") + .IsUnique(); + + b.ToTable("Dispenser"); + }); + + modelBuilder.Entity("DispenserProvider.DataBase.Models.LogDTO", b => + { + b.Property("Signature") + .HasColumnType("nvarchar(132)"); + + b.Property("CreationTime") + .HasColumnType("datetime2(0)"); + + b.Property("Operation") + .IsRequired() + .HasColumnType("nvarchar(32)"); + + b.HasKey("Signature"); + + b.ToTable("Logs"); + }); + + modelBuilder.Entity("DispenserProvider.DataBase.Models.SignatureDTO", b => + { + b.Property("Signature") + .HasColumnType("nvarchar(132)"); + + b.Property("IsRefund") + .HasColumnType("bit"); + + b.Property("ValidFrom") + .HasColumnType("datetime2(0)"); + + b.Property("ValidUntil") + .HasColumnType("datetime2(0)"); + + b.HasKey("Signature"); + + b.ToTable("Signatures"); + }); + + modelBuilder.Entity("DispenserProvider.DataBase.Models.TransactionDetailDTO", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ChainId") + .HasColumnType("bigint"); + + b.Property("PoolId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.ToTable("TransactionDetails"); + }); + + modelBuilder.Entity("DispenserProvider.DataBase.Models.BuilderDTO", b => + { + b.HasOne("DispenserProvider.DataBase.Models.TransactionDetailDTO", "TransactionDetail") + .WithMany("Builders") + .HasForeignKey("TransactionDetailId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TransactionDetail"); + }); + + modelBuilder.Entity("DispenserProvider.DataBase.Models.DispenserDTO", b => + { + b.HasOne("DispenserProvider.DataBase.Models.LogDTO", "CreationLog") + .WithMany("CreationDispensers") + .HasForeignKey("CreationLogSignature") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DispenserProvider.DataBase.Models.LogDTO", "DeletionLog") + .WithMany("DeletionDispensers") + .HasForeignKey("DeletionLogSignature") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("DispenserProvider.DataBase.Models.TransactionDetailDTO", "RefundDetail") + .WithOne() + .HasForeignKey("DispenserProvider.DataBase.Models.DispenserDTO", "RefundDetailId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("DispenserProvider.DataBase.Models.SignatureDTO", "UserSignature") + .WithOne("Dispenser") + .HasForeignKey("DispenserProvider.DataBase.Models.DispenserDTO", "Signature") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("DispenserProvider.DataBase.Models.TransactionDetailDTO", "WithdrawalDetail") + .WithOne("Dispenser") + .HasForeignKey("DispenserProvider.DataBase.Models.DispenserDTO", "WithdrawalDetailId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CreationLog"); + + b.Navigation("DeletionLog"); + + b.Navigation("RefundDetail"); + + b.Navigation("UserSignature"); + + b.Navigation("WithdrawalDetail"); + }); + + modelBuilder.Entity("DispenserProvider.DataBase.Models.LogDTO", b => + { + b.Navigation("CreationDispensers"); + + b.Navigation("DeletionDispensers"); + }); + + modelBuilder.Entity("DispenserProvider.DataBase.Models.SignatureDTO", b => + { + b.Navigation("Dispenser") + .IsRequired(); + }); + + modelBuilder.Entity("DispenserProvider.DataBase.Models.TransactionDetailDTO", b => + { + b.Navigation("Builders"); + + b.Navigation("Dispenser") + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/DispenserProvider.Migrations/Migrations/20241213123343_Update-Amount-To-WeiAmount.cs b/src/DispenserProvider.Migrations/Migrations/20241213123343_Update-Amount-To-WeiAmount.cs new file mode 100644 index 0000000..18d5022 --- /dev/null +++ b/src/DispenserProvider.Migrations/Migrations/20241213123343_Update-Amount-To-WeiAmount.cs @@ -0,0 +1,40 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace DispenserProvider.DataBase.Migrations +{ + /// + public partial class UpdateAmountToWeiAmount : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Amount", + table: "Builders"); + + migrationBuilder.AddColumn( + name: "WeiAmount", + table: "Builders", + type: "nvarchar(78)", + nullable: false, + defaultValue: ""); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "WeiAmount", + table: "Builders"); + + migrationBuilder.AddColumn( + name: "Amount", + table: "Builders", + type: "decimal(36,18)", + nullable: false, + defaultValue: 0m); + } + } +} diff --git a/src/DispenserProvider.Migrations/Migrations/DispenserContextModelSnapshot.cs b/src/DispenserProvider.Migrations/Migrations/DispenserContextModelSnapshot.cs index cc3fbe1..36a9d31 100644 --- a/src/DispenserProvider.Migrations/Migrations/DispenserContextModelSnapshot.cs +++ b/src/DispenserProvider.Migrations/Migrations/DispenserContextModelSnapshot.cs @@ -30,9 +30,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("Amount") - .HasColumnType("decimal(36,18)"); - b.Property("FinishTime") .HasColumnType("datetime2(0)"); @@ -46,6 +43,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("TransactionDetailId") .HasColumnType("bigint"); + b.Property("WeiAmount") + .IsRequired() + .HasColumnType("nvarchar(78)"); + b.HasKey("Id"); b.HasIndex("TransactionDetailId");