Browse Source

Added HasColumnType to price properties

pull/49/head
gdlcf88 6 years ago
parent
commit
07b8ae39ef
  1. 7
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/OrdersDbContextModelCreatingExtensions.cs
  2. 2661
      samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200506014116_AddedColumnTypes.Designer.cs
  3. 125
      samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200506014116_AddedColumnTypes.cs
  4. 14
      samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/EasyMallMigrationsDbContextModelSnapshot.cs

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

@ -46,6 +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)");
});
builder.Entity<OrderLine>(b =>
@ -53,6 +57,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)");
});
}
}

2661
samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200506014116_AddedColumnTypes.Designer.cs

File diff suppressed because it is too large

125
samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200506014116_AddedColumnTypes.cs

@ -0,0 +1,125 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace EasyMall.Migrations
{
public partial class AddedColumnTypes : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<decimal>(
name: "TotalPrice",
table: "OrdersOrders",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<decimal>(
name: "TotalDiscount",
table: "OrdersOrders",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<decimal>(
name: "RefundedAmount",
table: "OrdersOrders",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<decimal>(
name: "ProductTotalPrice",
table: "OrdersOrders",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<decimal>(
name: "UnitPrice",
table: "OrdersOrderLines",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<decimal>(
name: "TotalPrice",
table: "OrdersOrderLines",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<decimal>(
name: "TotalDiscount",
table: "OrdersOrderLines",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<decimal>(
name: "TotalPrice",
table: "OrdersOrders",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "TotalDiscount",
table: "OrdersOrders",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "RefundedAmount",
table: "OrdersOrders",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "ProductTotalPrice",
table: "OrdersOrders",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "UnitPrice",
table: "OrdersOrderLines",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "TotalPrice",
table: "OrdersOrderLines",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
migrationBuilder.AlterColumn<decimal>(
name: "TotalDiscount",
table: "OrdersOrderLines",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
}
}
}

14
samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/EasyMallMigrationsDbContextModelSnapshot.cs

@ -86,7 +86,7 @@ namespace EasyMall.Migrations
.HasColumnType("datetime2");
b.Property<decimal>("ProductTotalPrice")
.HasColumnType("decimal(18,2)");
.HasColumnType("decimal(18,6)");
b.Property<DateTime?>("ReducedInventoryAfterPaymentTime")
.HasColumnType("datetime2");
@ -95,7 +95,7 @@ namespace EasyMall.Migrations
.HasColumnType("datetime2");
b.Property<decimal>("RefundedAmount")
.HasColumnType("decimal(18,2)");
.HasColumnType("decimal(18,6)");
b.Property<string>("StaffRemark")
.HasColumnType("nvarchar(max)");
@ -108,10 +108,10 @@ namespace EasyMall.Migrations
.HasColumnType("uniqueidentifier");
b.Property<decimal>("TotalDiscount")
.HasColumnType("decimal(18,2)");
.HasColumnType("decimal(18,6)");
b.Property<decimal>("TotalPrice")
.HasColumnType("decimal(18,2)");
.HasColumnType("decimal(18,6)");
b.HasKey("Id");
@ -185,13 +185,13 @@ namespace EasyMall.Migrations
.HasColumnType("nvarchar(max)");
b.Property<decimal>("TotalDiscount")
.HasColumnType("decimal(18,2)");
.HasColumnType("decimal(18,6)");
b.Property<decimal>("TotalPrice")
.HasColumnType("decimal(18,2)");
.HasColumnType("decimal(18,6)");
b.Property<decimal>("UnitPrice")
.HasColumnType("decimal(18,2)");
.HasColumnType("decimal(18,6)");
b.HasKey("Id");

Loading…
Cancel
Save