struct&&assiQues

This commit is contained in:
SpecialX
2025-06-20 15:37:39 +08:00
parent f37262d72e
commit d20c051c51
68 changed files with 1927 additions and 2869 deletions

View File

@@ -1,93 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace TechHelper.Server.Migrations
{
/// <inheritdoc />
public partial class assignmentnot_required : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: new Guid("02a808ba-bd16-4f90-bf2b-0bc42f767e00"));
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: new Guid("9e526681-e57e-46b5-a01c-5731b27bfc4a"));
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: new Guid("dfdfb884-4063-4161-84e0-9c225f4e883c"));
migrationBuilder.AlterColumn<Guid>(
name: "assignment",
table: "assignment_group",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ new Guid("b2e087e6-ea32-46c4-aeb3-09b936cd0cf4"), null, "Teacher", "TEACHER" },
{ new Guid("ba33e047-8354-4f2c-b8b1-1f46441c28fc"), null, "Administrator", "ADMINISTRATOR" },
{ new Guid("d4b41bc3-612e-49dd-aeda-6a98ea0e4e68"), null, "Student", "STUDENT" }
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: new Guid("b2e087e6-ea32-46c4-aeb3-09b936cd0cf4"));
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: new Guid("ba33e047-8354-4f2c-b8b1-1f46441c28fc"));
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: new Guid("d4b41bc3-612e-49dd-aeda-6a98ea0e4e68"));
migrationBuilder.AlterColumn<Guid>(
name: "assignment",
table: "assignment_group",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ new Guid("02a808ba-bd16-4f90-bf2b-0bc42f767e00"), null, "Administrator", "ADMINISTRATOR" },
{ new Guid("9e526681-e57e-46b5-a01c-5731b27bfc4a"), null, "Student", "STUDENT" },
{ new Guid("dfdfb884-4063-4161-84e0-9c225f4e883c"), null, "Teacher", "TEACHER" }
});
}
}
}

View File

@@ -12,7 +12,7 @@ using TechHelper.Context;
namespace TechHelper.Server.Migrations
{
[DbContext(typeof(ApplicationContext))]
[Migration("20250610025325_init")]
[Migration("20250619070929_init")]
partial class init
{
/// <inheritdoc />
@@ -36,7 +36,7 @@ namespace TechHelper.Server.Migrations
.HasColumnType("datetime(6)")
.HasColumnName("created_at");
b.Property<Guid>("CreatedBy")
b.Property<Guid>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("created_by");
@@ -53,9 +53,12 @@ namespace TechHelper.Server.Migrations
.HasColumnType("tinyint(1)")
.HasColumnName("deleted");
b.Property<string>("SubjectArea")
.IsRequired()
.HasColumnType("longtext")
b.Property<float>("Score")
.HasColumnType("float")
.HasColumnName("score");
b.Property<byte>("SubjectArea")
.HasColumnType("tinyint unsigned")
.HasColumnName("subject_area");
b.Property<string>("Title")
@@ -64,8 +67,8 @@ namespace TechHelper.Server.Migrations
.HasColumnType("varchar(255)")
.HasColumnName("title");
b.Property<float?>("TotalPoints")
.HasColumnType("float")
b.Property<byte>("TotalQuestions")
.HasColumnType("tinyint unsigned")
.HasColumnName("total_points");
b.Property<DateTime>("UpdatedAt")
@@ -77,7 +80,7 @@ namespace TechHelper.Server.Migrations
b.HasKey("Id");
b.HasIndex("CreatedBy");
b.HasIndex("CreatorId");
b.HasIndex("UserId");
@@ -151,61 +154,6 @@ namespace TechHelper.Server.Migrations
b.ToTable("assignment_class", (string)null);
});
modelBuilder.Entity("Entities.Contracts.AssignmentGroup", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnName("id");
b.Property<Guid?>("AssignmentId")
.IsRequired()
.HasColumnType("char(36)")
.HasColumnName("assignment");
b.Property<string>("Descript")
.IsRequired()
.HasMaxLength(65535)
.HasColumnType("longtext")
.HasColumnName("descript");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("deleted");
b.Property<byte>("Number")
.HasColumnType("tinyint unsigned")
.HasColumnName("number");
b.Property<Guid?>("ParentGroup")
.HasColumnType("char(36)")
.HasColumnName("parent_group");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(65535)
.HasColumnType("longtext")
.HasColumnName("title");
b.Property<float?>("TotalPoints")
.HasColumnType("float")
.HasColumnName("total_points");
b.Property<bool>("ValidQuestionGroup")
.HasColumnType("tinyint(1)")
.HasColumnName("valid_question_group");
b.HasKey("Id");
b.HasIndex("AssignmentId");
b.HasIndex("ParentGroup");
b.ToTable("assignment_group", (string)null);
});
modelBuilder.Entity("Entities.Contracts.AssignmentQuestion", b =>
{
b.Property<Guid>("Id")
@@ -221,6 +169,10 @@ namespace TechHelper.Server.Migrations
.HasColumnType("datetime(6)")
.HasColumnName("created_at");
b.Property<byte>("Index")
.HasColumnType("tinyint unsigned")
.HasColumnName("question_number");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
@@ -231,10 +183,6 @@ namespace TechHelper.Server.Migrations
.HasColumnType("char(36)")
.HasColumnName("question_id");
b.Property<byte>("QuestionNumber")
.HasColumnType("tinyint unsigned")
.HasColumnName("question_number");
b.Property<float?>("Score")
.HasColumnType("float")
.HasColumnName("score");
@@ -248,6 +196,61 @@ namespace TechHelper.Server.Migrations
b.ToTable("assignment_questions", (string)null);
});
modelBuilder.Entity("Entities.Contracts.AssignmentStruct", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnName("id");
b.Property<Guid?>("AssignmentId")
.HasColumnType("char(36)")
.HasColumnName("assignment");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(65535)
.HasColumnType("longtext")
.HasColumnName("descript");
b.Property<byte>("Index")
.HasColumnType("tinyint unsigned")
.HasColumnName("number");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("deleted");
b.Property<byte>("Layout")
.HasColumnType("tinyint unsigned")
.HasColumnName("layout");
b.Property<Guid?>("ParentGroupId")
.HasColumnType("char(36)")
.HasColumnName("parent_group");
b.Property<float?>("Score")
.HasColumnType("float")
.HasColumnName("total_points");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(65535)
.HasColumnType("longtext")
.HasColumnName("title");
b.HasKey("Id");
b.HasIndex("AssignmentId")
.IsUnique();
b.HasIndex("ParentGroupId");
b.ToTable("assignment_group", (string)null);
});
modelBuilder.Entity("Entities.Contracts.Class", b =>
{
b.Property<Guid>("Id")
@@ -337,9 +340,8 @@ namespace TechHelper.Server.Migrations
.HasColumnType("char(36)")
.HasColumnName("teacher_id");
b.Property<string>("SubjectTaught")
.IsRequired()
.HasColumnType("longtext")
b.Property<byte>("SubjectTaught")
.HasColumnType("tinyint unsigned")
.HasColumnName("subject_taught");
b.HasKey("ClassId", "TeacherId");
@@ -349,6 +351,72 @@ namespace TechHelper.Server.Migrations
b.ToTable("class_teachers", (string)null);
});
modelBuilder.Entity("Entities.Contracts.KeyPoint", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.Property<Guid>("LessonID")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("LessonID");
b.ToTable("key_point");
});
modelBuilder.Entity("Entities.Contracts.Lesson", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("TextbookID")
.HasColumnType("char(36)");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("TextbookID");
b.ToTable("lesson");
});
modelBuilder.Entity("Entities.Contracts.LessonQuestion", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid>("LessonID")
.HasColumnType("char(36)");
b.Property<string>("Question")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("LessonID");
b.ToTable("lesson_question");
});
modelBuilder.Entity("Entities.Contracts.Question", b =>
{
b.Property<Guid>("Id")
@@ -356,8 +424,7 @@ namespace TechHelper.Server.Migrations
.HasColumnType("char(36)")
.HasColumnName("id");
b.Property<string>("CorrectAnswer")
.IsRequired()
b.Property<string>("Answer")
.HasMaxLength(65535)
.HasColumnType("longtext")
.HasColumnName("correct_answer");
@@ -369,53 +436,75 @@ namespace TechHelper.Server.Migrations
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<DateTime>("CreatedAt"));
b.Property<Guid>("CreatedBy")
b.Property<Guid>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("created_by");
b.Property<string>("DifficultyLevel")
.IsRequired()
b.Property<byte>("DifficultyLevel")
.HasMaxLength(10)
.HasColumnType("varchar(10)")
.HasColumnType("tinyint unsigned")
.HasColumnName("difficulty_level");
b.Property<byte>("GroupState")
.HasColumnType("tinyint unsigned")
.HasColumnName("group_state");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("deleted");
b.Property<string>("QuestionText")
b.Property<Guid?>("KeyPointId")
.HasColumnType("char(36)")
.HasColumnName("key_point");
b.Property<Guid?>("LessonId")
.HasColumnType("char(36)")
.HasColumnName("lesson");
b.Property<string>("Options")
.HasColumnType("longtext")
.HasColumnName("options");
b.Property<Guid?>("ParentQuestionId")
.HasColumnType("char(36)")
.HasColumnName("parent_question_group_id");
b.Property<byte>("SubjectArea")
.HasMaxLength(100)
.HasColumnType("tinyint unsigned")
.HasColumnName("subject_area");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(65535)
.HasColumnType("longtext")
.HasColumnName("question_text");
b.Property<string>("QuestionType")
.IsRequired()
b.Property<byte>("Type")
.HasMaxLength(20)
.HasColumnType("varchar(20)")
.HasColumnType("tinyint unsigned")
.HasColumnName("question_type");
b.Property<string>("SubjectArea")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnName("subject_area");
b.Property<DateTime>("UpdatedAt")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("datetime(6)")
.HasColumnName("updated_at");
b.Property<bool>("ValidQuestion")
.HasColumnType("tinyint(1)")
.HasColumnName("valid_question");
b.HasKey("Id");
b.HasIndex("CreatedBy");
b.HasIndex("CreatorId");
b.HasIndex("KeyPointId");
b.HasIndex("LessonId");
b.HasIndex("ParentQuestionId");
b.HasIndex("Title")
.HasAnnotation("MySql:IndexPrefixLength", new[] { 20 });
b.ToTable("questions", (string)null);
});
@@ -439,7 +528,7 @@ namespace TechHelper.Server.Migrations
.HasColumnType("datetime(6)")
.HasColumnName("graded_at");
b.Property<Guid?>("GradedBy")
b.Property<Guid?>("GraderId")
.HasColumnType("char(36)")
.HasColumnName("graded_by");
@@ -459,10 +548,9 @@ namespace TechHelper.Server.Migrations
.HasColumnType("float")
.HasColumnName("overall_grade");
b.Property<string>("Status")
.IsRequired()
b.Property<int>("Status")
.HasMaxLength(15)
.HasColumnType("varchar(15)")
.HasColumnType("int")
.HasColumnName("status");
b.Property<Guid>("StudentId")
@@ -477,7 +565,7 @@ namespace TechHelper.Server.Migrations
b.HasIndex("AssignmentId");
b.HasIndex("GradedBy");
b.HasIndex("GraderId");
b.HasIndex("StudentId");
@@ -552,6 +640,30 @@ namespace TechHelper.Server.Migrations
b.ToTable("submission_details", (string)null);
});
modelBuilder.Entity("Entities.Contracts.Textbook", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<byte>("Grade")
.HasColumnType("tinyint unsigned");
b.Property<byte>("Publisher")
.HasColumnType("tinyint unsigned");
b.Property<byte>("SubjectArea")
.HasColumnType("tinyint unsigned");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("textbook");
});
modelBuilder.Entity("Entities.Contracts.User", b =>
{
b.Property<Guid>("Id")
@@ -662,19 +774,19 @@ namespace TechHelper.Server.Migrations
b.HasData(
new
{
Id = new Guid("9e526681-e57e-46b5-a01c-5731b27bfc4a"),
Id = new Guid("895d8f32-714e-4a14-bd97-8fa262b83172"),
Name = "Student",
NormalizedName = "STUDENT"
},
new
{
Id = new Guid("dfdfb884-4063-4161-84e0-9c225f4e883c"),
Id = new Guid("d182c396-c656-42da-965a-d93c17a1f74f"),
Name = "Teacher",
NormalizedName = "TEACHER"
},
new
{
Id = new Guid("02a808ba-bd16-4f90-bf2b-0bc42f767e00"),
Id = new Guid("4e65fab9-3315-4474-b92c-bdab5a617e65"),
Name = "Administrator",
NormalizedName = "ADMINISTRATOR"
});
@@ -787,7 +899,7 @@ namespace TechHelper.Server.Migrations
{
b.HasOne("Entities.Contracts.User", "Creator")
.WithMany()
.HasForeignKey("CreatedBy")
.HasForeignKey("CreatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@@ -828,27 +940,9 @@ namespace TechHelper.Server.Migrations
b.Navigation("Class");
});
modelBuilder.Entity("Entities.Contracts.AssignmentGroup", b =>
{
b.HasOne("Entities.Contracts.Assignment", "Assignment")
.WithMany("AssignmentGroups")
.HasForeignKey("AssignmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Contracts.AssignmentGroup", "ParentAssignmentGroup")
.WithMany("ChildAssignmentGroups")
.HasForeignKey("ParentGroup")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Assignment");
b.Navigation("ParentAssignmentGroup");
});
modelBuilder.Entity("Entities.Contracts.AssignmentQuestion", b =>
{
b.HasOne("Entities.Contracts.AssignmentGroup", "AssignmentGroup")
b.HasOne("Entities.Contracts.AssignmentStruct", "AssignmentGroup")
.WithMany("AssignmentQuestions")
.HasForeignKey("AssignmentGroupId")
.OnDelete(DeleteBehavior.Cascade)
@@ -865,6 +959,22 @@ namespace TechHelper.Server.Migrations
b.Navigation("Question");
});
modelBuilder.Entity("Entities.Contracts.AssignmentStruct", b =>
{
b.HasOne("Entities.Contracts.Assignment", "Assignment")
.WithOne("ExamStruct")
.HasForeignKey("Entities.Contracts.AssignmentStruct", "AssignmentId");
b.HasOne("Entities.Contracts.AssignmentStruct", "ParentGroup")
.WithMany("ChildrenGroups")
.HasForeignKey("ParentGroupId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Assignment");
b.Navigation("ParentGroup");
});
modelBuilder.Entity("Entities.Contracts.Class", b =>
{
b.HasOne("Entities.Contracts.User", "HeadTeacher")
@@ -914,15 +1024,69 @@ namespace TechHelper.Server.Migrations
b.Navigation("Teacher");
});
modelBuilder.Entity("Entities.Contracts.KeyPoint", b =>
{
b.HasOne("Entities.Contracts.Lesson", "Lesson")
.WithMany("KeyPoints")
.HasForeignKey("LessonID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lesson");
});
modelBuilder.Entity("Entities.Contracts.Lesson", b =>
{
b.HasOne("Entities.Contracts.Textbook", "Textbook")
.WithMany("Lessons")
.HasForeignKey("TextbookID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Textbook");
});
modelBuilder.Entity("Entities.Contracts.LessonQuestion", b =>
{
b.HasOne("Entities.Contracts.Lesson", "Lesson")
.WithMany("LessonQuestions")
.HasForeignKey("LessonID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lesson");
});
modelBuilder.Entity("Entities.Contracts.Question", b =>
{
b.HasOne("Entities.Contracts.User", "Creator")
.WithMany("CreatedQuestions")
.HasForeignKey("CreatedBy")
.HasForeignKey("CreatorId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Entities.Contracts.KeyPoint", "KeyPoint")
.WithMany("Questions")
.HasForeignKey("KeyPointId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Entities.Contracts.Lesson", "Lesson")
.WithMany("Questions")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Entities.Contracts.Question", "ParentQuestion")
.WithMany("ChildrenQuestion")
.HasForeignKey("ParentQuestionId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Creator");
b.Navigation("KeyPoint");
b.Navigation("Lesson");
b.Navigation("ParentQuestion");
});
modelBuilder.Entity("Entities.Contracts.Submission", b =>
@@ -935,7 +1099,7 @@ namespace TechHelper.Server.Migrations
b.HasOne("Entities.Contracts.User", "Grader")
.WithMany("GradedSubmissions")
.HasForeignKey("GradedBy")
.HasForeignKey("GraderId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Entities.Contracts.User", "Student")
@@ -959,7 +1123,7 @@ namespace TechHelper.Server.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Contracts.User", "User")
b.HasOne("Entities.Contracts.User", "Student")
.WithMany("SubmissionDetails")
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Restrict)
@@ -973,9 +1137,9 @@ namespace TechHelper.Server.Migrations
b.Navigation("AssignmentQuestion");
b.Navigation("Submission");
b.Navigation("Student");
b.Navigation("User");
b.Navigation("Submission");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
@@ -1035,23 +1199,24 @@ namespace TechHelper.Server.Migrations
b.Navigation("AssignmentClasses");
b.Navigation("AssignmentGroups");
b.Navigation("ExamStruct")
.IsRequired();
b.Navigation("Submissions");
});
modelBuilder.Entity("Entities.Contracts.AssignmentGroup", b =>
{
b.Navigation("AssignmentQuestions");
b.Navigation("ChildAssignmentGroups");
});
modelBuilder.Entity("Entities.Contracts.AssignmentQuestion", b =>
{
b.Navigation("SubmissionDetails");
});
modelBuilder.Entity("Entities.Contracts.AssignmentStruct", b =>
{
b.Navigation("AssignmentQuestions");
b.Navigation("ChildrenGroups");
});
modelBuilder.Entity("Entities.Contracts.Class", b =>
{
b.Navigation("AssignmentClasses");
@@ -1061,9 +1226,25 @@ namespace TechHelper.Server.Migrations
b.Navigation("ClassTeachers");
});
modelBuilder.Entity("Entities.Contracts.KeyPoint", b =>
{
b.Navigation("Questions");
});
modelBuilder.Entity("Entities.Contracts.Lesson", b =>
{
b.Navigation("KeyPoints");
b.Navigation("LessonQuestions");
b.Navigation("Questions");
});
modelBuilder.Entity("Entities.Contracts.Question", b =>
{
b.Navigation("AssignmentQuestions");
b.Navigation("ChildrenQuestion");
});
modelBuilder.Entity("Entities.Contracts.Submission", b =>
@@ -1071,6 +1252,11 @@ namespace TechHelper.Server.Migrations
b.Navigation("SubmissionDetails");
});
modelBuilder.Entity("Entities.Contracts.Textbook", b =>
{
b.Navigation("Lessons");
});
modelBuilder.Entity("Entities.Contracts.User", b =>
{
b.Navigation("CreatedAssignments");

View File

@@ -77,6 +77,23 @@ namespace TechHelper.Server.Migrations
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "textbook",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Grade = table.Column<byte>(type: "tinyint unsigned", nullable: false),
Title = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Publisher = table.Column<byte>(type: "tinyint unsigned", nullable: false),
SubjectArea = table.Column<byte>(type: "tinyint unsigned", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_textbook", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
@@ -207,10 +224,10 @@ namespace TechHelper.Server.Migrations
.Annotation("MySql:CharSet", "utf8mb4"),
description = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
subject_area = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
subject_area = table.Column<byte>(type: "tinyint unsigned", nullable: false),
due_date = table.Column<DateTime>(type: "datetime(6)", nullable: false),
total_points = table.Column<float>(type: "float", nullable: true),
total_points = table.Column<byte>(type: "tinyint unsigned", nullable: false),
score = table.Column<float>(type: "float", nullable: false),
created_by = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false),
updated_at = table.Column<DateTime>(type: "datetime(6)", nullable: false),
@@ -263,36 +280,25 @@ namespace TechHelper.Server.Migrations
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "questions",
name: "lesson",
columns: table => new
{
id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
question_text = table.Column<string>(type: "longtext", maxLength: 65535, nullable: false)
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Title = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
question_type = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false)
Description = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
correct_answer = table.Column<string>(type: "longtext", maxLength: 65535, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
difficulty_level = table.Column<string>(type: "varchar(10)", maxLength: 10, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
subject_area = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
created_by = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
updated_at = table.Column<DateTime>(type: "datetime(6)", rowVersion: true, nullable: false),
deleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
valid_question = table.Column<bool>(type: "tinyint(1)", nullable: false)
TextbookID = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_questions", x => x.id);
table.PrimaryKey("PK_lesson", x => x.Id);
table.ForeignKey(
name: "FK_questions_AspNetUsers_created_by",
column: x => x.created_by,
principalTable: "AspNetUsers",
name: "FK_lesson_textbook_TextbookID",
column: x => x.TextbookID,
principalTable: "textbook",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
@@ -326,16 +332,16 @@ namespace TechHelper.Server.Migrations
columns: table => new
{
id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
assignment = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
assignment = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
title = table.Column<string>(type: "longtext", maxLength: 65535, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
descript = table.Column<string>(type: "longtext", maxLength: 65535, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
layout = table.Column<byte>(type: "tinyint unsigned", nullable: false),
total_points = table.Column<float>(type: "float", nullable: true),
number = table.Column<byte>(type: "tinyint unsigned", nullable: false),
parent_group = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
deleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
valid_question_group = table.Column<bool>(type: "tinyint(1)", nullable: false)
deleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false)
},
constraints: table =>
{
@@ -350,8 +356,7 @@ namespace TechHelper.Server.Migrations
name: "FK_assignment_group_assignments_assignment",
column: x => x.assignment,
principalTable: "assignments",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
principalColumn: "id");
})
.Annotation("MySql:CharSet", "utf8mb4");
@@ -370,8 +375,7 @@ namespace TechHelper.Server.Migrations
graded_by = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
graded_at = table.Column<DateTime>(type: "datetime(6)", nullable: true),
deleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
status = table.Column<string>(type: "varchar(15)", maxLength: 15, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
status = table.Column<int>(type: "int", maxLength: 15, nullable: false)
},
constraints: table =>
{
@@ -457,8 +461,7 @@ namespace TechHelper.Server.Migrations
{
class_id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
teacher_id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
subject_taught = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
subject_taught = table.Column<byte>(type: "tinyint unsigned", nullable: false)
},
constraints: table =>
{
@@ -478,6 +481,102 @@ namespace TechHelper.Server.Migrations
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "key_point",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Key = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
LessonID = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_key_point", x => x.Id);
table.ForeignKey(
name: "FK_key_point_lesson_LessonID",
column: x => x.LessonID,
principalTable: "lesson",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "lesson_question",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Question = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
LessonID = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_lesson_question", x => x.Id);
table.ForeignKey(
name: "FK_lesson_question_lesson_LessonID",
column: x => x.LessonID,
principalTable: "lesson",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "questions",
columns: table => new
{
id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
question_text = table.Column<string>(type: "longtext", maxLength: 65535, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
correct_answer = table.Column<string>(type: "longtext", maxLength: 65535, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
question_type = table.Column<byte>(type: "tinyint unsigned", maxLength: 20, nullable: false),
difficulty_level = table.Column<byte>(type: "tinyint unsigned", maxLength: 10, nullable: false),
subject_area = table.Column<byte>(type: "tinyint unsigned", maxLength: 100, nullable: false),
group_state = table.Column<byte>(type: "tinyint unsigned", nullable: false),
options = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
key_point = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
lesson = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
parent_question_group_id = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
created_by = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
updated_at = table.Column<DateTime>(type: "datetime(6)", rowVersion: true, nullable: false),
deleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false)
},
constraints: table =>
{
table.PrimaryKey("PK_questions", x => x.id);
table.ForeignKey(
name: "FK_questions_AspNetUsers_created_by",
column: x => x.created_by,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_questions_key_point_key_point",
column: x => x.key_point,
principalTable: "key_point",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_questions_lesson_lesson",
column: x => x.lesson,
principalTable: "lesson",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_questions_questions_parent_question_group_id",
column: x => x.parent_question_group_id,
principalTable: "questions",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "assignment_questions",
columns: table => new
@@ -556,9 +655,9 @@ namespace TechHelper.Server.Migrations
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ new Guid("02a808ba-bd16-4f90-bf2b-0bc42f767e00"), null, "Administrator", "ADMINISTRATOR" },
{ new Guid("9e526681-e57e-46b5-a01c-5731b27bfc4a"), null, "Student", "STUDENT" },
{ new Guid("dfdfb884-4063-4161-84e0-9c225f4e883c"), null, "Teacher", "TEACHER" }
{ new Guid("4e65fab9-3315-4474-b92c-bdab5a617e65"), null, "Administrator", "ADMINISTRATOR" },
{ new Guid("895d8f32-714e-4a14-bd97-8fa262b83172"), null, "Student", "STUDENT" },
{ new Guid("d182c396-c656-42da-965a-d93c17a1f74f"), null, "Teacher", "TEACHER" }
});
migrationBuilder.CreateIndex(
@@ -611,7 +710,8 @@ namespace TechHelper.Server.Migrations
migrationBuilder.CreateIndex(
name: "IX_assignment_group_assignment",
table: "assignment_group",
column: "assignment");
column: "assignment",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_assignment_group_parent_group",
@@ -653,11 +753,47 @@ namespace TechHelper.Server.Migrations
table: "classes",
column: "head_teacher_id");
migrationBuilder.CreateIndex(
name: "IX_key_point_LessonID",
table: "key_point",
column: "LessonID");
migrationBuilder.CreateIndex(
name: "IX_lesson_TextbookID",
table: "lesson",
column: "TextbookID");
migrationBuilder.CreateIndex(
name: "IX_lesson_question_LessonID",
table: "lesson_question",
column: "LessonID");
migrationBuilder.CreateIndex(
name: "IX_questions_created_by",
table: "questions",
column: "created_by");
migrationBuilder.CreateIndex(
name: "IX_questions_key_point",
table: "questions",
column: "key_point");
migrationBuilder.CreateIndex(
name: "IX_questions_lesson",
table: "questions",
column: "lesson");
migrationBuilder.CreateIndex(
name: "IX_questions_parent_question_group_id",
table: "questions",
column: "parent_question_group_id");
migrationBuilder.CreateIndex(
name: "IX_questions_question_text",
table: "questions",
column: "question_text")
.Annotation("MySql:IndexPrefixLength", new[] { 20 });
migrationBuilder.CreateIndex(
name: "IX_submission_details_assignment_question_id",
table: "submission_details",
@@ -719,6 +855,9 @@ namespace TechHelper.Server.Migrations
migrationBuilder.DropTable(
name: "class_teachers");
migrationBuilder.DropTable(
name: "lesson_question");
migrationBuilder.DropTable(
name: "submission_details");
@@ -743,8 +882,17 @@ namespace TechHelper.Server.Migrations
migrationBuilder.DropTable(
name: "assignments");
migrationBuilder.DropTable(
name: "key_point");
migrationBuilder.DropTable(
name: "AspNetUsers");
migrationBuilder.DropTable(
name: "lesson");
migrationBuilder.DropTable(
name: "textbook");
}
}
}

View File

@@ -33,7 +33,7 @@ namespace TechHelper.Server.Migrations
.HasColumnType("datetime(6)")
.HasColumnName("created_at");
b.Property<Guid>("CreatedBy")
b.Property<Guid>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("created_by");
@@ -50,9 +50,12 @@ namespace TechHelper.Server.Migrations
.HasColumnType("tinyint(1)")
.HasColumnName("deleted");
b.Property<string>("SubjectArea")
.IsRequired()
.HasColumnType("longtext")
b.Property<float>("Score")
.HasColumnType("float")
.HasColumnName("score");
b.Property<byte>("SubjectArea")
.HasColumnType("tinyint unsigned")
.HasColumnName("subject_area");
b.Property<string>("Title")
@@ -61,8 +64,8 @@ namespace TechHelper.Server.Migrations
.HasColumnType("varchar(255)")
.HasColumnName("title");
b.Property<float?>("TotalPoints")
.HasColumnType("float")
b.Property<byte>("TotalQuestions")
.HasColumnType("tinyint unsigned")
.HasColumnName("total_points");
b.Property<DateTime>("UpdatedAt")
@@ -74,7 +77,7 @@ namespace TechHelper.Server.Migrations
b.HasKey("Id");
b.HasIndex("CreatedBy");
b.HasIndex("CreatorId");
b.HasIndex("UserId");
@@ -148,60 +151,6 @@ namespace TechHelper.Server.Migrations
b.ToTable("assignment_class", (string)null);
});
modelBuilder.Entity("Entities.Contracts.AssignmentGroup", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnName("id");
b.Property<Guid?>("AssignmentId")
.HasColumnType("char(36)")
.HasColumnName("assignment");
b.Property<string>("Descript")
.IsRequired()
.HasMaxLength(65535)
.HasColumnType("longtext")
.HasColumnName("descript");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("deleted");
b.Property<byte>("Number")
.HasColumnType("tinyint unsigned")
.HasColumnName("number");
b.Property<Guid?>("ParentGroup")
.HasColumnType("char(36)")
.HasColumnName("parent_group");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(65535)
.HasColumnType("longtext")
.HasColumnName("title");
b.Property<float?>("TotalPoints")
.HasColumnType("float")
.HasColumnName("total_points");
b.Property<bool>("ValidQuestionGroup")
.HasColumnType("tinyint(1)")
.HasColumnName("valid_question_group");
b.HasKey("Id");
b.HasIndex("AssignmentId");
b.HasIndex("ParentGroup");
b.ToTable("assignment_group", (string)null);
});
modelBuilder.Entity("Entities.Contracts.AssignmentQuestion", b =>
{
b.Property<Guid>("Id")
@@ -217,6 +166,10 @@ namespace TechHelper.Server.Migrations
.HasColumnType("datetime(6)")
.HasColumnName("created_at");
b.Property<byte>("Index")
.HasColumnType("tinyint unsigned")
.HasColumnName("question_number");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
@@ -227,10 +180,6 @@ namespace TechHelper.Server.Migrations
.HasColumnType("char(36)")
.HasColumnName("question_id");
b.Property<byte>("QuestionNumber")
.HasColumnType("tinyint unsigned")
.HasColumnName("question_number");
b.Property<float?>("Score")
.HasColumnType("float")
.HasColumnName("score");
@@ -244,6 +193,61 @@ namespace TechHelper.Server.Migrations
b.ToTable("assignment_questions", (string)null);
});
modelBuilder.Entity("Entities.Contracts.AssignmentStruct", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnName("id");
b.Property<Guid?>("AssignmentId")
.HasColumnType("char(36)")
.HasColumnName("assignment");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(65535)
.HasColumnType("longtext")
.HasColumnName("descript");
b.Property<byte>("Index")
.HasColumnType("tinyint unsigned")
.HasColumnName("number");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("deleted");
b.Property<byte>("Layout")
.HasColumnType("tinyint unsigned")
.HasColumnName("layout");
b.Property<Guid?>("ParentGroupId")
.HasColumnType("char(36)")
.HasColumnName("parent_group");
b.Property<float?>("Score")
.HasColumnType("float")
.HasColumnName("total_points");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(65535)
.HasColumnType("longtext")
.HasColumnName("title");
b.HasKey("Id");
b.HasIndex("AssignmentId")
.IsUnique();
b.HasIndex("ParentGroupId");
b.ToTable("assignment_group", (string)null);
});
modelBuilder.Entity("Entities.Contracts.Class", b =>
{
b.Property<Guid>("Id")
@@ -333,9 +337,8 @@ namespace TechHelper.Server.Migrations
.HasColumnType("char(36)")
.HasColumnName("teacher_id");
b.Property<string>("SubjectTaught")
.IsRequired()
.HasColumnType("longtext")
b.Property<byte>("SubjectTaught")
.HasColumnType("tinyint unsigned")
.HasColumnName("subject_taught");
b.HasKey("ClassId", "TeacherId");
@@ -345,6 +348,72 @@ namespace TechHelper.Server.Migrations
b.ToTable("class_teachers", (string)null);
});
modelBuilder.Entity("Entities.Contracts.KeyPoint", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.Property<Guid>("LessonID")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("LessonID");
b.ToTable("key_point");
});
modelBuilder.Entity("Entities.Contracts.Lesson", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("TextbookID")
.HasColumnType("char(36)");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("TextbookID");
b.ToTable("lesson");
});
modelBuilder.Entity("Entities.Contracts.LessonQuestion", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid>("LessonID")
.HasColumnType("char(36)");
b.Property<string>("Question")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("LessonID");
b.ToTable("lesson_question");
});
modelBuilder.Entity("Entities.Contracts.Question", b =>
{
b.Property<Guid>("Id")
@@ -352,8 +421,7 @@ namespace TechHelper.Server.Migrations
.HasColumnType("char(36)")
.HasColumnName("id");
b.Property<string>("CorrectAnswer")
.IsRequired()
b.Property<string>("Answer")
.HasMaxLength(65535)
.HasColumnType("longtext")
.HasColumnName("correct_answer");
@@ -365,53 +433,75 @@ namespace TechHelper.Server.Migrations
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<DateTime>("CreatedAt"));
b.Property<Guid>("CreatedBy")
b.Property<Guid>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("created_by");
b.Property<string>("DifficultyLevel")
.IsRequired()
b.Property<byte>("DifficultyLevel")
.HasMaxLength(10)
.HasColumnType("varchar(10)")
.HasColumnType("tinyint unsigned")
.HasColumnName("difficulty_level");
b.Property<byte>("GroupState")
.HasColumnType("tinyint unsigned")
.HasColumnName("group_state");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("deleted");
b.Property<string>("QuestionText")
b.Property<Guid?>("KeyPointId")
.HasColumnType("char(36)")
.HasColumnName("key_point");
b.Property<Guid?>("LessonId")
.HasColumnType("char(36)")
.HasColumnName("lesson");
b.Property<string>("Options")
.HasColumnType("longtext")
.HasColumnName("options");
b.Property<Guid?>("ParentQuestionId")
.HasColumnType("char(36)")
.HasColumnName("parent_question_group_id");
b.Property<byte>("SubjectArea")
.HasMaxLength(100)
.HasColumnType("tinyint unsigned")
.HasColumnName("subject_area");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(65535)
.HasColumnType("longtext")
.HasColumnName("question_text");
b.Property<string>("QuestionType")
.IsRequired()
b.Property<byte>("Type")
.HasMaxLength(20)
.HasColumnType("varchar(20)")
.HasColumnType("tinyint unsigned")
.HasColumnName("question_type");
b.Property<string>("SubjectArea")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnName("subject_area");
b.Property<DateTime>("UpdatedAt")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("datetime(6)")
.HasColumnName("updated_at");
b.Property<bool>("ValidQuestion")
.HasColumnType("tinyint(1)")
.HasColumnName("valid_question");
b.HasKey("Id");
b.HasIndex("CreatedBy");
b.HasIndex("CreatorId");
b.HasIndex("KeyPointId");
b.HasIndex("LessonId");
b.HasIndex("ParentQuestionId");
b.HasIndex("Title")
.HasAnnotation("MySql:IndexPrefixLength", new[] { 20 });
b.ToTable("questions", (string)null);
});
@@ -435,7 +525,7 @@ namespace TechHelper.Server.Migrations
.HasColumnType("datetime(6)")
.HasColumnName("graded_at");
b.Property<Guid?>("GradedBy")
b.Property<Guid?>("GraderId")
.HasColumnType("char(36)")
.HasColumnName("graded_by");
@@ -455,10 +545,9 @@ namespace TechHelper.Server.Migrations
.HasColumnType("float")
.HasColumnName("overall_grade");
b.Property<string>("Status")
.IsRequired()
b.Property<int>("Status")
.HasMaxLength(15)
.HasColumnType("varchar(15)")
.HasColumnType("int")
.HasColumnName("status");
b.Property<Guid>("StudentId")
@@ -473,7 +562,7 @@ namespace TechHelper.Server.Migrations
b.HasIndex("AssignmentId");
b.HasIndex("GradedBy");
b.HasIndex("GraderId");
b.HasIndex("StudentId");
@@ -548,6 +637,30 @@ namespace TechHelper.Server.Migrations
b.ToTable("submission_details", (string)null);
});
modelBuilder.Entity("Entities.Contracts.Textbook", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<byte>("Grade")
.HasColumnType("tinyint unsigned");
b.Property<byte>("Publisher")
.HasColumnType("tinyint unsigned");
b.Property<byte>("SubjectArea")
.HasColumnType("tinyint unsigned");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("textbook");
});
modelBuilder.Entity("Entities.Contracts.User", b =>
{
b.Property<Guid>("Id")
@@ -658,19 +771,19 @@ namespace TechHelper.Server.Migrations
b.HasData(
new
{
Id = new Guid("d4b41bc3-612e-49dd-aeda-6a98ea0e4e68"),
Id = new Guid("895d8f32-714e-4a14-bd97-8fa262b83172"),
Name = "Student",
NormalizedName = "STUDENT"
},
new
{
Id = new Guid("b2e087e6-ea32-46c4-aeb3-09b936cd0cf4"),
Id = new Guid("d182c396-c656-42da-965a-d93c17a1f74f"),
Name = "Teacher",
NormalizedName = "TEACHER"
},
new
{
Id = new Guid("ba33e047-8354-4f2c-b8b1-1f46441c28fc"),
Id = new Guid("4e65fab9-3315-4474-b92c-bdab5a617e65"),
Name = "Administrator",
NormalizedName = "ADMINISTRATOR"
});
@@ -783,7 +896,7 @@ namespace TechHelper.Server.Migrations
{
b.HasOne("Entities.Contracts.User", "Creator")
.WithMany()
.HasForeignKey("CreatedBy")
.HasForeignKey("CreatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@@ -824,26 +937,9 @@ namespace TechHelper.Server.Migrations
b.Navigation("Class");
});
modelBuilder.Entity("Entities.Contracts.AssignmentGroup", b =>
{
b.HasOne("Entities.Contracts.Assignment", "Assignment")
.WithMany("AssignmentGroups")
.HasForeignKey("AssignmentId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Entities.Contracts.AssignmentGroup", "ParentAssignmentGroup")
.WithMany("ChildAssignmentGroups")
.HasForeignKey("ParentGroup")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Assignment");
b.Navigation("ParentAssignmentGroup");
});
modelBuilder.Entity("Entities.Contracts.AssignmentQuestion", b =>
{
b.HasOne("Entities.Contracts.AssignmentGroup", "AssignmentGroup")
b.HasOne("Entities.Contracts.AssignmentStruct", "AssignmentGroup")
.WithMany("AssignmentQuestions")
.HasForeignKey("AssignmentGroupId")
.OnDelete(DeleteBehavior.Cascade)
@@ -860,6 +956,22 @@ namespace TechHelper.Server.Migrations
b.Navigation("Question");
});
modelBuilder.Entity("Entities.Contracts.AssignmentStruct", b =>
{
b.HasOne("Entities.Contracts.Assignment", "Assignment")
.WithOne("ExamStruct")
.HasForeignKey("Entities.Contracts.AssignmentStruct", "AssignmentId");
b.HasOne("Entities.Contracts.AssignmentStruct", "ParentGroup")
.WithMany("ChildrenGroups")
.HasForeignKey("ParentGroupId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Assignment");
b.Navigation("ParentGroup");
});
modelBuilder.Entity("Entities.Contracts.Class", b =>
{
b.HasOne("Entities.Contracts.User", "HeadTeacher")
@@ -909,15 +1021,69 @@ namespace TechHelper.Server.Migrations
b.Navigation("Teacher");
});
modelBuilder.Entity("Entities.Contracts.KeyPoint", b =>
{
b.HasOne("Entities.Contracts.Lesson", "Lesson")
.WithMany("KeyPoints")
.HasForeignKey("LessonID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lesson");
});
modelBuilder.Entity("Entities.Contracts.Lesson", b =>
{
b.HasOne("Entities.Contracts.Textbook", "Textbook")
.WithMany("Lessons")
.HasForeignKey("TextbookID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Textbook");
});
modelBuilder.Entity("Entities.Contracts.LessonQuestion", b =>
{
b.HasOne("Entities.Contracts.Lesson", "Lesson")
.WithMany("LessonQuestions")
.HasForeignKey("LessonID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lesson");
});
modelBuilder.Entity("Entities.Contracts.Question", b =>
{
b.HasOne("Entities.Contracts.User", "Creator")
.WithMany("CreatedQuestions")
.HasForeignKey("CreatedBy")
.HasForeignKey("CreatorId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Entities.Contracts.KeyPoint", "KeyPoint")
.WithMany("Questions")
.HasForeignKey("KeyPointId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Entities.Contracts.Lesson", "Lesson")
.WithMany("Questions")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Entities.Contracts.Question", "ParentQuestion")
.WithMany("ChildrenQuestion")
.HasForeignKey("ParentQuestionId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Creator");
b.Navigation("KeyPoint");
b.Navigation("Lesson");
b.Navigation("ParentQuestion");
});
modelBuilder.Entity("Entities.Contracts.Submission", b =>
@@ -930,7 +1096,7 @@ namespace TechHelper.Server.Migrations
b.HasOne("Entities.Contracts.User", "Grader")
.WithMany("GradedSubmissions")
.HasForeignKey("GradedBy")
.HasForeignKey("GraderId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Entities.Contracts.User", "Student")
@@ -954,7 +1120,7 @@ namespace TechHelper.Server.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entities.Contracts.User", "User")
b.HasOne("Entities.Contracts.User", "Student")
.WithMany("SubmissionDetails")
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Restrict)
@@ -968,9 +1134,9 @@ namespace TechHelper.Server.Migrations
b.Navigation("AssignmentQuestion");
b.Navigation("Submission");
b.Navigation("Student");
b.Navigation("User");
b.Navigation("Submission");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
@@ -1030,23 +1196,24 @@ namespace TechHelper.Server.Migrations
b.Navigation("AssignmentClasses");
b.Navigation("AssignmentGroups");
b.Navigation("ExamStruct")
.IsRequired();
b.Navigation("Submissions");
});
modelBuilder.Entity("Entities.Contracts.AssignmentGroup", b =>
{
b.Navigation("AssignmentQuestions");
b.Navigation("ChildAssignmentGroups");
});
modelBuilder.Entity("Entities.Contracts.AssignmentQuestion", b =>
{
b.Navigation("SubmissionDetails");
});
modelBuilder.Entity("Entities.Contracts.AssignmentStruct", b =>
{
b.Navigation("AssignmentQuestions");
b.Navigation("ChildrenGroups");
});
modelBuilder.Entity("Entities.Contracts.Class", b =>
{
b.Navigation("AssignmentClasses");
@@ -1056,9 +1223,25 @@ namespace TechHelper.Server.Migrations
b.Navigation("ClassTeachers");
});
modelBuilder.Entity("Entities.Contracts.KeyPoint", b =>
{
b.Navigation("Questions");
});
modelBuilder.Entity("Entities.Contracts.Lesson", b =>
{
b.Navigation("KeyPoints");
b.Navigation("LessonQuestions");
b.Navigation("Questions");
});
modelBuilder.Entity("Entities.Contracts.Question", b =>
{
b.Navigation("AssignmentQuestions");
b.Navigation("ChildrenQuestion");
});
modelBuilder.Entity("Entities.Contracts.Submission", b =>
@@ -1066,6 +1249,11 @@ namespace TechHelper.Server.Migrations
b.Navigation("SubmissionDetails");
});
modelBuilder.Entity("Entities.Contracts.Textbook", b =>
{
b.Navigation("Lessons");
});
modelBuilder.Entity("Entities.Contracts.User", b =>
{
b.Navigation("CreatedAssignments");