refactor(all): Удалены из БД таблицы V1
This commit is contained in:
365
PARR.DAL/Migrations/20231017233652_RemoveTblsV1.cs
Normal file
365
PARR.DAL/Migrations/20231017233652_RemoveTblsV1.cs
Normal file
@@ -0,0 +1,365 @@
|
||||
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 RemoveTblsV1 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "V1_ApplicationsInHost");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "V1_JobJournals");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "V1_Applications");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "V1_Hosts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "V1_JobStatuses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "V1_Jobs");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "V1_ApplicationTypes");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "V1_JobCategorys");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "V1_JobModes");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "V1_JobTypes");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "V1_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),
|
||||
Description = table.Column<string>(type: "text", nullable: true),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
V1_ApplicationTypeId = table.Column<Guid>(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<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_V1_Hosts", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "V1_JobCategorys",
|
||||
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_V1_JobCategorys", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "V1_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_V1_JobModes", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "V1_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_V1_JobStatuses", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "V1_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_V1_JobTypes", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "V1_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_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_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_V1_Jobs", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_V1_Jobs_Applications_ApplicationId",
|
||||
column: x => x.ApplicationId,
|
||||
principalTable: "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_ApplicationsInHost",
|
||||
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),
|
||||
V1_ApplicationId = table.Column<Guid>(type: "uuid", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_V1_ApplicationsInHost", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_V1_ApplicationsInHost_Applications_ApplicationId",
|
||||
column: x => x.ApplicationId,
|
||||
principalTable: "Applications",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_V1_ApplicationsInHost_V1_Applications_V1_ApplicationId",
|
||||
column: x => x.V1_ApplicationId,
|
||||
principalTable: "V1_Applications",
|
||||
principalColumn: "Id");
|
||||
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_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_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(
|
||||
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_ApplicationsInHost_V1_ApplicationId",
|
||||
table: "V1_ApplicationsInHost",
|
||||
column: "V1_ApplicationId");
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user