//
using System;
using BankDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace BankDatabaseImplement.Migrations
{
[DbContext(typeof(BankDB))]
partial class BankDBModelSnapshot : 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("BankDatabaseImplement.Models.Client", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Address")
.IsRequired()
.HasColumnType("text");
b.Property("Email")
.IsRequired()
.HasColumnType("text");
b.Property("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property("LastName")
.IsRequired()
.HasColumnType("text");
b.Property("MiddleName")
.HasColumnType("text");
b.Property("Password")
.IsRequired()
.HasColumnType("text");
b.Property("PhoneNumber")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Cost", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("EmployeeId")
.HasColumnType("integer");
b.Property("NameOfCost")
.IsRequired()
.HasColumnType("text");
b.Property("Price")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.ToTable("Costs");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CostByPurchase", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CostId")
.HasColumnType("integer");
b.Property("Count")
.HasColumnType("integer");
b.Property("PurchaseId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CostId");
b.HasIndex("PurchaseId");
b.ToTable("CostByPurchases");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Employee", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Email")
.IsRequired()
.HasColumnType("text");
b.Property("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property("LastName")
.IsRequired()
.HasColumnType("text");
b.Property("MiddleName")
.HasColumnType("text");
b.Property("Password")
.IsRequired()
.HasColumnType("text");
b.Property("PhoneNumber")
.IsRequired()
.HasColumnType("text");
b.Property("Post")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Employees");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Operation", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("EmployeeId")
.HasColumnType("integer");
b.Property("Mark")
.IsRequired()
.HasColumnType("text");
b.Property("Model")
.IsRequired()
.HasColumnType("text");
b.Property("Price")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.ToTable("Operations");
});
modelBuilder.Entity("BankDatabaseImplement.Models.OperationByPurchase", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CountOperations")
.HasColumnType("integer");
b.Property("OperationId")
.HasColumnType("integer");
b.Property("PurchaseId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("OperationId");
b.HasIndex("PurchaseId");
b.ToTable("OperationByPurchases");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Date")
.HasColumnType("date");
b.Property("OperationByPurchaseId")
.HasColumnType("integer");
b.Property("PaidPrice")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("OperationByPurchaseId");
b.ToTable("Payments");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Purchase", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ClientId")
.HasColumnType("integer");
b.Property("DatePurchase")
.HasColumnType("date");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("Purchases");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Cost", b =>
{
b.HasOne("BankDatabaseImplement.Models.Employee", "Employee")
.WithMany("Costs")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CostByPurchase", b =>
{
b.HasOne("BankDatabaseImplement.Models.Cost", "Cost")
.WithMany("Purchases")
.HasForeignKey("CostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BankDatabaseImplement.Models.Purchase", "Purchase")
.WithMany("Costs")
.HasForeignKey("PurchaseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cost");
b.Navigation("Purchase");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Operation", b =>
{
b.HasOne("BankDatabaseImplement.Models.Employee", "Employee")
.WithMany("Operations")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
});
modelBuilder.Entity("BankDatabaseImplement.Models.OperationByPurchase", b =>
{
b.HasOne("BankDatabaseImplement.Models.Operation", "Operation")
.WithMany("Purchases")
.HasForeignKey("OperationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BankDatabaseImplement.Models.Purchase", "Purchase")
.WithMany("Operations")
.HasForeignKey("PurchaseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Operation");
b.Navigation("Purchase");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b =>
{
b.HasOne("BankDatabaseImplement.Models.OperationByPurchase", "OperationByPurchase")
.WithMany("Payments")
.HasForeignKey("OperationByPurchaseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("OperationByPurchase");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Purchase", b =>
{
b.HasOne("BankDatabaseImplement.Models.Client", "Client")
.WithMany("Purchases")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Client", b =>
{
b.Navigation("Purchases");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Cost", b =>
{
b.Navigation("Purchases");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Employee", b =>
{
b.Navigation("Costs");
b.Navigation("Operations");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Operation", b =>
{
b.Navigation("Purchases");
});
modelBuilder.Entity("BankDatabaseImplement.Models.OperationByPurchase", b =>
{
b.Navigation("Payments");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Purchase", b =>
{
b.Navigation("Costs");
b.Navigation("Operations");
});
#pragma warning restore 612, 618
}
}
}