using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional namespace TechHelper.Server.Migrations { /// public partial class init : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterDatabase() .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "AspNetRoles", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Name = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), NormalizedName = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ConcurrencyStamp = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { table.PrimaryKey("PK_AspNetRoles", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "AspNetUsers", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), RefreshToken = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), RefreshTokenExpiryTime = table.Column(type: "datetime(6)", nullable: true), Address = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), DisplayName = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), deleted = table.Column(type: "tinyint(1)", nullable: false), UserName = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), NormalizedUserName = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Email = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), NormalizedEmail = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), EmailConfirmed = table.Column(type: "tinyint(1)", nullable: false), PasswordHash = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), SecurityStamp = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ConcurrencyStamp = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), PhoneNumber = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), PhoneNumberConfirmed = table.Column(type: "tinyint(1)", nullable: false), TwoFactorEnabled = table.Column(type: "tinyint(1)", nullable: false), LockoutEnd = table.Column(type: "datetime(6)", nullable: true), LockoutEnabled = table.Column(type: "tinyint(1)", nullable: false), AccessFailedCount = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AspNetUsers", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "QuestionContexts", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Description = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { table.PrimaryKey("PK_QuestionContexts", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "textbook", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Grade = table.Column(type: "tinyint unsigned", nullable: false), Title = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Publisher = table.Column(type: "tinyint unsigned", nullable: false), SubjectArea = table.Column(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 { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), RoleId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), ClaimType = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ClaimValue = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); table.ForeignKey( name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", column: x => x.RoleId, principalTable: "AspNetRoles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "AspNetUserClaims", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), UserId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), ClaimType = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), ClaimValue = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); table.ForeignKey( name: "FK_AspNetUserClaims_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "AspNetUserLogins", columns: table => new { LoginProvider = table.Column(type: "varchar(255)", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ProviderKey = table.Column(type: "varchar(255)", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ProviderDisplayName = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), UserId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); table.ForeignKey( name: "FK_AspNetUserLogins_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "AspNetUserRoles", columns: table => new { UserId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), RoleId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); table.ForeignKey( name: "FK_AspNetUserRoles_AspNetRoles_RoleId", column: x => x.RoleId, principalTable: "AspNetRoles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_AspNetUserRoles_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "AspNetUserTokens", columns: table => new { UserId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), LoginProvider = table.Column(type: "varchar(255)", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Name = table.Column(type: "varchar(255)", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Value = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); table.ForeignKey( name: "FK_AspNetUserTokens_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "classes", columns: table => new { id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), grade = table.Column(type: "tinyint unsigned", nullable: false), @class = table.Column(name: "class", type: "tinyint unsigned", nullable: false), description = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), head_teacher_id = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), created_at = table.Column(type: "datetime(6)", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), updated_at = table.Column(type: "datetime(6)", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn), deleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false) }, constraints: table => { table.PrimaryKey("PK_classes", x => x.id); table.ForeignKey( name: "FK_classes_AspNetUsers_head_teacher_id", column: x => x.head_teacher_id, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "lesson", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Title = table.Column(type: "varchar(255)", maxLength: 255, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Description = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), TextbookID = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_lesson", x => x.Id); table.ForeignKey( name: "FK_lesson_textbook_TextbookID", column: x => x.TextbookID, principalTable: "textbook", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "class_student", columns: table => new { class_id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), student_id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), enrollment_date = table.Column(type: "datetime(6)", nullable: false), deleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false) }, constraints: table => { table.PrimaryKey("PK_class_student", x => new { x.class_id, x.student_id }); table.ForeignKey( name: "FK_class_student_AspNetUsers_student_id", column: x => x.student_id, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_class_student_classes_class_id", column: x => x.class_id, principalTable: "classes", principalColumn: "id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "class_teachers", columns: table => new { class_id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), teacher_id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), subject_taught = table.Column(type: "tinyint unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_class_teachers", x => new { x.class_id, x.teacher_id }); table.ForeignKey( name: "FK_class_teachers_AspNetUsers_teacher_id", column: x => x.teacher_id, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_class_teachers_classes_class_id", column: x => x.class_id, principalTable: "classes", principalColumn: "id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "key_point", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Key = table.Column(type: "varchar(255)", maxLength: 255, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), LessonID = table.Column(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(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Question = table.Column(type: "longtext", maxLength: 65535, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), LessonID = table.Column(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(type: "char(36)", nullable: false, collation: "ascii_general_ci"), question_text = table.Column(type: "longtext", maxLength: 65535, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), correct_answer = table.Column(type: "longtext", maxLength: 65535, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), question_type = table.Column(type: "tinyint unsigned", maxLength: 20, nullable: false), difficulty_level = table.Column(type: "tinyint unsigned", maxLength: 10, nullable: false), subject_area = table.Column(type: "tinyint unsigned", maxLength: 100, nullable: false), options = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), key_point = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), lesson = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), created_by = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), created_at = table.Column(type: "datetime(6)", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), updated_at = table.Column(type: "datetime(6)", rowVersion: true, nullable: false), deleted = table.Column(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); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "assignment_questions", columns: table => new { id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), question_id = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), title = table.Column(type: "varchar(1024)", maxLength: 1024, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), description = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), question_number = table.Column(type: "tinyint unsigned", nullable: false), parent_question_group_id = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), group_state = table.Column(type: "tinyint unsigned", nullable: false), created_at = table.Column(type: "datetime(6)", nullable: false), score = table.Column(type: "float", nullable: true), deleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false) }, constraints: table => { table.PrimaryKey("PK_assignment_questions", x => x.id); table.ForeignKey( name: "FK_assignment_questions_QuestionContexts_description", column: x => x.description, principalTable: "QuestionContexts", principalColumn: "Id", onDelete: ReferentialAction.SetNull); table.ForeignKey( name: "FK_assignment_questions_assignment_questions_parent_question_gr~", column: x => x.parent_question_group_id, principalTable: "assignment_questions", principalColumn: "id"); table.ForeignKey( name: "FK_assignment_questions_questions_question_id", column: x => x.question_id, principalTable: "questions", principalColumn: "id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "assignments", columns: table => new { id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), title = table.Column(type: "varchar(255)", maxLength: 255, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), description = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), subject_area = table.Column(type: "tinyint unsigned", nullable: false), exam_struct_id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), due_date = table.Column(type: "datetime(6)", nullable: false), total_points = table.Column(type: "tinyint unsigned", nullable: false), score = table.Column(type: "float", nullable: false), created_by = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), created_at = table.Column(type: "datetime(6)", nullable: false), updated_at = table.Column(type: "datetime(6)", nullable: false), deleted = table.Column(type: "tinyint(1)", nullable: false), UserId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_assignments", x => x.id); table.ForeignKey( name: "FK_assignments_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id"); table.ForeignKey( name: "FK_assignments_AspNetUsers_created_by", column: x => x.created_by, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_assignments_assignment_questions_exam_struct_id", column: x => x.exam_struct_id, principalTable: "assignment_questions", principalColumn: "id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "assignment_attachments", columns: table => new { id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), assignment_id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), file_path = table.Column(type: "varchar(255)", maxLength: 255, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), file_name = table.Column(type: "varchar(255)", maxLength: 255, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), uploaded_at = table.Column(type: "datetime(6)", nullable: false), deleted = table.Column(type: "tinyint(1)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_assignment_attachments", x => x.id); table.ForeignKey( name: "FK_assignment_attachments_assignments_assignment_id", column: x => x.assignment_id, principalTable: "assignments", principalColumn: "id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "assignment_class", columns: table => new { assignment_id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), class_id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), assigned_at = table.Column(type: "datetime(6)", nullable: false), deleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false) }, constraints: table => { table.PrimaryKey("PK_assignment_class", x => new { x.assignment_id, x.class_id }); table.ForeignKey( name: "FK_assignment_class_assignments_assignment_id", column: x => x.assignment_id, principalTable: "assignments", principalColumn: "id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_assignment_class_classes_class_id", column: x => x.class_id, principalTable: "classes", principalColumn: "id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "submissions", columns: table => new { id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), assignment_id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), student_id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), attempt_number = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), submission_time = table.Column(type: "datetime(6)", nullable: false), overall_grade = table.Column(type: "float", precision: 5, scale: 2, nullable: true), overall_feedback = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), graded_by = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), graded_at = table.Column(type: "datetime(6)", nullable: true), deleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), status = table.Column(type: "int", maxLength: 15, nullable: false) }, constraints: table => { table.PrimaryKey("PK_submissions", x => x.id); table.ForeignKey( name: "FK_submissions_AspNetUsers_graded_by", column: x => x.graded_by, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.SetNull); table.ForeignKey( name: "FK_submissions_AspNetUsers_student_id", column: x => x.student_id, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_submissions_assignments_assignment_id", column: x => x.assignment_id, principalTable: "assignments", principalColumn: "id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "submission_details", columns: table => new { id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), submission_id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), student_id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), assignment_question_id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), student_answer = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), is_correct = table.Column(type: "tinyint(1)", nullable: true), points_awarded = table.Column(type: "float", precision: 5, scale: 2, nullable: true), teacher_feedback = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), created_at = table.Column(type: "datetime(6)", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), updated_at = table.Column(type: "datetime(6)", rowVersion: true, nullable: false), deleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false) }, constraints: table => { table.PrimaryKey("PK_submission_details", x => x.id); table.ForeignKey( name: "FK_submission_details_AspNetUsers_student_id", column: x => x.student_id, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_submission_details_assignment_questions_assignment_question_~", column: x => x.assignment_question_id, principalTable: "assignment_questions", principalColumn: "id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_submission_details_submissions_submission_id", column: x => x.submission_id, principalTable: "submissions", principalColumn: "id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.InsertData( table: "AspNetRoles", columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" }, values: new object[,] { { new Guid("6163bf44-8dc7-4ad4-8d4c-c4452123949e"), null, "Student", "STUDENT" }, { new Guid("90caaab6-bfc7-4b70-891a-4c6f327e29d8"), null, "Teacher", "TEACHER" }, { new Guid("bf88293a-32d6-4d73-bc83-fe763c143024"), null, "Administrator", "ADMINISTRATOR" } }); migrationBuilder.CreateIndex( name: "IX_AspNetRoleClaims_RoleId", table: "AspNetRoleClaims", column: "RoleId"); migrationBuilder.CreateIndex( name: "RoleNameIndex", table: "AspNetRoles", column: "NormalizedName", unique: true); migrationBuilder.CreateIndex( name: "IX_AspNetUserClaims_UserId", table: "AspNetUserClaims", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_AspNetUserLogins_UserId", table: "AspNetUserLogins", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_AspNetUserRoles_RoleId", table: "AspNetUserRoles", column: "RoleId"); migrationBuilder.CreateIndex( name: "EmailIndex", table: "AspNetUsers", column: "NormalizedEmail"); migrationBuilder.CreateIndex( name: "UserNameIndex", table: "AspNetUsers", column: "NormalizedUserName", unique: true); migrationBuilder.CreateIndex( name: "IX_assignment_attachments_assignment_id", table: "assignment_attachments", column: "assignment_id"); migrationBuilder.CreateIndex( name: "IX_assignment_class_class_id", table: "assignment_class", column: "class_id"); migrationBuilder.CreateIndex( name: "IX_assignment_questions_description", table: "assignment_questions", column: "description"); migrationBuilder.CreateIndex( name: "IX_assignment_questions_parent_question_group_id", table: "assignment_questions", column: "parent_question_group_id"); migrationBuilder.CreateIndex( name: "IX_assignment_questions_question_id", table: "assignment_questions", column: "question_id"); migrationBuilder.CreateIndex( name: "IX_assignments_created_by", table: "assignments", column: "created_by"); migrationBuilder.CreateIndex( name: "IX_assignments_exam_struct_id", table: "assignments", column: "exam_struct_id", unique: true); migrationBuilder.CreateIndex( name: "IX_assignments_UserId", table: "assignments", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_class_student_student_id", table: "class_student", column: "student_id"); migrationBuilder.CreateIndex( name: "IX_class_teachers_teacher_id", table: "class_teachers", column: "teacher_id"); migrationBuilder.CreateIndex( name: "IX_classes_head_teacher_id", 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_question_text", table: "questions", column: "question_text") .Annotation("MySql:IndexPrefixLength", new[] { 20 }); migrationBuilder.CreateIndex( name: "IX_submission_details_assignment_question_id", table: "submission_details", column: "assignment_question_id"); migrationBuilder.CreateIndex( name: "IX_submission_details_student_id", table: "submission_details", column: "student_id"); migrationBuilder.CreateIndex( name: "IX_submission_details_submission_id", table: "submission_details", column: "submission_id"); migrationBuilder.CreateIndex( name: "IX_submissions_assignment_id", table: "submissions", column: "assignment_id"); migrationBuilder.CreateIndex( name: "IX_submissions_graded_by", table: "submissions", column: "graded_by"); migrationBuilder.CreateIndex( name: "IX_submissions_student_id", table: "submissions", column: "student_id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AspNetRoleClaims"); migrationBuilder.DropTable( name: "AspNetUserClaims"); migrationBuilder.DropTable( name: "AspNetUserLogins"); migrationBuilder.DropTable( name: "AspNetUserRoles"); migrationBuilder.DropTable( name: "AspNetUserTokens"); migrationBuilder.DropTable( name: "assignment_attachments"); migrationBuilder.DropTable( name: "assignment_class"); migrationBuilder.DropTable( name: "class_student"); migrationBuilder.DropTable( name: "class_teachers"); migrationBuilder.DropTable( name: "lesson_question"); migrationBuilder.DropTable( name: "submission_details"); migrationBuilder.DropTable( name: "AspNetRoles"); migrationBuilder.DropTable( name: "classes"); migrationBuilder.DropTable( name: "submissions"); migrationBuilder.DropTable( name: "assignments"); migrationBuilder.DropTable( name: "assignment_questions"); migrationBuilder.DropTable( name: "QuestionContexts"); migrationBuilder.DropTable( name: "questions"); migrationBuilder.DropTable( name: "AspNetUsers"); migrationBuilder.DropTable( name: "key_point"); migrationBuilder.DropTable( name: "lesson"); migrationBuilder.DropTable( name: "textbook"); } } }