//
using System;
using CaseAccountingDataBaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace CaseAccountingDataBaseImplement.Migrations
{
[DbContext(typeof(CaseAccountingDatabase))]
[Migration("20230519145356_migrSpecializationNullAttempt2")]
partial class migrSpecializationNullAttempt2
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Annotation")
.IsRequired()
.HasColumnType("text");
b.Property("Applicant")
.IsRequired()
.HasColumnType("text");
b.Property("Date")
.HasColumnType("timestamp with time zone");
b.Property("Defendant")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("SpecializationId")
.HasColumnType("integer");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("SpecializationId");
b.HasIndex("UserId");
b.ToTable("Cases");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CaseId")
.HasColumnType("integer");
b.Property("DealId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CaseId");
b.HasIndex("DealId");
b.ToTable("CaseDeals");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CaseId")
.HasColumnType("integer");
b.Property("LawyerId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CaseId");
b.HasIndex("LawyerId");
b.ToTable("CaseLawyers");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Coast")
.HasColumnType("numeric");
b.Property("Date")
.HasColumnType("timestamp with time zone");
b.Property("Service")
.IsRequired()
.HasColumnType("text");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Contracts");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Date")
.HasColumnType("timestamp with time zone");
b.Property("Responsibilities")
.IsRequired()
.HasColumnType("text");
b.Property("Subject")
.IsRequired()
.HasColumnType("text");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Deals");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ContractId")
.HasColumnType("integer");
b.Property("DealId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ContractId");
b.HasIndex("DealId");
b.ToTable("DealContracts");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CaseId")
.HasColumnType("integer");
b.Property("Date")
.HasColumnType("timestamp with time zone");
b.Property("Information")
.IsRequired()
.HasColumnType("text");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CaseId");
b.HasIndex("UserId");
b.ToTable("Hearings");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Experience")
.HasColumnType("integer");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Patronymic")
.IsRequired()
.HasColumnType("text");
b.Property("SpecializationId")
.HasColumnType("integer");
b.Property("Surname")
.IsRequired()
.HasColumnType("text");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("SpecializationId");
b.HasIndex("UserId");
b.ToTable("Lawyers");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ContractId")
.HasColumnType("integer");
b.Property("LawyerId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ContractId");
b.HasIndex("LawyerId");
b.ToTable("LawyerContracts");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Specializations");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Login")
.IsRequired()
.HasColumnType("text");
b.Property("Password")
.IsRequired()
.HasColumnType("text");
b.Property("Role")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
{
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
.WithMany("Cases")
.HasForeignKey("SpecializationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
.WithMany("Cases")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Specialization");
b.Navigation("User");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
{
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
.WithMany("Deals")
.HasForeignKey("CaseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
.WithMany("CaseDeals")
.HasForeignKey("DealId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Case");
b.Navigation("Deal");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
{
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
.WithMany("CaseLawyers")
.HasForeignKey("CaseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
.WithMany("CaseLawyers")
.HasForeignKey("LawyerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Case");
b.Navigation("Lawyer");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
{
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
.WithMany("Contracts")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
{
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
.WithMany("Deals")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
{
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
.WithMany("DealContracts")
.HasForeignKey("ContractId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
.WithMany("Contracts")
.HasForeignKey("DealId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Contract");
b.Navigation("Deal");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
{
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
.WithMany("Hearings")
.HasForeignKey("CaseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
.WithMany("Hearings")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Case");
b.Navigation("User");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
{
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
.WithMany("Lawyers")
.HasForeignKey("SpecializationId");
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
.WithMany("Lawyers")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Specialization");
b.Navigation("User");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
{
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
.WithMany("LawyerContracts")
.HasForeignKey("ContractId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
.WithMany("LawyerContracts")
.HasForeignKey("LawyerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Contract");
b.Navigation("Lawyer");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
{
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
.WithMany("Specializations")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
{
b.Navigation("CaseLawyers");
b.Navigation("Deals");
b.Navigation("Hearings");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
{
b.Navigation("DealContracts");
b.Navigation("LawyerContracts");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
{
b.Navigation("CaseDeals");
b.Navigation("Contracts");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
{
b.Navigation("CaseLawyers");
b.Navigation("LawyerContracts");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
{
b.Navigation("Cases");
b.Navigation("Lawyers");
});
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
{
b.Navigation("Cases");
b.Navigation("Contracts");
b.Navigation("Deals");
b.Navigation("Hearings");
b.Navigation("Lawyers");
b.Navigation("Specializations");
});
#pragma warning restore 612, 618
}
}
}