using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace PARR.DAL.Migrations
{
///
public partial class TblsAIHIT : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
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.DropTable(
name: "V1_ApplicationType");
migrationBuilder.EnsureSchema(
name: "AIHIT");
migrationBuilder.CreateTable(
name: "RawDataEKs",
schema: "AIHIT",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
IP = table.Column(type: "text", nullable: true),
Metka = table.Column(type: "text", nullable: true),
IsActive = table.Column(type: "text", nullable: true),
IsImportant = table.Column(type: "text", nullable: true),
CreateTime = table.Column(type: "timestamp with time zone", nullable: true),
AdditionalInfo = table.Column(type: "text", nullable: true),
ResponseArea = table.Column(type: "text", nullable: true),
EKCategory = table.Column(type: "text", nullable: true),
EKFindCode = table.Column(type: "text", nullable: true),
ProductCode = table.Column(type: "text", nullable: true),
ServiceCode = table.Column(type: "text", nullable: true),
ShortName = table.Column(type: "text", nullable: true),
ResponsibleByEK = table.Column(type: "text", nullable: true),
PlannedTimeToRepair = table.Column(type: "timestamp with time zone", nullable: true),
EKSubCategory = table.Column(type: "text", nullable: true),
FullName = table.Column(type: "text", nullable: true),
Prescription = table.Column(type: "text", nullable: true),
Company = table.Column(type: "text", nullable: true),
WorkGroup = table.Column(type: "text", nullable: true),
Location = table.Column(type: "text", nullable: true),
EKRevizor = table.Column(type: "text", nullable: true),
EKRegister = table.Column(type: "text", nullable: true),
NetworkName = table.Column(type: "text", nullable: true),
Status = table.Column(type: "text", nullable: true),
EKType = table.Column(type: "text", nullable: true),
EndExplotationDate = table.Column(type: "timestamp with time zone", nullable: true),
StartExplotationDate = table.Column(type: "timestamp with time zone", nullable: true),
TargetRepairTime = table.Column(type: "text", nullable: true),
SysModTime = table.Column(type: "timestamp with time zone", nullable: true),
SysModUser = table.Column(type: "text", nullable: true),
NewEKFindCode = table.Column(type: "text", nullable: true),
OldEKFindCode = table.Column(type: "text", nullable: true),
CTSDirection = table.Column(type: "text", nullable: true),
AIHID = table.Column(type: "integer", nullable: true),
IsUnreliableData = table.Column(type: "character(1)", nullable: true),
ShiftWorkGroup = table.Column(type: "text", nullable: true),
ClientSoftware = table.Column(type: "text", nullable: true),
ClientOS = table.Column(type: "text", nullable: true),
DBType = table.Column(type: "text", nullable: true),
APPType = table.Column(type: "text", nullable: true),
CKBSServerType = table.Column(type: "text", nullable: true),
IBServerType = table.Column(type: "text", nullable: true),
InfrastructureServerType = table.Column(type: "text", nullable: true),
MonitoringServerType = table.Column(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RawDataEKs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Settings",
schema: "AIHIT",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Group = table.Column(type: "text", nullable: true),
Name = table.Column(type: "text", nullable: false),
Value = table.Column(type: "text", nullable: false),
Description = table.Column(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Settings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_ApplicationTypes",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Name = table.Column(type: "text", nullable: false),
Description = table.Column(type: "text", nullable: true),
V1_ApplicationTypeId = table.Column(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_ApplicationTypes", x => x.Id);
table.ForeignKey(
name: "FK_V1_ApplicationTypes_V1_ApplicationTypes_V1_ApplicationTypeId",
column: x => x.V1_ApplicationTypeId,
principalTable: "V1_ApplicationTypes",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "V1_Hosts",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
HostName = table.Column(type: "text", nullable: true),
IP = table.Column(type: "text", nullable: false),
RegionalEK = table.Column(type: "text", nullable: true),
LinkEK = table.Column(type: "text", nullable: true),
Status = table.Column(type: "text", nullable: true),
WorkGroup = table.Column(type: "text", nullable: true),
Responsible = table.Column(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Hosts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobCategorys",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Name = table.Column(type: "text", nullable: false),
Description = table.Column(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobCategorys", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobModes",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Name = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobModes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobStatuses",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Name = table.Column(type: "text", nullable: false),
Description = table.Column(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobStatuses", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobTypes",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Name = table.Column(type: "text", nullable: false),
Description = table.Column(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_Applications",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Name = table.Column(type: "text", nullable: false),
ApplicationTypeId = table.Column(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Applications", x => x.Id);
table.ForeignKey(
name: "FK_V1_Applications_V1_ApplicationTypes_ApplicationTypeId",
column: x => x.ApplicationTypeId,
principalTable: "V1_ApplicationTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "V1_ApplicationsInHost",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
ApplicationId = table.Column(type: "uuid", nullable: false),
HostId = table.Column(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_ApplicationsInHost", x => x.Id);
table.ForeignKey(
name: "FK_V1_ApplicationsInHost_V1_Applications_ApplicationId",
column: x => x.ApplicationId,
principalTable: "V1_Applications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_ApplicationsInHost_V1_Hosts_HostId",
column: x => x.HostId,
principalTable: "V1_Hosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "V1_Jobs",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Name = table.Column(type: "text", nullable: false),
ScriptName = table.Column(type: "text", nullable: false),
JobModeId = table.Column(type: "uuid", nullable: false),
JobCategoryId = table.Column(type: "uuid", nullable: true),
JobTypeId = table.Column(type: "uuid", nullable: true),
ApplicationId = table.Column(type: "uuid", nullable: false),
Frequency = table.Column(type: "integer", nullable: false),
StartAt = table.Column(type: "timestamp with time zone", nullable: false),
IsEnabled = table.Column(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Jobs", x => x.Id);
table.ForeignKey(
name: "FK_V1_Jobs_V1_Applications_ApplicationId",
column: x => x.ApplicationId,
principalTable: "V1_Applications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_Jobs_V1_JobCategorys_JobCategoryId",
column: x => x.JobCategoryId,
principalTable: "V1_JobCategorys",
principalColumn: "Id");
table.ForeignKey(
name: "FK_V1_Jobs_V1_JobModes_JobModeId",
column: x => x.JobModeId,
principalTable: "V1_JobModes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_Jobs_V1_JobTypes_JobTypeId",
column: x => x.JobTypeId,
principalTable: "V1_JobTypes",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "V1_JobJournals",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
DateOper = table.Column(type: "timestamp with time zone", nullable: false),
Other = table.Column(type: "text", nullable: true),
TimeOut = table.Column(type: "integer", nullable: true),
Info = table.Column(type: "text", nullable: true),
JobStatusId = table.Column(type: "uuid", nullable: false),
HostId = table.Column(type: "uuid", nullable: false),
JobId = table.Column(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobJournals", x => x.Id);
table.ForeignKey(
name: "FK_V1_JobJournals_V1_Hosts_HostId",
column: x => x.HostId,
principalTable: "V1_Hosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_JobJournals_V1_JobStatuses_JobStatusId",
column: x => x.JobStatusId,
principalTable: "V1_JobStatuses",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_JobJournals_V1_Jobs_JobId",
column: x => x.JobId,
principalTable: "V1_Jobs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
schema: "AIHIT",
table: "Settings",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Group", "Name", "Value" },
values: new object[,]
{
{ new Guid("1ad12210-be62-459a-aa6c-fda7648503f7"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Строка подключения к базе данных АИХ ИТ", null, "ConnectionString", "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;" },
{ new Guid("1fd43634-4a06-4237-9727-edfa6f3eebe8"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "DVS", "96-ДВС" },
{ new Guid("50f66704-4d26-4587-bb1e-dca70c8f4b89"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "ZAB", "94 - ЗАБ" }
});
migrationBuilder.InsertData(
table: "V1_ApplicationTypes",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name", "V1_ApplicationTypeId" },
values: new object[,]
{
{ new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СП xml АИХ ИТ", "APP", null },
{ new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле ОС xml АИХ ИТ", "OS", null },
{ new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СУБД xml АИХ ИТ", "DB", null }
});
migrationBuilder.InsertData(
table: "V1_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: "V1_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_V1_Applications_ApplicationTypeId",
table: "V1_Applications",
column: "ApplicationTypeId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationsInHost_ApplicationId",
table: "V1_ApplicationsInHost",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationsInHost_HostId",
table: "V1_ApplicationsInHost",
column: "HostId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationTypes_V1_ApplicationTypeId",
table: "V1_ApplicationTypes",
column: "V1_ApplicationTypeId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournals_HostId",
table: "V1_JobJournals",
column: "HostId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournals_JobId",
table: "V1_JobJournals",
column: "JobId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournals_JobStatusId",
table: "V1_JobJournals",
column: "JobStatusId");
migrationBuilder.CreateIndex(
name: "IX_V1_Jobs_ApplicationId",
table: "V1_Jobs",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_V1_Jobs_JobCategoryId",
table: "V1_Jobs",
column: "JobCategoryId");
migrationBuilder.CreateIndex(
name: "IX_V1_Jobs_JobModeId",
table: "V1_Jobs",
column: "JobModeId");
migrationBuilder.CreateIndex(
name: "IX_V1_Jobs_JobTypeId",
table: "V1_Jobs",
column: "JobTypeId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "RawDataEKs",
schema: "AIHIT");
migrationBuilder.DropTable(
name: "Settings",
schema: "AIHIT");
migrationBuilder.DropTable(
name: "V1_ApplicationsInHost");
migrationBuilder.DropTable(
name: "V1_JobJournals");
migrationBuilder.DropTable(
name: "V1_Hosts");
migrationBuilder.DropTable(
name: "V1_JobStatuses");
migrationBuilder.DropTable(
name: "V1_Jobs");
migrationBuilder.DropTable(
name: "V1_Applications");
migrationBuilder.DropTable(
name: "V1_JobCategorys");
migrationBuilder.DropTable(
name: "V1_JobModes");
migrationBuilder.DropTable(
name: "V1_JobTypes");
migrationBuilder.DropTable(
name: "V1_ApplicationTypes");
migrationBuilder.CreateTable(
name: "V1_ApplicationType",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Description = table.Column(type: "text", nullable: true),
Name = table.Column(type: "text", nullable: false),
V1_ApplicationTypeId = table.Column(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_ApplicationType", x => x.Id);
table.ForeignKey(
name: "FK_V1_ApplicationType_V1_ApplicationType_V1_ApplicationTypeId",
column: x => x.V1_ApplicationTypeId,
principalTable: "V1_ApplicationType",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "V1_Host",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
HostName = table.Column(type: "text", nullable: true),
IP = table.Column(type: "text", nullable: false),
LinkEK = table.Column(type: "text", nullable: true),
RegionalEK = table.Column(type: "text", nullable: true),
Responsible = table.Column(type: "text", nullable: true),
Status = table.Column(type: "text", nullable: true),
WorkGroup = table.Column(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(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Description = table.Column(type: "text", nullable: true),
Name = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobCategory", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobMode",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Name = table.Column(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(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Description = table.Column(type: "text", nullable: true),
Name = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobStatus", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobType",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Description = table.Column(type: "text", nullable: true),
Name = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobType", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_Application",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
ApplicationTypeId = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Name = table.Column(type: "text", 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_ApplicationInHost",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
ApplicationId = table.Column(type: "uuid", nullable: false),
HostId = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true)
},
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(type: "uuid", nullable: false),
ApplicationId = table.Column(type: "uuid", nullable: false),
JobCategoryId = table.Column(type: "uuid", nullable: true),
JobModeId = table.Column(type: "uuid", nullable: false),
JobTypeId = table.Column(type: "uuid", nullable: true),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
Frequency = table.Column(type: "integer", nullable: false),
IsEnabled = table.Column(type: "boolean", nullable: false),
Name = table.Column(type: "text", nullable: false),
ScriptName = table.Column(type: "text", nullable: false),
StartAt = table.Column(type: "timestamp with time zone", 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(type: "uuid", nullable: false),
HostId = table.Column(type: "uuid", nullable: false),
JobId = table.Column(type: "uuid", nullable: false),
JobStatusId = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
DateModified = table.Column(type: "timestamp with time zone", nullable: true),
DateOper = table.Column(type: "timestamp with time zone", nullable: false),
Info = table.Column(type: "text", nullable: true),
Other = table.Column(type: "text", nullable: true),
TimeOut = table.Column(type: "integer", nullable: true)
},
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_ApplicationType",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name", "V1_ApplicationTypeId" },
values: new object[,]
{
{ new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СП xml АИХ ИТ", "APP", null },
{ new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле ОС xml АИХ ИТ", "OS", null },
{ new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СУБД xml АИХ ИТ", "DB", null }
});
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_ApplicationType_V1_ApplicationTypeId",
table: "V1_ApplicationType",
column: "V1_ApplicationTypeId");
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");
}
}
}