646 lines
22 KiB
C#
646 lines
22 KiB
C#
// <auto-generated />
|
|
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
|
|
{
|
|
/// <inheritdoc />
|
|
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<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("DoctorFIO")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.Property<string>("Login")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.Property<string>("Password")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Doctors");
|
|
});
|
|
|
|
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Drug", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("Count")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<DateTime>("DateCreate")
|
|
.HasColumnType("timestamp without time zone");
|
|
|
|
b.Property<int>("DoctorId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("DrugName")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.Property<double>("Price")
|
|
.HasColumnType("double precision");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DoctorId");
|
|
|
|
b.ToTable("Drugs");
|
|
});
|
|
|
|
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.DrugMedication", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("DrugId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("MedicationId")
|
|
.HasColumnType("integer");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DrugId");
|
|
|
|
b.HasIndex("MedicationId");
|
|
|
|
b.ToTable("DrugMedications");
|
|
});
|
|
|
|
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.DrugService", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("DrugId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int?>("MedicationId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("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<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("DoctorId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("MedicationName")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.Property<double>("Price")
|
|
.HasColumnType("double precision");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DoctorId");
|
|
|
|
b.ToTable("Medications");
|
|
});
|
|
|
|
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Owner", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Login")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.Property<string>("OwnerFIO")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.Property<string>("Password")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Owners");
|
|
});
|
|
|
|
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Pet", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("MedicationId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("OwnerId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("PetBreed")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.Property<string>("PetGender")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.Property<string>("PetName")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.Property<string>("PetType")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("MedicationId");
|
|
|
|
b.HasIndex("OwnerId");
|
|
|
|
b.ToTable("Pets");
|
|
});
|
|
|
|
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Purchase", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("Count")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<DateTime>("DateCreate")
|
|
.HasColumnType("timestamp without time zone");
|
|
|
|
b.Property<int>("DrugId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("OwnerId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("PuchaseName")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.Property<double>("Sum")
|
|
.HasColumnType("double precision");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DrugId");
|
|
|
|
b.HasIndex("OwnerId");
|
|
|
|
b.ToTable("Purchases");
|
|
});
|
|
|
|
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.PurchasePet", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("PetId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("PurchaseId")
|
|
.HasColumnType("integer");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("PetId");
|
|
|
|
b.HasIndex("PurchaseId");
|
|
|
|
b.ToTable("PurchasePets");
|
|
});
|
|
|
|
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Service", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("DoctorId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("ServiceName")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.Property<int>("VisitId")
|
|
.HasColumnType("integer");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DoctorId");
|
|
|
|
b.HasIndex("VisitId");
|
|
|
|
b.ToTable("Services");
|
|
});
|
|
|
|
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.ServiceMedication", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("MedicationId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("ServiceId")
|
|
.HasColumnType("integer");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("MedicationId");
|
|
|
|
b.HasIndex("ServiceId");
|
|
|
|
b.ToTable("ServiceMedications");
|
|
});
|
|
|
|
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Visit", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<DateTime>("DateVisit")
|
|
.HasColumnType("timestamp without time zone");
|
|
|
|
b.Property<int>("DoctorId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("OwnerId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("VisitName")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DoctorId");
|
|
|
|
b.HasIndex("OwnerId");
|
|
|
|
b.ToTable("Visits");
|
|
});
|
|
|
|
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.VisitPet", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("PetId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("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
|
|
}
|
|
}
|
|
}
|