From 2a5e8e33722f2d0c98876ee69eb4573c4c5cb6e7 Mon Sep 17 00:00:00 2001
From: DyCTaTOR <125912249+DyCTaTOR@users.noreply.github.com>
Date: Sat, 18 May 2024 20:48:42 +0400
Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B0=20?=
=?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20=D0=B4?=
=?UTF-8?q?=D1=80=D1=83=D0=B3=D1=83=D1=8E=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA?=
=?UTF-8?q?=D1=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../20240518164251_newMigration.Designer.cs | 467 +++++++++
.../Migrations/20240518164251_newMigration.cs | 41 +
.../UniversityDatabaseModelSnapshot.cs | 922 +++++++++---------
.../UniversityDatabase.cs | 2 +-
4 files changed, 973 insertions(+), 459 deletions(-)
create mode 100644 University/UniversityDatabaseImplement/Migrations/20240518164251_newMigration.Designer.cs
create mode 100644 University/UniversityDatabaseImplement/Migrations/20240518164251_newMigration.cs
diff --git a/University/UniversityDatabaseImplement/Migrations/20240518164251_newMigration.Designer.cs b/University/UniversityDatabaseImplement/Migrations/20240518164251_newMigration.Designer.cs
new file mode 100644
index 0000000..3fb0cf9
--- /dev/null
+++ b/University/UniversityDatabaseImplement/Migrations/20240518164251_newMigration.Designer.cs
@@ -0,0 +1,467 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using UniversityDatabaseImplement;
+
+#nullable disable
+
+namespace UniversityDatabaseImplement.Migrations
+{
+ [DbContext(typeof(UniversityDatabase))]
+ [Migration("20240518164251_newMigration")]
+ partial class newMigration
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.4")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Attestation", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("FormOfEvaluation")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Score")
+ .HasColumnType("int");
+
+ b.Property("StudentId")
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("StudentId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Attestations");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Date")
+ .HasColumnType("date");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TeacherId")
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TeacherId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Disciplines");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Date")
+ .HasColumnType("date");
+
+ b.Property("FormOfStudy")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Profile")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("PlanOfStudys");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudyTeacher", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("PlanOfStudyId")
+ .HasColumnType("int");
+
+ b.Property("TeacherId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PlanOfStudyId");
+
+ b.HasIndex("TeacherId");
+
+ b.ToTable("PlanOfStudyTeachers");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Statement", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Date")
+ .HasColumnType("datetime2");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TeacherId")
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TeacherId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Statements");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PhoneNumber")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PlanOfStudyId")
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PlanOfStudyId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Students");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.StudentDiscipline", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("DisciplineId")
+ .HasColumnType("int");
+
+ b.Property("StudentId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DisciplineId");
+
+ b.HasIndex("StudentId");
+
+ b.ToTable("StudentDisciplines");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AcademicDegree")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Position")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Teachers");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.User", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Login")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Role")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Users");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Attestation", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.Student", "Student")
+ .WithMany("Attestations")
+ .HasForeignKey("StudentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("UniversityDatabaseImplement.Models.User", "User")
+ .WithMany("Attestations")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Student");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
+ .WithMany("Disciplines")
+ .HasForeignKey("TeacherId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("UniversityDatabaseImplement.Models.User", "User")
+ .WithMany("Disciplines")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Teacher");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.User", "User")
+ .WithMany("PlanOfStudys")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudyTeacher", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.PlanOfStudy", "PlanOfStudy")
+ .WithMany("Teachers")
+ .HasForeignKey("PlanOfStudyId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
+ .WithMany("PlanOfStudyTeachers")
+ .HasForeignKey("TeacherId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("PlanOfStudy");
+
+ b.Navigation("Teacher");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Statement", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
+ .WithMany("Statements")
+ .HasForeignKey("TeacherId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("UniversityDatabaseImplement.Models.User", "User")
+ .WithMany("Statements")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Teacher");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.PlanOfStudy", "PlanOfStudy")
+ .WithMany("Students")
+ .HasForeignKey("PlanOfStudyId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("UniversityDatabaseImplement.Models.User", "User")
+ .WithMany("Students")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("PlanOfStudy");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.StudentDiscipline", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.Discipline", "Discipline")
+ .WithMany("Students")
+ .HasForeignKey("DisciplineId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("UniversityDatabaseImplement.Models.Student", "Student")
+ .WithMany("StudentDiscipline")
+ .HasForeignKey("StudentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Discipline");
+
+ b.Navigation("Student");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.User", "User")
+ .WithMany("Teachers")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
+ {
+ b.Navigation("Students");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
+ {
+ b.Navigation("Students");
+
+ b.Navigation("Teachers");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
+ {
+ b.Navigation("Attestations");
+
+ b.Navigation("StudentDiscipline");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
+ {
+ b.Navigation("Disciplines");
+
+ b.Navigation("PlanOfStudyTeachers");
+
+ b.Navigation("Statements");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.User", b =>
+ {
+ b.Navigation("Attestations");
+
+ b.Navigation("Disciplines");
+
+ b.Navigation("PlanOfStudys");
+
+ b.Navigation("Statements");
+
+ b.Navigation("Students");
+
+ b.Navigation("Teachers");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/University/UniversityDatabaseImplement/Migrations/20240518164251_newMigration.cs b/University/UniversityDatabaseImplement/Migrations/20240518164251_newMigration.cs
new file mode 100644
index 0000000..fb0cbe1
--- /dev/null
+++ b/University/UniversityDatabaseImplement/Migrations/20240518164251_newMigration.cs
@@ -0,0 +1,41 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace UniversityDatabaseImplement.Migrations
+{
+ ///
+ public partial class newMigration : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn(
+ name: "Date",
+ table: "PlanOfStudys",
+ type: "date",
+ nullable: false,
+ defaultValue: new DateOnly(1, 1, 1));
+
+ migrationBuilder.AddColumn(
+ name: "Date",
+ table: "Disciplines",
+ type: "date",
+ nullable: false,
+ defaultValue: new DateOnly(1, 1, 1));
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "Date",
+ table: "PlanOfStudys");
+
+ migrationBuilder.DropColumn(
+ name: "Date",
+ table: "Disciplines");
+ }
+ }
+}
diff --git a/University/UniversityDatabaseImplement/Migrations/UniversityDatabaseModelSnapshot.cs b/University/UniversityDatabaseImplement/Migrations/UniversityDatabaseModelSnapshot.cs
index 8261fef..b595910 100644
--- a/University/UniversityDatabaseImplement/Migrations/UniversityDatabaseModelSnapshot.cs
+++ b/University/UniversityDatabaseImplement/Migrations/UniversityDatabaseModelSnapshot.cs
@@ -1,458 +1,464 @@
-//
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using UniversityDatabaseImplement;
-
-#nullable disable
-
-namespace UniversityDatabaseImplement.Migrations
-{
- [DbContext(typeof(UniversityDatabase))]
- partial class UniversityDatabaseModelSnapshot : ModelSnapshot
- {
- protected override void BuildModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "8.0.4")
- .HasAnnotation("Relational:MaxIdentifierLength", 128);
-
- SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.Attestation", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("FormOfEvaluation")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Score")
- .HasColumnType("int");
-
- b.Property("StudentId")
- .HasColumnType("int");
-
- b.Property("UserId")
- .HasColumnType("int");
-
- b.HasKey("Id");
-
- b.HasIndex("StudentId");
-
- b.HasIndex("UserId");
-
- b.ToTable("Attestations");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("Description")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("TeacherId")
- .HasColumnType("int");
-
- b.Property("UserId")
- .HasColumnType("int");
-
- b.HasKey("Id");
-
- b.HasIndex("TeacherId");
-
- b.HasIndex("UserId");
-
- b.ToTable("Disciplines");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("FormOfStudy")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Profile")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("UserId")
- .HasColumnType("int");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("PlanOfStudys");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudyTeacher", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("PlanOfStudyId")
- .HasColumnType("int");
-
- b.Property("TeacherId")
- .HasColumnType("int");
-
- b.HasKey("Id");
-
- b.HasIndex("PlanOfStudyId");
-
- b.HasIndex("TeacherId");
-
- b.ToTable("PlanOfStudyTeachers");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.Statement", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("Date")
- .HasColumnType("datetime2");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("TeacherId")
- .HasColumnType("int");
-
- b.Property("UserId")
- .HasColumnType("int");
-
- b.HasKey("Id");
-
- b.HasIndex("TeacherId");
-
- b.HasIndex("UserId");
-
- b.ToTable("Statements");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("PhoneNumber")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("PlanOfStudyId")
- .HasColumnType("int");
-
- b.Property("UserId")
- .HasColumnType("int");
-
- b.HasKey("Id");
-
- b.HasIndex("PlanOfStudyId");
-
- b.HasIndex("UserId");
-
- b.ToTable("Students");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.StudentDiscipline", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("DisciplineId")
- .HasColumnType("int");
-
- b.Property("StudentId")
- .HasColumnType("int");
-
- b.HasKey("Id");
-
- b.HasIndex("DisciplineId");
-
- b.HasIndex("StudentId");
-
- b.ToTable("StudentDisciplines");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("AcademicDegree")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Position")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("UserId")
- .HasColumnType("int");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("Teachers");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.User", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("Email")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Login")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Password")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Role")
- .HasColumnType("int");
-
- b.HasKey("Id");
-
- b.ToTable("Users");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.Attestation", b =>
- {
- b.HasOne("UniversityDatabaseImplement.Models.Student", "Student")
- .WithMany("Attestations")
- .HasForeignKey("StudentId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("UniversityDatabaseImplement.Models.User", "User")
- .WithMany("Attestations")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Student");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
- {
- b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
- .WithMany("Disciplines")
- .HasForeignKey("TeacherId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("UniversityDatabaseImplement.Models.User", "User")
- .WithMany("Disciplines")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Teacher");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
- {
- b.HasOne("UniversityDatabaseImplement.Models.User", "User")
- .WithMany("PlanOfStudys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudyTeacher", b =>
- {
- b.HasOne("UniversityDatabaseImplement.Models.PlanOfStudy", "PlanOfStudy")
- .WithMany("Teachers")
- .HasForeignKey("PlanOfStudyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
- .WithMany("PlanOfStudyTeachers")
- .HasForeignKey("TeacherId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("PlanOfStudy");
-
- b.Navigation("Teacher");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.Statement", b =>
- {
- b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
- .WithMany("Statements")
- .HasForeignKey("TeacherId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("UniversityDatabaseImplement.Models.User", "User")
- .WithMany("Statements")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Teacher");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
- {
- b.HasOne("UniversityDatabaseImplement.Models.PlanOfStudy", "PlanOfStudy")
- .WithMany("Students")
- .HasForeignKey("PlanOfStudyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("UniversityDatabaseImplement.Models.User", "User")
- .WithMany("Students")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("PlanOfStudy");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.StudentDiscipline", b =>
- {
- b.HasOne("UniversityDatabaseImplement.Models.Discipline", "Discipline")
- .WithMany("Students")
- .HasForeignKey("DisciplineId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("UniversityDatabaseImplement.Models.Student", "Student")
- .WithMany("StudentDiscipline")
- .HasForeignKey("StudentId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Discipline");
-
- b.Navigation("Student");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
- {
- b.HasOne("UniversityDatabaseImplement.Models.User", "User")
- .WithMany("Teachers")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
- {
- b.Navigation("Students");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
- {
- b.Navigation("Students");
-
- b.Navigation("Teachers");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
- {
- b.Navigation("Attestations");
-
- b.Navigation("StudentDiscipline");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
- {
- b.Navigation("Disciplines");
-
- b.Navigation("PlanOfStudyTeachers");
-
- b.Navigation("Statements");
- });
-
- modelBuilder.Entity("UniversityDatabaseImplement.Models.User", b =>
- {
- b.Navigation("Attestations");
-
- b.Navigation("Disciplines");
-
- b.Navigation("PlanOfStudys");
-
- b.Navigation("Statements");
-
- b.Navigation("Students");
-
- b.Navigation("Teachers");
- });
-#pragma warning restore 612, 618
- }
- }
-}
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using UniversityDatabaseImplement;
+
+#nullable disable
+
+namespace UniversityDatabaseImplement.Migrations
+{
+ [DbContext(typeof(UniversityDatabase))]
+ partial class UniversityDatabaseModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.4")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Attestation", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("FormOfEvaluation")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Score")
+ .HasColumnType("int");
+
+ b.Property("StudentId")
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("StudentId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Attestations");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Date")
+ .HasColumnType("date");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TeacherId")
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TeacherId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Disciplines");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Date")
+ .HasColumnType("date");
+
+ b.Property("FormOfStudy")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Profile")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("PlanOfStudys");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudyTeacher", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("PlanOfStudyId")
+ .HasColumnType("int");
+
+ b.Property("TeacherId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PlanOfStudyId");
+
+ b.HasIndex("TeacherId");
+
+ b.ToTable("PlanOfStudyTeachers");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Statement", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Date")
+ .HasColumnType("datetime2");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TeacherId")
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TeacherId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Statements");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PhoneNumber")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PlanOfStudyId")
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PlanOfStudyId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Students");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.StudentDiscipline", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("DisciplineId")
+ .HasColumnType("int");
+
+ b.Property("StudentId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DisciplineId");
+
+ b.HasIndex("StudentId");
+
+ b.ToTable("StudentDisciplines");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AcademicDegree")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Position")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Teachers");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.User", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Login")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Role")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Users");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Attestation", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.Student", "Student")
+ .WithMany("Attestations")
+ .HasForeignKey("StudentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("UniversityDatabaseImplement.Models.User", "User")
+ .WithMany("Attestations")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Student");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
+ .WithMany("Disciplines")
+ .HasForeignKey("TeacherId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("UniversityDatabaseImplement.Models.User", "User")
+ .WithMany("Disciplines")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Teacher");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.User", "User")
+ .WithMany("PlanOfStudys")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudyTeacher", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.PlanOfStudy", "PlanOfStudy")
+ .WithMany("Teachers")
+ .HasForeignKey("PlanOfStudyId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
+ .WithMany("PlanOfStudyTeachers")
+ .HasForeignKey("TeacherId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("PlanOfStudy");
+
+ b.Navigation("Teacher");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Statement", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
+ .WithMany("Statements")
+ .HasForeignKey("TeacherId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("UniversityDatabaseImplement.Models.User", "User")
+ .WithMany("Statements")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Teacher");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.PlanOfStudy", "PlanOfStudy")
+ .WithMany("Students")
+ .HasForeignKey("PlanOfStudyId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("UniversityDatabaseImplement.Models.User", "User")
+ .WithMany("Students")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("PlanOfStudy");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.StudentDiscipline", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.Discipline", "Discipline")
+ .WithMany("Students")
+ .HasForeignKey("DisciplineId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("UniversityDatabaseImplement.Models.Student", "Student")
+ .WithMany("StudentDiscipline")
+ .HasForeignKey("StudentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Discipline");
+
+ b.Navigation("Student");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
+ {
+ b.HasOne("UniversityDatabaseImplement.Models.User", "User")
+ .WithMany("Teachers")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
+ {
+ b.Navigation("Students");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
+ {
+ b.Navigation("Students");
+
+ b.Navigation("Teachers");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
+ {
+ b.Navigation("Attestations");
+
+ b.Navigation("StudentDiscipline");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
+ {
+ b.Navigation("Disciplines");
+
+ b.Navigation("PlanOfStudyTeachers");
+
+ b.Navigation("Statements");
+ });
+
+ modelBuilder.Entity("UniversityDatabaseImplement.Models.User", b =>
+ {
+ b.Navigation("Attestations");
+
+ b.Navigation("Disciplines");
+
+ b.Navigation("PlanOfStudys");
+
+ b.Navigation("Statements");
+
+ b.Navigation("Students");
+
+ b.Navigation("Teachers");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/University/UniversityDatabaseImplement/UniversityDatabase.cs b/University/UniversityDatabaseImplement/UniversityDatabase.cs
index 2b73bad..c5d217c 100644
--- a/University/UniversityDatabaseImplement/UniversityDatabase.cs
+++ b/University/UniversityDatabaseImplement/UniversityDatabase.cs
@@ -11,7 +11,7 @@ namespace UniversityDatabaseImplement
if (optionsBuilder.IsConfigured == false)
{
//Возможно понадобится писать вместо (localdb) название пк, вот пк Егора: DESKTOP-N8BRIPR; other-name: LAPTOP-DYCTATOR; other-name: DyCTaTOR
- optionsBuilder.UseSqlServer(@"Data Source=DyCTaTOR\SQLEXPRESS;Initial Catalog=UniversityDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
+ optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=UniversityDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}