//
using System;
using ECommerce.Model.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ECommerce.Model.Migrations
{
[DbContext(typeof(AppDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.0-preview.3.25171.6")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ECommerce.Model.Entities.Cart", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CustomerId")
.HasColumnType("uuid");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("CustomerId")
.IsUnique();
b.ToTable("Carts");
});
modelBuilder.Entity("ECommerce.Model.Entities.CartItem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CartId")
.HasColumnType("uuid");
b.Property("ProductId")
.HasColumnType("uuid");
b.Property("Quantity")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CartId");
b.HasIndex("ProductId");
b.ToTable("CartItems");
});
modelBuilder.Entity("ECommerce.Model.Entities.Category", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Description")
.HasColumnType("text");
b.Property("ImageUrl")
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("Categories");
});
modelBuilder.Entity("ECommerce.Model.Entities.Customer", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property("LastName")
.IsRequired()
.HasColumnType("text");
b.Property("Phone")
.HasColumnType("text");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("ECommerce.Model.Entities.Order", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CustomerId")
.HasColumnType("uuid");
b.Property("OrderNumber")
.IsRequired()
.HasColumnType("text");
b.Property("Status")
.IsRequired()
.HasColumnType("text");
b.Property("TotalAmount")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.ToTable("Orders");
});
modelBuilder.Entity("ECommerce.Model.Entities.OrderItem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("OrderId")
.HasColumnType("uuid");
b.Property("ProductId")
.HasColumnType("uuid");
b.Property("Quantity")
.HasColumnType("integer");
b.Property("UnitPrice")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ProductId");
b.ToTable("OrderItems");
});
modelBuilder.Entity("ECommerce.Model.Entities.Payment", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Amount")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Currency")
.HasColumnType("text");
b.Property("OrderId")
.HasColumnType("uuid");
b.Property("Status")
.IsRequired()
.HasColumnType("text");
b.Property("StripePaymentIntentId")
.IsRequired()
.HasColumnType("text");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("OrderId")
.IsUnique();
b.ToTable("Payments");
});
modelBuilder.Entity("ECommerce.Model.Entities.Product", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CategoryId")
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Description")
.HasColumnType("text");
b.Property("ImageContentType")
.HasColumnType("text");
b.Property("ImageData")
.HasColumnType("bytea");
b.Property("ImageUrl")
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Price")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)");
b.Property("StockQuantity")
.HasColumnType("integer");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.ToTable("Products");
});
modelBuilder.Entity("ECommerce.Model.Entities.Review", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Comment")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("ProductId")
.HasColumnType("uuid");
b.Property("Rating")
.HasColumnType("integer");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UserId")
.HasColumnType("text");
b.Property("UserName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.HasKey("Id");
b.HasIndex("ProductId");
b.ToTable("Reviews");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ClaimType")
.HasColumnType("text");
b.Property("ClaimValue")
.HasColumnType("text");
b.Property("RoleId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("AccessFailedCount")
.HasColumnType("integer");
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("EmailConfirmed")
.HasColumnType("boolean");
b.Property("LockoutEnabled")
.HasColumnType("boolean");
b.Property("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("PasswordHash")
.HasColumnType("text");
b.Property("PhoneNumber")
.HasColumnType("text");
b.Property("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property("SecurityStamp")
.HasColumnType("text");
b.Property("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ClaimType")
.HasColumnType("text");
b.Property("ClaimValue")
.HasColumnType("text");
b.Property("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
{
b.Property("LoginProvider")
.HasColumnType("text");
b.Property("ProviderKey")
.HasColumnType("text");
b.Property("ProviderDisplayName")
.HasColumnType("text");
b.Property("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
{
b.Property("UserId")
.HasColumnType("text");
b.Property("RoleId")
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
{
b.Property("UserId")
.HasColumnType("text");
b.Property("LoginProvider")
.HasColumnType("text");
b.Property("Name")
.HasColumnType("text");
b.Property("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("ECommerce.Model.Entities.Cart", b =>
{
b.HasOne("ECommerce.Model.Entities.Customer", "Customer")
.WithOne("Cart")
.HasForeignKey("ECommerce.Model.Entities.Cart", "CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Customer");
});
modelBuilder.Entity("ECommerce.Model.Entities.CartItem", b =>
{
b.HasOne("ECommerce.Model.Entities.Cart", "Cart")
.WithMany("Items")
.HasForeignKey("CartId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ECommerce.Model.Entities.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cart");
b.Navigation("Product");
});
modelBuilder.Entity("ECommerce.Model.Entities.Customer", b =>
{
b.OwnsOne("ECommerce.Model.ValueObjects.Address", "DefaultAddress", b1 =>
{
b1.Property("CustomerId")
.HasColumnType("uuid");
b1.Property("City")
.IsRequired()
.HasColumnType("text");
b1.Property("Country")
.IsRequired()
.HasColumnType("text");
b1.Property("State")
.IsRequired()
.HasColumnType("text");
b1.Property("Street")
.IsRequired()
.HasColumnType("text");
b1.Property("ZipCode")
.IsRequired()
.HasColumnType("text");
b1.HasKey("CustomerId");
b1.ToTable("Customers");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.Navigation("DefaultAddress");
});
modelBuilder.Entity("ECommerce.Model.Entities.Order", b =>
{
b.HasOne("ECommerce.Model.Entities.Customer", "Customer")
.WithMany("Orders")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("ECommerce.Model.ValueObjects.Address", "ShippingAddress", b1 =>
{
b1.Property("OrderId")
.HasColumnType("uuid");
b1.Property("City")
.IsRequired()
.HasColumnType("text");
b1.Property("Country")
.IsRequired()
.HasColumnType("text");
b1.Property("State")
.IsRequired()
.HasColumnType("text");
b1.Property("Street")
.IsRequired()
.HasColumnType("text");
b1.Property("ZipCode")
.IsRequired()
.HasColumnType("text");
b1.HasKey("OrderId");
b1.ToTable("Orders");
b1.WithOwner()
.HasForeignKey("OrderId");
});
b.Navigation("Customer");
b.Navigation("ShippingAddress");
});
modelBuilder.Entity("ECommerce.Model.Entities.OrderItem", b =>
{
b.HasOne("ECommerce.Model.Entities.Order", "Order")
.WithMany("Items")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ECommerce.Model.Entities.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
b.Navigation("Product");
});
modelBuilder.Entity("ECommerce.Model.Entities.Payment", b =>
{
b.HasOne("ECommerce.Model.Entities.Order", "Order")
.WithOne("Payment")
.HasForeignKey("ECommerce.Model.Entities.Payment", "OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
});
modelBuilder.Entity("ECommerce.Model.Entities.Product", b =>
{
b.HasOne("ECommerce.Model.Entities.Category", "Category")
.WithMany("Products")
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Category");
});
modelBuilder.Entity("ECommerce.Model.Entities.Review", b =>
{
b.HasOne("ECommerce.Model.Entities.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ECommerce.Model.Entities.Cart", b =>
{
b.Navigation("Items");
});
modelBuilder.Entity("ECommerce.Model.Entities.Category", b =>
{
b.Navigation("Products");
});
modelBuilder.Entity("ECommerce.Model.Entities.Customer", b =>
{
b.Navigation("Cart");
b.Navigation("Orders");
});
modelBuilder.Entity("ECommerce.Model.Entities.Order", b =>
{
b.Navigation("Items");
b.Navigation("Payment");
});
#pragma warning restore 612, 618
}
}
}