From 3c6167eee6cf09a2a4dcec1d072d58d9edc55e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=91=D0=B0=D0=BA=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D1=81=D0=BA=D0=B0=D1=8F?= Date: Thu, 30 May 2024 03:15:34 +0400 Subject: [PATCH] =?UTF-8?q?=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=B8?= =?UTF-8?q?=20=D0=B1=D0=B5=D0=B7=20=D1=81=D0=B8=D0=BC=D0=BF=D1=82=D0=BE?= =?UTF-8?q?=D0=BC=D0=BE=D0=B2=20=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=20=D0=BB?= =?UTF-8?q?=D0=B5=D0=BA=D0=B0=D1=80=D1=81=D1=82=D0=B2=D0=B0=20=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B0=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0240529231348_For-Medicaments.Designer.cs} | 7 +--- ...s.cs => 20240529231348_For-Medicaments.cs} | 41 +++++++++++++++++++ .../PolyclinicDatabaseModelSnapshot.cs | 5 +-- .../Models/Medicament.cs | 1 - 4 files changed, 44 insertions(+), 10 deletions(-) rename Polyclinic/PolyclinicDatabaseImplement/Migrations/{20240529230147_For-Medicaments.Designer.cs => 20240529231348_For-Medicaments.Designer.cs} (98%) rename Polyclinic/PolyclinicDatabaseImplement/Migrations/{20240529230147_For-Medicaments.cs => 20240529231348_For-Medicaments.cs} (79%) diff --git a/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240529230147_For-Medicaments.Designer.cs b/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240529231348_For-Medicaments.Designer.cs similarity index 98% rename from Polyclinic/PolyclinicDatabaseImplement/Migrations/20240529230147_For-Medicaments.Designer.cs rename to Polyclinic/PolyclinicDatabaseImplement/Migrations/20240529231348_For-Medicaments.Designer.cs index 756512a..8ea70b9 100644 --- a/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240529230147_For-Medicaments.Designer.cs +++ b/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240529231348_For-Medicaments.Designer.cs @@ -12,7 +12,7 @@ using SecuritySystemDatabaseImplement; namespace PolyclinicDatabaseImplement.Migrations { [DbContext(typeof(PolyclinicDatabase))] - [Migration("20240529230147_For-Medicaments")] + [Migration("20240529231348_For-Medicaments")] partial class ForMedicaments { /// @@ -120,7 +120,6 @@ namespace PolyclinicDatabaseImplement.Migrations .HasColumnType("int"); b.Property("SymptomId") - .IsRequired() .HasColumnType("int"); b.HasKey("Id"); @@ -342,9 +341,7 @@ namespace PolyclinicDatabaseImplement.Migrations b.HasOne("PolyclinicDatabaseImplement.Models.Symptom", "Symptom") .WithMany() - .HasForeignKey("SymptomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + .HasForeignKey("SymptomId"); b.Navigation("Procedure"); diff --git a/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240529230147_For-Medicaments.cs b/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240529231348_For-Medicaments.cs similarity index 79% rename from Polyclinic/PolyclinicDatabaseImplement/Migrations/20240529230147_For-Medicaments.cs rename to Polyclinic/PolyclinicDatabaseImplement/Migrations/20240529231348_For-Medicaments.cs index 7cb6589..04f4e94 100644 --- a/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240529230147_For-Medicaments.cs +++ b/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240529231348_For-Medicaments.cs @@ -14,6 +14,10 @@ namespace PolyclinicDatabaseImplement.Migrations name: "FK_Medicaments_Procedures_ProcedureId", table: "Medicaments"); + migrationBuilder.DropForeignKey( + name: "FK_Medicaments_Symptomes_SymptomId", + table: "Medicaments"); + migrationBuilder.AlterColumn( name: "Comment", table: "Symptomes", @@ -38,6 +42,14 @@ namespace PolyclinicDatabaseImplement.Migrations oldClrType: typeof(string), oldType: "nvarchar(max)"); + migrationBuilder.AlterColumn( + name: "SymptomId", + table: "Medicaments", + type: "int", + nullable: true, + oldClrType: typeof(int), + oldType: "int"); + migrationBuilder.AlterColumn( name: "ProcedureId", table: "Medicaments", @@ -76,6 +88,13 @@ namespace PolyclinicDatabaseImplement.Migrations column: "ProcedureId", principalTable: "Procedures", principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_Medicaments_Symptomes_SymptomId", + table: "Medicaments", + column: "SymptomId", + principalTable: "Symptomes", + principalColumn: "Id"); } /// @@ -85,6 +104,10 @@ namespace PolyclinicDatabaseImplement.Migrations name: "FK_Medicaments_Procedures_ProcedureId", table: "Medicaments"); + migrationBuilder.DropForeignKey( + name: "FK_Medicaments_Symptomes_SymptomId", + table: "Medicaments"); + migrationBuilder.AlterColumn( name: "Comment", table: "Symptomes", @@ -115,6 +138,16 @@ namespace PolyclinicDatabaseImplement.Migrations oldType: "nvarchar(max)", oldNullable: true); + migrationBuilder.AlterColumn( + name: "SymptomId", + table: "Medicaments", + type: "int", + nullable: false, + defaultValue: 0, + oldClrType: typeof(int), + oldType: "int", + oldNullable: true); + migrationBuilder.AlterColumn( name: "ProcedureId", table: "Medicaments", @@ -162,6 +195,14 @@ namespace PolyclinicDatabaseImplement.Migrations principalTable: "Procedures", principalColumn: "Id", onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Medicaments_Symptomes_SymptomId", + table: "Medicaments", + column: "SymptomId", + principalTable: "Symptomes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); } } } diff --git a/Polyclinic/PolyclinicDatabaseImplement/Migrations/PolyclinicDatabaseModelSnapshot.cs b/Polyclinic/PolyclinicDatabaseImplement/Migrations/PolyclinicDatabaseModelSnapshot.cs index c96f2f7..0e1ffea 100644 --- a/Polyclinic/PolyclinicDatabaseImplement/Migrations/PolyclinicDatabaseModelSnapshot.cs +++ b/Polyclinic/PolyclinicDatabaseImplement/Migrations/PolyclinicDatabaseModelSnapshot.cs @@ -117,7 +117,6 @@ namespace PolyclinicDatabaseImplement.Migrations .HasColumnType("int"); b.Property("SymptomId") - .IsRequired() .HasColumnType("int"); b.HasKey("Id"); @@ -339,9 +338,7 @@ namespace PolyclinicDatabaseImplement.Migrations b.HasOne("PolyclinicDatabaseImplement.Models.Symptom", "Symptom") .WithMany() - .HasForeignKey("SymptomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + .HasForeignKey("SymptomId"); b.Navigation("Procedure"); diff --git a/Polyclinic/PolyclinicDatabaseImplement/Models/Medicament.cs b/Polyclinic/PolyclinicDatabaseImplement/Models/Medicament.cs index fa6bcec..8e0f838 100644 --- a/Polyclinic/PolyclinicDatabaseImplement/Models/Medicament.cs +++ b/Polyclinic/PolyclinicDatabaseImplement/Models/Medicament.cs @@ -17,7 +17,6 @@ namespace PolyclinicDatabaseImplement.Models public int? ProcedureId { get; set; } - [Required] public int? SymptomId { get; set; } public virtual Symptom? Symptom { get; set; }