using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace APT.Data.Migrations.Migrations
{
    public partial class wyw2026020201 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            //migrationBuilder.DropForeignKey(
            //    name: "FK_T_PF_PARAM_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARYID",
            //    table: "T_PF_PARAM");

            //migrationBuilder.DropForeignKey(
            //    name: "FK_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_T_FM_ORGANIZATION_Nav_OrgID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            //migrationBuilder.DropForeignKey(
            //    name: "FK_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_T_SE_COURSEWEARLIBRARY_Nav_CourID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            //migrationBuilder.DropForeignKey(
            //    name: "FK_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_T_SE_TRAIN_NOTIFY_Nav_NotifyID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            //migrationBuilder.DropIndex(
            //    name: "IX_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_Nav_CourID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            //migrationBuilder.DropIndex(
            //    name: "IX_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_Nav_NotifyID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            //migrationBuilder.DropIndex(
            //    name: "IX_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_Nav_OrgID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            //migrationBuilder.DropIndex(
            //    name: "IX_T_PF_PARAM_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARYID",
            //    table: "T_PF_PARAM");

            //migrationBuilder.DropColumn(
            //    name: "DbConn",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            //migrationBuilder.DropColumn(
            //    name: "Nav_CourID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            //migrationBuilder.DropColumn(
            //    name: "Nav_NotifyID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            //migrationBuilder.DropColumn(
            //    name: "Nav_OrgID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            //migrationBuilder.DropColumn(
            //    name: "TaskID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            migrationBuilder.DropColumn(
                name: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARYID",
                table: "T_PF_PARAM");

            migrationBuilder.AddColumn<Guid>(
                name: "EDU_CARD_ID",
                table: "T_SE_TRAIN_RECORD_PAPER",
                type: "uniqueidentifier",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "FILE_PATH",
                table: "T_SE_TRAIN_RECORD_PAPER",
                type: "nvarchar(200)",
                maxLength: 200,
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "TEXT_ID",
                table: "T_SE_TRAIN_RECORD_PAPER",
                type: "uniqueidentifier",
                nullable: true);

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

            migrationBuilder.CreateTable(
                name: "T_SE_TRAIN_RECORD_TEXT",
                columns: table => new
                {
                    ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    RECORD_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    USER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SCORE = table.Column<int>(type: "int", nullable: true),
                    TEXT_TIMES = table.Column<int>(type: "int", nullable: false),
                    ISPASS = table.Column<bool>(type: "bit", nullable: true),
                    IS_DELETED = table.Column<bool>(type: "bit", nullable: false),
                    ORG_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ENTITY_ORG_TPYE = table.Column<int>(type: "int", nullable: false),
                    FORM_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    FLOW_STATUS = table.Column<int>(type: "int", nullable: false),
                    FLOW_SEND_STATUS = table.Column<int>(type: "int", nullable: false),
                    FLOW_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    CREATE_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
                    MODIFY_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
                    CREATER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    MODIFIER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_SE_TRAIN_RECORD_TEXT", x => x.ID);
                    table.ForeignKey(
                        name: "FK_T_SE_TRAIN_RECORD_TEXT_T_FM_ORGANIZATION_ORG_ID",
                        column: x => x.ORG_ID,
                        principalTable: "T_FM_ORGANIZATION",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_T_SE_TRAIN_RECORD_TEXT_T_FM_USER_USER_ID",
                        column: x => x.USER_ID,
                        principalTable: "T_FM_USER",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_T_SE_TRAIN_RECORD_TEXT_T_SE_TRAIN_RECORD_RECORD_ID",
                        column: x => x.RECORD_ID,
                        principalTable: "T_SE_TRAIN_RECORD",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_T_SE_TRAIN_RECORD_PAPER_TEXT_ID",
                table: "T_SE_TRAIN_RECORD_PAPER",
                column: "TEXT_ID");

            //migrationBuilder.CreateIndex(
            //    name: "IX_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_COURSEWEARLIBRARY_ID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    column: "COURSEWEARLIBRARY_ID");

            //migrationBuilder.CreateIndex(
            //    name: "IX_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_NOTIFY_ID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    column: "NOTIFY_ID");

            migrationBuilder.CreateIndex(
                name: "IX_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_ORG_ID",
                table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
                column: "ORG_ID");

            migrationBuilder.CreateIndex(
                name: "IX_T_SE_TRAIN_RECORD_TEXT_ORG_ID",
                table: "T_SE_TRAIN_RECORD_TEXT",
                column: "ORG_ID");

            migrationBuilder.CreateIndex(
                name: "IX_T_SE_TRAIN_RECORD_TEXT_RECORD_ID",
                table: "T_SE_TRAIN_RECORD_TEXT",
                column: "RECORD_ID");

            migrationBuilder.CreateIndex(
                name: "IX_T_SE_TRAIN_RECORD_TEXT_USER_ID",
                table: "T_SE_TRAIN_RECORD_TEXT",
                column: "USER_ID");

            //migrationBuilder.AddForeignKey(
            //    name: "FK_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_T_FM_ORGANIZATION_ORG_ID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    column: "ORG_ID",
            //    principalTable: "T_FM_ORGANIZATION",
            //    principalColumn: "ID",
            //    onDelete: ReferentialAction.Restrict);

            //migrationBuilder.AddForeignKey(
            //    name: "FK_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_T_SE_COURSEWEARLIBRARY_COURSEWEARLIBRARY_ID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    column: "COURSEWEARLIBRARY_ID",
            //    principalTable: "T_SE_COURSEWEARLIBRARY",
            //    principalColumn: "ID",
            //    onDelete: ReferentialAction.Restrict);

            //migrationBuilder.AddForeignKey(
            //    name: "FK_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_T_SE_TRAIN_NOTIFY_NOTIFY_ID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    column: "NOTIFY_ID",
            //    principalTable: "T_SE_TRAIN_NOTIFY",
            //    principalColumn: "ID",
            //    onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_T_SE_TRAIN_RECORD_PAPER_T_SE_TRAIN_RECORD_TEXT_TEXT_ID",
                table: "T_SE_TRAIN_RECORD_PAPER",
                column: "TEXT_ID",
                principalTable: "T_SE_TRAIN_RECORD_TEXT",
                principalColumn: "ID",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            //migrationBuilder.DropForeignKey(
            //    name: "FK_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_T_FM_ORGANIZATION_ORG_ID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            //migrationBuilder.DropForeignKey(
            //    name: "FK_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_T_SE_COURSEWEARLIBRARY_COURSEWEARLIBRARY_ID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            //migrationBuilder.DropForeignKey(
            //    name: "FK_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_T_SE_TRAIN_NOTIFY_NOTIFY_ID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            migrationBuilder.DropForeignKey(
                name: "FK_T_SE_TRAIN_RECORD_PAPER_T_SE_TRAIN_RECORD_TEXT_TEXT_ID",
                table: "T_SE_TRAIN_RECORD_PAPER");

            migrationBuilder.DropTable(
                name: "T_SE_TRAIN_RECORD_TEXT");

            migrationBuilder.DropIndex(
                name: "IX_T_SE_TRAIN_RECORD_PAPER_TEXT_ID",
                table: "T_SE_TRAIN_RECORD_PAPER");

            //migrationBuilder.DropIndex(
            //    name: "IX_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_COURSEWEARLIBRARY_ID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            //migrationBuilder.DropIndex(
            //    name: "IX_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_NOTIFY_ID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            //migrationBuilder.DropIndex(
            //    name: "IX_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_ORG_ID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY");

            migrationBuilder.DropColumn(
                name: "EDU_CARD_ID",
                table: "T_SE_TRAIN_RECORD_PAPER");

            migrationBuilder.DropColumn(
                name: "FILE_PATH",
                table: "T_SE_TRAIN_RECORD_PAPER");

            migrationBuilder.DropColumn(
                name: "TEXT_ID",
                table: "T_SE_TRAIN_RECORD_PAPER");

            //migrationBuilder.AlterColumn<Guid>(
            //    name: "ORG_ID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    type: "uniqueidentifier",
            //    nullable: true,
            //    oldClrType: typeof(Guid),
            //    oldType: "uniqueidentifier");

            //migrationBuilder.AddColumn<string>(
            //    name: "DbConn",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    type: "nvarchar(max)",
            //    nullable: true);

            //migrationBuilder.AddColumn<Guid>(
            //    name: "Nav_CourID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    type: "uniqueidentifier",
            //    nullable: true);

            //migrationBuilder.AddColumn<Guid>(
            //    name: "Nav_NotifyID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    type: "uniqueidentifier",
            //    nullable: true);

            //migrationBuilder.AddColumn<Guid>(
            //    name: "Nav_OrgID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    type: "uniqueidentifier",
            //    nullable: true);

            //migrationBuilder.AddColumn<Guid>(
            //    name: "TaskID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    type: "uniqueidentifier",
            //    nullable: false,
            //    defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            //migrationBuilder.AddColumn<Guid>(
            //    name: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARYID",
            //    table: "T_PF_PARAM",
            //    type: "uniqueidentifier",
            //    nullable: true);

            //migrationBuilder.CreateIndex(
            //    name: "IX_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_Nav_CourID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    column: "Nav_CourID");

            //migrationBuilder.CreateIndex(
            //    name: "IX_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_Nav_NotifyID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    column: "Nav_NotifyID");

            //migrationBuilder.CreateIndex(
            //    name: "IX_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_Nav_OrgID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    column: "Nav_OrgID");

            //migrationBuilder.CreateIndex(
            //    name: "IX_T_PF_PARAM_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARYID",
            //    table: "T_PF_PARAM",
            //    column: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARYID");

            //migrationBuilder.AddForeignKey(
            //    name: "FK_T_PF_PARAM_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARYID",
            //    table: "T_PF_PARAM",
            //    column: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARYID",
            //    principalTable: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    principalColumn: "ID",
            //    onDelete: ReferentialAction.Restrict);

            //migrationBuilder.AddForeignKey(
            //    name: "FK_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_T_FM_ORGANIZATION_Nav_OrgID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    column: "Nav_OrgID",
            //    principalTable: "T_FM_ORGANIZATION",
            //    principalColumn: "ID",
            //    onDelete: ReferentialAction.Restrict);

            //migrationBuilder.AddForeignKey(
            //    name: "FK_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_T_SE_COURSEWEARLIBRARY_Nav_CourID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    column: "Nav_CourID",
            //    principalTable: "T_SE_COURSEWEARLIBRARY",
            //    principalColumn: "ID",
            //    onDelete: ReferentialAction.Restrict);

            //migrationBuilder.AddForeignKey(
            //    name: "FK_T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY_T_SE_TRAIN_NOTIFY_Nav_NotifyID",
            //    table: "T_SE_TRAIN_NOTIFY_COURSEWEARLIBRARY",
            //    column: "Nav_NotifyID",
            //    principalTable: "T_SE_TRAIN_NOTIFY",
            //    principalColumn: "ID",
            //    onDelete: ReferentialAction.Restrict);
        }
    }
}
