diff --git a/Directory.Build.props b/Directory.Build.props index 1a72b9ab..69b1917f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ - 3.413.0 + 3.414.0 $(VersionSuffix)-$(BuildNumber) diff --git a/src/VirtoCommerce.OrdersModule.Core/Model/LineItem.cs b/src/VirtoCommerce.OrdersModule.Core/Model/LineItem.cs index 39273ea9..27205fb6 100644 --- a/src/VirtoCommerce.OrdersModule.Core/Model/LineItem.cs +++ b/src/VirtoCommerce.OrdersModule.Core/Model/LineItem.cs @@ -80,6 +80,7 @@ public class LineItem : AuditableEntity, IHasTaxDetalization, ISupportCancellati public string CategoryId { get; set; } public string Name { get; set; } + public string ProductOuterId { get; set; } public string Comment { get; set; } public string Status { get; set; } diff --git a/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj b/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj index f5917ef9..abb31827 100644 --- a/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj +++ b/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20230911181734_AddProductOuterId.Designer.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20230911181734_AddProductOuterId.Designer.cs new file mode 100644 index 00000000..9d6970e1 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20230911181734_AddProductOuterId.Designer.cs @@ -0,0 +1,2054 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using VirtoCommerce.OrdersModule.Data.Repositories; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations +{ + [DbContext(typeof(OrderDbContext))] + [Migration("20230911181734_AddProductOuterId")] + partial class AddProductOuterId + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.13") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("AddressType") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("Email") + .HasMaxLength(254) + .HasColumnType("varchar(254)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Line1") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Line2") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Name") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Organization") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("Phone") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("PostalCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RegionId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("RegionName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderAddress", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PaymentId") + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique(); + + b.ToTable("OrderCapture", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CaptureId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderCaptureItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ChannelId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("DiscountTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("DiscountTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Fee") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("FeeTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("FeeTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("FeeWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("HandlingTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("HandlingTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("IsPrototype") + .HasColumnType("tinyint(1)"); + + b.Property("LanguageCode") + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PaymentTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("PaymentTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("PurchaseOrderNumber") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("timestamp(6)"); + + b.Property("ShippingTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("ShippingTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("ShoppingCartId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("StoreId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("StoreName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("SubTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("SubTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("SubscriptionId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SubscriptionNumber") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Total") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.ToTable("CustomerOrder", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CouponCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CouponInvalidDescription") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("LineItemId") + .HasColumnType("varchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("PromotionDescription") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("PromotionId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderDiscount", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Currency") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeeId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("LineItemId") + .HasColumnType("varchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderFeeDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CatalogId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CategoryId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Fee") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("FeeWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("FulfillmentLocationCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("varchar(1028)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("IsGift") + .HasColumnType("tinyint(1)"); + + b.Property("IsReccuring") + .HasColumnType("tinyint(1)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Price") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("PriceId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PriceWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ProductOuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ProductType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("ShippingMethodCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sku") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("VendorId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderLineItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("BooleanValue") + .HasColumnType("tinyint(1)"); + + b.Property("CaptureId") + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("DateTimeValue") + .HasColumnType("datetime(6)"); + + b.Property("DecimalValue") + .HasColumnType("decimal(18,5)"); + + b.Property("DictionaryItemId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("IntegerValue") + .HasColumnType("int"); + + b.Property("LineItemId") + .HasColumnType("varchar(128)"); + + b.Property("Locale") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("LongTextValue") + .HasColumnType("longtext"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("ObjectId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ObjectType") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("PropertyId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PropertyName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("RefundId") + .HasColumnType("varchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.Property("ShortTextValue") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("ValueType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("RefundId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ObjectType", "CustomerOrderId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_CustomerOrderId"); + + b.HasIndex("ObjectType", "LineItemId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_LineItemId"); + + b.HasIndex("ObjectType", "ObjectId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ObjectId"); + + b.HasIndex("ObjectType", "PaymentInId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_PaymentInId"); + + b.HasIndex("ObjectType", "RefundId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_RefundId"); + + b.HasIndex("ObjectType", "ShipmentId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ShipmentId"); + + b.ToTable("OrderDynamicPropertyObjectValue", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("GatewayIpAddress") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("IsProcessed") + .HasColumnType("tinyint(1)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Note") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("PaymentInId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ProcessAttemptCount") + .HasColumnType("int"); + + b.Property("ProcessError") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("ProcessedDate") + .HasColumnType("datetime(6)"); + + b.Property("RequestData") + .HasColumnType("longtext"); + + b.Property("ResponseCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ResponseData") + .HasColumnType("longtext"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Type") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("PaymentInId"); + + b.ToTable("OrderPaymentGatewayTransaction", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("AuthorizedDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("CapturedDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("GatewayCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("IncomingDate") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Price") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("PriceWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Purpose") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Total") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("VoidedDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderPaymentIn", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PaymentId") + .HasColumnType("varchar(128)"); + + b.Property("ReasonCode") + .HasColumnType("longtext"); + + b.Property("ReasonMessage") + .HasColumnType("longtext"); + + b.Property("RejectReasonMessage") + .HasColumnType("longtext"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique(); + + b.ToTable("OrderRefund", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("RefundId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("RefundId"); + + b.ToTable("OrderRefundItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("DeliveryDate") + .HasColumnType("datetime(6)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Fee") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("FeeWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Price") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("PriceWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("ShipmentMethodCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ShipmentMethodOption") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Total") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TrackingNumber") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("TrackingUrl") + .HasColumnType("longtext"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("VolumetricWeight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderShipment", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ShipmentPackageId") + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ShipmentPackageId"); + + b.ToTable("OrderShipmentItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("PackageType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderShipmentPackage", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("LineItemId") + .HasColumnType("varchar(128)"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("Rate") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderTaxDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Addresses") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Addresses") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Addresses") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Captures") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("Items") + .HasForeignKey("CaptureId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("CaptureItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Capture"); + + b.Navigation("LineItem"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Discounts") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("Discounts") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Discounts") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Discounts") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("FeeDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("FeeDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("FeeDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("FeeDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Items") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CaptureId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Capture"); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Refund"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Transactions") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PaymentIn"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("InPayments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("InPayments") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Refunds") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("RefundItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("Items") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("LineItem"); + + b.Navigation("Refund"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Shipments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ShipmentItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Items") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", "ShipmentPackage") + .WithMany("Items") + .HasForeignKey("ShipmentPackageId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("LineItem"); + + b.Navigation("Shipment"); + + b.Navigation("ShipmentPackage"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Packages") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("TaxDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("TaxDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("TaxDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("TaxDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Shipments"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Navigation("CaptureItems"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("RefundItems"); + + b.Navigation("ShipmentItems"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Captures"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("Refunds"); + + b.Navigation("TaxDetails"); + + b.Navigation("Transactions"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Packages"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20230911181734_AddProductOuterId.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20230911181734_AddProductOuterId.cs new file mode 100644 index 00000000..0c5e3902 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20230911181734_AddProductOuterId.cs @@ -0,0 +1,27 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations +{ + public partial class AddProductOuterId : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProductOuterId", + table: "OrderLineItem", + type: "varchar(128)", + maxLength: 128, + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProductOuterId", + table: "OrderLineItem"); + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs index 05e99bac..691b4948 100644 --- a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs @@ -16,7 +16,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "6.0.0") + .HasAnnotation("ProductVersion", "6.0.13") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => @@ -704,6 +704,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(128) .HasColumnType("varchar(128)"); + b.Property("ProductOuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + b.Property("ProductType") .HasMaxLength(64) .HasColumnType("varchar(64)"); diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20230911181748_AddProductOuterId.Designer.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20230911181748_AddProductOuterId.Designer.cs new file mode 100644 index 00000000..ad85a5ad --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20230911181748_AddProductOuterId.Designer.cs @@ -0,0 +1,2006 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using VirtoCommerce.OrdersModule.Data.Repositories; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations +{ + [DbContext(typeof(OrderDbContext))] + [Migration("20230911181748_AddProductOuterId")] + partial class AddProductOuterId + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.13") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("AddressType") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("Email") + .HasMaxLength(254) + .HasColumnType("character varying(254)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Line1") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("Line2") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("Name") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("Organization") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("Phone") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("PostalCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("RegionId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("RegionName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderAddress", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PaymentId") + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique(); + + b.ToTable("OrderCapture", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CaptureId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderCaptureItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("ChannelId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountTotal") + .HasColumnType("Money"); + + b.Property("DiscountTotalWithTax") + .HasColumnType("Money"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeTotal") + .HasColumnType("Money"); + + b.Property("FeeTotalWithTax") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("HandlingTotal") + .HasColumnType("Money"); + + b.Property("HandlingTotalWithTax") + .HasColumnType("Money"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("IsPrototype") + .HasColumnType("boolean"); + + b.Property("LanguageCode") + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PaymentTotal") + .HasColumnType("Money"); + + b.Property("PaymentTotalWithTax") + .HasColumnType("Money"); + + b.Property("PurchaseOrderNumber") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("ShippingTotal") + .HasColumnType("Money"); + + b.Property("ShippingTotalWithTax") + .HasColumnType("Money"); + + b.Property("ShoppingCartId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("StoreId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("StoreName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("SubTotal") + .HasColumnType("Money"); + + b.Property("SubTotalWithTax") + .HasColumnType("Money"); + + b.Property("SubscriptionId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("SubscriptionNumber") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("numeric(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("Total") + .HasColumnType("Money"); + + b.HasKey("Id"); + + b.ToTable("CustomerOrder", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CouponCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CouponInvalidDescription") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("LineItemId") + .HasColumnType("character varying(128)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("PromotionDescription") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("PromotionId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderDiscount", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("Currency") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("FeeId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("LineItemId") + .HasColumnType("character varying(128)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderFeeDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CatalogId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CategoryId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("FulfillmentLocationCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("character varying(1028)"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("IsGift") + .HasColumnType("boolean"); + + b.Property("IsReccuring") + .HasColumnType("boolean"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProductOuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProductType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.Property("ShippingMethodCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sku") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("TaxPercentRate") + .HasColumnType("numeric(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("VendorId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderLineItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("BooleanValue") + .HasColumnType("boolean"); + + b.Property("CaptureId") + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("DateTimeValue") + .HasColumnType("timestamp with time zone"); + + b.Property("DecimalValue") + .HasColumnType("numeric(18,5)"); + + b.Property("DictionaryItemId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("IntegerValue") + .HasColumnType("integer"); + + b.Property("LineItemId") + .HasColumnType("character varying(128)"); + + b.Property("Locale") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("LongTextValue") + .HasColumnType("text"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ObjectId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ObjectType") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("PropertyId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PropertyName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("RefundId") + .HasColumnType("character varying(128)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.Property("ShortTextValue") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("ValueType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("RefundId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ObjectType", "CustomerOrderId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_CustomerOrderId"); + + b.HasIndex("ObjectType", "LineItemId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_LineItemId"); + + b.HasIndex("ObjectType", "ObjectId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ObjectId"); + + b.HasIndex("ObjectType", "PaymentInId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_PaymentInId"); + + b.HasIndex("ObjectType", "RefundId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_RefundId"); + + b.HasIndex("ObjectType", "ShipmentId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ShipmentId"); + + b.ToTable("OrderDynamicPropertyObjectValue", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("GatewayIpAddress") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("IsProcessed") + .HasColumnType("boolean"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Note") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("PaymentInId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ProcessAttemptCount") + .HasColumnType("integer"); + + b.Property("ProcessError") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("ProcessedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("RequestData") + .HasColumnType("text"); + + b.Property("ResponseCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ResponseData") + .HasColumnType("text"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Type") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("PaymentInId"); + + b.ToTable("OrderPaymentGatewayTransaction", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("AuthorizedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("CapturedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("GatewayCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("IncomingDate") + .HasColumnType("timestamp with time zone"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("Purpose") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("numeric(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Total") + .HasColumnType("Money"); + + b.Property("TotalWithTax") + .HasColumnType("Money"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("VoidedDate") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderPaymentIn", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PaymentId") + .HasColumnType("character varying(128)"); + + b.Property("ReasonCode") + .HasColumnType("text"); + + b.Property("ReasonMessage") + .HasColumnType("text"); + + b.Property("RejectReasonMessage") + .HasColumnType("text"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique(); + + b.ToTable("OrderRefund", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.Property("RefundId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("RefundId"); + + b.ToTable("OrderRefundItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("DeliveryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("ShipmentMethodCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ShipmentMethodOption") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("numeric(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Total") + .HasColumnType("Money"); + + b.Property("TotalWithTax") + .HasColumnType("Money"); + + b.Property("TrackingNumber") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("TrackingUrl") + .HasColumnType("text"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("VolumetricWeight") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderShipment", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ShipmentPackageId") + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ShipmentPackageId"); + + b.ToTable("OrderShipmentItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("PackageType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderShipmentPackage", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("LineItemId") + .HasColumnType("character varying(128)"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("Rate") + .HasPrecision(18, 2) + .HasColumnType("numeric(18,2)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderTaxDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Addresses") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Addresses") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Addresses") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Captures") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("Items") + .HasForeignKey("CaptureId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("CaptureItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Capture"); + + b.Navigation("LineItem"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Discounts") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("Discounts") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Discounts") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Discounts") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("FeeDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("FeeDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("FeeDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("FeeDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Items") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CaptureId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Capture"); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Refund"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Transactions") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PaymentIn"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("InPayments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("InPayments") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Refunds") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("RefundItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("Items") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("LineItem"); + + b.Navigation("Refund"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Shipments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ShipmentItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Items") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", "ShipmentPackage") + .WithMany("Items") + .HasForeignKey("ShipmentPackageId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("LineItem"); + + b.Navigation("Shipment"); + + b.Navigation("ShipmentPackage"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Packages") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("TaxDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("TaxDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("TaxDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("TaxDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Shipments"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Navigation("CaptureItems"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("RefundItems"); + + b.Navigation("ShipmentItems"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Captures"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("Refunds"); + + b.Navigation("TaxDetails"); + + b.Navigation("Transactions"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Packages"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20230911181748_AddProductOuterId.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20230911181748_AddProductOuterId.cs new file mode 100644 index 00000000..21263f51 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20230911181748_AddProductOuterId.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations +{ + public partial class AddProductOuterId : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProductOuterId", + table: "OrderLineItem", + type: "character varying(128)", + maxLength: 128, + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProductOuterId", + table: "OrderLineItem"); + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs index 75054dc4..e384bb92 100644 --- a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "6.0.0") + .HasAnnotation("ProductVersion", "6.0.13") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -679,6 +679,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(128) .HasColumnType("character varying(128)"); + b.Property("ProductOuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + b.Property("ProductType") .HasMaxLength(64) .HasColumnType("character varying(64)"); diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20230911181802_AddProductOuterId.Designer.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20230911181802_AddProductOuterId.Designer.cs new file mode 100644 index 00000000..c5bf313e --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20230911181802_AddProductOuterId.Designer.cs @@ -0,0 +1,2007 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using VirtoCommerce.OrdersModule.Data.Repositories; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations +{ + [DbContext(typeof(OrderDbContext))] + [Migration("20230911181802_AddProductOuterId")] + partial class AddProductOuterId + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.13") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("AddressType") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("Email") + .HasMaxLength(254) + .HasColumnType("nvarchar(254)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Line1") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("Line2") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("Name") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("Organization") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("Phone") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PostalCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RegionId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("RegionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderAddress", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentId") + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique() + .HasFilter("[CustomerOrderId] IS NOT NULL"); + + b.ToTable("OrderCapture", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CaptureId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderCaptureItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("ChannelId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountTotal") + .HasColumnType("Money"); + + b.Property("DiscountTotalWithTax") + .HasColumnType("Money"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeTotal") + .HasColumnType("Money"); + + b.Property("FeeTotalWithTax") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("HandlingTotal") + .HasColumnType("Money"); + + b.Property("HandlingTotalWithTax") + .HasColumnType("Money"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("IsPrototype") + .HasColumnType("bit"); + + b.Property("LanguageCode") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentTotal") + .HasColumnType("Money"); + + b.Property("PaymentTotalWithTax") + .HasColumnType("Money"); + + b.Property("PurchaseOrderNumber") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("rowversion"); + + b.Property("ShippingTotal") + .HasColumnType("Money"); + + b.Property("ShippingTotalWithTax") + .HasColumnType("Money"); + + b.Property("ShoppingCartId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StoreId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StoreName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("SubTotal") + .HasColumnType("Money"); + + b.Property("SubTotalWithTax") + .HasColumnType("Money"); + + b.Property("SubscriptionId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SubscriptionNumber") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("Total") + .HasColumnType("Money"); + + b.HasKey("Id"); + + b.ToTable("CustomerOrder", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CouponCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CouponInvalidDescription") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("LineItemId") + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("PromotionDescription") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("PromotionId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderDiscount", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("Currency") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FeeId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("LineItemId") + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderFeeDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CatalogId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CategoryId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("FulfillmentLocationCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("nvarchar(1028)"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("IsGift") + .HasColumnType("bit"); + + b.Property("IsReccuring") + .HasColumnType("bit"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProductOuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProductType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("ShippingMethodCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sku") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("VendorId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderLineItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("BooleanValue") + .HasColumnType("bit"); + + b.Property("CaptureId") + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("DateTimeValue") + .HasColumnType("datetime2"); + + b.Property("DecimalValue") + .HasColumnType("decimal(18,5)"); + + b.Property("DictionaryItemId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IntegerValue") + .HasColumnType("int"); + + b.Property("LineItemId") + .HasColumnType("nvarchar(128)"); + + b.Property("Locale") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("LongTextValue") + .HasColumnType("nvarchar(max)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("ObjectId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ObjectType") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("PropertyId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PropertyName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("RefundId") + .HasColumnType("nvarchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.Property("ShortTextValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ValueType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("RefundId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ObjectType", "CustomerOrderId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_CustomerOrderId"); + + b.HasIndex("ObjectType", "LineItemId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_LineItemId"); + + b.HasIndex("ObjectType", "ObjectId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ObjectId"); + + b.HasIndex("ObjectType", "PaymentInId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_PaymentInId"); + + b.HasIndex("ObjectType", "RefundId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_RefundId"); + + b.HasIndex("ObjectType", "ShipmentId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ShipmentId"); + + b.ToTable("OrderDynamicPropertyObjectValue", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("GatewayIpAddress") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IsProcessed") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Note") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("PaymentInId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ProcessAttemptCount") + .HasColumnType("int"); + + b.Property("ProcessError") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("ProcessedDate") + .HasColumnType("datetime2"); + + b.Property("RequestData") + .HasColumnType("nvarchar(max)"); + + b.Property("ResponseCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResponseData") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Type") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("PaymentInId"); + + b.ToTable("OrderPaymentGatewayTransaction", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("AuthorizedDate") + .HasColumnType("datetime2"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("CapturedDate") + .HasColumnType("datetime2"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("GatewayCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IncomingDate") + .HasColumnType("datetime2"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("Purpose") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Total") + .HasColumnType("Money"); + + b.Property("TotalWithTax") + .HasColumnType("Money"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("VoidedDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderPaymentIn", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentId") + .HasColumnType("nvarchar(128)"); + + b.Property("ReasonCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ReasonMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("RejectReasonMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique() + .HasFilter("[CustomerOrderId] IS NOT NULL"); + + b.ToTable("OrderRefund", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("RefundId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("RefundId"); + + b.ToTable("OrderRefundItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("DeliveryDate") + .HasColumnType("datetime2"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("ShipmentMethodCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ShipmentMethodOption") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Total") + .HasColumnType("Money"); + + b.Property("TotalWithTax") + .HasColumnType("Money"); + + b.Property("TrackingNumber") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TrackingUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("VolumetricWeight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderShipment", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ShipmentPackageId") + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ShipmentPackageId"); + + b.ToTable("OrderShipmentItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("PackageType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderShipmentPackage", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("LineItemId") + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("Rate") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderTaxDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Addresses") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Addresses") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Addresses") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Captures") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("Items") + .HasForeignKey("CaptureId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("CaptureItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Capture"); + + b.Navigation("LineItem"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Discounts") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("Discounts") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Discounts") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Discounts") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("FeeDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("FeeDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("FeeDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("FeeDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Items") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CaptureId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Capture"); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Refund"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Transactions") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PaymentIn"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("InPayments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("InPayments") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Refunds") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("RefundItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("Items") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("LineItem"); + + b.Navigation("Refund"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Shipments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ShipmentItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Items") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", "ShipmentPackage") + .WithMany("Items") + .HasForeignKey("ShipmentPackageId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("LineItem"); + + b.Navigation("Shipment"); + + b.Navigation("ShipmentPackage"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Packages") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("TaxDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("TaxDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("TaxDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("TaxDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Shipments"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Navigation("CaptureItems"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("RefundItems"); + + b.Navigation("ShipmentItems"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Captures"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("Refunds"); + + b.Navigation("TaxDetails"); + + b.Navigation("Transactions"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Packages"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20230911181802_AddProductOuterId.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20230911181802_AddProductOuterId.cs new file mode 100644 index 00000000..c0fd5491 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20230911181802_AddProductOuterId.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations +{ + public partial class AddProductOuterId : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProductOuterId", + table: "OrderLineItem", + type: "nvarchar(128)", + maxLength: 128, + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProductOuterId", + table: "OrderLineItem"); + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs index 7d3cd00f..0e2a9c80 100644 --- a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "6.0.0") + .HasAnnotation("ProductVersion", "6.0.13") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); @@ -679,6 +679,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("ProductOuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("ProductType") .HasMaxLength(64) .HasColumnType("nvarchar(64)"); diff --git a/src/VirtoCommerce.OrdersModule.Data/Model/LineItemEntity.cs b/src/VirtoCommerce.OrdersModule.Data/Model/LineItemEntity.cs index 528f7bde..21012f7d 100644 --- a/src/VirtoCommerce.OrdersModule.Data/Model/LineItemEntity.cs +++ b/src/VirtoCommerce.OrdersModule.Data/Model/LineItemEntity.cs @@ -55,6 +55,9 @@ public class LineItemEntity : AuditableEntity, IHasOuterId [StringLength(1024)] public string Name { get; set; } + [StringLength(128)] + public string ProductOuterId { get; set; } + [StringLength(2048)] public string Comment { get; set; } @@ -145,6 +148,7 @@ public virtual LineItem ToModel(LineItem lineItem) lineItem.Sku = Sku; lineItem.ProductType = ProductType; lineItem.Name = Name; + lineItem.ProductOuterId = ProductOuterId; lineItem.ImageUrl = ImageUrl; lineItem.ShippingMethodCode = ShippingMethodCode; lineItem.FulfillmentLocationCode = FulfillmentLocationCode; @@ -215,6 +219,7 @@ public virtual LineItemEntity FromModel(LineItem lineItem, PrimaryKeyResolvingMa ProductId = lineItem.ProductId; Sku = lineItem.Sku; ProductType = lineItem.ProductType; + ProductOuterId = lineItem.ProductOuterId; Name = lineItem.Name; ImageUrl = lineItem.ImageUrl; ShippingMethodCode = lineItem.ShippingMethodCode; diff --git a/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs b/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs index cb0ecfc5..f4e8cab9 100644 --- a/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs +++ b/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs @@ -239,6 +239,7 @@ protected virtual LineItem ToOrderModel(CartModule.Core.Model.LineItem lineItem) retVal.Length = lineItem.Length; retVal.MeasureUnit = lineItem.MeasureUnit; retVal.Name = lineItem.Name; + retVal.ProductOuterId = lineItem.ProductOuterId; retVal.PriceId = lineItem.PriceId; retVal.ProductId = lineItem.ProductId; retVal.ProductType = lineItem.ProductType; diff --git a/src/VirtoCommerce.OrdersModule.Web/Controllers/Api/OrderModuleController.cs b/src/VirtoCommerce.OrdersModule.Web/Controllers/Api/OrderModuleController.cs index d8e5f864..52b29fd5 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Controllers/Api/OrderModuleController.cs +++ b/src/VirtoCommerce.OrdersModule.Web/Controllers/Api/OrderModuleController.cs @@ -418,15 +418,6 @@ public async Task> GetNewShipment(string id) retVal.Number = _uniqueNumberGenerator.GenerateNumber(numberTemplate.ToString()); return Ok(retVal); - - ////Detect not whole shipped items - ////TODO: LineItem partial shipping - //var shippedLineItemIds = order.Shipments.SelectMany(x => x.Items).Select(x => x.LineItemId); - - ////TODO Add check for digital products (don't add to shipment) - //retVal.Items = order.Items.Where(x => !shippedLineItemIds.Contains(x.Id)) - // .Select(x => new coreModel.ShipmentItem(x)).ToList(); - //return Ok(retVal.ToWebModel()); } return NotFound(); @@ -610,8 +601,6 @@ public async Task GetInvoicePdf(string orderNumber) var searchCriteria = AbstractTypeFactory.TryCreateInstance(); searchCriteria.Number = orderNumber; searchCriteria.Take = 1; - //ToDo - //searchCriteria.ResponseGroup = OrderReadPricesPermission.ApplyResponseGroupFiltering(_securityService.GetUserPermissions(User.Identity.Name), null); var orders = await _searchService.SearchAsync(searchCriteria); var order = orders.Results.FirstOrDefault(); diff --git a/src/VirtoCommerce.OrdersModule.Web/module.manifest b/src/VirtoCommerce.OrdersModule.Web/module.manifest index a1dd9984..8a2a5713 100644 --- a/src/VirtoCommerce.OrdersModule.Web/module.manifest +++ b/src/VirtoCommerce.OrdersModule.Web/module.manifest @@ -1,11 +1,11 @@ VirtoCommerce.Orders - 3.413.0 + 3.414.0 3.413.0 - +