// using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using VeterinaryDatabaseImplement; #nullable disable namespace VeterinaryDatabaseImplement.Migrations { [DbContext(typeof(VeterinaryDatabase))] [Migration("20240529175621_InitialCreate10")] partial class InitialCreate10 { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "7.0.16") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Doctor", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("DoctorFIO") .IsRequired() .HasColumnType("text"); b.Property("Login") .IsRequired() .HasColumnType("text"); b.Property("Password") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.ToTable("Doctors"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Drug", 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("DoctorId") .HasColumnType("integer"); b.Property("DrugName") .IsRequired() .HasColumnType("text"); b.Property("Price") .HasColumnType("double precision"); b.HasKey("Id"); b.HasIndex("DoctorId"); b.ToTable("Drugs"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.DrugMedication", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("DrugId") .HasColumnType("integer"); b.Property("MedicationId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("DrugId"); b.HasIndex("MedicationId"); b.ToTable("DrugMedications"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.DrugService", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("DrugId") .HasColumnType("integer"); b.Property("MedicationId") .HasColumnType("integer"); b.Property("ServiceId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("DrugId"); b.HasIndex("MedicationId"); b.HasIndex("ServiceId"); b.ToTable("DrugServices"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Medication", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("DoctorId") .HasColumnType("integer"); b.Property("MedicationName") .IsRequired() .HasColumnType("text"); b.Property("Price") .HasColumnType("double precision"); b.HasKey("Id"); b.HasIndex("DoctorId"); b.ToTable("Medications"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Owner", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Login") .IsRequired() .HasColumnType("text"); b.Property("OwnerFIO") .IsRequired() .HasColumnType("text"); b.Property("Password") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.ToTable("Owners"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Pet", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("MedicationId") .HasColumnType("integer"); b.Property("OwnerId") .HasColumnType("integer"); b.Property("PetBreed") .IsRequired() .HasColumnType("text"); b.Property("PetGender") .IsRequired() .HasColumnType("text"); b.Property("PetName") .IsRequired() .HasColumnType("text"); b.Property("PetType") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("MedicationId"); b.HasIndex("OwnerId"); b.ToTable("Pets"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Purchase", 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("DrugId") .HasColumnType("integer"); b.Property("OwnerId") .HasColumnType("integer"); b.Property("PuchaseName") .IsRequired() .HasColumnType("text"); b.Property("Sum") .HasColumnType("double precision"); b.HasKey("Id"); b.HasIndex("DrugId"); b.HasIndex("OwnerId"); b.ToTable("Purchases"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.PurchasePet", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("PetId") .HasColumnType("integer"); b.Property("PurchaseId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("PetId"); b.HasIndex("PurchaseId"); b.ToTable("PurchasePets"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Service", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("DoctorId") .HasColumnType("integer"); b.Property("ServiceName") .IsRequired() .HasColumnType("text"); b.Property("VisitId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("DoctorId"); b.HasIndex("VisitId"); b.ToTable("Services"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.ServiceMedication", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("MedicationId") .HasColumnType("integer"); b.Property("ServiceId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("MedicationId"); b.HasIndex("ServiceId"); b.ToTable("ServiceMedications"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Visit", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("DateVisit") .HasColumnType("timestamp without time zone"); b.Property("DoctorId") .HasColumnType("integer"); b.Property("OwnerId") .HasColumnType("integer"); b.Property("VisitName") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("DoctorId"); b.HasIndex("OwnerId"); b.ToTable("Visits"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.VisitPet", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("PetId") .HasColumnType("integer"); b.Property("VisitId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("PetId"); b.HasIndex("VisitId"); b.ToTable("VisitPets"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Drug", b => { b.HasOne("VeterinaryDatabaseImplement.Models.Doctor", "Doctor") .WithMany("Drugs") .HasForeignKey("DoctorId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Doctor"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.DrugMedication", b => { b.HasOne("VeterinaryDatabaseImplement.Models.Drug", "Drug") .WithMany() .HasForeignKey("DrugId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("VeterinaryDatabaseImplement.Models.Medication", "Medication") .WithMany("DrugMedications") .HasForeignKey("MedicationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Drug"); b.Navigation("Medication"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.DrugService", b => { b.HasOne("VeterinaryDatabaseImplement.Models.Drug", "Drug") .WithMany("Services") .HasForeignKey("DrugId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("VeterinaryDatabaseImplement.Models.Medication", null) .WithMany("DrugServices") .HasForeignKey("MedicationId"); b.HasOne("VeterinaryDatabaseImplement.Models.Service", "Service") .WithMany("DrugServices") .HasForeignKey("ServiceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Drug"); b.Navigation("Service"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Medication", b => { b.HasOne("VeterinaryDatabaseImplement.Models.Doctor", null) .WithMany("Medications") .HasForeignKey("DoctorId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Pet", b => { b.HasOne("VeterinaryDatabaseImplement.Models.Medication", "Medication") .WithMany("Pets") .HasForeignKey("MedicationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("VeterinaryDatabaseImplement.Models.Owner", "Owner") .WithMany("Pets") .HasForeignKey("OwnerId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Medication"); b.Navigation("Owner"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Purchase", b => { b.HasOne("VeterinaryDatabaseImplement.Models.Drug", "Drug") .WithMany("Purchases") .HasForeignKey("DrugId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("VeterinaryDatabaseImplement.Models.Owner", "Owner") .WithMany("Purchases") .HasForeignKey("OwnerId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Drug"); b.Navigation("Owner"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.PurchasePet", b => { b.HasOne("VeterinaryDatabaseImplement.Models.Pet", "Pet") .WithMany("Purchases") .HasForeignKey("PetId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("VeterinaryDatabaseImplement.Models.Purchase", "Purchase") .WithMany("Pets") .HasForeignKey("PurchaseId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Pet"); b.Navigation("Purchase"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Service", b => { b.HasOne("VeterinaryDatabaseImplement.Models.Doctor", "Doctor") .WithMany("Services") .HasForeignKey("DoctorId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("VeterinaryDatabaseImplement.Models.Visit", "Visit") .WithMany() .HasForeignKey("VisitId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Doctor"); b.Navigation("Visit"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.ServiceMedication", b => { b.HasOne("VeterinaryDatabaseImplement.Models.Medication", "Medication") .WithMany("ServiceMedications") .HasForeignKey("MedicationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("VeterinaryDatabaseImplement.Models.Service", "Service") .WithMany("Medications") .HasForeignKey("ServiceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Medication"); b.Navigation("Service"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Visit", b => { b.HasOne("VeterinaryDatabaseImplement.Models.Doctor", "Doctor") .WithMany("Visits") .HasForeignKey("DoctorId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("VeterinaryDatabaseImplement.Models.Owner", "Owner") .WithMany("Visits") .HasForeignKey("OwnerId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Doctor"); b.Navigation("Owner"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.VisitPet", b => { b.HasOne("VeterinaryDatabaseImplement.Models.Pet", "Pet") .WithMany("Visits") .HasForeignKey("PetId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("VeterinaryDatabaseImplement.Models.Visit", "Visit") .WithMany("Pets") .HasForeignKey("VisitId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Pet"); b.Navigation("Visit"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Doctor", b => { b.Navigation("Drugs"); b.Navigation("Medications"); b.Navigation("Services"); b.Navigation("Visits"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Drug", b => { b.Navigation("Purchases"); b.Navigation("Services"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Medication", b => { b.Navigation("DrugMedications"); b.Navigation("DrugServices"); b.Navigation("Pets"); b.Navigation("ServiceMedications"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Owner", b => { b.Navigation("Pets"); b.Navigation("Purchases"); b.Navigation("Visits"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Pet", b => { b.Navigation("Purchases"); b.Navigation("Visits"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Purchase", b => { b.Navigation("Pets"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Service", b => { b.Navigation("DrugServices"); b.Navigation("Medications"); }); modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Visit", b => { b.Navigation("Pets"); }); #pragma warning restore 612, 618 } } }