78 lines
3.3 KiB
C#
78 lines
3.3 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace PARR.DAL.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class tblRobotConfigurationSnapshots : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "ConfigurationSnapshots",
|
|
schema: "robot",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
RobotCode = table.Column<int>(type: "integer", nullable: false),
|
|
RobotStatusCode = table.Column<int>(type: "integer", nullable: false),
|
|
TaskStatusCode = table.Column<int>(type: "integer", nullable: false),
|
|
Count = table.Column<int>(type: "integer", nullable: false, comment: "Количество заданий в этой комбинации статусов")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_ConfigurationSnapshots", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_ConfigurationSnapshots_RobotStatuses_RobotStatusCode",
|
|
column: x => x.RobotStatusCode,
|
|
principalTable: "RobotStatuses",
|
|
principalColumn: "Code",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_ConfigurationSnapshots_Robots_RobotCode",
|
|
column: x => x.RobotCode,
|
|
principalTable: "Robots",
|
|
principalColumn: "Code",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_ConfigurationSnapshots_TaskStatuses_TaskStatusCode",
|
|
column: x => x.TaskStatusCode,
|
|
principalTable: "TaskStatuses",
|
|
principalColumn: "Code",
|
|
onDelete: ReferentialAction.Cascade);
|
|
},
|
|
comment: "Снимки заданий роботам");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ConfigurationSnapshots_RobotCode_DateCreated",
|
|
schema: "robot",
|
|
table: "ConfigurationSnapshots",
|
|
columns: new[] { "RobotCode", "DateCreated" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ConfigurationSnapshots_RobotStatusCode",
|
|
schema: "robot",
|
|
table: "ConfigurationSnapshots",
|
|
column: "RobotStatusCode");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ConfigurationSnapshots_TaskStatusCode",
|
|
schema: "robot",
|
|
table: "ConfigurationSnapshots",
|
|
column: "TaskStatusCode");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "ConfigurationSnapshots",
|
|
schema: "robot");
|
|
}
|
|
}
|
|
}
|