Browse Source

Close #52: Change all the money value data types to decimal(20,8)

pull/57/head
gdlcf88 6 years ago
parent
commit
fd8ee384e8
  1. 14
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/OrdersDbContextModelCreatingExtensions.cs
  2. 18
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp/EShop/Payments/EntityFrameworkCore/PaymentsDbContextModelCreatingExtensions.cs
  3. 4
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/ProductsDbContextModelCreatingExtensions.cs
  4. 3543
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200620070213_ChangedMoneyToDecimal20_8.Designer.cs
  5. 303
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200620070213_ChangedMoneyToDecimal20_8.cs
  6. 36
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/EShopSampleMigrationsDbContextModelSnapshot.cs

14
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/OrdersDbContextModelCreatingExtensions.cs

@ -46,10 +46,10 @@ namespace EasyAbp.EShop.Orders.EntityFrameworkCore
b.ToTable(options.TablePrefix + "Orders", options.Schema);
b.ConfigureByConvention();
/* Configure more properties here */
b.Property(x => x.ProductTotalPrice).HasColumnType("decimal(18,6)");
b.Property(x => x.TotalPrice).HasColumnType("decimal(18,6)");
b.Property(x => x.TotalDiscount).HasColumnType("decimal(18,6)");
b.Property(x => x.RefundedAmount).HasColumnType("decimal(18,6)");
b.Property(x => x.ProductTotalPrice).HasColumnType("decimal(20,8)");
b.Property(x => x.TotalPrice).HasColumnType("decimal(20,8)");
b.Property(x => x.TotalDiscount).HasColumnType("decimal(20,8)");
b.Property(x => x.RefundedAmount).HasColumnType("decimal(20,8)");
b.HasIndex(x => x.OrderNumber).IsUnique();
});
@ -58,9 +58,9 @@ namespace EasyAbp.EShop.Orders.EntityFrameworkCore
b.ToTable(options.TablePrefix + "OrderLines", options.Schema);
b.ConfigureByConvention();
/* Configure more properties here */
b.Property(x => x.TotalPrice).HasColumnType("decimal(18,6)");
b.Property(x => x.TotalDiscount).HasColumnType("decimal(18,6)");
b.Property(x => x.UnitPrice).HasColumnType("decimal(18,6)");
b.Property(x => x.TotalPrice).HasColumnType("decimal(20,8)");
b.Property(x => x.TotalDiscount).HasColumnType("decimal(20,8)");
b.Property(x => x.UnitPrice).HasColumnType("decimal(20,8)");
});
}
}

18
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp/EShop/Payments/EntityFrameworkCore/PaymentsDbContextModelCreatingExtensions.cs

@ -47,10 +47,10 @@ namespace EasyAbp.EShop.Payments.EntityFrameworkCore
b.ToTable(options.TablePrefix + "Payments", options.Schema);
b.ConfigureByConvention();
/* Configure more properties here */
b.Property(x => x.ActualPaymentAmount).HasColumnType("decimal(18,6)");
b.Property(x => x.OriginalPaymentAmount).HasColumnType("decimal(18,6)");
b.Property(x => x.PaymentDiscount).HasColumnType("decimal(18,6)");
b.Property(x => x.RefundAmount).HasColumnType("decimal(18,6)");
b.Property(x => x.ActualPaymentAmount).HasColumnType("decimal(20,8)");
b.Property(x => x.OriginalPaymentAmount).HasColumnType("decimal(20,8)");
b.Property(x => x.PaymentDiscount).HasColumnType("decimal(20,8)");
b.Property(x => x.RefundAmount).HasColumnType("decimal(20,8)");
});
builder.Entity<Refund>(b =>
@ -58,7 +58,7 @@ namespace EasyAbp.EShop.Payments.EntityFrameworkCore
b.ToTable(options.TablePrefix + "Refunds", options.Schema);
b.ConfigureByConvention();
/* Configure more properties here */
b.Property(x => x.RefundAmount).HasColumnType("decimal(18,6)");
b.Property(x => x.RefundAmount).HasColumnType("decimal(20,8)");
});
builder.Entity<PaymentItem>(b =>
@ -66,10 +66,10 @@ namespace EasyAbp.EShop.Payments.EntityFrameworkCore
b.ToTable(options.TablePrefix + "PaymentItems", options.Schema);
b.ConfigureByConvention();
/* Configure more properties here */
b.Property(x => x.ActualPaymentAmount).HasColumnType("decimal(18,6)");
b.Property(x => x.OriginalPaymentAmount).HasColumnType("decimal(18,6)");
b.Property(x => x.PaymentDiscount).HasColumnType("decimal(18,6)");
b.Property(x => x.RefundAmount).HasColumnType("decimal(18,6)");
b.Property(x => x.ActualPaymentAmount).HasColumnType("decimal(20,8)");
b.Property(x => x.OriginalPaymentAmount).HasColumnType("decimal(20,8)");
b.Property(x => x.PaymentDiscount).HasColumnType("decimal(20,8)");
b.Property(x => x.RefundAmount).HasColumnType("decimal(20,8)");
});
}
}

4
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/ProductsDbContextModelCreatingExtensions.cs

@ -81,8 +81,8 @@ namespace EasyAbp.EShop.Products.EntityFrameworkCore
b.ToTable(options.TablePrefix + "ProductSkus", options.Schema);
b.ConfigureByConvention();
/* Configure more properties here */
b.Property(x => x.Price).HasColumnType("decimal(18,6)");
b.Property(x => x.OriginalPrice).HasColumnType("decimal(18,6)");
b.Property(x => x.Price).HasColumnType("decimal(20,8)");
b.Property(x => x.OriginalPrice).HasColumnType("decimal(20,8)");
});
builder.Entity<Category>(b =>

3543
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200620070213_ChangedMoneyToDecimal20_8.Designer.cs

File diff suppressed because it is too large

303
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200620070213_ChangedMoneyToDecimal20_8.cs

@ -0,0 +1,303 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace EShopSample.Migrations
{
public partial class ChangedMoneyToDecimal20_8 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<decimal>(
name: "Price",
table: "EShopProductsProductSkus",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "OriginalPrice",
table: "EShopProductsProductSkus",
type: "decimal(20,8)",
nullable: true,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)",
oldNullable: true);
migrationBuilder.AlterColumn<decimal>(
name: "RefundAmount",
table: "EShopPaymentsRefunds",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "RefundAmount",
table: "EShopPaymentsPayments",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "PaymentDiscount",
table: "EShopPaymentsPayments",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "OriginalPaymentAmount",
table: "EShopPaymentsPayments",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "ActualPaymentAmount",
table: "EShopPaymentsPayments",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "RefundAmount",
table: "EShopPaymentsPaymentItems",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "PaymentDiscount",
table: "EShopPaymentsPaymentItems",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "OriginalPaymentAmount",
table: "EShopPaymentsPaymentItems",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "ActualPaymentAmount",
table: "EShopPaymentsPaymentItems",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "TotalPrice",
table: "EShopOrdersOrders",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "TotalDiscount",
table: "EShopOrdersOrders",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "RefundedAmount",
table: "EShopOrdersOrders",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "ProductTotalPrice",
table: "EShopOrdersOrders",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "UnitPrice",
table: "EShopOrdersOrderLines",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "TotalPrice",
table: "EShopOrdersOrderLines",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "TotalDiscount",
table: "EShopOrdersOrderLines",
type: "decimal(20,8)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<decimal>(
name: "Price",
table: "EShopProductsProductSkus",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "OriginalPrice",
table: "EShopProductsProductSkus",
type: "decimal(18,6)",
nullable: true,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)",
oldNullable: true);
migrationBuilder.AlterColumn<decimal>(
name: "RefundAmount",
table: "EShopPaymentsRefunds",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "RefundAmount",
table: "EShopPaymentsPayments",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "PaymentDiscount",
table: "EShopPaymentsPayments",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "OriginalPaymentAmount",
table: "EShopPaymentsPayments",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "ActualPaymentAmount",
table: "EShopPaymentsPayments",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "RefundAmount",
table: "EShopPaymentsPaymentItems",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "PaymentDiscount",
table: "EShopPaymentsPaymentItems",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "OriginalPaymentAmount",
table: "EShopPaymentsPaymentItems",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "ActualPaymentAmount",
table: "EShopPaymentsPaymentItems",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "TotalPrice",
table: "EShopOrdersOrders",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "TotalDiscount",
table: "EShopOrdersOrders",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "RefundedAmount",
table: "EShopOrdersOrders",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "ProductTotalPrice",
table: "EShopOrdersOrders",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "UnitPrice",
table: "EShopOrdersOrderLines",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "TotalPrice",
table: "EShopOrdersOrderLines",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
migrationBuilder.AlterColumn<decimal>(
name: "TotalDiscount",
table: "EShopOrdersOrderLines",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(20,8)");
}
}
}

36
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/EShopSampleMigrationsDbContextModelSnapshot.cs

@ -94,7 +94,7 @@ namespace EShopSample.Migrations
.HasColumnType("uniqueidentifier");
b.Property<decimal>("ProductTotalPrice")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<DateTime?>("ReducedInventoryAfterPaymentTime")
.HasColumnType("datetime2");
@ -103,7 +103,7 @@ namespace EShopSample.Migrations
.HasColumnType("datetime2");
b.Property<decimal>("RefundedAmount")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<string>("StaffRemark")
.HasColumnType("nvarchar(max)");
@ -116,10 +116,10 @@ namespace EShopSample.Migrations
.HasColumnType("uniqueidentifier");
b.Property<decimal>("TotalDiscount")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<decimal>("TotalPrice")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.HasKey("Id");
@ -197,13 +197,13 @@ namespace EShopSample.Migrations
.HasColumnType("nvarchar(max)");
b.Property<decimal>("TotalDiscount")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<decimal>("TotalPrice")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<decimal>("UnitPrice")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.HasKey("Id");
@ -219,7 +219,7 @@ namespace EShopSample.Migrations
.HasColumnType("uniqueidentifier");
b.Property<decimal>("ActualPaymentAmount")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<DateTime?>("CancelledTime")
.HasColumnType("datetime2");
@ -273,19 +273,19 @@ namespace EShopSample.Migrations
.HasColumnType("uniqueidentifier");
b.Property<decimal>("OriginalPaymentAmount")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<string>("PayeeAccount")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("PaymentDiscount")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<string>("PaymentMethod")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("RefundAmount")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<Guid?>("StoreId")
.HasColumnType("uniqueidentifier");
@ -309,7 +309,7 @@ namespace EShopSample.Migrations
.HasColumnType("uniqueidentifier");
b.Property<decimal>("ActualPaymentAmount")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
@ -351,16 +351,16 @@ namespace EShopSample.Migrations
.HasColumnType("uniqueidentifier");
b.Property<decimal>("OriginalPaymentAmount")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<decimal>("PaymentDiscount")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<Guid?>("PaymentId")
.HasColumnType("uniqueidentifier");
b.Property<decimal>("RefundAmount")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.HasKey("Id");
@ -430,7 +430,7 @@ namespace EShopSample.Migrations
.HasColumnType("uniqueidentifier");
b.Property<decimal>("RefundAmount")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<string>("RefundPaymentMethod")
.HasColumnType("nvarchar(max)");
@ -1053,10 +1053,10 @@ namespace EShopSample.Migrations
.HasColumnType("int");
b.Property<decimal?>("OriginalPrice")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<decimal>("Price")
.HasColumnType("decimal(18,6)");
.HasColumnType("decimal(20,8)");
b.Property<Guid?>("ProductDetailId")
.HasColumnType("uniqueidentifier");

Loading…
Cancel
Save