using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Jiaowu.Api.Infrastructure.Persistence.Migrations.MySql
{
    /// <inheritdoc />
    public partial class ClassCounselorAssignment : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "CounselorUserId",
                table: "AdministrativeClasses",
                type: "char(36)",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_AdministrativeClasses_CounselorUserId",
                table: "AdministrativeClasses",
                column: "CounselorUserId");

            migrationBuilder.AddForeignKey(
                name: "FK_AdministrativeClasses_AspNetUsers_CounselorUserId",
                table: "AdministrativeClasses",
                column: "CounselorUserId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.SetNull);
        }

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

            migrationBuilder.DropIndex(
                name: "IX_AdministrativeClasses_CounselorUserId",
                table: "AdministrativeClasses");

            migrationBuilder.DropColumn(
                name: "CounselorUserId",
                table: "AdministrativeClasses");
        }
    }
}
