//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using UniversityDataBaseImplemet;
#nullable disable
namespace UniversityDataBaseImplemet.Migrations
{
[DbContext(typeof(Database))]
partial class DatabaseModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("UniversityContracts.ViewModels.EducationGroupViewModel", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("NumberOfStudent")
.HasColumnType("integer");
b.Property("StreamId")
.HasColumnType("integer");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("StreamId");
b.ToTable("EducationGroupViewModel");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Discipline", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Hours")
.HasColumnType("integer");
b.Property("MarkType")
.HasColumnType("boolean");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("StreamId")
.HasColumnType("integer");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("StreamId");
b.HasIndex("UserId");
b.ToTable("Discipline");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Date")
.HasColumnType("timestamp with time zone");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Documents");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("NumberOfStudent")
.HasColumnType("integer");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("EducationGroups");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupDocument", b =>
{
b.Property("EducationGroupId")
.HasColumnType("integer");
b.Property("DocumentId")
.HasColumnType("integer");
b.HasKey("EducationGroupId", "DocumentId");
b.HasIndex("DocumentId");
b.ToTable("EducationGroupsDocuments");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupStream", b =>
{
b.Property("EducationGroupId")
.HasColumnType("integer");
b.Property("StreamId")
.HasColumnType("integer");
b.HasKey("EducationGroupId", "StreamId");
b.HasIndex("StreamId");
b.ToTable("EducationGroupsStreams");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("EducationStatuses");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Course")
.HasColumnType("integer");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Streams");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("DateOfAddmission")
.HasColumnType("timestamp with time zone");
b.Property("DateOfBirth")
.HasColumnType("timestamp with time zone");
b.Property("EducationStatusId")
.HasColumnType("integer");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("StudentCard")
.HasColumnType("integer");
b.Property("Surname")
.IsRequired()
.HasColumnType("text");
b.Property("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("EducationStatusId");
b.HasIndex("UserId");
b.ToTable("Students");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentDocument", b =>
{
b.Property("StudentId")
.HasColumnType("integer");
b.Property("DocumentId")
.HasColumnType("integer");
b.HasKey("StudentId", "DocumentId");
b.HasIndex("DocumentId");
b.ToTable("StudentDocuments");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentStream", b =>
{
b.Property("StudentId")
.HasColumnType("integer");
b.Property("StreamId")
.HasColumnType("integer");
b.HasKey("StudentId", "StreamId");
b.HasIndex("StreamId");
b.ToTable("StudentStreams");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Login")
.IsRequired()
.HasColumnType("text");
b.Property("Password")
.IsRequired()
.HasColumnType("text");
b.Property("Role")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("User");
});
modelBuilder.Entity("UniversityContracts.ViewModels.EducationGroupViewModel", b =>
{
b.HasOne("UniversityDataBaseImplemet.Models.Stream", null)
.WithMany("StreamEdGroups")
.HasForeignKey("StreamId");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Discipline", b =>
{
b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
.WithMany()
.HasForeignKey("StreamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
.WithMany("Disciplines")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.NoAction)
.IsRequired();
b.Navigation("Stream");
b.Navigation("User");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b =>
{
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
.WithMany("Documents")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.NoAction)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b =>
{
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
.WithMany("EducationGroups")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.NoAction)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupDocument", b =>
{
b.HasOne("UniversityDataBaseImplemet.Models.Document", "Document")
.WithMany("EducationGroupDocument")
.HasForeignKey("DocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("UniversityDataBaseImplemet.Models.EducationGroup", "EducationGroup")
.WithMany("EducationGroupDocument")
.HasForeignKey("EducationGroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Document");
b.Navigation("EducationGroup");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupStream", b =>
{
b.HasOne("UniversityDataBaseImplemet.Models.EducationGroup", "EducationGroup")
.WithMany("EducationGroupStream")
.HasForeignKey("EducationGroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
.WithMany("EducationGroupStream")
.HasForeignKey("StreamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("EducationGroup");
b.Navigation("Stream");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b =>
{
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
.WithMany("EducationStatuses")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.NoAction)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b =>
{
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
.WithMany("Streams")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.NoAction)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b =>
{
b.HasOne("UniversityDataBaseImplemet.Models.EducationStatus", "EducationStatus")
.WithMany("Students")
.HasForeignKey("EducationStatusId");
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
.WithMany("Students")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.NoAction)
.IsRequired();
b.Navigation("EducationStatus");
b.Navigation("User");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentDocument", b =>
{
b.HasOne("UniversityDataBaseImplemet.Models.Document", "Document")
.WithMany("Students")
.HasForeignKey("DocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("UniversityDataBaseImplemet.Models.Student", "Student")
.WithMany("DocumentStudents")
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Document");
b.Navigation("Student");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentStream", b =>
{
b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
.WithMany("StreamStudents")
.HasForeignKey("StreamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("UniversityDataBaseImplemet.Models.Student", "Student")
.WithMany("StudentStream")
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Stream");
b.Navigation("Student");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b =>
{
b.Navigation("EducationGroupDocument");
b.Navigation("Students");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b =>
{
b.Navigation("EducationGroupDocument");
b.Navigation("EducationGroupStream");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b =>
{
b.Navigation("Students");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b =>
{
b.Navigation("EducationGroupStream");
b.Navigation("StreamEdGroups");
b.Navigation("StreamStudents");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b =>
{
b.Navigation("DocumentStudents");
b.Navigation("StudentStream");
});
modelBuilder.Entity("UniversityDataBaseImplemet.Models.User", b =>
{
b.Navigation("Disciplines");
b.Navigation("Documents");
b.Navigation("EducationGroups");
b.Navigation("EducationStatuses");
b.Navigation("Streams");
b.Navigation("Students");
});
#pragma warning restore 612, 618
}
}
}