using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Repository.Migrations
{
    public partial class _202410141 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Accounts",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    AccountID = table.Column<string>(nullable: true),
                    ChangePassword = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Accounts", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Houses",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    DateH = table.Column<string>(nullable: true),
                    LackH = table.Column<string>(nullable: true),
                    UsedH = table.Column<string>(nullable: true),
                    TotalH = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Houses", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Informations",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    OperatorCode = table.Column<string>(nullable: true),
                    ProCode = table.Column<string>(nullable: true),
                    SpendTime = table.Column<double>(nullable: false),
                    CreateTime = table.Column<DateTime>(nullable: false),
                    ProType = table.Column<string>(nullable: true),
                    ProNo = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Informations", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "OutofWorks",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    DateOutWork = table.Column<string>(nullable: true),
                    Actual = table.Column<int>(nullable: false),
                    FallIll = table.Column<int>(nullable: false),
                    Absenteeism = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OutofWorks", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ParamLogs",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Occured = table.Column<DateTime>(nullable: false),
                    Content = table.Column<string>(nullable: true),
                    OperateAction = table.Column<int>(nullable: false),
                    OperateObject = table.Column<string>(nullable: true),
                    UserName = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ParamLogs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Persons",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    EmployeeName = table.Column<string>(nullable: true),
                    ProProcess = table.Column<string>(nullable: true),
                    WorkTime = table.Column<string>(nullable: true),
                    Yield = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Persons", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ProductResult",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Result = table.Column<double>(nullable: false),
                    Datetime = table.Column<DateTime>(nullable: false),
                    Barcode = table.Column<string>(nullable: true),
                    Juge = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductResult", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Qualitys",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    DateQuality = table.Column<string>(nullable: true),
                    Q1 = table.Column<int>(nullable: false),
                    Q2 = table.Column<int>(nullable: false),
                    Q3 = table.Column<int>(nullable: false),
                    Q4 = table.Column<int>(nullable: false),
                    Q5 = table.Column<int>(nullable: false),
                    Q6 = table.Column<int>(nullable: false),
                    Q7 = table.Column<int>(nullable: false),
                    Q8 = table.Column<int>(nullable: false),
                    Q9 = table.Column<int>(nullable: false),
                    Q10 = table.Column<int>(nullable: false),
                    Q11 = table.Column<int>(nullable: false),
                    Q12 = table.Column<int>(nullable: false),
                    Q13 = table.Column<int>(nullable: false),
                    Q14 = table.Column<int>(nullable: false),
                    Q15 = table.Column<int>(nullable: false),
                    Q16 = table.Column<int>(nullable: false),
                    Q17 = table.Column<int>(nullable: false),
                    Q18 = table.Column<int>(nullable: false),
                    Q19 = table.Column<int>(nullable: false),
                    Q20 = table.Column<int>(nullable: false),
                    Q21 = table.Column<int>(nullable: false),
                    Q22 = table.Column<int>(nullable: false),
                    Q23 = table.Column<int>(nullable: false),
                    Q24 = table.Column<int>(nullable: false),
                    Q25 = table.Column<int>(nullable: false),
                    Q26 = table.Column<int>(nullable: false),
                    Q27 = table.Column<int>(nullable: false),
                    Q28 = table.Column<int>(nullable: false),
                    Q29 = table.Column<int>(nullable: false),
                    Q30 = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Qualitys", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "SopFiles",
                columns: table => new
                {
                    ID = table.Column<Guid>(nullable: false),
                    ProductName = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SopFiles", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "StatisticsLogs",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Timestamp = table.Column<DateTime>(nullable: false),
                    TraceState = table.Column<int>(nullable: false),
                    RequstType = table.Column<int>(nullable: false),
                    RequestCode = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StatisticsLogs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "LocalFile",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    FileNum = table.Column<string>(nullable: true),
                    Edition = table.Column<string>(nullable: true),
                    Date = table.Column<string>(nullable: true),
                    Type = table.Column<string>(nullable: true),
                    People = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    Process = table.Column<string>(nullable: true),
                    WorkTime = table.Column<string>(nullable: true),
                    SopFileID = table.Column<Guid>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_LocalFile", x => x.Id);
                    table.ForeignKey(
                        name: "FK_LocalFile_SopFiles_SopFileID",
                        column: x => x.SopFileID,
                        principalTable: "SopFiles",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "LocalFile2",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Num = table.Column<string>(nullable: true),
                    MaterialNum = table.Column<string>(nullable: true),
                    MaterialName = table.Column<string>(nullable: true),
                    Count = table.Column<string>(nullable: true),
                    Unit = table.Column<string>(nullable: true),
                    SopFileID = table.Column<Guid>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_LocalFile2", x => x.Id);
                    table.ForeignKey(
                        name: "FK_LocalFile2_SopFiles_SopFileID",
                        column: x => x.SopFileID,
                        principalTable: "SopFiles",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "LocalFile3",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Equipment = table.Column<string>(nullable: true),
                    Before = table.Column<string>(nullable: true),
                    Inn = table.Column<string>(nullable: true),
                    After = table.Column<string>(nullable: true),
                    LookOut = table.Column<string>(nullable: true),
                    SopFileID = table.Column<Guid>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_LocalFile3", x => x.Id);
                    table.ForeignKey(
                        name: "FK_LocalFile3_SopFiles_SopFileID",
                        column: x => x.SopFileID,
                        principalTable: "SopFiles",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_LocalFile_SopFileID",
                table: "LocalFile",
                column: "SopFileID");

            migrationBuilder.CreateIndex(
                name: "IX_LocalFile2_SopFileID",
                table: "LocalFile2",
                column: "SopFileID");

            migrationBuilder.CreateIndex(
                name: "IX_LocalFile3_SopFileID",
                table: "LocalFile3",
                column: "SopFileID");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Accounts");

            migrationBuilder.DropTable(
                name: "Houses");

            migrationBuilder.DropTable(
                name: "Informations");

            migrationBuilder.DropTable(
                name: "LocalFile");

            migrationBuilder.DropTable(
                name: "LocalFile2");

            migrationBuilder.DropTable(
                name: "LocalFile3");

            migrationBuilder.DropTable(
                name: "OutofWorks");

            migrationBuilder.DropTable(
                name: "ParamLogs");

            migrationBuilder.DropTable(
                name: "Persons");

            migrationBuilder.DropTable(
                name: "ProductResult");

            migrationBuilder.DropTable(
                name: "Qualitys");

            migrationBuilder.DropTable(
                name: "StatisticsLogs");

            migrationBuilder.DropTable(
                name: "SopFiles");
        }
    }
}