using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
///
public partial class tblRobotConfigurationSnapshots : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ConfigurationSnapshots",
schema: "robot",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
RobotCode = table.Column(type: "integer", nullable: false),
RobotStatusCode = table.Column(type: "integer", nullable: false),
TaskStatusCode = table.Column(type: "integer", nullable: false),
Count = table.Column(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");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ConfigurationSnapshots",
schema: "robot");
}
}
}