366 lines
18 KiB
C#
366 lines
18 KiB
C#
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 DbV5 : Migration
|
||
{
|
||
/// <inheritdoc />
|
||
protected override void Up(MigrationBuilder migrationBuilder)
|
||
{
|
||
migrationBuilder.CreateTable(
|
||
name: "ApplicationTypes",
|
||
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),
|
||
ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: true)
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_ApplicationTypes", x => x.Id);
|
||
table.ForeignKey(
|
||
name: "FK_ApplicationTypes_ApplicationTypes_ApplicationTypeId",
|
||
column: x => x.ApplicationTypeId,
|
||
principalTable: "ApplicationTypes",
|
||
principalColumn: "Id");
|
||
});
|
||
|
||
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),
|
||
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_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),
|
||
Name = table.Column<string>(type: "text", nullable: false),
|
||
Description = table.Column<string>(type: "text", nullable: true)
|
||
},
|
||
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),
|
||
Name = table.Column<string>(type: "text", nullable: false),
|
||
Description = table.Column<string>(type: "text", nullable: true)
|
||
},
|
||
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),
|
||
Name = table.Column<string>(type: "text", nullable: false),
|
||
Description = table.Column<string>(type: "text", nullable: true)
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_JobTypes", x => x.Id);
|
||
});
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "Applications",
|
||
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_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: "ApplicationsInHosts",
|
||
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_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),
|
||
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: false),
|
||
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_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",
|
||
onDelete: ReferentialAction.Cascade);
|
||
});
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "JobJournals",
|
||
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_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: "ApplicationTypes",
|
||
columns: new[] { "Id", "ApplicationTypeId", "DateCreated", "DateModified", "Description", "Name" },
|
||
values: new object[,]
|
||
{
|
||
{ new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), null, new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СП xml АИХ ИТ", "APP" },
|
||
{ new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), null, new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле ОС xml АИХ ИТ", "OS" },
|
||
{ new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), null, new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СУБД xml АИХ ИТ", "DB" }
|
||
});
|
||
|
||
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_ApplicationTypes_ApplicationTypeId",
|
||
table: "ApplicationTypes",
|
||
column: "ApplicationTypeId");
|
||
|
||
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");
|
||
}
|
||
|
||
/// <inheritdoc />
|
||
protected override void Down(MigrationBuilder migrationBuilder)
|
||
{
|
||
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.DropTable(
|
||
name: "ApplicationTypes");
|
||
}
|
||
}
|
||
}
|