using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace IRaCIS.Core.Infra.EFCore.Migrations
{
    /// <inheritdoc />
    public partial class DownloadAddTrialSiteCode : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "TrialSiteCode",
                table: "TrialImageDownload",
                type: "nvarchar(400)",
                maxLength: 400,
                nullable: false,
                defaultValue: "",
                comment: "一致性分析的就显示一致性分析的中心");

            migrationBuilder.CreateIndex(
                name: "IX_TrialImageDownload_SubjectId",
                table: "TrialImageDownload",
                column: "SubjectId");

            migrationBuilder.AddForeignKey(
                name: "FK_TrialImageDownload_Subject_SubjectId",
                table: "TrialImageDownload",
                column: "SubjectId",
                principalTable: "Subject",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

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

            migrationBuilder.DropIndex(
                name: "IX_TrialImageDownload_SubjectId",
                table: "TrialImageDownload");

            migrationBuilder.DropColumn(
                name: "TrialSiteCode",
                table: "TrialImageDownload");
        }
    }
}
