Files
parr_api/PARR.DAL/Migrations/20260610042457_tblRobotSnapshot.cs

65 lines
2.6 KiB
C#

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");
}
}
}