//
using System;
using MagicCarpetDatabase;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace MagicCarpetDatabase.Migrations
{
[DbContext(typeof(MagicCarpetDbContext))]
partial class MagicCarpetDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("MagicCarpetDatabase.Models.Client", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("DiscountSize")
.HasColumnType("double precision");
b.Property("FIO")
.IsRequired()
.HasColumnType("text");
b.Property("PhoneNumber")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("PhoneNumber")
.IsUnique();
b.ToTable("Clients");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.Employee", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("BirthDate")
.HasColumnType("timestamp with time zone");
b.Property("Email")
.IsRequired()
.HasColumnType("text");
b.Property("EmploymentDate")
.HasColumnType("timestamp with time zone");
b.Property("FIO")
.IsRequired()
.HasColumnType("text");
b.Property("IsDeleted")
.HasColumnType("boolean");
b.Property("PostId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Employees");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.Post", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("ChangeDate")
.HasColumnType("timestamp with time zone");
b.Property("IsActual")
.HasColumnType("boolean");
b.Property("PostId")
.IsRequired()
.HasColumnType("text");
b.Property("PostName")
.IsRequired()
.HasColumnType("text");
b.Property("PostType")
.HasColumnType("integer");
b.Property("Salary")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("PostId", "IsActual")
.IsUnique()
.HasFilter("\"IsActual\" = TRUE");
b.HasIndex("PostName", "IsActual")
.IsUnique()
.HasFilter("\"IsActual\" = TRUE");
b.ToTable("Posts");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.Salary", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("EmployeeId")
.IsRequired()
.HasColumnType("text");
b.Property("EmployeeSalary")
.HasColumnType("double precision");
b.Property("SalaryDate")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.ToTable("Salaries");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.Sale", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("ClientId")
.HasColumnType("text");
b.Property("Discount")
.HasColumnType("double precision");
b.Property("DiscountType")
.HasColumnType("integer");
b.Property("EmployeeId")
.IsRequired()
.HasColumnType("text");
b.Property("IsCancel")
.HasColumnType("boolean");
b.Property("SaleDate")
.HasColumnType("timestamp with time zone");
b.Property("Sum")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("EmployeeId");
b.ToTable("Sales");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.SaleTour", b =>
{
b.Property("SaleId")
.HasColumnType("text");
b.Property("TourId")
.HasColumnType("text");
b.Property("Count")
.HasColumnType("integer");
b.Property("Price")
.HasColumnType("double precision");
b.HasKey("SaleId", "TourId");
b.HasIndex("TourId");
b.ToTable("SaleTours");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.Tour", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("Price")
.HasColumnType("double precision");
b.Property("TourCountry")
.HasColumnType("text");
b.Property("TourName")
.IsRequired()
.HasColumnType("text");
b.Property("TourType")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("TourName")
.IsUnique();
b.ToTable("Tours");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.TourHistory", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("ChangeDate")
.HasColumnType("timestamp with time zone");
b.Property("OldPrice")
.HasColumnType("double precision");
b.Property("TourId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TourId");
b.ToTable("TourHistories");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.Salary", b =>
{
b.HasOne("MagicCarpetDatabase.Models.Employee", "Employee")
.WithMany("Salaries")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.Sale", b =>
{
b.HasOne("MagicCarpetDatabase.Models.Client", "Client")
.WithMany("Sales")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("MagicCarpetDatabase.Models.Employee", "Employee")
.WithMany("Sales")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Employee");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.SaleTour", b =>
{
b.HasOne("MagicCarpetDatabase.Models.Sale", "Sale")
.WithMany("SaleTours")
.HasForeignKey("SaleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("MagicCarpetDatabase.Models.Tour", "Tour")
.WithMany("SaleTours")
.HasForeignKey("TourId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Sale");
b.Navigation("Tour");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.TourHistory", b =>
{
b.HasOne("MagicCarpetDatabase.Models.Tour", "Tour")
.WithMany("TourHistories")
.HasForeignKey("TourId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tour");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.Client", b =>
{
b.Navigation("Sales");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.Employee", b =>
{
b.Navigation("Salaries");
b.Navigation("Sales");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.Sale", b =>
{
b.Navigation("SaleTours");
});
modelBuilder.Entity("MagicCarpetDatabase.Models.Tour", b =>
{
b.Navigation("SaleTours");
b.Navigation("TourHistories");
});
#pragma warning restore 612, 618
}
}
}