//
using System;
using HardwareShopDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace HardwareShopDatabaseImplement.Migrations
{
[DbContext(typeof(HardwareShopDatabase))]
partial class HardwareShopDatabaseModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.ManyToMany.BuildComponent", b =>
{
b.Property("ComponentId")
.HasColumnType("integer");
b.Property("BuildId")
.HasColumnType("integer");
b.Property("Count")
.HasColumnType("integer");
b.HasKey("ComponentId", "BuildId");
b.HasIndex("BuildId");
b.ToTable("BuildsComponents");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.ManyToMany.GoodComponent", b =>
{
b.Property("GoodId")
.HasColumnType("integer");
b.Property("ComponentId")
.HasColumnType("integer");
b.Property("Count")
.HasColumnType("integer");
b.HasKey("GoodId", "ComponentId");
b.HasIndex("ComponentId");
b.ToTable("GoodComponents");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.ManyToMany.PurchaseBuild", b =>
{
b.Property("PurchaseId")
.HasColumnType("integer");
b.Property("BuildId")
.HasColumnType("integer");
b.Property("Count")
.HasColumnType("integer");
b.HasKey("PurchaseId", "BuildId");
b.HasIndex("BuildId");
b.ToTable("PurchasesBuilds");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.ManyToMany.PurchaseGood", b =>
{
b.Property("PurchaseId")
.HasColumnType("integer");
b.Property("GoodId")
.HasColumnType("integer");
b.Property("Count")
.HasColumnType("integer");
b.HasKey("PurchaseId", "GoodId");
b.HasIndex("GoodId");
b.ToTable("PurchasesGoods");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Storekeeper.Component", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ClientId")
.HasColumnType("integer");
b.Property("ComponentName")
.IsRequired()
.HasColumnType("text");
b.Property("Cost")
.HasColumnType("double precision");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("Components");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Storekeeper.Good", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ClientId")
.HasColumnType("integer");
b.Property("GoodName")
.IsRequired()
.HasColumnType("text");
b.Property("Price")
.HasColumnType("double precision");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("Goods");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Storekeeper.Order", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ClientId")
.HasColumnType("integer");
b.Property("Count")
.HasColumnType("integer");
b.Property("DateCreate")
.HasColumnType("timestamp with time zone");
b.Property("DateImplement")
.HasColumnType("timestamp with time zone");
b.Property("GoodId")
.HasColumnType("integer");
b.Property("Status")
.HasColumnType("integer");
b.Property("Sum")
.HasColumnType("double precision");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("GoodId");
b.ToTable("Orders");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Email")
.IsRequired()
.HasColumnType("text");
b.Property("Login")
.IsRequired()
.HasColumnType("text");
b.Property("Password")
.IsRequired()
.HasColumnType("text");
b.Property("Role")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("Email")
.IsUnique();
b.HasIndex("Login")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Worker.Build", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("BuildName")
.IsRequired()
.HasColumnType("text");
b.Property("ClientId")
.HasColumnType("integer");
b.Property("Price")
.HasColumnType("numeric");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("Builds");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Worker.Comment", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("BuildId")
.HasColumnType("integer");
b.Property("ClientId")
.HasColumnType("integer");
b.Property("Text")
.IsRequired()
.HasColumnType("text");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("BuildId");
b.HasIndex("ClientId");
b.ToTable("Comments");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Worker.Purchase", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ClientId")
.HasColumnType("integer");
b.Property("DatePurchase")
.HasColumnType("timestamp with time zone");
b.Property("PurchaseStatus")
.HasColumnType("integer");
b.Property("Sum")
.HasColumnType("numeric");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("Purchases");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.ManyToMany.BuildComponent", b =>
{
b.HasOne("HardwareShopDatabaseImplement.Models.Worker.Build", "Build")
.WithMany("Components")
.HasForeignKey("BuildId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("HardwareShopDatabaseImplement.Models.Storekeeper.Component", "Component")
.WithMany("Builds")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Build");
b.Navigation("Component");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.ManyToMany.GoodComponent", b =>
{
b.HasOne("HardwareShopDatabaseImplement.Models.Storekeeper.Component", "Component")
.WithMany("Goods")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("HardwareShopDatabaseImplement.Models.Storekeeper.Good", "Good")
.WithMany("Components")
.HasForeignKey("GoodId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Good");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.ManyToMany.PurchaseBuild", b =>
{
b.HasOne("HardwareShopDatabaseImplement.Models.Worker.Build", "Build")
.WithMany("Purchases")
.HasForeignKey("BuildId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("HardwareShopDatabaseImplement.Models.Worker.Purchase", "Purchase")
.WithMany("Builds")
.HasForeignKey("PurchaseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Build");
b.Navigation("Purchase");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.ManyToMany.PurchaseGood", b =>
{
b.HasOne("HardwareShopDatabaseImplement.Models.Storekeeper.Good", "Good")
.WithMany("Purchases")
.HasForeignKey("GoodId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("HardwareShopDatabaseImplement.Models.Worker.Purchase", "Purchase")
.WithMany("Goods")
.HasForeignKey("PurchaseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Good");
b.Navigation("Purchase");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Storekeeper.Component", b =>
{
b.HasOne("HardwareShopDatabaseImplement.Models.User", "User")
.WithMany("Components")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Storekeeper.Good", b =>
{
b.HasOne("HardwareShopDatabaseImplement.Models.User", "User")
.WithMany("Goods")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Storekeeper.Order", b =>
{
b.HasOne("HardwareShopDatabaseImplement.Models.User", "User")
.WithMany("Orders")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("HardwareShopDatabaseImplement.Models.Storekeeper.Good", "Good")
.WithMany("Orders")
.HasForeignKey("GoodId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Good");
b.Navigation("User");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Worker.Build", b =>
{
b.HasOne("HardwareShopDatabaseImplement.Models.User", "User")
.WithMany("Builds")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Worker.Comment", b =>
{
b.HasOne("HardwareShopDatabaseImplement.Models.Worker.Build", "Build")
.WithMany("Comments")
.HasForeignKey("BuildId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("HardwareShopDatabaseImplement.Models.User", "User")
.WithMany("Comments")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Build");
b.Navigation("User");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Worker.Purchase", b =>
{
b.HasOne("HardwareShopDatabaseImplement.Models.User", "User")
.WithMany("Purchases")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Storekeeper.Component", b =>
{
b.Navigation("Builds");
b.Navigation("Goods");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Storekeeper.Good", b =>
{
b.Navigation("Components");
b.Navigation("Orders");
b.Navigation("Purchases");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.User", b =>
{
b.Navigation("Builds");
b.Navigation("Comments");
b.Navigation("Components");
b.Navigation("Goods");
b.Navigation("Orders");
b.Navigation("Purchases");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Worker.Build", b =>
{
b.Navigation("Comments");
b.Navigation("Components");
b.Navigation("Purchases");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Worker.Purchase", b =>
{
b.Navigation("Builds");
b.Navigation("Goods");
});
#pragma warning restore 612, 618
}
}
}