//
using System;
using DatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace DatabaseImplement.Migrations
{
[DbContext(typeof(Database))]
[Migration("20240717230804_cartitem2")]
partial class cartitem2
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("DatabaseImplement.Models.CartItem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Count")
.HasColumnType("integer");
b.Property("DateCreated")
.HasColumnType("timestamp without time zone");
b.Property("ProductId")
.HasColumnType("uuid");
b.Property("ProductName")
.IsRequired()
.HasColumnType("text");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ProductId");
b.ToTable("CartItems");
});
modelBuilder.Entity("DatabaseImplement.Models.MediaFile", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Image")
.IsRequired()
.HasColumnType("bytea");
b.Property("ProductId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ProductId");
b.ToTable("MediaFiles");
});
modelBuilder.Entity("DatabaseImplement.Models.Product", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Amount")
.HasColumnType("integer");
b.Property("Category")
.HasColumnType("text");
b.Property("Description")
.HasColumnType("text");
b.Property("IsBeingSold")
.HasColumnType("boolean");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Price")
.HasColumnType("double precision");
b.Property("Rate")
.HasColumnType("double precision");
b.Property("SaleId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("SaleId");
b.ToTable("Products");
});
modelBuilder.Entity("DatabaseImplement.Models.Purchase", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Cost")
.HasColumnType("double precision");
b.Property("DatePurchase")
.HasColumnType("timestamp without time zone");
b.Property("Status")
.HasColumnType("integer");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Purchases");
});
modelBuilder.Entity("DatabaseImplement.Models.PurchaseProducts", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Count")
.HasColumnType("integer");
b.Property("ProductId")
.HasColumnType("uuid");
b.Property("PurchaseId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ProductId");
b.HasIndex("PurchaseId");
b.ToTable("PurchaseProducts");
});
modelBuilder.Entity("DatabaseImplement.Models.Role", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Roles");
});
modelBuilder.Entity("DatabaseImplement.Models.Sale", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Category")
.HasColumnType("text");
b.Property("Description")
.IsRequired()
.HasColumnType("text");
b.Property("End")
.HasColumnType("timestamp without time zone");
b.Property("FullDescription")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Start")
.HasColumnType("timestamp without time zone");
b.Property("Value")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Sales");
});
modelBuilder.Entity("DatabaseImplement.Models.Sell", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("DateSell")
.HasColumnType("timestamp without time zone");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Sells");
});
modelBuilder.Entity("DatabaseImplement.Models.SellProducts", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Count")
.HasColumnType("integer");
b.Property("ProductId")
.HasColumnType("uuid");
b.Property("SellId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ProductId");
b.HasIndex("SellId");
b.ToTable("SellProducts");
});
modelBuilder.Entity("DatabaseImplement.Models.Supplier", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Deals")
.HasColumnType("integer");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Suppliers");
});
modelBuilder.Entity("DatabaseImplement.Models.SupplierProduct", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Count")
.HasColumnType("integer");
b.Property("ProductId")
.HasColumnType("uuid");
b.Property("SupplierId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ProductId");
b.HasIndex("SupplierId");
b.ToTable("SupplierProducts");
});
modelBuilder.Entity("DatabaseImplement.Models.Supply", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Date")
.HasColumnType("timestamp without time zone");
b.Property("DateArriving")
.HasColumnType("timestamp without time zone");
b.Property("DateComplete")
.HasColumnType("timestamp without time zone");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Price")
.HasColumnType("double precision");
b.Property("Status")
.HasColumnType("integer");
b.Property("SupplierId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("SupplierId");
b.ToTable("Supplies");
});
modelBuilder.Entity("DatabaseImplement.Models.SupplyDoc", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("SupplyId")
.HasColumnType("uuid");
b.HasKey("Id");
b.ToTable("SupplyDocs");
});
modelBuilder.Entity("DatabaseImplement.Models.SupplyProduct", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Count")
.HasColumnType("integer");
b.Property("ProductId")
.HasColumnType("uuid");
b.Property("SupplyId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ProductId");
b.HasIndex("SupplyId");
b.ToTable("SupplyProducts");
});
modelBuilder.Entity("DatabaseImplement.Models.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Birthday")
.HasColumnType("timestamp without time zone");
b.Property("Bonus")
.HasColumnType("integer");
b.Property("Email")
.IsRequired()
.HasColumnType("text");
b.Property("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property("OnlyImportantMails")
.HasColumnType("boolean");
b.Property("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property("RoleId")
.HasColumnType("uuid");
b.Property("SecondName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("Users");
});
modelBuilder.Entity("DatabaseImplement.Models.CartItem", b =>
{
b.HasOne("DatabaseImplement.Models.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
});
modelBuilder.Entity("DatabaseImplement.Models.MediaFile", b =>
{
b.HasOne("DatabaseImplement.Models.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
});
modelBuilder.Entity("DatabaseImplement.Models.Product", b =>
{
b.HasOne("DatabaseImplement.Models.Sale", "Sale")
.WithMany("Products")
.HasForeignKey("SaleId");
b.Navigation("Sale");
});
modelBuilder.Entity("DatabaseImplement.Models.Purchase", b =>
{
b.HasOne("DatabaseImplement.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("DatabaseImplement.Models.PurchaseProducts", b =>
{
b.HasOne("DatabaseImplement.Models.Product", "Product")
.WithMany("PurchaseProducts")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DatabaseImplement.Models.Purchase", "Purchase")
.WithMany("Products")
.HasForeignKey("PurchaseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("Purchase");
});
modelBuilder.Entity("DatabaseImplement.Models.Sell", b =>
{
b.HasOne("DatabaseImplement.Models.User", "User")
.WithMany()
.HasForeignKey("UserId");
b.Navigation("User");
});
modelBuilder.Entity("DatabaseImplement.Models.SellProducts", b =>
{
b.HasOne("DatabaseImplement.Models.Product", "Product")
.WithMany("SellProducts")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DatabaseImplement.Models.Sell", "Sell")
.WithMany("Products")
.HasForeignKey("SellId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("Sell");
});
modelBuilder.Entity("DatabaseImplement.Models.SupplierProduct", b =>
{
b.HasOne("DatabaseImplement.Models.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DatabaseImplement.Models.Supplier", "Supplier")
.WithMany("Products")
.HasForeignKey("SupplierId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("Supplier");
});
modelBuilder.Entity("DatabaseImplement.Models.Supply", b =>
{
b.HasOne("DatabaseImplement.Models.Supplier", "Supplier")
.WithMany()
.HasForeignKey("SupplierId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Supplier");
});
modelBuilder.Entity("DatabaseImplement.Models.SupplyProduct", b =>
{
b.HasOne("DatabaseImplement.Models.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DatabaseImplement.Models.Supply", "Supply")
.WithMany("Products")
.HasForeignKey("SupplyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("Supply");
});
modelBuilder.Entity("DatabaseImplement.Models.User", b =>
{
b.HasOne("DatabaseImplement.Models.Role", "Role")
.WithMany()
.HasForeignKey("RoleId");
b.Navigation("Role");
});
modelBuilder.Entity("DatabaseImplement.Models.Product", b =>
{
b.Navigation("PurchaseProducts");
b.Navigation("SellProducts");
});
modelBuilder.Entity("DatabaseImplement.Models.Purchase", b =>
{
b.Navigation("Products");
});
modelBuilder.Entity("DatabaseImplement.Models.Sale", b =>
{
b.Navigation("Products");
});
modelBuilder.Entity("DatabaseImplement.Models.Sell", b =>
{
b.Navigation("Products");
});
modelBuilder.Entity("DatabaseImplement.Models.Supplier", b =>
{
b.Navigation("Products");
});
modelBuilder.Entity("DatabaseImplement.Models.Supply", b =>
{
b.Navigation("Products");
});
#pragma warning restore 612, 618
}
}
}