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 upd : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_assignment_questions_assignment_questions_parent_question_gr~",
                table: "assignment_questions");

            migrationBuilder.DropForeignKey(
                name: "FK_submission_details_AspNetUsers_student_id",
                table: "submission_details");

            migrationBuilder.DropForeignKey(
                name: "FK_submissions_AspNetUsers_student_id",
                table: "submissions");

            migrationBuilder.DeleteData(
                table: "AspNetRoles",
                keyColumn: "Id",
                keyValue: new Guid("3cfe35e8-73d5-4170-9856-f1d078554822"));

            migrationBuilder.DeleteData(
                table: "AspNetRoles",
                keyColumn: "Id",
                keyValue: new Guid("754c4967-6af2-4a81-b970-1e90a3a269b3"));

            migrationBuilder.DeleteData(
                table: "AspNetRoles",
                keyColumn: "Id",
                keyValue: new Guid("8546457c-185c-4b79-bece-bc21e41d02e7"));

            migrationBuilder.AddColumn<string>(
                name: "sequence",
                table: "assignment_questions",
                type: "longtext",
                nullable: false)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.InsertData(
                table: "AspNetRoles",
                columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
                values: new object[,]
                {
                    { new Guid("5f0c1b3c-ad05-4ca9-b9fd-a359cb518236"), null, "Teacher", "TEACHER" },
                    { new Guid("a81f5de2-9691-45fa-8d31-ae4ffeb34453"), null, "Administrator", "ADMINISTRATOR" },
                    { new Guid("c310acf7-9605-4c55-8b9f-9bf9cd2dadb9"), null, "Student", "STUDENT" }
                });

            migrationBuilder.AddForeignKey(
                name: "FK_assignment_questions_assignment_questions_parent_question_gr~",
                table: "assignment_questions",
                column: "parent_question_group_id",
                principalTable: "assignment_questions",
                principalColumn: "id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_submission_details_AspNetUsers_student_id",
                table: "submission_details",
                column: "student_id",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_submissions_AspNetUsers_student_id",
                table: "submissions",
                column: "student_id",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_assignment_questions_assignment_questions_parent_question_gr~",
                table: "assignment_questions");

            migrationBuilder.DropForeignKey(
                name: "FK_submission_details_AspNetUsers_student_id",
                table: "submission_details");

            migrationBuilder.DropForeignKey(
                name: "FK_submissions_AspNetUsers_student_id",
                table: "submissions");

            migrationBuilder.DeleteData(
                table: "AspNetRoles",
                keyColumn: "Id",
                keyValue: new Guid("5f0c1b3c-ad05-4ca9-b9fd-a359cb518236"));

            migrationBuilder.DeleteData(
                table: "AspNetRoles",
                keyColumn: "Id",
                keyValue: new Guid("a81f5de2-9691-45fa-8d31-ae4ffeb34453"));

            migrationBuilder.DeleteData(
                table: "AspNetRoles",
                keyColumn: "Id",
                keyValue: new Guid("c310acf7-9605-4c55-8b9f-9bf9cd2dadb9"));

            migrationBuilder.DropColumn(
                name: "sequence",
                table: "assignment_questions");

            migrationBuilder.InsertData(
                table: "AspNetRoles",
                columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
                values: new object[,]
                {
                    { new Guid("3cfe35e8-73d5-4170-9856-f1d078554822"), null, "Student", "STUDENT" },
                    { new Guid("754c4967-6af2-4a81-b970-1e90a3a269b3"), null, "Teacher", "TEACHER" },
                    { new Guid("8546457c-185c-4b79-bece-bc21e41d02e7"), null, "Administrator", "ADMINISTRATOR" }
                });

            migrationBuilder.AddForeignKey(
                name: "FK_assignment_questions_assignment_questions_parent_question_gr~",
                table: "assignment_questions",
                column: "parent_question_group_id",
                principalTable: "assignment_questions",
                principalColumn: "id");

            migrationBuilder.AddForeignKey(
                name: "FK_submission_details_AspNetUsers_student_id",
                table: "submission_details",
                column: "student_id",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_submissions_AspNetUsers_student_id",
                table: "submissions",
                column: "student_id",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
    }
}
