feat(api,core,dal,domain): Сохранение снапшотов состояния роботов.

This commit is contained in:
Mikhail Trubnikov
2026-06-10 16:48:16 +10:00
parent a64ab59de1
commit d736208a46
22 changed files with 4194 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,64 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class tblRobotSnapshot : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "robot");
migrationBuilder.CreateTable(
name: "Snapshots",
schema: "robot",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
TemplateRobotsCount = table.Column<int>(type: "integer", nullable: false, comment: "Количество запущенных роботов по шаблонам"),
ScheduleRobotsCount = table.Column<int>(type: "integer", nullable: false, comment: "Количество запущенных роботов по расписаниям"),
MaxRobots = table.Column<int>(type: "integer", nullable: false, comment: "Максимально разрешенное количество роботов на сервере"),
Ip = table.Column<string>(type: "character varying(45)", maxLength: 45, nullable: false, comment: "Текущий IP-адрес сервера")
},
constraints: table =>
{
table.PrimaryKey("PK_Snapshots", x => x.Id);
},
comment: "Снимки роботов");
migrationBuilder.UpdateData(
table: "Settings",
keyColumn: "Name",
keyValue: "RobotWaitTime",
column: "Value",
value: "00:10:00");
migrationBuilder.CreateIndex(
name: "IX_Snapshots_Ip_DateCreated",
schema: "robot",
table: "Snapshots",
columns: new[] { "Ip", "DateCreated" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Snapshots",
schema: "robot");
migrationBuilder.UpdateData(
table: "Settings",
keyColumn: "Name",
keyValue: "RobotWaitTime",
column: "Value",
value: "00:15:00");
}
}
}

View File

@@ -867,6 +867,43 @@ namespace PARR.DAL.Migrations
b.ToTable("RobotConfigurations");
});
modelBuilder.Entity("PARR.Domain.Entities.RobotEntities.RobotSnapshot", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<string>("Ip")
.IsRequired()
.HasMaxLength(45)
.HasColumnType("character varying(45)")
.HasComment("Текущий IP-адрес сервера");
b.Property<int>("MaxRobots")
.HasColumnType("integer")
.HasComment("Максимально разрешенное количество роботов на сервере");
b.Property<int>("ScheduleRobotsCount")
.HasColumnType("integer")
.HasComment("Количество запущенных роботов по расписаниям");
b.Property<int>("TemplateRobotsCount")
.HasColumnType("integer")
.HasComment("Количество запущенных роботов по шаблонам");
b.HasKey("Id");
b.HasIndex("Ip", "DateCreated");
b.ToTable("Snapshots", "robot", t =>
{
t.HasComment("Снимки роботов");
});
});
modelBuilder.Entity("PARR.Domain.Entities.RobotHistory", b =>
{
b.Property<Guid>("Id")
@@ -2261,7 +2298,7 @@ namespace PARR.DAL.Migrations
{
Name = "RobotWaitTime",
Description = "Время ожидания выполнения роботом задания",
Value = "00:15:00"
Value = "00:10:00"
},
new
{