From 6993d3f59c57b2663207a74580be4abf18b62c90 Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Tue, 30 Apr 2024 11:47:36 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D1=8C=D0=BD=D0=B0?= =?UTF-8?q?=D1=8F=20=D0=BC=D0=B8=D0=B3=D1=80=D0=B0=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...40430074427_InitializeDatabase.Designer.cs | 431 ++++++++++++++++++ .../20240430074427_InitializeDatabase.cs | 345 ++++++++++++++ .../PolyclinicDatabaseModelSnapshot.cs | 428 +++++++++++++++++ .../PolyclinicDatabaseImplement.csproj | 4 + .../PolyclinicView/PolyclinicView.csproj | 11 + 5 files changed, 1219 insertions(+) create mode 100644 Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430074427_InitializeDatabase.Designer.cs create mode 100644 Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430074427_InitializeDatabase.cs create mode 100644 Polyclinic/PolyclinicDatabaseImplement/Migrations/PolyclinicDatabaseModelSnapshot.cs diff --git a/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430074427_InitializeDatabase.Designer.cs b/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430074427_InitializeDatabase.Designer.cs new file mode 100644 index 0000000..6e6261c --- /dev/null +++ b/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430074427_InitializeDatabase.Designer.cs @@ -0,0 +1,431 @@ +// +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("20240430074427_InitializeDatabase")] + partial class InitializeDatabase + { + /// + 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.Property("RecipeId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RecipeId"); + + 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("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") + .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("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Procedures"); + }); + + modelBuilder.Entity("PolyclinicDatabaseImplement.Models.ProcedureRecipe", 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("ProcedureRecipes"); + }); + + 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("ProceduresCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Recipes"); + }); + + 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.Course", b => + { + b.HasOne("PolyclinicDatabaseImplement.Models.Recipe", "Recipe") + .WithMany() + .HasForeignKey("RecipeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Recipe"); + }); + + 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.ProcedureRecipe", b => + { + b.HasOne("PolyclinicDatabaseImplement.Models.Procedure", "Procedure") + .WithMany("Recipes") + .HasForeignKey("ProcedureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PolyclinicDatabaseImplement.Models.Recipe", "Recipe") + .WithMany() + .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.Procedure", b => + { + b.Navigation("Recipes"); + }); + + modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Symptom", b => + { + b.Navigation("Diagnoses"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430074427_InitializeDatabase.cs b/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430074427_InitializeDatabase.cs new file mode 100644 index 0000000..f85fb17 --- /dev/null +++ b/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430074427_InitializeDatabase.cs @@ -0,0 +1,345 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace PolyclinicDatabaseImplement.Migrations +{ + /// + public partial class InitializeDatabase : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Procedures", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + UserId = table.Column(type: "int", nullable: false), + Name = table.Column(type: "nvarchar(max)", nullable: false), + Comment = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Procedures", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Recipes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ProceduresCount = table.Column(type: "int", nullable: false), + Comment = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Recipes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Symptomes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: false), + Comment = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Symptomes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + FIO = table.Column(type: "nvarchar(max)", nullable: false), + Email = table.Column(type: "nvarchar(max)", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false), + Role = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Courses", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + DaysCount = table.Column(type: "int", nullable: false), + PillsPerDay = table.Column(type: "int", nullable: false), + Comment = table.Column(type: "nvarchar(max)", nullable: false), + RecipeId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Courses", x => x.Id); + table.ForeignKey( + name: "FK_Courses_Recipes_RecipeId", + column: x => x.RecipeId, + principalTable: "Recipes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProcedureRecipes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ProcedureId = table.Column(type: "int", nullable: false), + RecipeId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProcedureRecipes", x => x.Id); + table.ForeignKey( + name: "FK_ProcedureRecipes_Procedures_ProcedureId", + column: x => x.ProcedureId, + principalTable: "Procedures", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProcedureRecipes_Recipes_RecipeId", + column: x => x.RecipeId, + principalTable: "Recipes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Medicaments", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: false), + Comment = table.Column(type: "nvarchar(max)", nullable: false), + ProcedureId = table.Column(type: "int", nullable: false), + SymptomId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Medicaments", x => x.Id); + table.ForeignKey( + name: "FK_Medicaments_Procedures_ProcedureId", + column: x => x.ProcedureId, + principalTable: "Procedures", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Medicaments_Symptomes_SymptomId", + column: x => x.SymptomId, + principalTable: "Symptomes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "SymptomRecipes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + SymptomId = table.Column(type: "int", nullable: false), + RecipeId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SymptomRecipes", x => x.Id); + table.ForeignKey( + name: "FK_SymptomRecipes_Recipes_RecipeId", + column: x => x.RecipeId, + principalTable: "Recipes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_SymptomRecipes_Symptomes_SymptomId", + column: x => x.SymptomId, + principalTable: "Symptomes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Diagnoses", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: false), + Comment = table.Column(type: "nvarchar(max)", nullable: false), + UserId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Diagnoses", x => x.Id); + table.ForeignKey( + name: "FK_Diagnoses_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "CourseDiagnoses", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CourseId = table.Column(type: "int", nullable: false), + DiagnoseId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CourseDiagnoses", x => x.Id); + table.ForeignKey( + name: "FK_CourseDiagnoses_Courses_CourseId", + column: x => x.CourseId, + principalTable: "Courses", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CourseDiagnoses_Diagnoses_DiagnoseId", + column: x => x.DiagnoseId, + principalTable: "Diagnoses", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "SymptomDiagnoses", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + SymptomId = table.Column(type: "int", nullable: false), + DiagnoseId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SymptomDiagnoses", x => x.Id); + table.ForeignKey( + name: "FK_SymptomDiagnoses_Diagnoses_DiagnoseId", + column: x => x.DiagnoseId, + principalTable: "Diagnoses", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_SymptomDiagnoses_Symptomes_SymptomId", + column: x => x.SymptomId, + principalTable: "Symptomes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_CourseDiagnoses_CourseId", + table: "CourseDiagnoses", + column: "CourseId"); + + migrationBuilder.CreateIndex( + name: "IX_CourseDiagnoses_DiagnoseId", + table: "CourseDiagnoses", + column: "DiagnoseId"); + + migrationBuilder.CreateIndex( + name: "IX_Courses_RecipeId", + table: "Courses", + column: "RecipeId"); + + migrationBuilder.CreateIndex( + name: "IX_Diagnoses_UserId", + table: "Diagnoses", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Medicaments_ProcedureId", + table: "Medicaments", + column: "ProcedureId"); + + migrationBuilder.CreateIndex( + name: "IX_Medicaments_SymptomId", + table: "Medicaments", + column: "SymptomId"); + + migrationBuilder.CreateIndex( + name: "IX_ProcedureRecipes_ProcedureId", + table: "ProcedureRecipes", + column: "ProcedureId"); + + migrationBuilder.CreateIndex( + name: "IX_ProcedureRecipes_RecipeId", + table: "ProcedureRecipes", + column: "RecipeId"); + + migrationBuilder.CreateIndex( + name: "IX_SymptomDiagnoses_DiagnoseId", + table: "SymptomDiagnoses", + column: "DiagnoseId"); + + migrationBuilder.CreateIndex( + name: "IX_SymptomDiagnoses_SymptomId", + table: "SymptomDiagnoses", + column: "SymptomId"); + + migrationBuilder.CreateIndex( + name: "IX_SymptomRecipes_RecipeId", + table: "SymptomRecipes", + column: "RecipeId"); + + migrationBuilder.CreateIndex( + name: "IX_SymptomRecipes_SymptomId", + table: "SymptomRecipes", + column: "SymptomId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CourseDiagnoses"); + + migrationBuilder.DropTable( + name: "Medicaments"); + + migrationBuilder.DropTable( + name: "ProcedureRecipes"); + + migrationBuilder.DropTable( + name: "SymptomDiagnoses"); + + migrationBuilder.DropTable( + name: "SymptomRecipes"); + + migrationBuilder.DropTable( + name: "Courses"); + + migrationBuilder.DropTable( + name: "Procedures"); + + migrationBuilder.DropTable( + name: "Diagnoses"); + + migrationBuilder.DropTable( + name: "Symptomes"); + + migrationBuilder.DropTable( + name: "Recipes"); + + migrationBuilder.DropTable( + name: "Users"); + } + } +} diff --git a/Polyclinic/PolyclinicDatabaseImplement/Migrations/PolyclinicDatabaseModelSnapshot.cs b/Polyclinic/PolyclinicDatabaseImplement/Migrations/PolyclinicDatabaseModelSnapshot.cs new file mode 100644 index 0000000..90355e1 --- /dev/null +++ b/Polyclinic/PolyclinicDatabaseImplement/Migrations/PolyclinicDatabaseModelSnapshot.cs @@ -0,0 +1,428 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using SecuritySystemDatabaseImplement; + +#nullable disable + +namespace PolyclinicDatabaseImplement.Migrations +{ + [DbContext(typeof(PolyclinicDatabase))] + partial class PolyclinicDatabaseModelSnapshot : ModelSnapshot + { + protected override void BuildModel(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.Property("RecipeId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RecipeId"); + + 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("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") + .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("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Procedures"); + }); + + modelBuilder.Entity("PolyclinicDatabaseImplement.Models.ProcedureRecipe", 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("ProcedureRecipes"); + }); + + 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("ProceduresCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Recipes"); + }); + + 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.Course", b => + { + b.HasOne("PolyclinicDatabaseImplement.Models.Recipe", "Recipe") + .WithMany() + .HasForeignKey("RecipeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Recipe"); + }); + + 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.ProcedureRecipe", b => + { + b.HasOne("PolyclinicDatabaseImplement.Models.Procedure", "Procedure") + .WithMany("Recipes") + .HasForeignKey("ProcedureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PolyclinicDatabaseImplement.Models.Recipe", "Recipe") + .WithMany() + .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.Procedure", b => + { + b.Navigation("Recipes"); + }); + + modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Symptom", b => + { + b.Navigation("Diagnoses"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Polyclinic/PolyclinicDatabaseImplement/PolyclinicDatabaseImplement.csproj b/Polyclinic/PolyclinicDatabaseImplement/PolyclinicDatabaseImplement.csproj index a72d4e4..a1d7582 100644 --- a/Polyclinic/PolyclinicDatabaseImplement/PolyclinicDatabaseImplement.csproj +++ b/Polyclinic/PolyclinicDatabaseImplement/PolyclinicDatabaseImplement.csproj @@ -9,6 +9,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Polyclinic/PolyclinicView/PolyclinicView.csproj b/Polyclinic/PolyclinicView/PolyclinicView.csproj index b57c89e..05799d6 100644 --- a/Polyclinic/PolyclinicView/PolyclinicView.csproj +++ b/Polyclinic/PolyclinicView/PolyclinicView.csproj @@ -8,4 +8,15 @@ enable + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + \ No newline at end of file -- 2.25.1