using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; namespace AvaloniaApplication4.Models; public partial class TestDataBaseCheskinaContext : DbContext { public TestDataBaseCheskinaContext() { } public TestDataBaseCheskinaContext(DbContextOptions options) : base(options) { } public virtual DbSet CodeAcademicSubjects { get; set; } public virtual DbSet CodeCompetencies { get; set; } public virtual DbSet Competencies { get; set; } public virtual DbSet Grades { get; set; } public virtual DbSet Logs { get; set; } public virtual DbSet MdkWithModules { get; set; } public virtual DbSet Modules { get; set; } public virtual DbSet ModulesWithCompetencies { get; set; } public virtual DbSet ProgramStatuses { get; set; } public virtual DbSet ProgramTemplates { get; set; } public virtual DbSet ProgramsWithModules { get; set; } public virtual DbSet ProgramsWithStudents { get; set; } public virtual DbSet ProgramsWithSubjects { get; set; } public virtual DbSet RunningPrograms { get; set; } public virtual DbSet Students { get; set; } public virtual DbSet StudentsEducations { get; set; } public virtual DbSet StudyListModulesStudents { get; set; } public virtual DbSet StudyListSubjectsStudents { get; set; } public virtual DbSet Subjects { get; set; } public virtual DbSet SystemRoles { get; set; } public virtual DbSet TrainingStandarts { get; set; } public virtual DbSet Users { get; set; } public virtual DbSet UsersLogins { get; set; } public virtual DbSet UsersWithRoles { get; set; } public virtual DbSet WaysToChanges { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) #warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. => optionsBuilder.UseNpgsql("Host=ngknn.ru;Port=5442;Database=testDataBaseCheskina;Username=41P;Password=12357"); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => { entity.HasKey(e => e.IdCodeAcademicSubjects).HasName("code_academic_subjects_pk"); entity.ToTable("code_academic_subjects"); entity.Property(e => e.IdCodeAcademicSubjects) .HasColumnType("character varying") .HasColumnName("id_code_academic_subjects"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Code).HasName("code_competencies_pk"); entity.ToTable("code_competencies"); entity.Property(e => e.Code) .HasColumnType("character varying") .HasColumnName("code"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdCompenetnce).HasName("competencies_pk"); entity.ToTable("competencies"); entity.Property(e => e.IdCompenetnce) .UseIdentityAlwaysColumn() .HasColumnName("id_compenetnce"); entity.Property(e => e.CodeCompenetnce) .HasColumnType("character varying") .HasColumnName("code_compenetnce"); entity.Property(e => e.Description) .HasColumnType("character varying") .HasColumnName("description"); entity.Property(e => e.NameCompetence) .HasColumnType("character varying") .HasColumnName("name_competence"); entity.HasOne(d => d.CodeCompenetnceNavigation).WithMany(p => p.Competencies) .HasForeignKey(d => d.CodeCompenetnce) .HasConstraintName("competencies_code_competencies_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("grade_pk"); entity.ToTable("grade"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.Name) .HasColumnType("character varying") .HasColumnName("name"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdLog).HasName("logs_pk"); entity.ToTable("logs"); entity.Property(e => e.IdLog) .UseIdentityAlwaysColumn() .HasColumnName("id_log"); entity.Property(e => e.Date).HasColumnName("date"); entity.Property(e => e.Description) .HasColumnType("character varying") .HasColumnName("description"); entity.Property(e => e.IdUser).HasColumnName("id_user"); entity.HasOne(d => d.IdUserNavigation).WithMany(p => p.Logs) .HasForeignKey(d => d.IdUser) .HasConstraintName("logs_users_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("mdk_with_modules_pk"); entity.ToTable("mdk_with_modules"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.IdMdk).HasColumnName("id_mdk"); entity.Property(e => e.IdModule).HasColumnName("id_module"); entity.HasOne(d => d.IdMdkNavigation).WithMany(p => p.MdkWithModules) .HasForeignKey(d => d.IdMdk) .HasConstraintName("mdk_with_modules_fk_1"); entity.HasOne(d => d.IdModuleNavigation).WithMany(p => p.MdkWithModules) .HasForeignKey(d => d.IdModule) .HasConstraintName("mdk_with_modules_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdModule).HasName("modules_pk"); entity.ToTable("modules"); entity.HasIndex(e => e.CodeModule, "modules_un").IsUnique(); entity.Property(e => e.IdModule) .UseIdentityAlwaysColumn() .HasColumnName("id_module"); entity.Property(e => e.CodeModule) .HasColumnType("character varying") .HasColumnName("code_module"); entity.Property(e => e.IdTrainingStandarts).HasColumnName("id_training_standarts"); entity.Property(e => e.Name) .HasColumnType("character varying") .HasColumnName("name"); entity.HasOne(d => d.IdTrainingStandartsNavigation).WithMany(p => p.Modules) .HasForeignKey(d => d.IdTrainingStandarts) .HasConstraintName("modules_training_standarts_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("modules_with_competencies_pk"); entity.ToTable("modules_with_competencies"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.IdCompetence).HasColumnName("id_competence"); entity.Property(e => e.IdModule).HasColumnName("id_module"); entity.HasOne(d => d.IdCompetenceNavigation).WithMany(p => p.ModulesWithCompetencies) .HasForeignKey(d => d.IdCompetence) .HasConstraintName("modules_with_competencies_competencies_fk"); entity.HasOne(d => d.IdModuleNavigation).WithMany(p => p.ModulesWithCompetencies) .HasForeignKey(d => d.IdModule) .HasConstraintName("modules_with_competencies_modules_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdStatus).HasName("program_status_pk"); entity.ToTable("program_status"); entity.Property(e => e.IdStatus) .UseIdentityAlwaysColumn() .HasColumnName("id_status"); entity.Property(e => e.NameStatus) .HasColumnType("character varying") .HasColumnName("name_status"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdProgramTemplate).HasName("program_template_pk"); entity.ToTable("program_template"); entity.HasIndex(e => e.CodeProgram, "program_template_un").IsUnique(); entity.Property(e => e.IdProgramTemplate) .UseIdentityAlwaysColumn() .HasColumnName("id_program_template"); entity.Property(e => e.CodeProgram) .HasColumnType("character varying") .HasColumnName("code_program"); entity.Property(e => e.NameProgram) .HasColumnType("character varying") .HasColumnName("name_program"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("programs_with_modules_pk"); entity.ToTable("programs_with_modules"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.IdModule).HasColumnName("id_module"); entity.Property(e => e.IdRunningProgram).HasColumnName("id_running_program"); entity.HasOne(d => d.IdModuleNavigation).WithMany(p => p.ProgramsWithModules) .HasForeignKey(d => d.IdModule) .HasConstraintName("programs_with_modules_fk_1"); entity.HasOne(d => d.IdRunningProgramNavigation).WithMany(p => p.ProgramsWithModules) .HasForeignKey(d => d.IdRunningProgram) .HasConstraintName("programs_with_modules_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("programs_with_students_pk"); entity.ToTable("programs_with_students"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.IdRunningProgram).HasColumnName("id_running_program"); entity.Property(e => e.IdStudent).HasColumnName("id_student"); entity.HasOne(d => d.IdRunningProgramNavigation).WithMany(p => p.ProgramsWithStudents) .HasForeignKey(d => d.IdRunningProgram) .HasConstraintName("programs_with_students_running_programs_fk"); entity.HasOne(d => d.IdStudentNavigation).WithMany(p => p.ProgramsWithStudents) .HasForeignKey(d => d.IdStudent) .HasConstraintName("programs_with_students_students_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("programs_with_subjects_pk"); entity.ToTable("programs_with_subjects"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.IdRunningProgram).HasColumnName("id_running_program"); entity.Property(e => e.IdSubject).HasColumnName("id_subject"); entity.Property(e => e.IdTeacher).HasColumnName("id_teacher"); entity.Property(e => e.IdWay).HasColumnName("id_way"); entity.Property(e => e.NumberOfHours).HasColumnName("number_of_hours"); entity.HasOne(d => d.IdRunningProgramNavigation).WithMany(p => p.ProgramsWithSubjects) .HasForeignKey(d => d.IdRunningProgram) .HasConstraintName("programs_with_subjects_fk"); entity.HasOne(d => d.IdSubjectNavigation).WithMany(p => p.ProgramsWithSubjects) .HasForeignKey(d => d.IdSubject) .HasConstraintName("programs_with_subjects_fk_1"); entity.HasOne(d => d.IdTeacherNavigation).WithMany(p => p.ProgramsWithSubjects) .HasForeignKey(d => d.IdTeacher) .HasConstraintName("programs_with_subjects_fk_2"); entity.HasOne(d => d.IdWayNavigation).WithMany(p => p.ProgramsWithSubjects) .HasForeignKey(d => d.IdWay) .HasConstraintName("programs_with_subjects_ways_to_change_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdRunningPrograms).HasName("running_programs_pk"); entity.ToTable("running_programs"); entity.Property(e => e.IdRunningPrograms) .UseIdentityAlwaysColumn() .HasColumnName("id_running_programs"); entity.Property(e => e.DateEnd).HasColumnName("date_end"); entity.Property(e => e.DateStart).HasColumnName("date_start"); entity.Property(e => e.IdProgramTemplate).HasColumnName("id_program_template"); entity.Property(e => e.IdSecretary).HasColumnName("id_secretary"); entity.Property(e => e.IdStatus).HasColumnName("id_status"); entity.Property(e => e.IdTrainingStandart).HasColumnName("id_training_standart"); entity.Property(e => e.IdTutor).HasColumnName("id_tutor"); entity.HasOne(d => d.IdProgramTemplateNavigation).WithMany(p => p.RunningPrograms) .HasForeignKey(d => d.IdProgramTemplate) .HasConstraintName("running_programs_fk"); entity.HasOne(d => d.IdSecretaryNavigation).WithMany(p => p.RunningProgramIdSecretaryNavigations) .HasForeignKey(d => d.IdSecretary) .HasConstraintName("running_programs_fk_3"); entity.HasOne(d => d.IdStatusNavigation).WithMany(p => p.RunningPrograms) .HasForeignKey(d => d.IdStatus) .HasConstraintName("running_programs_fk_1"); entity.HasOne(d => d.IdTrainingStandartNavigation).WithMany(p => p.RunningPrograms) .HasForeignKey(d => d.IdTrainingStandart) .HasConstraintName("running_programs_training_standarts_fk"); entity.HasOne(d => d.IdTutorNavigation).WithMany(p => p.RunningProgramIdTutorNavigations) .HasForeignKey(d => d.IdTutor) .HasConstraintName("running_programs_fk_2"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdStudent).HasName("students_pk"); entity.ToTable("students"); entity.Property(e => e.IdStudent) .UseIdentityAlwaysColumn() .HasColumnName("id_student"); entity.Property(e => e.Birthday).HasColumnName("birthday"); entity.Property(e => e.IdEducation).HasColumnName("id_education"); entity.Property(e => e.Name) .HasColumnType("character varying") .HasColumnName("name"); entity.Property(e => e.Patronumic) .HasColumnType("character varying") .HasColumnName("patronumic"); entity.Property(e => e.Surname) .HasColumnType("character varying") .HasColumnName("surname"); entity.HasOne(d => d.IdEducationNavigation).WithMany(p => p.Students) .HasForeignKey(d => d.IdEducation) .HasConstraintName("students_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdEducation).HasName("students_education_pk"); entity.ToTable("students_education"); entity.Property(e => e.IdEducation) .UseIdentityAlwaysColumn() .HasColumnName("id_education"); entity.Property(e => e.Name) .HasColumnType("character varying") .HasColumnName("name"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("study_list_modules_students_pk"); entity.ToTable("study_list_modules_students"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.Grade).HasColumnName("grade"); entity.Property(e => e.IdModule).HasColumnName("id_module"); entity.Property(e => e.IdStudent).HasColumnName("id_student"); entity.HasOne(d => d.IdModuleNavigation).WithMany(p => p.StudyListModulesStudents) .HasForeignKey(d => d.IdModule) .HasConstraintName("study_list_modules_students_fk"); entity.HasOne(d => d.IdStudentNavigation).WithMany(p => p.StudyListModulesStudents) .HasForeignKey(d => d.IdStudent) .HasConstraintName("study_list_modules_students_fk_1"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("study_list_subjects_students_pk"); entity.ToTable("study_list_subjects_students"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.Grade).HasColumnName("grade"); entity.Property(e => e.IdStudent).HasColumnName("id_student"); entity.Property(e => e.IdSubject).HasColumnName("id_subject"); entity.HasOne(d => d.GradeNavigation).WithMany(p => p.StudyListSubjectsStudents) .HasForeignKey(d => d.Grade) .OnDelete(DeleteBehavior.SetNull) .HasConstraintName("study_list_subjects_students_grade_fk"); entity.HasOne(d => d.IdStudentNavigation).WithMany(p => p.StudyListSubjectsStudents) .HasForeignKey(d => d.IdStudent) .HasConstraintName("study_list_subjects_students_fk_1"); entity.HasOne(d => d.IdSubjectNavigation).WithMany(p => p.StudyListSubjectsStudents) .HasForeignKey(d => d.IdSubject) .HasConstraintName("study_list_subjects_students_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdSubject).HasName("subjects_pk"); entity.ToTable("subjects"); entity.Property(e => e.IdSubject) .UseIdentityAlwaysColumn() .HasColumnName("id_subject"); entity.Property(e => e.IdCodeAcademicSubject) .HasColumnType("character varying") .HasColumnName("id_code_academic_subject"); entity.Property(e => e.IdTrainingStandarts).HasColumnName("id_training_standarts"); entity.Property(e => e.NameSubject) .HasColumnType("character varying") .HasColumnName("name_subject"); entity.HasOne(d => d.IdCodeAcademicSubjectNavigation).WithMany(p => p.Subjects) .HasForeignKey(d => d.IdCodeAcademicSubject) .HasConstraintName("subjects_fk"); entity.HasOne(d => d.IdTrainingStandartsNavigation).WithMany(p => p.Subjects) .HasForeignKey(d => d.IdTrainingStandarts) .HasConstraintName("subjects_fk_1"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdRole).HasName("system_roles_pk"); entity.ToTable("system_roles"); entity.Property(e => e.IdRole) .UseIdentityAlwaysColumn() .HasColumnName("id_role"); entity.Property(e => e.RoleName) .HasColumnType("character varying") .HasColumnName("role_name"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdTrainingStandart).HasName("training_standarts_pk"); entity.ToTable("training_standarts"); entity.HasIndex(e => e.CodeTrainingStandart, "training_standarts_un").IsUnique(); entity.Property(e => e.IdTrainingStandart) .UseIdentityAlwaysColumn() .HasColumnName("id_training_standart"); entity.Property(e => e.CodeTrainingStandart) .HasColumnType("character varying") .HasColumnName("code_training_standart"); entity.Property(e => e.NameTrainingStandart) .HasColumnType("character varying") .HasColumnName("name_training_standart"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdUser).HasName("users_pk"); entity.ToTable("users"); entity.Property(e => e.IdUser) .UseIdentityAlwaysColumn() .HasColumnName("id_user"); entity.Property(e => e.Name) .HasColumnType("character varying") .HasColumnName("name"); entity.Property(e => e.Patronumic) .HasColumnType("character varying") .HasColumnName("patronumic"); entity.Property(e => e.Surname) .HasColumnType("character varying") .HasColumnName("surname"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.UserEmail).HasName("users_login_pk"); entity.ToTable("users_login"); entity.HasIndex(e => e.IdUser, "users_login_un").IsUnique(); entity.Property(e => e.UserEmail) .HasColumnType("character varying") .HasColumnName("user_email"); entity.Property(e => e.IdUser).HasColumnName("id_user"); entity.Property(e => e.Password) .HasColumnType("character varying") .HasColumnName("password"); entity.HasOne(d => d.IdUserNavigation).WithOne(p => p.UsersLogin) .HasForeignKey(d => d.IdUser) .HasConstraintName("users_login_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("users_with_roles_pk"); entity.ToTable("users_with_roles"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.IdRole).HasColumnName("id_role"); entity.Property(e => e.IdUser).HasColumnName("id_user"); entity.HasOne(d => d.IdRoleNavigation).WithMany(p => p.UsersWithRoles) .HasForeignKey(d => d.IdRole) .HasConstraintName("users_with_roles_fk_1"); entity.HasOne(d => d.IdUserNavigation).WithMany(p => p.UsersWithRoles) .HasForeignKey(d => d.IdUser) .HasConstraintName("users_with_roles_fk"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("ways_to_change_pk"); entity.ToTable("ways_to_change"); entity.Property(e => e.Id) .UseIdentityAlwaysColumn() .HasColumnName("id"); entity.Property(e => e.Name) .HasColumnType("character varying") .HasColumnName("name"); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); }