Попытка исправить другую ошибку

This commit is contained in:
DyCTaTOR 2024-05-18 20:48:42 +04:00
parent f897516f3e
commit 2a5e8e3372
4 changed files with 973 additions and 459 deletions

View File

@ -0,0 +1,467 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("FormOfEvaluation")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Score")
.HasColumnType("int");
b.Property<int>("StudentId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StudentId");
b.HasIndex("UserId");
b.ToTable("Attestations");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateOnly>("Date")
.HasColumnType("date");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("TeacherId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("TeacherId");
b.HasIndex("UserId");
b.ToTable("Disciplines");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateOnly>("Date")
.HasColumnType("date");
b.Property<string>("FormOfStudy")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Profile")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("PlanOfStudys");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudyTeacher", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("PlanOfStudyId")
.HasColumnType("int");
b.Property<int>("TeacherId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("PlanOfStudyId");
b.HasIndex("TeacherId");
b.ToTable("PlanOfStudyTeachers");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Statement", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("Date")
.HasColumnType("datetime2");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("TeacherId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("TeacherId");
b.HasIndex("UserId");
b.ToTable("Statements");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("PlanOfStudyId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("PlanOfStudyId");
b.HasIndex("UserId");
b.ToTable("Students");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.StudentDiscipline", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("DisciplineId")
.HasColumnType("int");
b.Property<int>("StudentId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("DisciplineId");
b.HasIndex("StudentId");
b.ToTable("StudentDisciplines");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("AcademicDegree")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Position")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Teachers");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("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
}
}
}

View File

@ -0,0 +1,41 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace UniversityDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class newMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateOnly>(
name: "Date",
table: "PlanOfStudys",
type: "date",
nullable: false,
defaultValue: new DateOnly(1, 1, 1));
migrationBuilder.AddColumn<DateOnly>(
name: "Date",
table: "Disciplines",
type: "date",
nullable: false,
defaultValue: new DateOnly(1, 1, 1));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Date",
table: "PlanOfStudys");
migrationBuilder.DropColumn(
name: "Date",
table: "Disciplines");
}
}
}

View File

@ -1,458 +1,464 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using UniversityDatabaseImplement; using UniversityDatabaseImplement;
#nullable disable #nullable disable
namespace UniversityDatabaseImplement.Migrations namespace UniversityDatabaseImplement.Migrations
{ {
[DbContext(typeof(UniversityDatabase))] [DbContext(typeof(UniversityDatabase))]
partial class UniversityDatabaseModelSnapshot : ModelSnapshot partial class UniversityDatabaseModelSnapshot : ModelSnapshot
{ {
protected override void BuildModel(ModelBuilder modelBuilder) protected override void BuildModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "8.0.4") .HasAnnotation("ProductVersion", "8.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("UniversityDatabaseImplement.Models.Attestation", b => modelBuilder.Entity("UniversityDatabaseImplement.Models.Attestation", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("FormOfEvaluation") b.Property<string>("FormOfEvaluation")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<int>("Score") b.Property<int>("Score")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("StudentId") b.Property<int>("StudentId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("UserId") b.Property<int>("UserId")
.HasColumnType("int"); .HasColumnType("int");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("StudentId"); b.HasIndex("StudentId");
b.HasIndex("UserId"); b.HasIndex("UserId");
b.ToTable("Attestations"); b.ToTable("Attestations");
}); });
modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b => modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Description") b.Property<DateOnly>("Date")
.IsRequired() .HasColumnType("date");
.HasColumnType("nvarchar(max)");
b.Property<string>("Description")
b.Property<string>("Name") .IsRequired()
.IsRequired() .HasColumnType("nvarchar(max)");
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
b.Property<int>("TeacherId") .IsRequired()
.HasColumnType("int"); .HasColumnType("nvarchar(max)");
b.Property<int>("UserId") b.Property<int>("TeacherId")
.HasColumnType("int"); .HasColumnType("int");
b.HasKey("Id"); b.Property<int>("UserId")
.HasColumnType("int");
b.HasIndex("TeacherId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TeacherId");
b.ToTable("Disciplines");
}); b.HasIndex("UserId");
modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b => b.ToTable("Disciplines");
{ });
b.Property<int>("Id")
.ValueGeneratedOnAdd() modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
.HasColumnType("int"); {
b.Property<int>("Id")
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); .ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("FormOfStudy")
.IsRequired() SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
.HasColumnType("nvarchar(max)");
b.Property<DateOnly>("Date")
b.Property<string>("Profile") .HasColumnType("date");
.IsRequired()
.HasColumnType("nvarchar(max)"); b.Property<string>("FormOfStudy")
.IsRequired()
b.Property<int>("UserId") .HasColumnType("nvarchar(max)");
.HasColumnType("int");
b.Property<string>("Profile")
b.HasKey("Id"); .IsRequired()
.HasColumnType("nvarchar(max)");
b.HasIndex("UserId");
b.Property<int>("UserId")
b.ToTable("PlanOfStudys"); .HasColumnType("int");
});
b.HasKey("Id");
modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudyTeacher", b =>
{ b.HasIndex("UserId");
b.Property<int>("Id")
.ValueGeneratedOnAdd() b.ToTable("PlanOfStudys");
.HasColumnType("int"); });
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudyTeacher", b =>
{
b.Property<int>("PlanOfStudyId") b.Property<int>("Id")
.HasColumnType("int"); .ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("TeacherId")
.HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.HasKey("Id"); b.Property<int>("PlanOfStudyId")
.HasColumnType("int");
b.HasIndex("PlanOfStudyId");
b.Property<int>("TeacherId")
b.HasIndex("TeacherId"); .HasColumnType("int");
b.ToTable("PlanOfStudyTeachers"); b.HasKey("Id");
});
b.HasIndex("PlanOfStudyId");
modelBuilder.Entity("UniversityDatabaseImplement.Models.Statement", b =>
{ b.HasIndex("TeacherId");
b.Property<int>("Id")
.ValueGeneratedOnAdd() b.ToTable("PlanOfStudyTeachers");
.HasColumnType("int"); });
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); modelBuilder.Entity("UniversityDatabaseImplement.Models.Statement", b =>
{
b.Property<DateTime>("Date") b.Property<int>("Id")
.HasColumnType("datetime2"); .ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired() SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("Date")
b.Property<int>("TeacherId") .HasColumnType("datetime2");
.HasColumnType("int");
b.Property<string>("Name")
b.Property<int>("UserId") .IsRequired()
.HasColumnType("int"); .HasColumnType("nvarchar(max)");
b.HasKey("Id"); b.Property<int>("TeacherId")
.HasColumnType("int");
b.HasIndex("TeacherId");
b.Property<int>("UserId")
b.HasIndex("UserId"); .HasColumnType("int");
b.ToTable("Statements"); b.HasKey("Id");
});
b.HasIndex("TeacherId");
modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
{ b.HasIndex("UserId");
b.Property<int>("Id")
.ValueGeneratedOnAdd() b.ToTable("Statements");
.HasColumnType("int"); });
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
{
b.Property<string>("Name") b.Property<int>("Id")
.IsRequired() .ValueGeneratedOnAdd()
.HasColumnType("nvarchar(max)"); .HasColumnType("int");
b.Property<string>("PhoneNumber") SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
.IsRequired()
.HasColumnType("nvarchar(max)"); b.Property<string>("Name")
.IsRequired()
b.Property<int>("PlanOfStudyId") .HasColumnType("nvarchar(max)");
.HasColumnType("int");
b.Property<string>("PhoneNumber")
b.Property<int>("UserId") .IsRequired()
.HasColumnType("int"); .HasColumnType("nvarchar(max)");
b.HasKey("Id"); b.Property<int>("PlanOfStudyId")
.HasColumnType("int");
b.HasIndex("PlanOfStudyId");
b.Property<int>("UserId")
b.HasIndex("UserId"); .HasColumnType("int");
b.ToTable("Students"); b.HasKey("Id");
});
b.HasIndex("PlanOfStudyId");
modelBuilder.Entity("UniversityDatabaseImplement.Models.StudentDiscipline", b =>
{ b.HasIndex("UserId");
b.Property<int>("Id")
.ValueGeneratedOnAdd() b.ToTable("Students");
.HasColumnType("int"); });
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); modelBuilder.Entity("UniversityDatabaseImplement.Models.StudentDiscipline", b =>
{
b.Property<int>("DisciplineId") b.Property<int>("Id")
.HasColumnType("int"); .ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("StudentId")
.HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.HasKey("Id"); b.Property<int>("DisciplineId")
.HasColumnType("int");
b.HasIndex("DisciplineId");
b.Property<int>("StudentId")
b.HasIndex("StudentId"); .HasColumnType("int");
b.ToTable("StudentDisciplines"); b.HasKey("Id");
});
b.HasIndex("DisciplineId");
modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
{ b.HasIndex("StudentId");
b.Property<int>("Id")
.ValueGeneratedOnAdd() b.ToTable("StudentDisciplines");
.HasColumnType("int"); });
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
{
b.Property<string>("AcademicDegree") b.Property<int>("Id")
.IsRequired() .ValueGeneratedOnAdd()
.HasColumnType("nvarchar(max)"); .HasColumnType("int");
b.Property<string>("Name") SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
.IsRequired()
.HasColumnType("nvarchar(max)"); b.Property<string>("AcademicDegree")
.IsRequired()
b.Property<string>("Position") .HasColumnType("nvarchar(max)");
.IsRequired()
.HasColumnType("nvarchar(max)"); b.Property<string>("Name")
.IsRequired()
b.Property<int>("UserId") .HasColumnType("nvarchar(max)");
.HasColumnType("int");
b.Property<string>("Position")
b.HasKey("Id"); .IsRequired()
.HasColumnType("nvarchar(max)");
b.HasIndex("UserId");
b.Property<int>("UserId")
b.ToTable("Teachers"); .HasColumnType("int");
});
b.HasKey("Id");
modelBuilder.Entity("UniversityDatabaseImplement.Models.User", b =>
{ b.HasIndex("UserId");
b.Property<int>("Id")
.ValueGeneratedOnAdd() b.ToTable("Teachers");
.HasColumnType("int"); });
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); modelBuilder.Entity("UniversityDatabaseImplement.Models.User", b =>
{
b.Property<string>("Email") b.Property<int>("Id")
.IsRequired() .ValueGeneratedOnAdd()
.HasColumnType("nvarchar(max)"); .HasColumnType("int");
b.Property<string>("Login") SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
.IsRequired()
.HasColumnType("nvarchar(max)"); b.Property<string>("Email")
.IsRequired()
b.Property<string>("Password") .HasColumnType("nvarchar(max)");
.IsRequired()
.HasColumnType("nvarchar(max)"); b.Property<string>("Login")
.IsRequired()
b.Property<int>("Role") .HasColumnType("nvarchar(max)");
.HasColumnType("int");
b.Property<string>("Password")
b.HasKey("Id"); .IsRequired()
.HasColumnType("nvarchar(max)");
b.ToTable("Users");
}); b.Property<int>("Role")
.HasColumnType("int");
modelBuilder.Entity("UniversityDatabaseImplement.Models.Attestation", b =>
{ b.HasKey("Id");
b.HasOne("UniversityDatabaseImplement.Models.Student", "Student")
.WithMany("Attestations") b.ToTable("Users");
.HasForeignKey("StudentId") });
.OnDelete(DeleteBehavior.Cascade)
.IsRequired(); modelBuilder.Entity("UniversityDatabaseImplement.Models.Attestation", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.User", "User") b.HasOne("UniversityDatabaseImplement.Models.Student", "Student")
.WithMany("Attestations") .WithMany("Attestations")
.HasForeignKey("UserId") .HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Student"); b.HasOne("UniversityDatabaseImplement.Models.User", "User")
.WithMany("Attestations")
b.Navigation("User"); .HasForeignKey("UserId")
}); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
{ b.Navigation("Student");
b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
.WithMany("Disciplines") b.Navigation("User");
.HasForeignKey("TeacherId") });
.OnDelete(DeleteBehavior.Cascade)
.IsRequired(); modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.User", "User") b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
.WithMany("Disciplines") .WithMany("Disciplines")
.HasForeignKey("UserId") .HasForeignKey("TeacherId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Teacher"); b.HasOne("UniversityDatabaseImplement.Models.User", "User")
.WithMany("Disciplines")
b.Navigation("User"); .HasForeignKey("UserId")
}); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
{ b.Navigation("Teacher");
b.HasOne("UniversityDatabaseImplement.Models.User", "User")
.WithMany("PlanOfStudys") b.Navigation("User");
.HasForeignKey("UserId") });
.OnDelete(DeleteBehavior.Cascade)
.IsRequired(); modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
{
b.Navigation("User"); b.HasOne("UniversityDatabaseImplement.Models.User", "User")
}); .WithMany("PlanOfStudys")
.HasForeignKey("UserId")
modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudyTeacher", b => .OnDelete(DeleteBehavior.Cascade)
{ .IsRequired();
b.HasOne("UniversityDatabaseImplement.Models.PlanOfStudy", "PlanOfStudy")
.WithMany("Teachers") b.Navigation("User");
.HasForeignKey("PlanOfStudyId") });
.OnDelete(DeleteBehavior.Cascade)
.IsRequired(); modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudyTeacher", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher") b.HasOne("UniversityDatabaseImplement.Models.PlanOfStudy", "PlanOfStudy")
.WithMany("PlanOfStudyTeachers") .WithMany("Teachers")
.HasForeignKey("TeacherId") .HasForeignKey("PlanOfStudyId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("PlanOfStudy"); b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
.WithMany("PlanOfStudyTeachers")
b.Navigation("Teacher"); .HasForeignKey("TeacherId")
}); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
modelBuilder.Entity("UniversityDatabaseImplement.Models.Statement", b =>
{ b.Navigation("PlanOfStudy");
b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
.WithMany("Statements") b.Navigation("Teacher");
.HasForeignKey("TeacherId") });
.OnDelete(DeleteBehavior.Cascade)
.IsRequired(); modelBuilder.Entity("UniversityDatabaseImplement.Models.Statement", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.User", "User") b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
.WithMany("Statements") .WithMany("Statements")
.HasForeignKey("UserId") .HasForeignKey("TeacherId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Teacher"); b.HasOne("UniversityDatabaseImplement.Models.User", "User")
.WithMany("Statements")
b.Navigation("User"); .HasForeignKey("UserId")
}); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
{ b.Navigation("Teacher");
b.HasOne("UniversityDatabaseImplement.Models.PlanOfStudy", "PlanOfStudy")
.WithMany("Students") b.Navigation("User");
.HasForeignKey("PlanOfStudyId") });
.OnDelete(DeleteBehavior.Cascade)
.IsRequired(); modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.User", "User") b.HasOne("UniversityDatabaseImplement.Models.PlanOfStudy", "PlanOfStudy")
.WithMany("Students") .WithMany("Students")
.HasForeignKey("UserId") .HasForeignKey("PlanOfStudyId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("PlanOfStudy"); b.HasOne("UniversityDatabaseImplement.Models.User", "User")
.WithMany("Students")
b.Navigation("User"); .HasForeignKey("UserId")
}); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
modelBuilder.Entity("UniversityDatabaseImplement.Models.StudentDiscipline", b =>
{ b.Navigation("PlanOfStudy");
b.HasOne("UniversityDatabaseImplement.Models.Discipline", "Discipline")
.WithMany("Students") b.Navigation("User");
.HasForeignKey("DisciplineId") });
.OnDelete(DeleteBehavior.Cascade)
.IsRequired(); modelBuilder.Entity("UniversityDatabaseImplement.Models.StudentDiscipline", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.Student", "Student") b.HasOne("UniversityDatabaseImplement.Models.Discipline", "Discipline")
.WithMany("StudentDiscipline") .WithMany("Students")
.HasForeignKey("StudentId") .HasForeignKey("DisciplineId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Discipline"); b.HasOne("UniversityDatabaseImplement.Models.Student", "Student")
.WithMany("StudentDiscipline")
b.Navigation("Student"); .HasForeignKey("StudentId")
}); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
{ b.Navigation("Discipline");
b.HasOne("UniversityDatabaseImplement.Models.User", "User")
.WithMany("Teachers") b.Navigation("Student");
.HasForeignKey("UserId") });
.OnDelete(DeleteBehavior.Cascade)
.IsRequired(); modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
{
b.Navigation("User"); b.HasOne("UniversityDatabaseImplement.Models.User", "User")
}); .WithMany("Teachers")
.HasForeignKey("UserId")
modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b => .OnDelete(DeleteBehavior.Cascade)
{ .IsRequired();
b.Navigation("Students");
}); b.Navigation("User");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
{ modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
b.Navigation("Students"); {
b.Navigation("Students");
b.Navigation("Teachers"); });
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b => {
{ b.Navigation("Students");
b.Navigation("Attestations");
b.Navigation("Teachers");
b.Navigation("StudentDiscipline"); });
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b => {
{ b.Navigation("Attestations");
b.Navigation("Disciplines");
b.Navigation("StudentDiscipline");
b.Navigation("PlanOfStudyTeachers"); });
b.Navigation("Statements"); modelBuilder.Entity("UniversityDatabaseImplement.Models.Teacher", b =>
}); {
b.Navigation("Disciplines");
modelBuilder.Entity("UniversityDatabaseImplement.Models.User", b =>
{ b.Navigation("PlanOfStudyTeachers");
b.Navigation("Attestations");
b.Navigation("Statements");
b.Navigation("Disciplines"); });
b.Navigation("PlanOfStudys"); modelBuilder.Entity("UniversityDatabaseImplement.Models.User", b =>
{
b.Navigation("Statements"); b.Navigation("Attestations");
b.Navigation("Students"); b.Navigation("Disciplines");
b.Navigation("Teachers"); b.Navigation("PlanOfStudys");
});
#pragma warning restore 612, 618 b.Navigation("Statements");
}
} b.Navigation("Students");
}
b.Navigation("Teachers");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -11,7 +11,7 @@ namespace UniversityDatabaseImplement
if (optionsBuilder.IsConfigured == false) if (optionsBuilder.IsConfigured == false)
{ {
//Возможно понадобится писать вместо (localdb) название пк, вот пк Егора: DESKTOP-N8BRIPR; other-name: LAPTOP-DYCTATOR; other-name: DyCTaTOR //Возможно понадобится писать вместо (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); base.OnConfiguring(optionsBuilder);
} }