//
using System;
using Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Infrastructure.Data.Migrations
{
[DbContext(typeof(StoreContext))]
[Migration("20220524182205_OrderEntityAdded")]
partial class OrderEntityAdded
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.5");
modelBuilder.Entity("Core.Entities.OrderAggregate.DeliveryMethod", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("DeliveryTime")
.HasColumnType("TEXT");
b.Property("Description")
.HasColumnType("TEXT");
b.Property("Price")
.HasColumnType("decimal(18,2)");
b.Property("ShortName")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("DeliveryMethod");
});
modelBuilder.Entity("Core.Entities.OrderAggregate.Order", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("BuyerEmail")
.HasColumnType("TEXT");
b.Property("DeliveryMethodId")
.HasColumnType("INTEGER");
b.Property("OrderDate")
.HasColumnType("TEXT");
b.Property("PaymentIntentId")
.HasColumnType("TEXT");
b.Property("Status")
.IsRequired()
.HasColumnType("TEXT");
b.Property("Subtotal")
.HasColumnType("REAL");
b.HasKey("Id");
b.HasIndex("DeliveryMethodId");
b.ToTable("Orders");
});
modelBuilder.Entity("Core.Entities.OrderAggregate.OrderItem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("OrderId")
.HasColumnType("INTEGER");
b.Property("Price")
.HasColumnType("decimal(18,2)");
b.Property("Quantity")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("OrderId");
b.ToTable("OrderItems");
});
modelBuilder.Entity("Core.Entities.Product", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Description")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property("PictureUrl")
.IsRequired()
.HasColumnType("TEXT");
b.Property("Price")
.HasColumnType("decimal(18,2)");
b.Property("ProductBrandId")
.HasColumnType("INTEGER");
b.Property("ProductTypeId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ProductBrandId");
b.HasIndex("ProductTypeId");
b.ToTable("Products");
});
modelBuilder.Entity("Core.Entities.ProductBrand", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Name")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("ProductBrands");
});
modelBuilder.Entity("Core.Entities.ProductType", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Name")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("ProductTypes");
});
modelBuilder.Entity("Core.Entities.OrderAggregate.Order", b =>
{
b.HasOne("Core.Entities.OrderAggregate.DeliveryMethod", "DeliveryMethod")
.WithMany()
.HasForeignKey("DeliveryMethodId");
b.OwnsOne("Core.Entities.OrderAggregate.Address", "ShipToAddress", b1 =>
{
b1.Property("OrderId")
.HasColumnType("INTEGER");
b1.Property("City")
.HasColumnType("TEXT");
b1.Property("FirstName")
.HasColumnType("TEXT");
b1.Property("LastName")
.HasColumnType("TEXT");
b1.Property("State")
.HasColumnType("TEXT");
b1.Property("Street")
.HasColumnType("TEXT");
b1.Property("ZipCode")
.HasColumnType("TEXT");
b1.HasKey("OrderId");
b1.ToTable("Orders");
b1.WithOwner()
.HasForeignKey("OrderId");
});
b.Navigation("DeliveryMethod");
b.Navigation("ShipToAddress");
});
modelBuilder.Entity("Core.Entities.OrderAggregate.OrderItem", b =>
{
b.HasOne("Core.Entities.OrderAggregate.Order", null)
.WithMany("OrderItems")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade);
b.OwnsOne("Core.Entities.OrderAggregate.ProductItemOrdered", "ItemOrdered", b1 =>
{
b1.Property("OrderItemId")
.HasColumnType("INTEGER");
b1.Property("PictureUrl")
.HasColumnType("TEXT");
b1.Property("ProductItemId")
.HasColumnType("INTEGER");
b1.Property("ProductName")
.HasColumnType("TEXT");
b1.HasKey("OrderItemId");
b1.ToTable("OrderItems");
b1.WithOwner()
.HasForeignKey("OrderItemId");
});
b.Navigation("ItemOrdered");
});
modelBuilder.Entity("Core.Entities.Product", b =>
{
b.HasOne("Core.Entities.ProductBrand", "ProductBrand")
.WithMany()
.HasForeignKey("ProductBrandId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Core.Entities.ProductType", "ProductType")
.WithMany()
.HasForeignKey("ProductTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ProductBrand");
b.Navigation("ProductType");
});
modelBuilder.Entity("Core.Entities.OrderAggregate.Order", b =>
{
b.Navigation("OrderItems");
});
#pragma warning restore 612, 618
}
}
}