//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SecuritySystemDatabaseImplement;
#nullable disable
namespace PolyclinicDatabaseImplement.Migrations
{
[DbContext(typeof(PolyclinicDatabase))]
[Migration("20240501145526_Init-Create")]
partial class InitCreate
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.16")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Course", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Comment")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("DaysCount")
.HasColumnType("int");
b.Property("PillsPerDay")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Courses");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.CourseDiagnose", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CourseId")
.HasColumnType("int");
b.Property("DiagnoseId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CourseId");
b.HasIndex("DiagnoseId");
b.ToTable("CourseDiagnoses");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Diagnose", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Comment")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("DateStartDiagnose")
.HasColumnType("datetime2");
b.Property("DateStopDiagnose")
.HasColumnType("datetime2");
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Diagnoses");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Medicament", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Comment")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("ProcedureId")
.HasColumnType("int");
b.Property("SymptomId")
.IsRequired()
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProcedureId");
b.HasIndex("SymptomId");
b.ToTable("Medicaments");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Procedure", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Comment")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("DateStartProcedure")
.HasColumnType("datetime2");
b.Property("DateStopProcedure")
.HasColumnType("datetime2");
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Procedures");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Recipe", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Comment")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("CourseId")
.HasColumnType("int");
b.Property("ProceduresCount")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CourseId");
b.ToTable("Recipes");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.RecipeProcedure", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("ProcedureId")
.HasColumnType("int");
b.Property("RecipeId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProcedureId");
b.HasIndex("RecipeId");
b.ToTable("RecipeProcedures");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Symptom", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Comment")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Symptomes");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.SymptomDiagnose", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("DiagnoseId")
.HasColumnType("int");
b.Property("SymptomId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("DiagnoseId");
b.HasIndex("SymptomId");
b.ToTable("SymptomDiagnoses");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.SymptomRecipe", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("RecipeId")
.HasColumnType("int");
b.Property("SymptomId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RecipeId");
b.HasIndex("SymptomId");
b.ToTable("SymptomRecipes");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("FIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Role")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.CourseDiagnose", b =>
{
b.HasOne("PolyclinicDatabaseImplement.Models.Course", "Course")
.WithMany("Diagnoses")
.HasForeignKey("CourseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PolyclinicDatabaseImplement.Models.Diagnose", "Diagnose")
.WithMany()
.HasForeignKey("DiagnoseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Course");
b.Navigation("Diagnose");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Diagnose", b =>
{
b.HasOne("PolyclinicDatabaseImplement.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Medicament", b =>
{
b.HasOne("PolyclinicDatabaseImplement.Models.Procedure", "Procedure")
.WithMany()
.HasForeignKey("ProcedureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PolyclinicDatabaseImplement.Models.Symptom", "Symptom")
.WithMany()
.HasForeignKey("SymptomId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Procedure");
b.Navigation("Symptom");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Procedure", b =>
{
b.HasOne("PolyclinicDatabaseImplement.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Recipe", b =>
{
b.HasOne("PolyclinicDatabaseImplement.Models.Course", "Course")
.WithMany()
.HasForeignKey("CourseId");
b.Navigation("Course");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.RecipeProcedure", b =>
{
b.HasOne("PolyclinicDatabaseImplement.Models.Procedure", "Procedure")
.WithMany()
.HasForeignKey("ProcedureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PolyclinicDatabaseImplement.Models.Recipe", "Recipe")
.WithMany("Procedures")
.HasForeignKey("RecipeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Procedure");
b.Navigation("Recipe");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.SymptomDiagnose", b =>
{
b.HasOne("PolyclinicDatabaseImplement.Models.Diagnose", "Diagnose")
.WithMany()
.HasForeignKey("DiagnoseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PolyclinicDatabaseImplement.Models.Symptom", "Symptom")
.WithMany("Diagnoses")
.HasForeignKey("SymptomId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Diagnose");
b.Navigation("Symptom");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.SymptomRecipe", b =>
{
b.HasOne("PolyclinicDatabaseImplement.Models.Recipe", "Recipe")
.WithMany()
.HasForeignKey("RecipeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PolyclinicDatabaseImplement.Models.Symptom", "Symptom")
.WithMany()
.HasForeignKey("SymptomId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Recipe");
b.Navigation("Symptom");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Course", b =>
{
b.Navigation("Diagnoses");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Recipe", b =>
{
b.Navigation("Procedures");
});
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Symptom", b =>
{
b.Navigation("Diagnoses");
});
#pragma warning restore 612, 618
}
}
}