using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional

namespace PARR.DAL.Migrations
{
    /// <inheritdoc />
    public partial class RnmPrevTblsV1 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_ApplicationTypes_ApplicationTypes_ApplicationTypeId",
                table: "ApplicationTypes");

            migrationBuilder.DropTable(
                name: "ApplicationsInHosts");

            migrationBuilder.DropTable(
                name: "JobJournals");

            migrationBuilder.DropTable(
                name: "Hosts");

            migrationBuilder.DropTable(
                name: "JobStatuses");

            migrationBuilder.DropTable(
                name: "Jobs");

            migrationBuilder.DropTable(
                name: "Applications");

            migrationBuilder.DropTable(
                name: "JobCategories");

            migrationBuilder.DropTable(
                name: "JobModes");

            migrationBuilder.DropTable(
                name: "JobTypes");

            migrationBuilder.DropPrimaryKey(
                name: "PK_ApplicationTypes",
                table: "ApplicationTypes");

            migrationBuilder.RenameTable(
                name: "ApplicationTypes",
                newName: "V1_ApplicationType");

            migrationBuilder.RenameColumn(
                name: "ApplicationTypeId",
                table: "V1_ApplicationType",
                newName: "V1_ApplicationTypeId");

            migrationBuilder.RenameIndex(
                name: "IX_ApplicationTypes_ApplicationTypeId",
                table: "V1_ApplicationType",
                newName: "IX_V1_ApplicationType_V1_ApplicationTypeId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_V1_ApplicationType",
                table: "V1_ApplicationType",
                column: "Id");

            migrationBuilder.CreateTable(
                name: "V1_Application",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    Name = table.Column<string>(type: "text", nullable: false),
                    ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_V1_Application", x => x.Id);
                    table.ForeignKey(
                        name: "FK_V1_Application_V1_ApplicationType_ApplicationTypeId",
                        column: x => x.ApplicationTypeId,
                        principalTable: "V1_ApplicationType",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "V1_Host",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    HostName = table.Column<string>(type: "text", nullable: true),
                    IP = table.Column<string>(type: "text", nullable: false),
                    RegionalEK = table.Column<string>(type: "text", nullable: true),
                    LinkEK = table.Column<string>(type: "text", nullable: true),
                    Status = table.Column<string>(type: "text", nullable: true),
                    WorkGroup = table.Column<string>(type: "text", nullable: true),
                    Responsible = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_V1_Host", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "V1_JobCategory",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    Name = table.Column<string>(type: "text", nullable: false),
                    Description = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_V1_JobCategory", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "V1_JobMode",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    Name = table.Column<string>(type: "text", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_V1_JobMode", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "V1_JobStatus",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    Name = table.Column<string>(type: "text", nullable: false),
                    Description = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_V1_JobStatus", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "V1_JobType",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    Name = table.Column<string>(type: "text", nullable: false),
                    Description = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_V1_JobType", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "V1_ApplicationInHost",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
                    HostId = table.Column<Guid>(type: "uuid", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_V1_ApplicationInHost", x => x.Id);
                    table.ForeignKey(
                        name: "FK_V1_ApplicationInHost_V1_Application_ApplicationId",
                        column: x => x.ApplicationId,
                        principalTable: "V1_Application",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_V1_ApplicationInHost_V1_Host_HostId",
                        column: x => x.HostId,
                        principalTable: "V1_Host",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "V1_Job",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    Name = table.Column<string>(type: "text", nullable: false),
                    ScriptName = table.Column<string>(type: "text", nullable: false),
                    JobModeId = table.Column<Guid>(type: "uuid", nullable: false),
                    JobCategoryId = table.Column<Guid>(type: "uuid", nullable: true),
                    JobTypeId = table.Column<Guid>(type: "uuid", nullable: true),
                    ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
                    Frequency = table.Column<int>(type: "integer", nullable: false),
                    StartAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    IsEnabled = table.Column<bool>(type: "boolean", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_V1_Job", x => x.Id);
                    table.ForeignKey(
                        name: "FK_V1_Job_V1_Application_ApplicationId",
                        column: x => x.ApplicationId,
                        principalTable: "V1_Application",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_V1_Job_V1_JobCategory_JobCategoryId",
                        column: x => x.JobCategoryId,
                        principalTable: "V1_JobCategory",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_V1_Job_V1_JobMode_JobModeId",
                        column: x => x.JobModeId,
                        principalTable: "V1_JobMode",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_V1_Job_V1_JobType_JobTypeId",
                        column: x => x.JobTypeId,
                        principalTable: "V1_JobType",
                        principalColumn: "Id");
                });

            migrationBuilder.CreateTable(
                name: "V1_JobJournal",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    DateOper = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    Other = table.Column<string>(type: "text", nullable: true),
                    TimeOut = table.Column<int>(type: "integer", nullable: true),
                    Info = table.Column<string>(type: "text", nullable: true),
                    JobStatusId = table.Column<Guid>(type: "uuid", nullable: false),
                    HostId = table.Column<Guid>(type: "uuid", nullable: false),
                    JobId = table.Column<Guid>(type: "uuid", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_V1_JobJournal", x => x.Id);
                    table.ForeignKey(
                        name: "FK_V1_JobJournal_V1_Host_HostId",
                        column: x => x.HostId,
                        principalTable: "V1_Host",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_V1_JobJournal_V1_JobStatus_JobStatusId",
                        column: x => x.JobStatusId,
                        principalTable: "V1_JobStatus",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_V1_JobJournal_V1_Job_JobId",
                        column: x => x.JobId,
                        principalTable: "V1_Job",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.InsertData(
                table: "V1_JobMode",
                columns: new[] { "Id", "DateCreated", "DateModified", "Name" },
                values: new object[,]
                {
                    { new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "manual" },
                    { new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "auto" }
                });

            migrationBuilder.InsertData(
                table: "V1_JobStatus",
                columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name" },
                values: new object[,]
                {
                    { new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание выполнено", "finished" },
                    { new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание запущено", "started" }
                });

            migrationBuilder.CreateIndex(
                name: "IX_V1_Application_ApplicationTypeId",
                table: "V1_Application",
                column: "ApplicationTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_V1_ApplicationInHost_ApplicationId",
                table: "V1_ApplicationInHost",
                column: "ApplicationId");

            migrationBuilder.CreateIndex(
                name: "IX_V1_ApplicationInHost_HostId",
                table: "V1_ApplicationInHost",
                column: "HostId");

            migrationBuilder.CreateIndex(
                name: "IX_V1_Job_ApplicationId",
                table: "V1_Job",
                column: "ApplicationId");

            migrationBuilder.CreateIndex(
                name: "IX_V1_Job_JobCategoryId",
                table: "V1_Job",
                column: "JobCategoryId");

            migrationBuilder.CreateIndex(
                name: "IX_V1_Job_JobModeId",
                table: "V1_Job",
                column: "JobModeId");

            migrationBuilder.CreateIndex(
                name: "IX_V1_Job_JobTypeId",
                table: "V1_Job",
                column: "JobTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_V1_JobJournal_HostId",
                table: "V1_JobJournal",
                column: "HostId");

            migrationBuilder.CreateIndex(
                name: "IX_V1_JobJournal_JobId",
                table: "V1_JobJournal",
                column: "JobId");

            migrationBuilder.CreateIndex(
                name: "IX_V1_JobJournal_JobStatusId",
                table: "V1_JobJournal",
                column: "JobStatusId");

            migrationBuilder.AddForeignKey(
                name: "FK_V1_ApplicationType_V1_ApplicationType_V1_ApplicationTypeId",
                table: "V1_ApplicationType",
                column: "V1_ApplicationTypeId",
                principalTable: "V1_ApplicationType",
                principalColumn: "Id");
        }

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

            migrationBuilder.DropTable(
                name: "V1_ApplicationInHost");

            migrationBuilder.DropTable(
                name: "V1_JobJournal");

            migrationBuilder.DropTable(
                name: "V1_Host");

            migrationBuilder.DropTable(
                name: "V1_JobStatus");

            migrationBuilder.DropTable(
                name: "V1_Job");

            migrationBuilder.DropTable(
                name: "V1_Application");

            migrationBuilder.DropTable(
                name: "V1_JobCategory");

            migrationBuilder.DropTable(
                name: "V1_JobMode");

            migrationBuilder.DropTable(
                name: "V1_JobType");

            migrationBuilder.DropPrimaryKey(
                name: "PK_V1_ApplicationType",
                table: "V1_ApplicationType");

            migrationBuilder.RenameTable(
                name: "V1_ApplicationType",
                newName: "ApplicationTypes");

            migrationBuilder.RenameColumn(
                name: "V1_ApplicationTypeId",
                table: "ApplicationTypes",
                newName: "ApplicationTypeId");

            migrationBuilder.RenameIndex(
                name: "IX_V1_ApplicationType_V1_ApplicationTypeId",
                table: "ApplicationTypes",
                newName: "IX_ApplicationTypes_ApplicationTypeId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_ApplicationTypes",
                table: "ApplicationTypes",
                column: "Id");

            migrationBuilder.CreateTable(
                name: "Applications",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    Name = table.Column<string>(type: "text", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Applications", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Applications_ApplicationTypes_ApplicationTypeId",
                        column: x => x.ApplicationTypeId,
                        principalTable: "ApplicationTypes",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "Hosts",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    HostName = table.Column<string>(type: "text", nullable: true),
                    IP = table.Column<string>(type: "text", nullable: false),
                    LinkEK = table.Column<string>(type: "text", nullable: true),
                    RegionalEK = table.Column<string>(type: "text", nullable: true),
                    Responsible = table.Column<string>(type: "text", nullable: true),
                    Status = table.Column<string>(type: "text", nullable: true),
                    WorkGroup = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Hosts", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JobCategories",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    Description = table.Column<string>(type: "text", nullable: true),
                    Name = table.Column<string>(type: "text", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JobCategories", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JobModes",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    Name = table.Column<string>(type: "text", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JobModes", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JobStatuses",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    Description = table.Column<string>(type: "text", nullable: true),
                    Name = table.Column<string>(type: "text", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JobStatuses", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JobTypes",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    Description = table.Column<string>(type: "text", nullable: true),
                    Name = table.Column<string>(type: "text", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JobTypes", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ApplicationsInHosts",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
                    HostId = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ApplicationsInHosts", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ApplicationsInHosts_Applications_ApplicationId",
                        column: x => x.ApplicationId,
                        principalTable: "Applications",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_ApplicationsInHosts_Hosts_HostId",
                        column: x => x.HostId,
                        principalTable: "Hosts",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "Jobs",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
                    JobCategoryId = table.Column<Guid>(type: "uuid", nullable: true),
                    JobModeId = table.Column<Guid>(type: "uuid", nullable: false),
                    JobTypeId = table.Column<Guid>(type: "uuid", nullable: true),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    Frequency = table.Column<int>(type: "integer", nullable: false),
                    IsEnabled = table.Column<bool>(type: "boolean", nullable: false),
                    Name = table.Column<string>(type: "text", nullable: false),
                    ScriptName = table.Column<string>(type: "text", nullable: false),
                    StartAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Jobs", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Jobs_Applications_ApplicationId",
                        column: x => x.ApplicationId,
                        principalTable: "Applications",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Jobs_JobCategories_JobCategoryId",
                        column: x => x.JobCategoryId,
                        principalTable: "JobCategories",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Jobs_JobModes_JobModeId",
                        column: x => x.JobModeId,
                        principalTable: "JobModes",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Jobs_JobTypes_JobTypeId",
                        column: x => x.JobTypeId,
                        principalTable: "JobTypes",
                        principalColumn: "Id");
                });

            migrationBuilder.CreateTable(
                name: "JobJournals",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    HostId = table.Column<Guid>(type: "uuid", nullable: false),
                    JobId = table.Column<Guid>(type: "uuid", nullable: false),
                    JobStatusId = table.Column<Guid>(type: "uuid", nullable: false),
                    DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    DateOper = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    Info = table.Column<string>(type: "text", nullable: true),
                    Other = table.Column<string>(type: "text", nullable: true),
                    TimeOut = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JobJournals", x => x.Id);
                    table.ForeignKey(
                        name: "FK_JobJournals_Hosts_HostId",
                        column: x => x.HostId,
                        principalTable: "Hosts",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_JobJournals_JobStatuses_JobStatusId",
                        column: x => x.JobStatusId,
                        principalTable: "JobStatuses",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_JobJournals_Jobs_JobId",
                        column: x => x.JobId,
                        principalTable: "Jobs",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.InsertData(
                table: "JobModes",
                columns: new[] { "Id", "DateCreated", "DateModified", "Name" },
                values: new object[,]
                {
                    { new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "manual" },
                    { new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "auto" }
                });

            migrationBuilder.InsertData(
                table: "JobStatuses",
                columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name" },
                values: new object[,]
                {
                    { new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание выполнено", "finished" },
                    { new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание запущено", "started" }
                });

            migrationBuilder.CreateIndex(
                name: "IX_Applications_ApplicationTypeId",
                table: "Applications",
                column: "ApplicationTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_ApplicationsInHosts_ApplicationId",
                table: "ApplicationsInHosts",
                column: "ApplicationId");

            migrationBuilder.CreateIndex(
                name: "IX_ApplicationsInHosts_HostId",
                table: "ApplicationsInHosts",
                column: "HostId");

            migrationBuilder.CreateIndex(
                name: "IX_JobJournals_HostId",
                table: "JobJournals",
                column: "HostId");

            migrationBuilder.CreateIndex(
                name: "IX_JobJournals_JobId",
                table: "JobJournals",
                column: "JobId");

            migrationBuilder.CreateIndex(
                name: "IX_JobJournals_JobStatusId",
                table: "JobJournals",
                column: "JobStatusId");

            migrationBuilder.CreateIndex(
                name: "IX_Jobs_ApplicationId",
                table: "Jobs",
                column: "ApplicationId");

            migrationBuilder.CreateIndex(
                name: "IX_Jobs_JobCategoryId",
                table: "Jobs",
                column: "JobCategoryId");

            migrationBuilder.CreateIndex(
                name: "IX_Jobs_JobModeId",
                table: "Jobs",
                column: "JobModeId");

            migrationBuilder.CreateIndex(
                name: "IX_Jobs_JobTypeId",
                table: "Jobs",
                column: "JobTypeId");

            migrationBuilder.AddForeignKey(
                name: "FK_ApplicationTypes_ApplicationTypes_ApplicationTypeId",
                table: "ApplicationTypes",
                column: "ApplicationTypeId",
                principalTable: "ApplicationTypes",
                principalColumn: "Id");
        }
    }
}
