Миграция готова. Update database выдаёт ошибку
This commit is contained in:
parent
fe451c578c
commit
85223abfaf
135
University/UniversityBusinessLogic/BusinessLogics/WorkerLogic.cs
Normal file
135
University/UniversityBusinessLogic/BusinessLogics/WorkerLogic.cs
Normal file
@ -0,0 +1,135 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.BusinessLogicsContracts;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.StorageContracts;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDataModels.Enums;
|
||||
|
||||
namespace UniversityBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class WorkerLogic : IWorkerLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IWorkerStorage _workerStorage;
|
||||
public WorkerLogic(ILogger<WorkerLogic> logger, IWorkerStorage
|
||||
workerStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_workerStorage = workerStorage;
|
||||
}
|
||||
public List<WorkerViewModel>? ReadList(WorkerSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. FirstName: {FirstName}.LastName: {LastName}. PhoneNumber: {PhoneNumber}" +
|
||||
"Email: {Email}.Id:{Id} ",
|
||||
model?.FirstName, model?.LastName, model?.PhoneNumber, model?.Email, model?.Id);
|
||||
var list = model == null ? _workerStorage.GetFullList() :
|
||||
_workerStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public WorkerViewModel? ReadElement(WorkerSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadList. FirstName: {FirstName}.LastName: {LastName}. PhoneNumber: {PhoneNumber}" +
|
||||
"Email: {Email}.Id:{Id} ",
|
||||
model?.FirstName, model?.LastName, model?.PhoneNumber, model?.Email, model?.Id);
|
||||
var element = _workerStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(WorkerBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_workerStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(WorkerBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_workerStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(WorkerBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_workerStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(WorkerBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.FirstName))
|
||||
{
|
||||
throw new ArgumentNullException("Нет имени пользователя",
|
||||
nameof(model.FirstName));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.LastName))
|
||||
{
|
||||
throw new ArgumentNullException("Нет фамилии пользователя",
|
||||
nameof(model.LastName));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.PhoneNumber))
|
||||
{
|
||||
throw new ArgumentNullException("Должен быть номер телефона", nameof(model.PhoneNumber));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Email))
|
||||
{
|
||||
throw new ArgumentNullException("Не указана почта",
|
||||
nameof(model.Email));
|
||||
}
|
||||
_logger.LogInformation("Worker. FirstName: {FirstName}.LastName: {LastName}. PhoneNumber: " +
|
||||
"{PhoneNumber}.Email: {Email}.Id:{Id}",
|
||||
model.FirstName, model.LastName, model.PhoneNumber, model.Email, model.Id);
|
||||
var element = _workerStorage.GetElement(new WorkerSearchModel
|
||||
{
|
||||
FirstName = model.FirstName,
|
||||
LastName = model.LastName,
|
||||
PhoneNumber = model.PhoneNumber,
|
||||
Email = model.Email
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Данный пользователь уже существует");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -11,7 +11,6 @@ namespace UniversityContracts.SearchModels
|
||||
public int? Id { get; set; }
|
||||
public string? FirstName { get; set; }
|
||||
public string? LastName { get; set; }
|
||||
public string? MiddleName { get; set; }
|
||||
public string? PhoneNumber { get; set; }
|
||||
public string? Email { get; set; }
|
||||
}
|
||||
|
@ -6,11 +6,4 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.17">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
442
University/UniversityDatabaseImplement/Migrations/20240429094924_Initial.Designer.cs
generated
Normal file
442
University/UniversityDatabaseImplement/Migrations/20240429094924_Initial.Designer.cs
generated
Normal file
@ -0,0 +1,442 @@
|
||||
// <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("20240429094924_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
/// <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.HasKey("Id");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.ToTable("Attestations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("TeacherId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TeacherId");
|
||||
|
||||
b.ToTable("Disciplines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("FormOfStudy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Profile")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WorkerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkerId");
|
||||
|
||||
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.HasKey("Id");
|
||||
|
||||
b.HasIndex("TeacherId");
|
||||
|
||||
b.ToTable("Statements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Storekeeper", 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>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MiddleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Storekeepers");
|
||||
});
|
||||
|
||||
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.HasKey("Id");
|
||||
|
||||
b.HasIndex("PlanOfStudyId");
|
||||
|
||||
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>("StorekeeperId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StorekeeperId");
|
||||
|
||||
b.ToTable("Teachers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Worker", 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>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MiddleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Workers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Attestation", b =>
|
||||
{
|
||||
b.HasOne("UniversityDatabaseImplement.Models.Student", "Student")
|
||||
.WithMany("Attestations")
|
||||
.HasForeignKey("StudentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Student");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
|
||||
{
|
||||
b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
|
||||
.WithMany("Disciplines")
|
||||
.HasForeignKey("TeacherId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Teacher");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
|
||||
{
|
||||
b.HasOne("UniversityDatabaseImplement.Models.Worker", "Worker")
|
||||
.WithMany("PlanOfStudys")
|
||||
.HasForeignKey("WorkerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Worker");
|
||||
});
|
||||
|
||||
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.Navigation("Teacher");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
|
||||
{
|
||||
b.HasOne("UniversityDatabaseImplement.Models.PlanOfStudy", "PlanOfStudy")
|
||||
.WithMany("Students")
|
||||
.HasForeignKey("PlanOfStudyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PlanOfStudy");
|
||||
});
|
||||
|
||||
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.Storekeeper", "Storekeeper")
|
||||
.WithMany("Teachers")
|
||||
.HasForeignKey("StorekeeperId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Storekeeper");
|
||||
});
|
||||
|
||||
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.Storekeeper", b =>
|
||||
{
|
||||
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.Worker", b =>
|
||||
{
|
||||
b.Navigation("PlanOfStudys");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,312 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace UniversityDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Storekeepers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
MiddleName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Storekeepers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Workers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
MiddleName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Workers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Teachers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
StorekeeperId = table.Column<int>(type: "int", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
AcademicDegree = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Position = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Teachers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Teachers_Storekeepers_StorekeeperId",
|
||||
column: x => x.StorekeeperId,
|
||||
principalTable: "Storekeepers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlanOfStudys",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WorkerId = table.Column<int>(type: "int", nullable: false),
|
||||
Profile = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
FormOfStudy = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlanOfStudys", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlanOfStudys_Workers_WorkerId",
|
||||
column: x => x.WorkerId,
|
||||
principalTable: "Workers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Disciplines",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
TeacherId = table.Column<int>(type: "int", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Disciplines", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Disciplines_Teachers_TeacherId",
|
||||
column: x => x.TeacherId,
|
||||
principalTable: "Teachers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Statements",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
TeacherId = table.Column<int>(type: "int", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Date = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Statements", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Statements_Teachers_TeacherId",
|
||||
column: x => x.TeacherId,
|
||||
principalTable: "Teachers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlanOfStudyTeachers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PlanOfStudyId = table.Column<int>(type: "int", nullable: false),
|
||||
TeacherId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlanOfStudyTeachers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlanOfStudyTeachers_PlanOfStudys_PlanOfStudyId",
|
||||
column: x => x.PlanOfStudyId,
|
||||
principalTable: "PlanOfStudys",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlanOfStudyTeachers_Teachers_TeacherId",
|
||||
column: x => x.TeacherId,
|
||||
principalTable: "Teachers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Students",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PlanOfStudyId = table.Column<int>(type: "int", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Students", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Students_PlanOfStudys_PlanOfStudyId",
|
||||
column: x => x.PlanOfStudyId,
|
||||
principalTable: "PlanOfStudys",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Attestations",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
StudentId = table.Column<int>(type: "int", nullable: false),
|
||||
FormOfEvaluation = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Score = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Attestations", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Attestations_Students_StudentId",
|
||||
column: x => x.StudentId,
|
||||
principalTable: "Students",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "StudentDisciplines",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
StudentId = table.Column<int>(type: "int", nullable: false),
|
||||
DisciplineId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_StudentDisciplines", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_StudentDisciplines_Disciplines_DisciplineId",
|
||||
column: x => x.DisciplineId,
|
||||
principalTable: "Disciplines",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_StudentDisciplines_Students_StudentId",
|
||||
column: x => x.StudentId,
|
||||
principalTable: "Students",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Attestations_StudentId",
|
||||
table: "Attestations",
|
||||
column: "StudentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Disciplines_TeacherId",
|
||||
table: "Disciplines",
|
||||
column: "TeacherId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlanOfStudys_WorkerId",
|
||||
table: "PlanOfStudys",
|
||||
column: "WorkerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlanOfStudyTeachers_PlanOfStudyId",
|
||||
table: "PlanOfStudyTeachers",
|
||||
column: "PlanOfStudyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlanOfStudyTeachers_TeacherId",
|
||||
table: "PlanOfStudyTeachers",
|
||||
column: "TeacherId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Statements_TeacherId",
|
||||
table: "Statements",
|
||||
column: "TeacherId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StudentDisciplines_DisciplineId",
|
||||
table: "StudentDisciplines",
|
||||
column: "DisciplineId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StudentDisciplines_StudentId",
|
||||
table: "StudentDisciplines",
|
||||
column: "StudentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Students_PlanOfStudyId",
|
||||
table: "Students",
|
||||
column: "PlanOfStudyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Teachers_StorekeeperId",
|
||||
table: "Teachers",
|
||||
column: "StorekeeperId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Attestations");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlanOfStudyTeachers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Statements");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "StudentDisciplines");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Disciplines");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Students");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Teachers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlanOfStudys");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Storekeepers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Workers");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,439 @@
|
||||
// <auto-generated />
|
||||
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<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.HasKey("Id");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.ToTable("Attestations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("TeacherId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TeacherId");
|
||||
|
||||
b.ToTable("Disciplines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("FormOfStudy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Profile")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WorkerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkerId");
|
||||
|
||||
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.HasKey("Id");
|
||||
|
||||
b.HasIndex("TeacherId");
|
||||
|
||||
b.ToTable("Statements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Storekeeper", 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>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MiddleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Storekeepers");
|
||||
});
|
||||
|
||||
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.HasKey("Id");
|
||||
|
||||
b.HasIndex("PlanOfStudyId");
|
||||
|
||||
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>("StorekeeperId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StorekeeperId");
|
||||
|
||||
b.ToTable("Teachers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Worker", 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>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MiddleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Workers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Attestation", b =>
|
||||
{
|
||||
b.HasOne("UniversityDatabaseImplement.Models.Student", "Student")
|
||||
.WithMany("Attestations")
|
||||
.HasForeignKey("StudentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Student");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
|
||||
{
|
||||
b.HasOne("UniversityDatabaseImplement.Models.Teacher", "Teacher")
|
||||
.WithMany("Disciplines")
|
||||
.HasForeignKey("TeacherId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Teacher");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.PlanOfStudy", b =>
|
||||
{
|
||||
b.HasOne("UniversityDatabaseImplement.Models.Worker", "Worker")
|
||||
.WithMany("PlanOfStudys")
|
||||
.HasForeignKey("WorkerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Worker");
|
||||
});
|
||||
|
||||
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.Navigation("Teacher");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Student", b =>
|
||||
{
|
||||
b.HasOne("UniversityDatabaseImplement.Models.PlanOfStudy", "PlanOfStudy")
|
||||
.WithMany("Students")
|
||||
.HasForeignKey("PlanOfStudyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PlanOfStudy");
|
||||
});
|
||||
|
||||
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.Storekeeper", "Storekeeper")
|
||||
.WithMany("Teachers")
|
||||
.HasForeignKey("StorekeeperId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Storekeeper");
|
||||
});
|
||||
|
||||
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.Storekeeper", b =>
|
||||
{
|
||||
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.Worker", b =>
|
||||
{
|
||||
b.Navigation("PlanOfStudys");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ namespace UniversityDatabaseImplement
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
//Возможно понадобится писать вместо (localdb) название пк, вот пк Егора: DESKTOP-N8BRIPR; other-name: LAPTOP-DYCTATOR
|
||||
optionsBuilder.UseSqlServer(@"Data Source=(localdb)\SQLEXPRESS;Initial Catalog=UniversityDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=(localdb)\UniversityDatabase;Initial Catalog=UniversityDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
@ -7,9 +7,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.17" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.17" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.17">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
Loading…
Reference in New Issue
Block a user