This commit is contained in:
Никита Потапов 2024-05-30 03:15:59 +04:00
commit 9ac54dfaec
4 changed files with 44 additions and 10 deletions

View File

@ -12,7 +12,7 @@ using SecuritySystemDatabaseImplement;
namespace PolyclinicDatabaseImplement.Migrations
{
[DbContext(typeof(PolyclinicDatabase))]
[Migration("20240529230147_For-Medicaments")]
[Migration("20240529231348_For-Medicaments")]
partial class ForMedicaments
{
/// <inheritdoc />
@ -120,7 +120,6 @@ namespace PolyclinicDatabaseImplement.Migrations
.HasColumnType("int");
b.Property<int?>("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");

View File

@ -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<string>(
name: "Comment",
table: "Symptomes",
@ -38,6 +42,14 @@ namespace PolyclinicDatabaseImplement.Migrations
oldClrType: typeof(string),
oldType: "nvarchar(max)");
migrationBuilder.AlterColumn<int>(
name: "SymptomId",
table: "Medicaments",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<int>(
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");
}
/// <inheritdoc />
@ -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<string>(
name: "Comment",
table: "Symptomes",
@ -115,6 +138,16 @@ namespace PolyclinicDatabaseImplement.Migrations
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "SymptomId",
table: "Medicaments",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
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);
}
}
}

View File

@ -117,7 +117,6 @@ namespace PolyclinicDatabaseImplement.Migrations
.HasColumnType("int");
b.Property<int?>("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");

View File

@ -17,7 +17,6 @@ namespace PolyclinicDatabaseImplement.Models
public int? ProcedureId { get; set; }
[Required]
public int? SymptomId { get; set; }
public virtual Symptom? Symptom { get; set; }