//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using SchoolAgainStudyDataBaseImplements;
#nullable disable
namespace SchoolAgainStudyDataBaseImplements.Migrations
{
[DbContext(typeof(SchoolDataBase))]
[Migration("20230405182217_Initial")]
partial class Initial
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Diy", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("DateCreate")
.HasColumnType("timestamp with time zone");
b.Property("Description")
.IsRequired()
.HasColumnType("text");
b.Property("StudentId")
.HasColumnType("integer");
b.Property("StudentName")
.IsRequired()
.HasColumnType("text");
b.Property("TaskId")
.HasColumnType("integer");
b.Property("TaskName")
.IsRequired()
.HasColumnType("text");
b.Property("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("StudentId");
b.HasIndex("TaskId");
b.ToTable("Diys");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.DiyInterest", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("DiyId")
.HasColumnType("integer");
b.Property("InterestId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DiyId");
b.HasIndex("InterestId");
b.ToTable("DiyInterests");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Interest", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Description")
.IsRequired()
.HasColumnType("text");
b.Property("StudentId")
.HasColumnType("integer");
b.Property("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("StudentId");
b.ToTable("Interests");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Lesson", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("DateEvent")
.HasColumnType("timestamp with time zone");
b.Property("ProductId")
.HasColumnType("integer");
b.Property("ProductName")
.IsRequired()
.HasColumnType("text");
b.Property("TeacherId")
.HasColumnType("integer");
b.Property("TeacherName")
.IsRequired()
.HasColumnType("text");
b.Property("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ProductId");
b.HasIndex("TeacherId");
b.ToTable("Lessons");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.LessonMaterial", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("LessonId")
.HasColumnType("integer");
b.Property("MaterialId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("LessonId");
b.HasIndex("MaterialId");
b.ToTable("LessonMaterials");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Material", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("SphereUse")
.IsRequired()
.HasColumnType("text");
b.Property("TeacherId")
.HasColumnType("integer");
b.Property("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeacherId");
b.ToTable("Materials");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Product", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("DateCreate")
.HasColumnType("timestamp with time zone");
b.Property("Description")
.IsRequired()
.HasColumnType("text");
b.Property("StudentId")
.HasColumnType("integer");
b.Property("StudentName")
.IsRequired()
.HasColumnType("text");
b.Property("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("StudentId");
b.ToTable("Products");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.ProductInterest", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("InterestId")
.HasColumnType("integer");
b.Property("ProductId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("InterestId");
b.HasIndex("ProductId");
b.ToTable("ProductInterests");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Student", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Class")
.HasColumnType("integer");
b.Property("Email")
.IsRequired()
.HasColumnType("text");
b.Property("Login")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Password")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Students");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Task", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("DateDelivery")
.HasColumnType("timestamp with time zone");
b.Property("DateIssue")
.HasColumnType("timestamp with time zone");
b.Property("TeacherId")
.HasColumnType("integer");
b.Property("TeacherName")
.IsRequired()
.HasColumnType("text");
b.Property("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TeacherId");
b.ToTable("Tasks");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.TaskMaterial", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("MaterialId")
.HasColumnType("integer");
b.Property("TaskId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("MaterialId");
b.HasIndex("TaskId");
b.ToTable("TaskMaterials");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Teacher", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Login")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Password")
.IsRequired()
.HasColumnType("text");
b.Property("Phone")
.IsRequired()
.HasColumnType("text");
b.Property("Post")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Teachers");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Diy", b =>
{
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Student", "Student")
.WithMany("Diys")
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Task", "Task")
.WithMany("Diys")
.HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Student");
b.Navigation("Task");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.DiyInterest", b =>
{
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Diy", "Diy")
.WithMany("Interests")
.HasForeignKey("DiyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Interest", "Interest")
.WithMany("DiyInterests")
.HasForeignKey("InterestId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Diy");
b.Navigation("Interest");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Interest", b =>
{
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Student", "Student")
.WithMany("Interests")
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Student");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Lesson", b =>
{
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Product", "Product")
.WithMany("Lessons")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Teacher", "Teacher")
.WithMany("Lessons")
.HasForeignKey("TeacherId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("Teacher");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.LessonMaterial", b =>
{
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Lesson", "Lesson")
.WithMany("Materials")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Material", "Material")
.WithMany("LessonMaterials")
.HasForeignKey("MaterialId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lesson");
b.Navigation("Material");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Material", b =>
{
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Teacher", "Teacher")
.WithMany("Materials")
.HasForeignKey("TeacherId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Teacher");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Product", b =>
{
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Student", "Student")
.WithMany("Products")
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Student");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.ProductInterest", b =>
{
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Interest", "Interest")
.WithMany("ProductInterests")
.HasForeignKey("InterestId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Product", "Product")
.WithMany("Interests")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Interest");
b.Navigation("Product");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Task", b =>
{
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Teacher", "Teacher")
.WithMany("Tasks")
.HasForeignKey("TeacherId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Teacher");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.TaskMaterial", b =>
{
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Material", "Material")
.WithMany("TaskMaterial")
.HasForeignKey("MaterialId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Task", "Task")
.WithMany("Materials")
.HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Material");
b.Navigation("Task");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Diy", b =>
{
b.Navigation("Interests");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Interest", b =>
{
b.Navigation("DiyInterests");
b.Navigation("ProductInterests");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Lesson", b =>
{
b.Navigation("Materials");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Material", b =>
{
b.Navigation("LessonMaterials");
b.Navigation("TaskMaterial");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Product", b =>
{
b.Navigation("Interests");
b.Navigation("Lessons");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Student", b =>
{
b.Navigation("Diys");
b.Navigation("Interests");
b.Navigation("Products");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Task", b =>
{
b.Navigation("Diys");
b.Navigation("Materials");
});
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Teacher", b =>
{
b.Navigation("Lessons");
b.Navigation("Materials");
b.Navigation("Tasks");
});
#pragma warning restore 612, 618
}
}
}