83 lines
3.9 KiB
C#
83 lines
3.9 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace RobotNet10.RobotApp.Data.Migrations.AppDb
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddDockStationConfig : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "DockStationConfig",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
StationId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
|
|
ConfigName = table.Column<string>(type: "nvarchar(64)", maxLength: 100, nullable: true),
|
|
Description = table.Column<string>(type: "ntext", maxLength: 500, nullable: true),
|
|
X = table.Column<double>(type: "double", nullable: false),
|
|
Y = table.Column<double>(type: "double", nullable: false),
|
|
Yaw = table.Column<double>(type: "double", nullable: false),
|
|
Width = table.Column<double>(type: "double", nullable: false),
|
|
Length = table.Column<double>(type: "double", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
IsActive = table.Column<bool>(type: "bit", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DockStationConfig", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DockStationMarkerEntry",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
DockStationConfigId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
MarkerId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
|
|
Type = table.Column<int>(type: "int", nullable: false),
|
|
Priority = table.Column<int>(type: "int", nullable: false),
|
|
DeviceId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
|
|
Code = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
ReferencePointsJson = table.Column<string>(type: "ntext", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DockStationMarkerEntry", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_DockStationMarkerEntry_DockStationConfig_DockStationConfigId",
|
|
column: x => x.DockStationConfigId,
|
|
principalTable: "DockStationConfig",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DockStationConfig_StationId",
|
|
table: "DockStationConfig",
|
|
column: "StationId",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DockStationMarkerEntry_DockStationConfigId",
|
|
table: "DockStationMarkerEntry",
|
|
column: "DockStationConfigId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "DockStationMarkerEntry");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "DockStationConfig");
|
|
}
|
|
}
|
|
}
|