// using System; using ComputerHardwareStoreDatabaseImplement; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ComputerHardwareStoreDatabaseImplement.Migrations { [DbContext(typeof(ComputerHardwareStoreDBContext))] [Migration("20240528172646_create")] partial class create { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.4") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Name") .IsRequired() .HasColumnType("text"); b.Property("Price") .HasColumnType("double precision"); b.Property("VendorId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("VendorId"); b.ToTable("Builds"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("BuildId") .HasColumnType("integer"); b.Property("ComponentId") .HasColumnType("integer"); b.Property("Count") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("BuildId"); b.HasIndex("ComponentId"); b.ToTable("BuildComponents"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("BuildId") .HasColumnType("integer"); b.Property("Date") .HasColumnType("timestamp without time zone"); b.Property("Text") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("BuildId"); b.ToTable("Comments"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Cost") .HasColumnType("double precision"); b.Property("Name") .IsRequired() .HasColumnType("text"); b.Property("StoreKeeperId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("StoreKeeperId"); b.ToTable("Components"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Count") .HasColumnType("integer"); b.Property("DateCreate") .HasColumnType("timestamp without time zone"); b.Property("DateImplement") .HasColumnType("timestamp without time zone"); b.Property("ProductId") .HasColumnType("integer"); b.Property("Status") .HasColumnType("integer"); b.Property("Sum") .HasColumnType("double precision"); b.HasKey("Id"); b.HasIndex("ProductId"); b.ToTable("Orders"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Count") .HasColumnType("integer"); b.Property("OrderId") .HasColumnType("integer"); b.Property("ProductId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("OrderId"); b.HasIndex("ProductId"); b.ToTable("OrderProducts"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Name") .IsRequired() .HasColumnType("text"); b.Property("Price") .HasColumnType("double precision"); b.Property("StoreKeeperId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("StoreKeeperId"); b.ToTable("Products"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("ComponentId") .HasColumnType("integer"); b.Property("Count") .HasColumnType("integer"); b.Property("ProductId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("ComponentId"); b.HasIndex("ProductId"); b.ToTable("ProductComponents"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Cost") .HasColumnType("double precision"); b.Property("DateCreate") .HasColumnType("timestamp without time zone"); b.Property("DateImplement") .HasColumnType("timestamp without time zone"); b.Property("VendorId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("VendorId"); b.ToTable("Purchases"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("BuildId") .HasColumnType("integer"); b.Property("Count") .HasColumnType("integer"); b.Property("PurchaseId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("BuildId"); b.HasIndex("PurchaseId"); b.ToTable("PurchaseBuilds"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Count") .HasColumnType("integer"); b.Property("ProductId") .HasColumnType("integer"); b.Property("PurchaseId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("ProductId"); b.HasIndex("PurchaseId"); b.ToTable("PurchaseProducts"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Login") .IsRequired() .HasColumnType("text"); b.Property("Name") .IsRequired() .HasColumnType("text"); b.Property("Password") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.ToTable("StoreKeepers"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Login") .IsRequired() .HasColumnType("text"); b.Property("Name") .IsRequired() .HasColumnType("text"); b.Property("Password") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.ToTable("Vendors"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b => { b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", "Vendor") .WithMany("Builds") .HasForeignKey("VendorId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Vendor"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b => { b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build") .WithMany("Components") .HasForeignKey("BuildId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component") .WithMany("BuldComponents") .HasForeignKey("ComponentId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Build"); b.Navigation("Component"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b => { b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build") .WithMany() .HasForeignKey("BuildId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Build"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b => { b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", "StoreKeeperЗЛ") .WithMany("Components") .HasForeignKey("StoreKeeperId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("StoreKeeperЗЛ"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b => { b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", null) .WithMany("Orders") .HasForeignKey("ProductId"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b => { b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Order", "Order") .WithMany("Products") .HasForeignKey("OrderId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product") .WithMany() .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Order"); b.Navigation("Product"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b => { b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", null) .WithMany("Products") .HasForeignKey("StoreKeeperId"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b => { b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component") .WithMany("ProductComponents") .HasForeignKey("ComponentId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product") .WithMany("Components") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Component"); b.Navigation("Product"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b => { b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", null) .WithMany("Purchases") .HasForeignKey("VendorId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b => { b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build") .WithMany() .HasForeignKey("BuildId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase") .WithMany("Builds") .HasForeignKey("PurchaseId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Build"); b.Navigation("Purchase"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b => { b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product") .WithMany() .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase") .WithMany("Products") .HasForeignKey("PurchaseId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Product"); b.Navigation("Purchase"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b => { b.Navigation("Components"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b => { b.Navigation("BuldComponents"); b.Navigation("ProductComponents"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b => { b.Navigation("Products"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b => { b.Navigation("Components"); b.Navigation("Orders"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b => { b.Navigation("Builds"); b.Navigation("Products"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b => { b.Navigation("Components"); b.Navigation("Products"); }); modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b => { b.Navigation("Builds"); b.Navigation("Purchases"); }); #pragma warning restore 612, 618 } } }