using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

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

            migrationBuilder.AddColumn<Guid>(
                name: "ExperimentRequiredCampusId",
                table: "TeachingTaskScheduleConstraints",
                type: "char(36)",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_TeachingTaskScheduleConstraints_ExperimentRequiredBuildingId",
                table: "TeachingTaskScheduleConstraints",
                column: "ExperimentRequiredBuildingId");

            migrationBuilder.CreateIndex(
                name: "IX_TeachingTaskScheduleConstraints_ExperimentRequiredCampusId",
                table: "TeachingTaskScheduleConstraints",
                column: "ExperimentRequiredCampusId");

            migrationBuilder.AddForeignKey(
                name: "FK_TeachingTaskScheduleConstraints_Buildings_ExperimentRequired~",
                table: "TeachingTaskScheduleConstraints",
                column: "ExperimentRequiredBuildingId",
                principalTable: "Buildings",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TeachingTaskScheduleConstraints_Campuses_ExperimentRequiredC~",
                table: "TeachingTaskScheduleConstraints",
                column: "ExperimentRequiredCampusId",
                principalTable: "Campuses",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

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

            migrationBuilder.DropForeignKey(
                name: "FK_TeachingTaskScheduleConstraints_Campuses_ExperimentRequiredC~",
                table: "TeachingTaskScheduleConstraints");

            migrationBuilder.DropIndex(
                name: "IX_TeachingTaskScheduleConstraints_ExperimentRequiredBuildingId",
                table: "TeachingTaskScheduleConstraints");

            migrationBuilder.DropIndex(
                name: "IX_TeachingTaskScheduleConstraints_ExperimentRequiredCampusId",
                table: "TeachingTaskScheduleConstraints");

            migrationBuilder.DropColumn(
                name: "ExperimentRequiredBuildingId",
                table: "TeachingTaskScheduleConstraints");

            migrationBuilder.DropColumn(
                name: "ExperimentRequiredCampusId",
                table: "TeachingTaskScheduleConstraints");
        }
    }
}
