//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using data;
#nullable disable
namespace data.Migrations
{
[DbContext(typeof(DatabaseContext))]
[Migration("20241122130744_FixIssueAgain")]
partial class FixIssueAgain
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("data.DAO.Diary", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Date")
.HasColumnType("date");
b.Property("DiaryText")
.IsRequired()
.HasColumnType("text");
b.Property("NumberSubject")
.HasColumnType("integer");
b.Property("StudentGroupSubjectId")
.HasColumnType("integer");
b.Property("StudentId")
.HasColumnType("integer");
b.Property("TrafficId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("StudentGroupSubjectId");
b.HasIndex("StudentId");
b.HasIndex("TrafficId");
b.ToTable("Diaries");
});
modelBuilder.Entity("data.DAO.Group", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Groups");
});
modelBuilder.Entity("data.DAO.Student", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property("GroupId")
.HasColumnType("integer");
b.Property("LastName")
.IsRequired()
.HasColumnType("text");
b.Property("Patronymic")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("GroupId");
b.ToTable("Students");
});
modelBuilder.Entity("data.DAO.StudentGroupSubject", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("GroupId")
.HasColumnType("integer");
b.Property("SemesterEnd")
.HasColumnType("integer");
b.Property("SemesterStart")
.HasColumnType("integer");
b.Property("SubjectId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("GroupId");
b.HasIndex("SubjectId");
b.ToTable("StudentGroupsSubjects");
});
modelBuilder.Entity("data.DAO.Subject", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Subjects");
});
modelBuilder.Entity("data.DAO.Traffic", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Traffics");
});
modelBuilder.Entity("data.DAO.Diary", b =>
{
b.HasOne("data.DAO.StudentGroupSubject", "StudentGroupSubject")
.WithMany()
.HasForeignKey("StudentGroupSubjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("data.DAO.Student", "Student")
.WithMany()
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("data.DAO.Traffic", "Traffic")
.WithMany()
.HasForeignKey("TrafficId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Student");
b.Navigation("StudentGroupSubject");
b.Navigation("Traffic");
});
modelBuilder.Entity("data.DAO.Student", b =>
{
b.HasOne("data.DAO.Group", "Group")
.WithMany("Students")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Group");
});
modelBuilder.Entity("data.DAO.StudentGroupSubject", b =>
{
b.HasOne("data.DAO.Group", "Group")
.WithMany()
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("data.DAO.Subject", "Subject")
.WithMany()
.HasForeignKey("SubjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Group");
b.Navigation("Subject");
});
modelBuilder.Entity("data.DAO.Group", b =>
{
b.Navigation("Students");
});
#pragma warning restore 612, 618
}
}
}