123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593 |
- using System;
- using System.Collections.Generic;
- using Microsoft.EntityFrameworkCore;
- namespace AvaloniaApplication4.Models;
- public partial class TestDataBaseCheskinaContext : DbContext
- {
- public TestDataBaseCheskinaContext()
- {
- }
- public TestDataBaseCheskinaContext(DbContextOptions<TestDataBaseCheskinaContext> options)
- : base(options)
- {
- }
- public virtual DbSet<CodeAcademicSubject> CodeAcademicSubjects { get; set; }
- public virtual DbSet<CodeCompetency> CodeCompetencies { get; set; }
- public virtual DbSet<Competency> Competencies { get; set; }
- public virtual DbSet<Grade> Grades { get; set; }
- public virtual DbSet<Log> Logs { get; set; }
- public virtual DbSet<MdkWithModule> MdkWithModules { get; set; }
- public virtual DbSet<Module> Modules { get; set; }
- public virtual DbSet<ModulesWithCompetency> ModulesWithCompetencies { get; set; }
- public virtual DbSet<ProgramStatus> ProgramStatuses { get; set; }
- public virtual DbSet<ProgramTemplate> ProgramTemplates { get; set; }
- public virtual DbSet<ProgramsWithModule> ProgramsWithModules { get; set; }
- public virtual DbSet<ProgramsWithStudent> ProgramsWithStudents { get; set; }
- public virtual DbSet<ProgramsWithSubject> ProgramsWithSubjects { get; set; }
- public virtual DbSet<RunningProgram> RunningPrograms { get; set; }
- public virtual DbSet<Student> Students { get; set; }
- public virtual DbSet<StudentsEducation> StudentsEducations { get; set; }
- public virtual DbSet<StudyListModulesStudent> StudyListModulesStudents { get; set; }
- public virtual DbSet<StudyListSubjectsStudent> StudyListSubjectsStudents { get; set; }
- public virtual DbSet<Subject> Subjects { get; set; }
- public virtual DbSet<SystemRole> SystemRoles { get; set; }
- public virtual DbSet<TrainingStandart> TrainingStandarts { get; set; }
- public virtual DbSet<User> Users { get; set; }
- public virtual DbSet<UsersLogin> UsersLogins { get; set; }
- public virtual DbSet<UsersWithRole> UsersWithRoles { get; set; }
- public virtual DbSet<WaysToChange> 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<CodeAcademicSubject>(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<CodeCompetency>(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<Competency>(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<Grade>(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<Log>(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<MdkWithModule>(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<Module>(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<ModulesWithCompetency>(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<ProgramStatus>(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<ProgramTemplate>(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<ProgramsWithModule>(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<ProgramsWithStudent>(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<ProgramsWithSubject>(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<RunningProgram>(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<Student>(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<StudentsEducation>(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<StudyListModulesStudent>(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<StudyListSubjectsStudent>(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<Subject>(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<SystemRole>(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<TrainingStandart>(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<User>(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<UsersLogin>(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<UsersLogin>(d => d.IdUser)
- .HasConstraintName("users_login_fk");
- });
- modelBuilder.Entity<UsersWithRole>(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<WaysToChange>(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);
- }
|