RobotApp/RobotApp/Data/Migrations/20251028102815_InitConfigDb.cs
Đăng Nguyễn 643a34a4b4 update
2025-10-28 17:28:46 +07:00

119 lines
6.3 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace RobotApp.Data.Migrations
{
/// <inheritdoc />
public partial class InitConfigDb : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "RobotConfig",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
NavigationType = table.Column<int>(type: "int", nullable: false),
RadiusWheel = table.Column<double>(type: "float", nullable: false),
Width = table.Column<double>(type: "float", nullable: false),
Length = table.Column<double>(type: "float", nullable: false),
Height = table.Column<double>(type: "float", 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),
ConfigName = table.Column<string>(type: "nvarchar(64)", maxLength: 100, nullable: true),
Description = table.Column<string>(type: "ntext", maxLength: 500, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RobotConfig", x => x.Id);
});
migrationBuilder.CreateTable(
name: "RobotPlcConfig",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PLCAddress = table.Column<string>(type: "nvarchar(64)", maxLength: 50, nullable: true),
PLCPort = table.Column<int>(type: "int", nullable: false),
PLCUnitId = table.Column<byte>(type: "tinyint", 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),
ConfigName = table.Column<string>(type: "nvarchar(64)", maxLength: 100, nullable: true),
Description = table.Column<string>(type: "ntext", maxLength: 500, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RobotPlcConfig", x => x.Id);
});
migrationBuilder.CreateTable(
name: "RobotSimulationConfig",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EnableSimulation = table.Column<bool>(type: "bit", nullable: false),
SimulationMaxVelocity = table.Column<double>(type: "float", nullable: false),
SimulationMaxAngularVelocity = table.Column<double>(type: "float", nullable: false),
SimulationAcceleration = table.Column<double>(type: "float", nullable: false),
SimulationDeceleration = table.Column<double>(type: "float", 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),
ConfigName = table.Column<string>(type: "nvarchar(64)", maxLength: 100, nullable: true),
Description = table.Column<string>(type: "ntext", maxLength: 500, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RobotSimulationConfig", x => x.Id);
});
migrationBuilder.CreateTable(
name: "RobotVDA5050Config",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
SerialNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 50, nullable: true),
VDA5050_HostServer = table.Column<string>(type: "nvarchar(64)", maxLength: 100, nullable: true),
VDA5050_Port = table.Column<int>(type: "int", nullable: false),
VDA5050_UserName = table.Column<string>(type: "nvarchar(64)", maxLength: 50, nullable: true),
VDA5050_Password = table.Column<string>(type: "nvarchar(64)", maxLength: 50, nullable: true),
VDA5050_Manufacturer = table.Column<string>(type: "nvarchar(64)", maxLength: 50, nullable: true),
VDA5050_Version = table.Column<string>(type: "nvarchar(64)", maxLength: 20, nullable: true),
VDA5050_PublishRepeat = table.Column<int>(type: "int", nullable: false),
VDA5050_EnablePassword = table.Column<bool>(type: "bit", nullable: false),
VDA5050_EnableTls = table.Column<bool>(type: "bit", 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),
ConfigName = table.Column<string>(type: "nvarchar(64)", maxLength: 100, nullable: true),
Description = table.Column<string>(type: "ntext", maxLength: 500, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RobotVDA5050Config", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "RobotConfig");
migrationBuilder.DropTable(
name: "RobotPlcConfig");
migrationBuilder.DropTable(
name: "RobotSimulationConfig");
migrationBuilder.DropTable(
name: "RobotVDA5050Config");
}
}
}