using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace IRaCIS.Core.Infra.EFCore.Migrations
{
    /// <inheritdoc />
    public partial class defaultvalue : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
          

            migrationBuilder.AddColumn<string>(
                name: "DefaultValue",
                table: "TrialClinicalTableQuestion",
                type: "nvarchar(400)",
                maxLength: 400,
                nullable: false,
                defaultValue: "",
                comment: "默认值");

            migrationBuilder.AddColumn<string>(
                name: "DefaultValue",
                table: "TrialClinicalQuestion",
                type: "nvarchar(400)",
                maxLength: 400,
                nullable: false,
                defaultValue: "",
                comment: "默认值");

            migrationBuilder.AddColumn<string>(
                name: "DefaultValue",
                table: "SystemClinicalTableQuestion",
                type: "nvarchar(400)",
                maxLength: 400,
                nullable: false,
                defaultValue: "",
                comment: "默认值");

            migrationBuilder.AddColumn<string>(
                name: "DefaultValue",
                table: "SystemClinicalQuestion",
                type: "nvarchar(400)",
                maxLength: 400,
                nullable: false,
                defaultValue: "",
                comment: "默认值");

         
        }

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

            migrationBuilder.DropColumn(
                name: "DefaultValue",
                table: "TrialClinicalTableQuestion");

            migrationBuilder.DropColumn(
                name: "DefaultValue",
                table: "TrialClinicalQuestion");

            migrationBuilder.DropColumn(
                name: "DefaultValue",
                table: "SystemClinicalTableQuestion");

            migrationBuilder.DropColumn(
                name: "DefaultValue",
                table: "SystemClinicalQuestion");

            migrationBuilder.AlterColumn<Guid>(
                name: "TrialReadingCriterionId",
                table: "TrialEmailNoticeConfig",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true,
                oldComment: "下次版本删除");

            migrationBuilder.AlterColumn<Guid>(
                name: "QuestionId",
                table: "ReadingTaskQuestionMark",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AddColumn<int>(
                name: "CriterionTypeEnum",
                table: "EmailNoticeConfig",
                type: "int",
                nullable: true,
                comment: "标准枚举--后续废弃，这里可以选择多个标准");

            migrationBuilder.AddForeignKey(
                name: "FK_ReadingTaskQuestionMark_ReadingQuestionTrial_QuestionId",
                table: "ReadingTaskQuestionMark",
                column: "QuestionId",
                principalTable: "ReadingQuestionTrial",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
