using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace RobotNet.RobotManager.Data.Migrations { /// public partial class AddRobotDb : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "RobotModels", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), ModelName = table.Column(type: "varchar(127)", nullable: false), OriginX = table.Column(type: "float", nullable: false), OriginY = table.Column(type: "float", nullable: false), Length = table.Column(type: "float", nullable: false), Width = table.Column(type: "float", nullable: false), ImageWidth = table.Column(type: "int", nullable: false), ImageHeight = table.Column(type: "int", nullable: false), NavigationType = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_RobotModels", x => x.Id); }); migrationBuilder.CreateTable( name: "Robots", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), RobotId = table.Column(type: "varchar(127)", nullable: false), Name = table.Column(type: "varchar(127)", nullable: false), ModelId = table.Column(type: "uniqueidentifier", nullable: false), MapId = table.Column(type: "uniqueidentifier", nullable: false), HomeNode = table.Column(type: "varchar(127)", nullable: true), ChargerNode = table.Column(type: "varchar(127)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Robots", x => x.Id); table.ForeignKey( name: "FK_Robots_RobotModels_MapId", column: x => x.MapId, principalTable: "RobotModels", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_Robots_MapId", table: "Robots", column: "MapId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Robots"); migrationBuilder.DropTable( name: "RobotModels"); } } }