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; }