using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace IRaCIS.Core.Infra.EFCore.Migrations
{
    /// <inheritdoc />
    public partial class qcSecond : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<DateTime>(
                name: "SecondReviewTime",
                table: "TrialQCQuestionAnswer",
                type: "datetime2",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "SecondReviewState",
                table: "SubjectVisit",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateIndex(
                name: "IX_TrialQCQuestionAnswer_SubjectVisitId",
                table: "TrialQCQuestionAnswer",
                column: "SubjectVisitId");

            migrationBuilder.AddForeignKey(
                name: "FK_TrialQCQuestionAnswer_SubjectVisit_SubjectVisitId",
                table: "TrialQCQuestionAnswer",
                column: "SubjectVisitId",
                principalTable: "SubjectVisit",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

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

            migrationBuilder.DropIndex(
                name: "IX_TrialQCQuestionAnswer_SubjectVisitId",
                table: "TrialQCQuestionAnswer");

            migrationBuilder.DropColumn(
                name: "SecondReviewTime",
                table: "TrialQCQuestionAnswer");

            migrationBuilder.DropColumn(
                name: "SecondReviewState",
                table: "SubjectVisit");
        }
    }
}
