feat(api): AgentTask, AgentHistory
This commit is contained in:
88
PARR.DAL/Migrations/20231018235601_TblAgentHistory.cs
Normal file
88
PARR.DAL/Migrations/20231018235601_TblAgentHistory.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TblAgentHistory : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AgentHistoryLevels",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AgentHistoryLevels", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AgentHistories",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
Message = table.Column<string>(type: "text", nullable: true),
|
||||
HistoryLevelId = table.Column<int>(type: "integer", nullable: false),
|
||||
TemplateId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AgentHistories", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AgentHistories_AgentHistoryLevels_HistoryLevelId",
|
||||
column: x => x.HistoryLevelId,
|
||||
principalTable: "AgentHistoryLevels",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AgentHistories_Templates_TemplateId",
|
||||
column: x => x.TemplateId,
|
||||
principalTable: "Templates",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "AgentHistoryLevels",
|
||||
columns: new[] { "Id", "Description", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "Агент начал выполнять задание", "Start" },
|
||||
{ 5, "Агент завершил выполнение задания", "End" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AgentHistories_HistoryLevelId",
|
||||
table: "AgentHistories",
|
||||
column: "HistoryLevelId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AgentHistories_TemplateId",
|
||||
table: "AgentHistories",
|
||||
column: "TemplateId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AgentHistories");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AgentHistoryLevels");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user